1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-01 08:17:38 +00:00

Sideline implied invisible-intangible coupling in ERC

* etc/ERC-NEWS: Add entry explaining removal of automatic `intangible'
propertizing of t-valued `invisible' messages.
* lisp/erc/erc.el (erc--insert-invisible-as-intangible-p): New flag
variable, a temporary escape hatch to regain pre-5.6 behavior
involving the modification of certain `invisible' messages.
(erc--insert-line): Gate unfavorable behavior behind
`erc--insert-invisible-as-intangible-p' flag.  Add comment clarifying
deferred initialization of `insert-position', which was part of the
many changes introduced as part of bug#60936.
This commit is contained in:
F. Jason Park 2023-12-27 18:44:29 -08:00
parent 7097be8ef6
commit 775bd4b631
2 changed files with 33 additions and 5 deletions

View File

@ -438,6 +438,17 @@ those folded onto the next line. Such inconsistency made stamp
detection overly complex and produced uneven results when toggling
stamp visibility.
*** Invisible message insertions not automatically made 'intangible'.
Previously, when 'erc-display-message' and friends spotted the
'invisible' text property with a value of t anywhere in text to be
inserted, it would apply that property to the entire message, along
with a t-valued 'intangible' property. Beginning with ERC 5.6, users
expecting this behavior will have to instead perform the treatment
themselves. To help with the transition, a temporary escape hatch has
been made available to regain this behavior, but its existence is only
guaranteed for this one minor version alone. See source code in the
vicinity of 'erc-insert-line' for more.
*** Date stamps have become independent messages.
ERC now inserts "date stamps" generated from the option
'erc-timestamp-format-left' as separate, standalone messages. This

View File

@ -3282,6 +3282,21 @@ If END is a marker, possibly update its position."
(unless (eq end erc-insert-marker)
(set-marker end nil)))
(defvar erc--insert-invisible-as-intangible-p nil
"When non-nil, ensure certain invisible messages are also intangible.
That is, single out any message inserted via `erc-insert-line'
that lacks a trailing newline but has a t-valued `invisible'
property anywhere along its length, and ensure it's both
`invisible' t and `intangible' t throughout. Note that this is
merely an escape hatch for accessing aberrant pre-5.6 behavior
that ERC considers a bug because it applies a practice described
as obsolete in the manual, and it does so heavy-handedly. That
the old behavior only acted when the input lacked a trailing
newline was likely accidental but is ultimately incidental. See
info node `(elisp) Special Properties' for specifics. Beware
that this flag and the behavior it restores may disappear at any
time, so if you need them, please let ERC know with \\[erc-bug].")
(defvar erc--insert-line-function nil
"When non-nil, an alterntive to `insert' for inserting messages.")
@ -3310,13 +3325,15 @@ preformatted or anticipated by third-party members of the various
modification hooks)."
(when string
(with-current-buffer (or buffer (process-buffer erc-server-process))
(let ((insert-position (marker-position erc-insert-marker)))
(let ((string string) ;; FIXME! Can this be removed?
(buffer-undo-list t)
(let (insert-position)
;; Initialize ^ below to thwart rogue `erc-insert-pre-hook'
;; members that dare to modify the buffer's length.
(let ((buffer-undo-list t)
(inhibit-read-only t))
(unless (string-match "\n$" string)
(unless (string-suffix-p "\n" string)
(setq string (concat string "\n"))
(when (erc-string-invisible-p string)
(when (and erc--insert-invisible-as-intangible-p
(erc-string-invisible-p string))
(erc-put-text-properties 0 (length string)
'(invisible intangible) string)))
(erc-log (concat "erc-display-message: " string