1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-20 04:50:55 -07:00

Make ERC's error-notice formatting more consistent

* lisp/erc/erc-backend.el (erc--server-propagate-failed-connection):
Include leading three-asterisk notice prefix when reporting process
exit status, and set the `erc-msg' text property to `notice-error'.
(erc-schedule-reconnect): Include leading notice prefix when inserting
`reconnecting' message.
* lisp/erc/erc.el (erc-process-input-line, erc-cmd-PART,
erc-cmd-TOPIC): Display `no-target' messages as "error notices".
(erc-message-english-disconnected,
erc-message-english-disconnected-noreconnect): Hard-code standard
value of `erc-notice-prefix' into message text for consistency during
formatting and insertion.
* test/lisp/erc/erc-tests.el (erc--refresh-prompt): Expect notice
prefix before `no-target' message.  (Bug#67031)
This commit is contained in:
F. Jason Park 2023-11-08 19:14:55 -08:00
parent 5baa0f61f8
commit beb60a9027
3 changed files with 9 additions and 8 deletions

View file

@ -728,7 +728,7 @@ error data is something ERC recognizes. Print an explanation to
the server buffer in any case."
(when (eq (process-status process) 'failed)
(erc-display-message
nil 'error (process-buffer process)
nil '(notice error) (process-buffer process)
(format "Process exit status: %S" (process-exit-status process)))
(pcase (process-exit-status process)
(111
@ -995,7 +995,7 @@ When `erc-server-reconnect-attempts' is a number, increment
(- erc-server-reconnect-attempts
(cl-incf erc-server-reconnect-count (or incr 1)))))
(proc (buffer-local-value 'erc-server-process buffer)))
(erc-display-message nil 'error buffer 'reconnecting
(erc-display-message nil '(notice error) buffer 'reconnecting
?m erc-server-reconnect-timeout
?i (if count erc-server-reconnect-count "N")
?n (if count erc-server-reconnect-attempts "A"))

View file

@ -3729,7 +3729,7 @@ this function from interpreting the line as a command."
(let ((r (erc-default-target)))
(if r
(funcall erc-send-input-line-function r line force)
(erc-display-message nil 'error (current-buffer) 'no-target)
(erc-display-message nil '(notice error) (current-buffer) 'no-target)
nil)))))
(defconst erc--shell-parse-regexp
@ -4581,7 +4581,7 @@ Otherwise leave the channel indicated by LINE."
(format "PART %s" ch)
(format "PART %s :%s" ch reason))
nil ch))
(erc-display-message nil 'error (current-buffer) 'no-target)))
(erc-display-message nil '(notice error) (current-buffer) 'no-target)))
t)
(t nil)))
(put 'erc-cmd-PART 'do-not-parse-args t)
@ -4921,7 +4921,7 @@ be displayed."
(progn
(erc-log (format "cmd: TOPIC [%s]: %s" ch topic))
(erc-server-send (format "TOPIC %s :%s" ch topic) nil ch))
(erc-display-message nil 'error (current-buffer) 'no-target)))
(erc-display-message nil '(notice error) (current-buffer) 'no-target)))
t)
(t nil)))
(defalias 'erc-cmd-T #'erc-cmd-TOPIC)
@ -8194,9 +8194,10 @@ All windows are opened in the current frame."
(flood-ctcp-off . "FLOOD PROTECTION: Automatic CTCP responses turned off.")
(flood-strict-mode
. "FLOOD PROTECTION: Switched to Strict Flood Control mode.")
(disconnected . "\n\nConnection failed! Re-establishing connection...\n")
(disconnected
. "\n\n*** Connection failed! Re-establishing connection...\n")
(disconnected-noreconnect
. "\n\nConnection failed! Not re-establishing connection.\n")
. "\n\n*** Connection failed! Not re-establishing connection.\n")
(reconnecting . "Reconnecting in %ms: attempt %i/%n ...")
(reconnect-canceled . "Canceled %u reconnect timer with %cs to go...")
(finished . "\n\n*** ERC finished ***\n")

View file

@ -317,7 +317,7 @@
(insert "Howdy")
(erc-send-current-line)
(save-excursion (forward-line -1)
(should (looking-at "No target"))
(should (looking-at (rx "*** No target")))
(forward-line -1)
(should (looking-at "<tester> Howdy")))
(should (looking-back "ServNet 6> "))