unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eshel Yaron <me@eshelyaron.com>
To: emacs-devel@gnu.org
Cc: "Barra Ó Catháin" <barra@ocathain.ie>
Subject: Re: master 048e72a403e 1/2: Add file/buffer-to-register (Bug#73308)
Date: Sun, 06 Oct 2024 09:52:08 +0200	[thread overview]
Message-ID: <m1msjhvfbr.fsf@dazzs-mbp.home> (raw)
In-Reply-To: <20241005100743.4B6DB1AA78D@vcs3.savannah.gnu.org> (Eli Zaretskii's message of "Sat, 5 Oct 2024 06:07:43 -0400 (EDT)")

Eli Zaretskii <eliz@gnu.org> writes:

> branch: master
> commit 048e72a403e22dc394b265c6ff290b8d40e806a5
> Author: Barra Ó Catháin <barra@ocathain.ie>
> Commit: Eli Zaretskii <eliz@gnu.org>
>
>     Add file/buffer-to-register (Bug#73308)

[...]

> +(defun buffer-to-register (buffer register)
> +  "Insert BUFFER into REGISTER.
> +To visit the buffer, use \\[jump-to-register].
> +
> +Interactively, prompt for REGISTER using `register-read-with-preview'.
> +With a prefix-argument, prompt for BUFFER-NAME using `read-buffer',
> +With no prefix-argument, use the current buffer for BUFFER."
> +  (interactive (list (if (eq current-prefix-arg nil)
> +                         (current-buffer)
> +                       (read-buffer "Buffer: "))
> +                     (register-read-with-preview "Buffer to register: ")))
> +  (add-hook 'kill-buffer-hook 'register-buffer-to-file-query nil t)
> +  (set-register register (cons 'buffer buffer)))

Hmm, this looks like a subtle bug: the BUFFER argument can be any
buffer, but the add-hook call is always local to the current buffer.
Shouldn't that add-hook happen inside a with-current-buffer or something
like that?


Best,

Eshel



       reply	other threads:[~2024-10-06  7:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <172812286261.457694.4614807424585269986@vcs3.savannah.gnu.org>
     [not found] ` <20241005100743.4B6DB1AA78D@vcs3.savannah.gnu.org>
2024-10-06  7:52   ` Eshel Yaron [this message]
2024-10-06 23:21     ` master 048e72a403e 1/2: Add file/buffer-to-register (Bug#73308) Barra Ó Catháin via Emacs development discussions.
2024-10-08  9:36       ` Eshel Yaron
2024-10-08 10:07         ` Barra Ó Catháin via Emacs development discussions.

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=m1msjhvfbr.fsf@dazzs-mbp.home \
    --to=me@eshelyaron.com \
    --cc=barra@ocathain.ie \
    --cc=emacs-devel@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 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).