* [fr] refile goto: push mark in the target buffer first
@ 2024-07-05 0:24 Samuel Wales
2024-07-06 15:28 ` Ihor Radchenko
0 siblings, 1 reply; 3+ messages in thread
From: Samuel Wales @ 2024-07-05 0:24 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1147 bytes --]
at least for my use case, refile goto should push mark in the target buffer
after visiting the buffer, before jumping. rationale: it can be a big
jump. m-< pushes mark for that reason. i think i saw that in the manual
years ago. :)
i am often in my-big-subtree, someplace, and go someplace else. i want to
return to that place in my-big-subtree. refile goto loses the previous
position. i want to c-u c-spc to get to where i was.
completely unrelated: global mark ring is orthogonal, as i know exactly
where i want to go, but it could take me anywhere. also, i've never gotten
global mark ring to work for me. i think maybe global marks should work
like vundo or undo-tree, where you have up down right left and i don't
think it should be a ring but a tree. when i jump, i often don't know that
i want to return so do not set the mark. to me, the big jump of refile
goto in the target buffer is the reasonable automatic mark setter like
m-<. also unrelated is switching buffers; i think in terms of headings.
--
The Kafka Pandemic
A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com
[-- Attachment #2: Type: text/html, Size: 1335 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [fr] refile goto: push mark in the target buffer first
2024-07-05 0:24 [fr] refile goto: push mark in the target buffer first Samuel Wales
@ 2024-07-06 15:28 ` Ihor Radchenko
2024-07-07 2:39 ` Samuel Wales
0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2024-07-06 15:28 UTC (permalink / raw)
To: Samuel Wales; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 560 bytes --]
Samuel Wales <samologist@gmail.com> writes:
> at least for my use case, refile goto should push mark in the target buffer
> after visiting the buffer, before jumping. rationale: it can be a big
> jump. m-< pushes mark for that reason. i think i saw that in the manual
> years ago. :)
>
> i am often in my-big-subtree, someplace, and go someplace else. i want to
> return to that place in my-big-subtree. refile goto loses the previous
> position. i want to c-u c-spc to get to where i was.
See the attached tentative patch.
This is an easy addition.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-refile-Push-point-to-Org-mark-ring-before-jumpin.patch --]
[-- Type: text/x-patch, Size: 2312 bytes --]
From b3a80c70bfca02287ca8ecdcba98cea170d9783b Mon Sep 17 00:00:00 2001
Message-ID: <b3a80c70bfca02287ca8ecdcba98cea170d9783b.1720279651.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Sat, 6 Jul 2024 17:26:08 +0200
Subject: [PATCH] org-refile: Push point to Org mark ring before jumping
* lisp/org-refile.el (org-refile):
(org-refile-goto-last-stored): Save position to the Org mark ring if
we are about to jump to a different position.
* etc/ORG-NEWS (~org-refile~ now saves current position to Org mark
ring when jumping to heading): Document the new feature.
Link: https://orgmode.org/list/CAJcAo8vYLJ3YGH0+nZs1rgtdq2iRKzJ8tuGxJKRD-XyEwEm4FA@mail.gmail.com
---
etc/ORG-NEWS | 8 +++++++-
lisp/org-refile.el | 2 ++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index b9f51667d..4e9d1bf8d 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -93,8 +93,14 @@ Runtime error near line 2: attempt to write a readonly database (8)
[ Babel evaluation exited with code 1 ]
#+end_example
-
** Miscellaneous
+*** ~org-refile~ now saves current position to Org mark ring when jumping to heading
+
+When ~org-refile~ is called with =C-u= or =C-u C-u= prefix argument
+(to jump to heading or to jump to the last refiled heading), it saves
+point to Org mark ring before jumping. Then, the user can return back
+via ~org-mark-ring-goto~.
+
*** Trailing =-= is now allowed in plain links
Previously, plain links like
diff --git a/lisp/org-refile.el b/lisp/org-refile.el
index c8e64903c..44361c143 100644
--- a/lisp/org-refile.el
+++ b/lisp/org-refile.el
@@ -544,6 +544,7 @@ (defun org-refile (&optional arg default-buffer rfloc msg)
(setq nbuf (find-file-noselect file 'nowarn))
(if (and arg (not (equal arg 3)))
(progn
+ (org-mark-ring-push)
(pop-to-buffer-same-window nbuf)
(goto-char (cond (pos)
((org-notes-order-reversed-p) (point-min))
@@ -634,6 +635,7 @@ (defun org-refile (&optional arg default-buffer rfloc msg)
(defun org-refile-goto-last-stored ()
"Go to the location where the last refile was stored."
(interactive)
+ (org-mark-ring-push)
(bookmark-jump (plist-get org-bookmark-names-plist :last-refile))
(message "This is the location of the last refile"))
--
2.45.2
[-- Attachment #3: Type: text/plain, Size: 224 bytes --]
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [fr] refile goto: push mark in the target buffer first
2024-07-06 15:28 ` Ihor Radchenko
@ 2024-07-07 2:39 ` Samuel Wales
0 siblings, 0 replies; 3+ messages in thread
From: Samuel Wales @ 2024-07-07 2:39 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 917 bytes --]
thank you! this would definitely meet my need.
i was thinking of the local mark, but i use org-mark-ring-goto all the time
also.
On Saturday, July 6, 2024, Ihor Radchenko <yantar92@posteo.net> wrote:
> Samuel Wales <samologist@gmail.com> writes:
>
> > at least for my use case, refile goto should push mark in the target
> buffer
> > after visiting the buffer, before jumping. rationale: it can be a big
> > jump. m-< pushes mark for that reason. i think i saw that in the manual
> > years ago. :)
> >
> > i am often in my-big-subtree, someplace, and go someplace else. i want
> to
> > return to that place in my-big-subtree. refile goto loses the previous
> > position. i want to c-u c-spc to get to where i was.
>
> See the attached tentative patch.
> This is an easy addition.
>
>
--
The Kafka Pandemic
A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com
[-- Attachment #2: Type: text/html, Size: 1355 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-07-07 2:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-05 0:24 [fr] refile goto: push mark in the target buffer first Samuel Wales
2024-07-06 15:28 ` Ihor Radchenko
2024-07-07 2:39 ` 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).