[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 048e72a403e 1/2: Add file/buffer-to-register (Bug#73308)
From: |
Eshel Yaron |
Subject: |
Re: master 048e72a403e 1/2: Add file/buffer-to-register (Bug#73308) |
Date: |
Sun, 06 Oct 2024 09:52:08 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
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
- Re: master 048e72a403e 1/2: Add file/buffer-to-register (Bug#73308),
Eshel Yaron <=