* [PATCH] org-refile.el: Add org-refile-reverse which toggles org-reverse-note-order
@ 2020-08-30 0:10 Adam Spiers
2020-09-04 13:47 ` Bastien
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Adam Spiers @ 2020-08-30 0:10 UTC (permalink / raw)
To: emacs-orgmode
This is useful for prepending to the start of the target headline
instead of appending to the end, or vice-versa depending on
org-reverse-note-order.
---
doc/org-manual.org | 10 ++++++++++
etc/ORG-NEWS | 9 +++++++++
lisp/org-keys.el | 1 +
lisp/org-refile.el | 11 +++++++++++
4 files changed, 31 insertions(+)
diff --git a/doc/org-manual.org b/doc/org-manual.org
index 3eb745b5d..e499367b7 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -7190,6 +7190,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 10658a970..a3c8397fc 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -267,6 +267,15 @@ Source code block header argument =:file-mode= can set file
permissions if =:file= argument is provided.
** New commands
+*** ~org-refile-reverse~
+
+Use default keybinding =<C-c C-M-w>= to run command
+~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.
+
*** ~org-table-header-line-mode~
Turn on a minor mode to display the first data row of the table at
diff --git a/lisp/org-keys.el b/lisp/org-keys.el
index 37df29983..902651175 100644
--- a/lisp/org-keys.el
+++ b/lisp/org-keys.el
@@ -582,6 +582,7 @@ (define-key org-mode-map (kbd "<backtab>") #'org-shifttab)
(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 7eb0a9643..c6ff35535 100644
--- a/lisp/org-refile.el
+++ b/lisp/org-refile.el
@@ -384,6 +384,17 @@ (defun org-refile-copy ()
(defvar org-capture-last-stored-marker)
+;;;###autoload
+(defun org-refile-reverse (&optional arg default-buffer rfloc msg)
+ "Invoke `org-refile', but temporarily toggling 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."
+ (interactive "P")
+ (let ((org-reverse-note-order (not (org-notes-order-reversed-p))))
+ (org-refile arg default-buffer rfloc msg)))
+
;;;###autoload
(defun org-refile (&optional arg default-buffer rfloc msg)
"Move the entry or entries at point to another heading.
--
2.27.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] org-refile.el: Add org-refile-reverse which toggles org-reverse-note-order
2020-08-30 0:10 [PATCH] org-refile.el: Add org-refile-reverse which toggles org-reverse-note-order Adam Spiers
@ 2020-09-04 13:47 ` Bastien
2020-09-06 6:10 ` Amin Bandali
2020-12-10 6:04 ` Kyle Meyer
2021-05-15 12:08 ` Bastien
2 siblings, 1 reply; 8+ messages in thread
From: Bastien @ 2020-09-04 13:47 UTC (permalink / raw)
To: Adam Spiers; +Cc: emacs-orgmode
Hi Adam,
Adam Spiers <orgmode@adamspiers.org> writes:
> This is useful for prepending to the start of the target headline
> instead of appending to the end, or vice-versa depending on
> org-reverse-note-order.
I think this would be useful. What others think?
I'm storing this for after 9.4 since we are in feature freeze.
Thanks,
--
Bastien
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] org-refile.el: Add org-refile-reverse which toggles org-reverse-note-order
2020-09-04 13:47 ` Bastien
@ 2020-09-06 6:10 ` Amin Bandali
2020-11-10 0:26 ` Adam Spiers
0 siblings, 1 reply; 8+ messages in thread
From: Amin Bandali @ 2020-09-06 6:10 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 357 bytes --]
Bastien writes:
> Hi Adam,
>
> Adam Spiers <orgmode@adamspiers.org> writes:
>
>> This is useful for prepending to the start of the target headline
>> instead of appending to the end, or vice-versa depending on
>> org-reverse-note-order.
>
> I think this would be useful. What others think?
>
[...]
+1; sounds quite useful to me as well.
Thank you both.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] org-refile.el: Add org-refile-reverse which toggles org-reverse-note-order
2020-09-06 6:10 ` Amin Bandali
@ 2020-11-10 0:26 ` Adam Spiers
0 siblings, 0 replies; 8+ messages in thread
From: Adam Spiers @ 2020-11-10 0:26 UTC (permalink / raw)
To: Bastien, emacs-orgmode
On Sun, Sep 06, 2020 at 02:10:09AM -0400, Amin Bandali wrote:
>Bastien writes:
>
>> Hi Adam,
>>
>> Adam Spiers <orgmode@adamspiers.org> writes:
>>
>>> This is useful for prepending to the start of the target headline
>>> instead of appending to the end, or vice-versa depending on
>>> org-reverse-note-order.
>>
>> I think this would be useful. What others think?
>>
>[...]
>
>+1; sounds quite useful to me as well.
>
>Thank you both.
Is it time to revisit this yet?
Thanks!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] org-refile.el: Add org-refile-reverse which toggles org-reverse-note-order
2020-08-30 0:10 [PATCH] org-refile.el: Add org-refile-reverse which toggles org-reverse-note-order Adam Spiers
2020-09-04 13:47 ` Bastien
@ 2020-12-10 6:04 ` Kyle Meyer
2021-04-27 20:54 ` Bastien
2021-05-15 12:08 ` Bastien
2 siblings, 1 reply; 8+ messages in thread
From: Kyle Meyer @ 2020-12-10 6:04 UTC (permalink / raw)
To: Adam Spiers; +Cc: emacs-orgmode
Thanks for the patch.
Adam Spiers writes:
> This is useful for prepending to the start of the target headline
> instead of appending to the end, or vice-versa depending on
> org-reverse-note-order.
It sounds like Bastien and Amin would also find this useful. I would
have liked to see a few more people chime in because I'm lukewarm on it
myself, as I tend to think things like this are better suited for
personal customization.
In any case, I think we should go forward with it. Could you add a
changelog entry to the commit message?
> diff --git a/doc/org-manual.org b/doc/org-manual.org
> index 3eb745b5d..e499367b7 100644
> --- a/doc/org-manual.org
> +++ b/doc/org-manual.org
> @@ -7190,6 +7190,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
It seems a bit odd to say it "works like refiling" when it _is_
refiling. Perhaps "Works like ~org-refile~ ..." or the common "Like X
but ..." pattern?
> + value of ~org-reverse-note-order~ applies to the current buffer. So
I think the "applies to the current buffer" (here and in other spots)
doesn't add anything while possibly confusing the reader into thinking
that the toggling isn't in effect when refiling an entry to another
buffer.
[...]
> +;;;###autoload
> +(defun org-refile-reverse (&optional arg default-buffer rfloc msg)
> + "Invoke `org-refile', but temporarily toggling how
> +~org-reverse-note-order~ applies to the current buffer. So if
s/~org-reverse-note-order~/`org-reverse-note-order'/
The first line of the docstring should be self-contained for apropos and
friends. Perhaps
Invoke `org-refile' with `org-reverse-note-order' inverted.
However, there's also the question of what toggling means for users that
have configured org-reverse-note-order to a set of regular expressions.
I think it's worth noting in the docstring that this case is treated the
same as t (i.e. any non-nil value is mapped to nil).
> +`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."
s/~org-refile-reverse~/`org-refile-reverse'/
> + (interactive "P")
> + (let ((org-reverse-note-order (not (org-notes-order-reversed-p))))
> + (org-refile arg default-buffer rfloc msg)))
> +
> ;;;###autoload
> (defun org-refile (&optional arg default-buffer rfloc msg)
> "Move the entry or entries at point to another heading.
> --
> 2.27.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] org-refile.el: Add org-refile-reverse which toggles org-reverse-note-order
2020-12-10 6:04 ` Kyle Meyer
@ 2021-04-27 20:54 ` Bastien
0 siblings, 0 replies; 8+ messages in thread
From: Bastien @ 2021-04-27 20:54 UTC (permalink / raw)
To: Kyle Meyer; +Cc: emacs-orgmode
Hi Adam,
Kyle Meyer <kyle@kyleam.com> writes:
> Thanks for the patch.
>
> Adam Spiers writes:
>
>> This is useful for prepending to the start of the target headline
>> instead of appending to the end, or vice-versa depending on
>> org-reverse-note-order.
>
> It sounds like Bastien and Amin would also find this useful. I would
> have liked to see a few more people chime in because I'm lukewarm on it
> myself, as I tend to think things like this are better suited for
> personal customization.
>
> In any case, I think we should go forward with it. Could you add a
> changelog entry to the commit message?
Sorry if I miss latest Adam's patch, with a changelog entry and a
commit message -- Adam, would you mind resending it?
Thanks
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] org-refile.el: Add org-refile-reverse which toggles org-reverse-note-order
2020-08-30 0:10 [PATCH] org-refile.el: Add org-refile-reverse which toggles org-reverse-note-order Adam Spiers
2020-09-04 13:47 ` Bastien
2020-12-10 6:04 ` Kyle Meyer
@ 2021-05-15 12:08 ` Bastien
2021-05-15 20:23 ` Samuel Wales
2 siblings, 1 reply; 8+ messages in thread
From: Bastien @ 2021-05-15 12:08 UTC (permalink / raw)
To: Adam Spiers; +Cc: emacs-orgmode
Hi Adam,
Adam Spiers <orgmode@adamspiers.org> writes:
> This is useful for prepending to the start of the target headline
> instead of appending to the end, or vice-versa depending on
> org-reverse-note-order.
Applied in master as 9e127a720, thanks.
--
Bastien
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] org-refile.el: Add org-refile-reverse which toggles org-reverse-note-order
2021-05-15 12:08 ` Bastien
@ 2021-05-15 20:23 ` Samuel Wales
0 siblings, 0 replies; 8+ messages in thread
From: Samuel Wales @ 2021-05-15 20:23 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
sounds good to decouple those, but i interpret org-refile-reverse to
mean "refile in reverse". from a to b -> from b to a. fwiw. thus,
you could be on a and goto b and then do a reverse refile. that would
be a useful operation. so i suggest org-refile-reverse-order or so.
On 5/15/21, Bastien <bzg@gnu.org> wrote:
> Hi Adam,
>
> Adam Spiers <orgmode@adamspiers.org> writes:
>
>> This is useful for prepending to the start of the target headline
>> instead of appending to the end, or vice-versa depending on
>> org-reverse-note-order.
>
> Applied in master as 9e127a720, thanks.
>
> --
> Bastien
>
>
--
The Kafka Pandemic
Please learn what misopathy is.
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-05-15 20:24 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-30 0:10 [PATCH] org-refile.el: Add org-refile-reverse which toggles org-reverse-note-order Adam Spiers
2020-09-04 13:47 ` Bastien
2020-09-06 6:10 ` Amin Bandali
2020-11-10 0:26 ` Adam Spiers
2020-12-10 6:04 ` Kyle Meyer
2021-04-27 20:54 ` Bastien
2021-05-15 12:08 ` Bastien
2021-05-15 20:23 ` Samuel Wales
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).