From: Sean McAfee <eefacm@gmail.com>
To: 74438@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 [thread overview]
Message-ID: <CANan03b0JCJmkW05QJEsnEKgUBrUia-uxax1S014a-5dK7xxUA@mail.gmail.com> (raw)
In-Reply-To: <f3849431-20c2-40e9-8bdc-6fe3f017b6fc@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1616 bytes --]
On Thu, Nov 21, 2024 at 12:32 PM Nikolay Kudryavtsev <
nikolay.kudryavtsev@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.
[-- Attachment #2: Type: text/html, Size: 2211 bytes --]
next prev parent reply other threads:[~2024-11-21 21:03 UTC|newest]
Thread overview: 14+ 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 [this message]
2024-11-22 12:39 ` Nikolay Kudryavtsev
2024-11-22 18:48 ` Sean McAfee
2024-11-22 21:16 ` Nikolay Kudryavtsev
2024-12-07 12:02 ` Eli Zaretskii
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CANan03b0JCJmkW05QJEsnEKgUBrUia-uxax1S014a-5dK7xxUA@mail.gmail.com \
--to=eefacm@gmail.com \
--cc=74438@debbugs.gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.