GNU bug report logs - #74438
29.1; global-mark-ring does not work as described

Previous Next

Package: emacs;

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

From: Sean McAfee <eefacm <at> gmail.com>
To: 74438 <at> debbugs.gnu.org
Subject: bug#74438: 29.1; global-mark-ring does not work as described
Date: Thu, 21 Nov 2024 13:03:24 -0800
[Message part 1 (text/plain, inline)]
On Thu, Nov 21, 2024 at 12:32 PM Nikolay Kudryavtsev <
nikolay.kudryavtsev <at> gmail.com> wrote:

> I still don't understand why do you need more than one mark for your use
> case?
>
> You are comparing two sexps. You put the foo buffer sexp position into
> the mark ring. Now you go to the bar buffer and select the sexp there.
> Why do you need to put the bar into the mark ring? Why do you need the
> second foo mark? You can just use the first(and only) foo mark and be
> done with it.
>

Er...yeah.  That's exactly what I want to do.  Not sure how I gave a
different impression.

Here's what I have now, minus some defensive coding to keep it short:

    ;; Helper function:
    (defun write-sexp-at (pos dest-file)
      (write-region pos (save-excursion (goto-char pos) (forward-sexp)
(point)) dest-file))

    (defun json-diff ()
      (interactive)
      (let ((file-a (make-temp-file "json-diff"))
            (file-b (make-temp-file "json-diff")))
        (with-current-buffer (marker-buffer last-global-mark)
          (write-sexp-at (marker-position last-global-mark) file-a))
        (write-sexp-at (point) file-b)
        (shell-command (format "~/bin/json-diff %s %s" file-a file-b))))

Originally I tried using (car global-mark-ring) instead of
last-global-mark, but that doesn't work, per my original bug report.  I
also tried saying (mark t) instead of (marker-position (car
global-mark-ring)).  That would have returned the correct position, but it
doesn't matter because (marker-buffer (car global-mark-ring)) can't be
relied upon to return the right buffer.
[Message part 2 (text/html, inline)]

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.