]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't discard trimmed args in erc-cmd-MODE
authorF. Jason Park <jp@neverwas.me>
Thu, 28 Dec 2023 05:13:45 +0000 (21:13 -0800)
committerEshel Yaron <me@eshelyaron.com>
Tue, 2 Jan 2024 07:58:06 +0000 (08:58 +0100)
* 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.

(cherry picked from commit 2560d81351c72002e1014c70af0488bbb2558b34)

lisp/erc/erc.el

index f80c8cbf2955ccca91abb003f668035100e1519c..6a64cf0f5bb2af3df8a649178a73aa9ea72a18e5 100644 (file)
@@ -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)