GNU bug report logs -
#74438
29.1; global-mark-ring does not work as described
Previous Next
Reported by: Sean McAfee <eefacm <at> gmail.com>
Date: Tue, 19 Nov 2024 20:26:02 UTC
Severity: normal
Found in version 29.1
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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.
This bug report was last modified 245 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.