From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sean McAfee Newsgroups: gmane.emacs.bugs Subject: bug#74438: 29.1; global-mark-ring does not work as described Date: Thu, 21 Nov 2024 13:03:24 -0800 Message-ID: References: <37667f67-9c28-4543-a28a-c5d42878dbce@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000008043e606277299f9" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33955"; mail-complaints-to="usenet@ciao.gmane.io" To: 74438@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 21 22:05:31 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tEEMl-0008gx-7V for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Nov 2024 22:05:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tEEML-0008SI-Th; Thu, 21 Nov 2024 16:05:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tEEMJ-0008M7-Lr for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2024 16:05:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tEEMJ-0003BG-9S for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2024 16:05:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:From:In-Reply-To:References:MIME-Version:To:Subject; bh=5GNrZq1Tw7M7zF7Al057+SHYmrje4llhGzAQIMapgc0=; b=XysxaM/frOx3hFq4pcZ1ZxPpPEWR2OtVGFsLDhAQMkcwKD6Wd5WCIxWIFiFFA64y4HKNHoztv+y1VHOJJ8bfl1AHJyBfXKoNTG+Re6TY5Ev2KHVrUvC9lE1WdcMUyBc/ayMISbJBZBajnMo3sg34nChKgxFCpihvbrkAjyrCQrfcWeSPvSeDGLBlSAQaeT9opTCpRYP8BMGk99oIxwJ1fwkipf8R0J4IHXmFqY3kTx3CnOACcZBzziPi5lZffJnI9SnX7v2LkcdiNJJhwvc0lFWwvFvzmOZGK89A4sb5Qo5R3IyxiXHTaxs8gD5O+Q+gWXmB+4I+X6hs25oe2LIV4w==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tEEMH-000773-OD for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2024 16:05:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Sean McAfee Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Nov 2024 21:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74438 X-GNU-PR-Package: emacs Original-Received: via spool by 74438-submit@debbugs.gnu.org id=B74438.173222308327305 (code B ref 74438); Thu, 21 Nov 2024 21:05:01 +0000 Original-Received: (at 74438) by debbugs.gnu.org; 21 Nov 2024 21:04:43 +0000 Original-Received: from localhost ([127.0.0.1]:51948 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tEELy-00076L-JY for submit@debbugs.gnu.org; Thu, 21 Nov 2024 16:04:42 -0500 Original-Received: from mail-yb1-f175.google.com ([209.85.219.175]:57749) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tEELx-000769-Cs for 74438@debbugs.gnu.org; Thu, 21 Nov 2024 16:04:42 -0500 Original-Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-e388d8850d3so1442594276.3 for <74438@debbugs.gnu.org>; Thu, 21 Nov 2024 13:04:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732223015; x=1732827815; darn=debbugs.gnu.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=5GNrZq1Tw7M7zF7Al057+SHYmrje4llhGzAQIMapgc0=; b=JL+0mqrUl4C7Eb8HdrKxclEb63UAOuz81cqSUDkD5+l1doEVrHUlzmqdKusv8qq0uI 9RpocoCBZyxO4Jw6SZGI45jQYJcSPUo06g7WkqXq8mQHqiHYVVXNpsHUMPU8TLKM4SD/ rp2Bvrk5I0hriMp734wMMO6nrgkaJ/PQggg2JYmGMNyYLsr070CGxj2bd5SB1egefJfR 9AyQDKzoWOQ6tgdnb1+I1t7XWCoR2t+RKKOHn4nBSvLJq9VhsSMPtweBI9R9SgIJagEv olUW+EnWiaVf8g7ePurEM4/2P9C1dATDyzsW5rxGFQ3As8Zw8hYN2jJlZYqZAN7qvZZC Ii0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732223015; x=1732827815; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5GNrZq1Tw7M7zF7Al057+SHYmrje4llhGzAQIMapgc0=; b=KFfBD6v/sL9F41/I/Piw8bHCw5hISqkakiChuZCj794yZJanzsWxfbKIQFtGi8iKIY estFXFPgfVrUOxEAhOG9/ZJTWqHeO/xqnsKHxruTL9PfvQlYSV+BTbmwZU9nKfrB2fTC G4NvMbZ1QYU5iVH8E6EBpOa3rigkKEIy4q4QvmXlGCHN362Qdg3wZ6BAdLURJakOvtyd g3A9Y9hfLAo0LJ/0rKx6CO571gQX00wbcTRhSefcQaiiEtLNIlfiCUOLV1xsL+LyOckV n14AxdSkWDxcmVyfycTvb+R93W4/3H/3o+KPr9y52M9n+00B6iqxn7NsvhptXBNA69EV mKkA== X-Gm-Message-State: AOJu0YxBuqcD9JopUfIp+125ujTahlxqTHjDEpw5bnNDhXpjRZrKfrv5 bfB9bJUUgrXE3KR9kbOFRre6Ua8xRSyjthxO19K1eL0Mc2kd+4BH/IBTy0EpFIVPx6Vfgb2eId4 6ws6Age81F3ouol4oPnRigcW9skAIm3j4goI= X-Gm-Gg: ASbGncuRhTWB09zbEdyCeH+wu2K8Djz+5xYsr+18XSs4XL9elJlHTcvmHrbs+OrYfDH 1PSEKok1nS1PAz8lHgCd8fwCiKDT2gv9g0N2uWXGvfTBJY5WwuZxSl9szTsdpxIEk X-Google-Smtp-Source: AGHT+IF7kItGRkfZOx92ZQqf9hzYz6EzVkuHJqXUkiFnrP6Jq+M8fT0ELE7SZqWrFvBuDw2yIdNL9RUMjhEhJfsCt8M= X-Received: by 2002:a05:6902:701:b0:e38:901b:602d with SMTP id 3f1490d57ef6-e38f8af7c41mr379962276.9.1732223015335; Thu, 21 Nov 2024 13:03:35 -0800 (PST) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:295756 Archived-At: --0000000000008043e606277299f9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Nov 21, 2024 at 12:32=E2=80=AFPM 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. --0000000000008043e606277299f9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Nov 21, 2024 at 12:32=E2=80=AFPM = Nikolay Kudryavtsev <ni= kolay.kudryavtsev@gmail.com> wrote:
=
I still don't underst= and 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.=C2=A0 That'= ;s exactly what I want to do.=C2=A0 Not sure how I gave a different impress= ion.

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

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

=C2=A0 =C2=A0 (defun json-diff ()
=C2=A0 =C2=A0 =C2=A0 (i= nteractive)
=C2=A0 =C2=A0 =C2=A0 (let ((file-a (make-temp-file "jso= n-diff"))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (file-b (make-t= emp-file "json-diff")))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (with-curr= ent-buffer (marker-buffer last-global-mark)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (write-sexp-at (marker-position last-global-mark) file-a))
=C2=A0= =C2=A0 =C2=A0 =C2=A0 (write-sexp-at (point) file-b)
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 (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.=C2=A0 I also = tried saying (mark t) instead of (marker-position (car global-mark-ring)).= =C2=A0 That would have returned the correct position, but it doesn't ma= tter because (marker-buffer (car global-mark-ring)) can't be relied upo= n to return the right buffer.

--0000000000008043e606277299f9--