From: F. Jason Park Date: Thu, 28 Dec 2023 05:13:45 +0000 (-0800) Subject: Don't discard trimmed args in erc-cmd-MODE X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9b7dc396f317b317af9b98ee5438a49d29be7946;p=emacs.git 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. (cherry picked from commit 2560d81351c72002e1014c70af0488bbb2558b34) --- 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)