emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 2560d81351c 4/7: Don't discard trimmed args in erc-cmd-MODE


From: F. Jason Park
Subject: master 2560d81351c 4/7: Don't discard trimmed args in erc-cmd-MODE
Date: Sun, 31 Dec 2023 10:07:49 -0500 (EST)

branch: master
commit 2560d81351c72002e1014c70af0488bbb2558b34
Author: F. Jason Park <jp@neverwas.me>
Commit: F. Jason Park <jp@neverwas.me>

    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.
---
 lisp/erc/erc.el | 12 ++++++++----
 1 file 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]