>From 52664b3d71a7bb3d6c57165300c9271d6079daaf Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Wed, 8 Nov 2023 21:20:54 -0800 Subject: [PATCH 4/5] [5.6] Slightly simplify text props on echoed ERC input * lisp/erc/erc.el (erc--msg-props): Reformat doc to improve readability. (erc-send-current-line): Don't bind `erc--msg-prop-overrides' because it affects all calls to `erc-display-message' made by slash commands, etc. (erc-display-msg): Set `erc-msg' property to `msg' instead of `self' because the only legitimate use of this function is for inserting "echoed" prompt input. (Bug#60936) --- lisp/erc/erc.el | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 4828319727e..be8e2d19b7f 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -155,31 +155,28 @@ erc--msg-props as of ERC 5.6: - `erc-msg': a symbol, guaranteed present; values include: - - - `msg', signifying a `PRIVMSG' or an incoming `NOTICE' - - `self', a fallback used by `erc-display-msg' for callers - that don't specify an `erc-msg' - - `unknown', a similar fallback for `erc-display-message' - - a catalog key, such as `s401' or `finished' - - an `erc-display-message' TYPE parameter, like `notice' + `msg', signifying a `PRIVMSG' or an incoming `NOTICE'; + `unknown', a fallback for `erc-display-message'; a catalog + key, such as `s401' or `finished'; an `erc-display-message' + TYPE parameter, like `notice' - `erc-cmd': a message's associated IRC command, as read by `erc--get-eq-comparable-cmd'; currently either a symbol, like `PRIVMSG', or a number, like 5, which represents the numeric - \"005\"; absent on \"local\" messages, such as simple warnings - and help text, and on outgoing messages unless echoed back by - the server (assuming future support) + \"005\"; absent on \"local\" messages, such as simple warnings + and help text, and on outgoing messages unless echoed back by + the server (assuming future support) - `erc-ctcp': a CTCP command, like `ACTION' - `erc-ts': a timestamp, possibly provided by the server; as of - 5.6, a ticks/hertz pair on Emacs 29 and above, and a \"list\" - type otherwise; managed by the `stamp' module + 5.6, a ticks/hertz pair on Emacs 29 and above, and a \"list\" + type otherwise; managed by the `stamp' module - `erc-ephemeral': a symbol prefixed by or matching a module - name; indicates to other modules and members of modification - hooks that the current message should not affect stateful - operations, such as recording a channel's most recent speaker + name; indicates to other modules and members of modification + hooks that the current message should not affect stateful + operations, such as recording a channel's most recent speaker This is an internal API, and the selection of related helper utilities is fluid and provisional. As of ERC 5.6, see the @@ -6933,8 +6930,7 @@ erc-send-current-line (inhibit-read-only t) (erc--current-line-input-split state) (old-buf (current-buffer))) - (let ((erc--msg-prop-overrides `((erc-msg . msg) - ,@erc--msg-prop-overrides))) + (progn ; unprogn this during next major surgery (erc-set-active-buffer (current-buffer)) ;; Kill the input and the prompt (delete-region erc-input-marker (erc-end-of-input-line)) @@ -7079,16 +7075,15 @@ erc-send-input (defun erc-display-msg (line) "Insert LINE into current buffer and run \"send\" hooks. -Expect LINE to originate from input submitted interactively at -the prompt, such as outgoing chat messages or echoed slash -commands." +Treat LINE as input submitted interactively at the prompt, such +as outgoing chat messages and echoed slash commands." (when erc-insert-this (save-excursion (erc--assert-input-bounds) (let ((insert-position (marker-position (goto-char erc-insert-marker))) - (erc--msg-props (or erc--msg-props ; prefer `self' to `unknown' + (erc--msg-props (or erc--msg-props (let ((ovs erc--msg-prop-overrides)) - (map-into `((erc-msg . self) ,@(reverse ovs)) + (map-into `((erc-msg . msg) ,@(reverse ovs)) 'hash-table)))) beg) (insert (erc-format-my-nick)) -- 2.41.0