emacs-diffs
[Top][All Lists]
Advanced

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

master c1befaf0a8b 10/19: Skip erc-ignored-user-p when erc-ignore-list i


From: F. Jason Park
Subject: master c1befaf0a8b 10/19: Skip erc-ignored-user-p when erc-ignore-list is empty
Date: Sun, 17 Dec 2023 23:21:39 -0500 (EST)

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

    Skip erc-ignored-user-p when erc-ignore-list is empty
    
    * lisp/erc/erc-backend.el (erc-server-PRIVMSG): Don't bother running
    `erc-ignored-user-p' and `erc-ignored-reply-p' when their associated
    options are null.  The option `erc-ignore-list' is buffer-local when
    set, and `erc-ignored-user-p' looks for it in the server buffer.
    Moreover, all functions that set it, like `erc-cmd-IGNORE' and
    `erc-cmd-UNIGNORE', do so in the server buffer.  And the response
    handler in question only runs in server buffers, so this shouldn't
    break anything.  Also, remove stray call to reassign trailing response
    contents.
    * lisp/erc/erc-common.el (erc-get-server-user): Rearrange so
    `erc-with-server-buffer' doesn't have to switch to the server buffer
    because `erc-downcase' can run in channels as well.
    * lisp/erc/erc.el (erc-ignored-user-p): Add comment.  (Bug#67677)
---
 lisp/erc/erc-backend.el | 7 ++++---
 lisp/erc/erc-common.el  | 5 +++--
 lisp/erc/erc.el         | 2 ++
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 6483192692b..1c29f49a129 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -1913,8 +1913,10 @@ add things to `%s' instead."
         (tgt (car (erc-response.command-args parsed)))
         (msg (erc-response.contents parsed)))
     (defvar erc-minibuffer-ignored)
-    (if (or (erc-ignored-user-p sender-spec)
-            (erc-ignored-reply-p msg tgt proc))
+    (defvar erc-ignore-list)
+    (defvar erc-ignore-reply-list)
+    (if (or (and erc-ignore-list (erc-ignored-user-p sender-spec))
+            (and erc-ignore-reply-list (erc-ignored-reply-p msg tgt proc)))
         (when erc-minibuffer-ignored
           (message "Ignored %s from %s to %s" cmd sender-spec tgt))
       (let* ((sndr (erc-parse-user sender-spec))
@@ -1929,7 +1931,6 @@ add things to `%s' instead."
                                      ,@erc--display-context))
              s buffer
              fnick)
-        (setf (erc-response.contents parsed) msg)
         (setq buffer (erc-get-buffer (if privp nick tgt) proc))
         ;; Even worth checking for empty target here? (invalid anyway)
         (unless (or buffer noticep (string-empty-p tgt) (eq ?$ (aref tgt 0))
diff --git a/lisp/erc/erc-common.el b/lisp/erc/erc-common.el
index ce0831709c7..90112ab9126 100644
--- a/lisp/erc/erc-common.el
+++ b/lisp/erc/erc-common.el
@@ -498,8 +498,9 @@ Use the CASEMAPPING ISUPPORT parameter to determine the 
style."
 (define-inline erc-get-server-user (nick)
   "Find NICK in the current server's `erc-server-users' hash table."
   (inline-letevals (nick)
-    (inline-quote (erc-with-server-buffer
-                    (gethash (erc-downcase ,nick) erc-server-users)))))
+    (inline-quote
+     (gethash (erc-downcase ,nick)
+              (erc-with-server-buffer erc-server-users)))))
 
 (defmacro erc--with-dependent-type-match (type &rest features)
   "Massage Custom :type TYPE with :match function that pre-loads FEATURES."
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 2e078651a52..dad7ebab621 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -7718,6 +7718,8 @@ The previous default target of QUERY type gets removed."
         (setq erc-default-recipients d2)
       (error "Current target is not a QUERY"))))
 
+;; FIXME move all ignore-related functionality to its own module,
+;; required and enabled by default (until some major version change).
 (defun erc-ignored-user-p (spec)
   "Return non-nil if SPEC matches something in `erc-ignore-list'.
 



reply via email to

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