From: Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com>
To: Sean McAfee <eefacm@gmail.com>, 74438@debbugs.gnu.org
Subject: bug#74438: 29.1; global-mark-ring does not work as described
Date: Fri, 22 Nov 2024 15:39:36 +0300 [thread overview]
Message-ID: <64684e77-0a4d-41b7-b24d-842f6db2b151@gmail.com> (raw)
In-Reply-To: <CANan03b0JCJmkW05QJEsnEKgUBrUia-uxax1S014a-5dK7xxUA@mail.gmail.com>
Sorry, but your code does not demonstrate at what points you're pushing
the mark(s). If you get the file-a marker before doing any write
operations, you should be safe:
(defun json-diff ()
(interactive)
(let ((buffer-a (find-file (make-temp-file "json-diff"))))
(with-current-buffer buffer-a (push-mark))
;; At this point we presumably no longer have the mark for buffer-a
for some reason
(let ((first-mark (car global-mark-ring)))
(with-current-buffer (marker-buffer first-mark)
(message (format "Working with %s at %s" (buffer-file-name
(current-buffer)) (marker-position first-mark)))))))
But be aware that you're never really safe if you're relying on the mark
ring here. If json-diff is an interactive command, nothing is stopping
the user from pushing another mark to the ring in between of specifying
file-a and file-b. Even worse if you're trying to get something from the
previous command(as you said in the letter before), because you can
never be sure what the previous command was and what it did.
Also, I don't know where did you get the last-global-mark thing, it's
not something that's in the Emacs 29 or 30's core.
next prev parent reply other threads:[~2024-11-22 12:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-19 20:24 bug#74438: 29.1; global-mark-ring does not work as described Sean McAfee
2024-11-20 10:18 ` Nikolay Kudryavtsev
2024-11-20 14:35 ` Eli Zaretskii
2024-11-21 7:51 ` Nikolay Kudryavtsev
2024-11-21 9:49 ` Eli Zaretskii
2024-11-20 19:16 ` Sean McAfee
2024-11-21 8:09 ` Nikolay Kudryavtsev
2024-11-21 19:49 ` Sean McAfee
2024-11-21 20:32 ` Nikolay Kudryavtsev
2024-11-21 21:03 ` Sean McAfee
2024-11-22 12:39 ` Nikolay Kudryavtsev [this message]
2024-11-22 18:48 ` Sean McAfee
2024-11-22 21:16 ` Nikolay Kudryavtsev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=64684e77-0a4d-41b7-b24d-842f6db2b151@gmail.com \
--to=nikolay.kudryavtsev@gmail.com \
--cc=74438@debbugs.gnu.org \
--cc=eefacm@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.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).