diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2009-05-12 16:29:58 +0200 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2009-05-12 16:29:58 +0200 |
commit | 610f0004c8994c82e2d9cf74ea16868c932c859b (patch) | |
tree | 95c82f5d7613087773dfe98cede3e3fc27ee22d6 | |
parent | 90204fe238621746ee75532e276daf97afafa0d7 (diff) | |
download | org-mode-610f0004c8994c82e2d9cf74ea16868c932c859b.tar.gz |
Modularize `org-yank'.
Patch by Derek Upham.
-rwxr-xr-x | lisp/ChangeLog | 4 | ||||
-rw-r--r-- | lisp/org.el | 26 |
2 files changed, 24 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fe7defc..bc0301b 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2009-05-12 Carsten Dominik <carsten.dominik@gmail.com> + * org.el (org-yank): Just call `org-yank-generic'. + (org-yank-generic): New function, containing the formaer + functionality of `org-yank'. + * org-latex.el (org-export-latex-not-done-keywords) (org-export-latex-done-keywords): New variables. (org-export-latex-todo-keyword-markup): New option. diff --git a/lisp/org.el b/lisp/org.el index ab7f243..2ffbc2c 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -15999,12 +15999,24 @@ Any prefix to this command will cause `yank' to be called directly with no special treatment. In particular, a simple `C-u' prefix will just plainly yank the text as it is. -\[1] Basically, the test checks if the first non-white line is a heading +\[1] The test checks if the first non-white line is a heading and if there are no other headings with fewer stars." (interactive "P") - (setq this-command 'yank) + (org-yank-generic 'yank arg)) + +(defun org-yank-generic (command arg) + "Perform some yank-like command. + +This function implements the behavior described in the `org-yank' +documentation. However, it has been generalized to work for any +interactive command with similar behavior." + + ;; pretend to be command COMMAND + (setq this-command command) + (if arg - (call-interactively 'yank) + (call-interactively command) + (let ((subtreep ; is kill a subtree, and the yank position appropriate? (and (org-kill-is-subtree-p) (or (bolp) @@ -16019,7 +16031,8 @@ plainly yank the text as it is. end) (if (and subtreep org-yank-adjusted-subtrees) (org-paste-subtree nil nil 'for-yank) - (call-interactively 'yank)) + (call-interactively command)) + (setq end (point)) (goto-char beg) (when (and (bolp) subtreep @@ -16035,7 +16048,8 @@ plainly yank the text as it is. (error (goto-char end))))) (when swallowp (message - "Yanked text not folded because that would swallow text")) + "Inserted text not folded because that would swallow text")) + (goto-char end) (skip-chars-forward " \t\n\r") (beginning-of-line 1) @@ -16045,7 +16059,7 @@ plainly yank the text as it is. (org-paste-subtree nil nil 'for-yank) (push-mark beg 'nomsg))) (t - (call-interactively 'yank)))))) + (call-interactively command)))))) (defun org-yank-folding-would-swallow-text (beg end) "Would hide-subtree at BEG swallow any text after END?" |