]> git.eshelyaron.com Git - emacs.git/commit
Preserve point when inserting date stamps in ERC
authorF. Jason Park <jp@neverwas.me>
Tue, 31 Oct 2023 23:50:16 +0000 (16:50 -0700)
committerF. Jason Park <jp@neverwas.me>
Wed, 1 Nov 2023 23:14:10 +0000 (16:14 -0700)
commit078cfe807295038fa321c9297e24de5145065622
treeab5c79b733cd8d5ec1c9dae9b0c597a8090af040
parent11e42b405ca222a037b7b3d215ef5d14a97ab929
Preserve point when inserting date stamps in ERC

* lisp/erc/erc-stamp.el (erc-stamp-mode, erc-stamp-disable): Move
remaining local teardown business to `erc-stamp--setup' and use
`erc-buffer-do' instead of `erc-with-all-buffers-of-server' to
emphasize that all ERC buffers are affected.
(erc-stamp--insert-date-stamp-as-phony-message): Move `erc--msg-props'
binding to `erc-stamp--lr-date-on-pre-modify'.
(erc-stamp--lr-date-on-pre-modify): Bind `erc--msg-props' here so that
the related guard condition in `erc-add-timestamp' is satisfied and
`erc-insert-timestamp-function' runs.  This fixes a regression new in
ERC 5.6 and introduced by c68dc778 "Manage some text props for ERC
insertion-hook members".  Also, `save-excursion' when narrowing to
prevent point from being dislodged after submitting input at the
prompt.
(erc-insert-timestamp-left-and-right): Don't initialize date stamps
when `erc-timestamp-format-left' is nil or consists only of newlines,
and enable fallback behavior in such cases on behalf of users without
informing them.  Allow global hook members to run first so that those
owned by `scrolltobottom' and similar can see the unadulterated input.
Fix wrong hook name.
(erc-stamp--setup): Fix wrong hook name.  Kill all local vars here
instead of sharing this duty with the minor-mode toggle.  (Bug#60936)
lisp/erc/erc-stamp.el