From: John Mastro <john.b.mastro@gmail.com>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: Movable position registers?
Date: Mon, 12 Sep 2016 13:52:56 -0700 [thread overview]
Message-ID: <CAOj2CQTp8SE-Mwv-oW4FB-=kTC1jZYLozmuyFbCWDZ45S5y00g@mail.gmail.com> (raw)
In-Reply-To: <c017ede5-f556-a6ab-1f1f-b43af739ffd1@gmail.com>
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
prev parent reply other threads:[~2016-09-12 20:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-12 18:06 Movable position registers? Nikolay Kudryavtsev
2016-09-12 20:52 ` John Mastro [this message]
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='CAOj2CQTp8SE-Mwv-oW4FB-=kTC1jZYLozmuyFbCWDZ45S5y00g@mail.gmail.com' \
--to=john.b.mastro@gmail.com \
--cc=help-gnu-emacs@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.