summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorF. Jason Park <jp@neverwas.me>2023-12-27 21:13:45 -0800
committerF. Jason Park <jp@neverwas.me>2023-12-31 06:56:32 -0800
commit2560d81351c72002e1014c70af0488bbb2558b34 (patch)
treec8ff9c241f44c4cc91d08994cefdc385e786232b
parentd5f6e911a99157d79bc900a1a8719298575dad74 (diff)
downloademacs-2560d81351c72002e1014c70af0488bbb2558b34.tar.gz
Don't discard trimmed args in erc-cmd-MODE
* lisp/erc/erc.el (erc-cmd-MODE): Use matched non-whitespace portion of input line instead of the original line. Otherwise, when the user types "/MODE #chan", the server sees "MODE #chan", with twos spaces. (erc--parse-nuh): Improve doc.
-rw-r--r--lisp/erc/erc.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index f80c8cbf295..6a64cf0f5bb 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -4822,7 +4822,7 @@ A list of valid mode strings for Libera.Chat may be found at
((string-match "^\\s-\\(.*\\)$" line)
(let ((s (match-string 1 line)))
(erc-log (format "cmd: MODE: %s" s))
- (erc-server-send (concat "MODE " line)))
+ (erc-server-send (concat "MODE " s)))
t)
(t nil)))
(put 'erc-cmd-MODE 'do-not-parse-args t)
@@ -7487,9 +7487,13 @@ Return a list of the three separate tokens."
(defun erc--parse-nuh (string)
"Match STRING against `erc--parse-user-regexp-pedantic'.
-Return matching groups or nil. Interpret a lone token or one
-with only a leading \"!\" as a host. See associated unit test
-for precise behavior."
+Return nil or matching groups representing nick, login, and host,
+any of which may be nil. Expect STRING not to contain leading
+prefix chars. Return an empty nick component to indicate further
+processing is required based on context. Interpret a lone token
+lacking delimiters or one with only a leading \"!\" as a host.
+
+See associated unit test for precise behavior."
(when (string-match erc--parse-user-regexp-pedantic string)
(list (match-string 1 string)
(match-string 2 string)