all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Movable position registers?
@ 2016-09-12 18:06 Nikolay Kudryavtsev
  2016-09-12 20:52 ` John Mastro
  0 siblings, 1 reply; 2+ messages in thread
From: Nikolay Kudryavtsev @ 2016-09-12 18:06 UTC (permalink / raw
  To: help-gnu-emacs@gnu.org

 From time to time I have this question, but always forget to ask.

Is there a way to put the position of comint input into a register, so 
whenever its position changes, the register moves with it? So I can use 
registers for irc buffers, sql buffers and shell buffers without the 
need for an extra end-of-buffer command.

-- 
Best Regards,
Nikolay Kudryavtsev




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Movable position registers?
  2016-09-12 18:06 Movable position registers? Nikolay Kudryavtsev
@ 2016-09-12 20:52 ` John Mastro
  0 siblings, 0 replies; 2+ messages in thread
From: John Mastro @ 2016-09-12 20:52 UTC (permalink / raw
  To: help-gnu-emacs@gnu.org

Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com> wrote:
> From time to time I have this question, but always forget to ask.
>
> Is there a way to put the position of comint input into a register, so
> whenever its position changes, the register moves with it? So I can use
> registers for irc buffers, sql buffers and shell buffers without the need
> for an extra end-of-buffer command.

If I understand correctly, I think perhaps you just need to use
`set-marker-insertion-type' so that the marker moves when text is
inserted at its position.

Here's an example of a modified/simplified version of
`point-to-register' that does so:

(defun my-point-to-register-with-insertion-type-t (register)
  (interactive
   (list (register-read-with-preview "Point to register: ")))
  (add-hook 'kill-buffer-hook 'register-swap-out nil t)
  (let ((marker (copy-marker (point))))
    (set-marker-insertion-type marker t)
    (set-register register marker)))

Hope that helps

        John



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-12 20:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-12 18:06 Movable position registers? Nikolay Kudryavtsev
2016-09-12 20:52 ` John Mastro

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.