branch: externals/org commit 33027f992d2d77853b713f6b1d17e2286d66ef28 Author: Adam Spiers <orgm...@adamspiers.org> Commit: Bastien <b...@gnu.org>
New command `org-refile-reverse' bound to C-c C-M-w * lisp/org-refile.el (org-refile-reverse): New command. * lisp/org-keys.el (org-mode-map): Bind C-c C-M-w to `org-refile-reverse'. * doc/org-manual.org (Refile and Copy): Document `org-refile-reverse'. * etc/ORG-NEWS (New command ~org-refile-reverse~ (=C-c C-M-w=)): Announce the new command. Link: https://orgmode.org/list/20200830001047.21362-1-orgm...@adamspiers.org/ --- doc/org-manual.org | 10 ++++++++++ etc/ORG-NEWS | 10 ++++++++++ lisp/org-keys.el | 1 + lisp/org-refile.el | 11 +++++++++++ 4 files changed, 32 insertions(+) diff --git a/doc/org-manual.org b/doc/org-manual.org index ab12fa7..a4baf52 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -7246,6 +7246,16 @@ special command: Copying works like refiling, except that the original note is not deleted. +- {{{kbd(C-c C-M-w)}}} (~org-refile-reverse~) :: + + #+kindex: C-c C-M-w + #+findex: org-refile-reverse + Works like refiling, except that it temporarily toggles how the + value of ~org-reverse-note-order~ applies to the current buffer. So + if ~org-refile~ would append the entry as the last entry under the + target header, ~org-refile-reverse~ will prepend it as the first + entry, and vice-versa. + ** Archiving :PROPERTIES: :DESCRIPTION: What to do with finished products. diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 669a7c3..b987b7a 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -230,6 +230,16 @@ package, to convert pandas Dataframes into orgmode tables: | 2 | 3 | 6 | #+end_src +*** New command ~org-refile-reverse~ (=C-c C-M-w=) + +You can now use =C-c C-M-w= to run ~org-refile-reverse~. + +It is almost identical to ~org-refile~, except that it temporarily +toggles how ~org-reverse-note-order~ applies to the current buffer. +So if ~org-refile~ would append the entry as the last entry under the +target heading, ~org-refile-reverse~ will prepend it as the first +entry, and vice-versa. + *** New startup options =#+startup: show<n>levels= These startup options complement the existing =overview=, =content=, diff --git a/lisp/org-keys.el b/lisp/org-keys.el index f04f87d..12d6226 100644 --- a/lisp/org-keys.el +++ b/lisp/org-keys.el @@ -581,6 +581,7 @@ COMMANDS is a list of alternating OLDDEF NEWDEF command names." (org-defkey org-mode-map (kbd "C-c ;") #'org-toggle-comment) (org-defkey org-mode-map (kbd "C-c C-w") #'org-refile) (org-defkey org-mode-map (kbd "C-c M-w") #'org-refile-copy) +(org-defkey org-mode-map (kbd "C-c C-M-w") #'org-refile-reverse) (org-defkey org-mode-map (kbd "C-c /") #'org-sparse-tree) ;minor-mode reserved (org-defkey org-mode-map (kbd "C-c \\") #'org-match-sparse-tree) ;minor-mode r. (org-defkey org-mode-map (kbd "C-c RET") #'org-ctrl-c-ret) diff --git a/lisp/org-refile.el b/lisp/org-refile.el index 2900be2..bffad0a 100644 --- a/lisp/org-refile.el +++ b/lisp/org-refile.el @@ -383,8 +383,19 @@ the *old* location.") (let ((org-refile-keep t)) (org-refile nil nil nil "Copy"))) +;;;###autoload +(defun org-refile-reverse (&optional arg default-buffer rfloc msg) + "Refile while temporarily toggling `org-reverse-note-order'. +So if `org-refile' would append the entry as the last entry under +the target heading, `org-refile-reverse' will prepend it as the +first entry, and vice-versa." + (interactive "P") + (let ((org-reverse-note-order (not (org-notes-order-reversed-p)))) + (org-refile arg default-buffer rfloc msg))) + (defvar org-capture-last-stored-marker) + ;;;###autoload (defun org-refile (&optional arg default-buffer rfloc msg) "Move the entry or entries at point to another heading.