summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Wahl <marcowahlsoft@gmail.com>2015-07-11 12:01:02 +0200
committerMarco Wahl <marcowahlsoft@gmail.com>2015-07-11 12:01:02 +0200
commit9132a79ec92b04adb83d4a4ceada5aa828347406 (patch)
tree5ef1c193ba973487f0f9d1083c08d23067708b56
parent120dcd1d1357502f9776cdfb0f27fdce69d34131 (diff)
downloadorg-mode-9132a79ec92b04adb83d4a4ceada5aa828347406.tar.gz
contrib/org-eww: Quote leading stars at kill
* contrib/lisp/org-eww.el (org-eww-copy-for-org-mode): Lines starting with '*' get quoted at special kill. This allows yanking content containing lines starting with a '*' without changing the outline structure.
-rw-r--r--contrib/lisp/org-eww.el13
1 files changed, 11 insertions, 2 deletions
diff --git a/contrib/lisp/org-eww.el b/contrib/lisp/org-eww.el
index 08dac11..42af0c9 100644
--- a/contrib/lisp/org-eww.el
+++ b/contrib/lisp/org-eww.el
@@ -87,7 +87,10 @@ Return t if there is no next link; otherwise, return nil."
"Copy current buffer content or active region with `org-mode' style links.
This will encode `link-title' and `link-location' with
`org-make-link-string', and insert the transformed test into the kill ring,
-so that it can be yanked into an Org-mode buffer with links working correctly."
+so that it can be yanked into an Org-mode buffer with links working correctly.
+
+Further lines starting with a star get quoted with a comma to keep
+the structure of the org file."
(interactive)
(let* ((regionp (org-region-active-p))
(transform-start (point-min))
@@ -138,7 +141,13 @@ so that it can be yanked into an Org-mode buffer with links working correctly."
(setq return-content
(concat return-content
(buffer-substring (point) transform-end))))
- (org-kill-new return-content)
+ ;; quote lines starting with *
+ (org-kill-new
+ (with-temp-buffer
+ (insert return-content)
+ (goto-char 0)
+ (replace-regexp "^\*" ",*")
+ (buffer-string)))
(message "Transforming links...done, use C-y to insert text into Org-mode file"))))