diff options
| author | F. Jason Park | 2023-09-11 21:21:42 -0700 |
|---|---|---|
| committer | F. Jason Park | 2023-12-17 20:17:55 -0800 |
| commit | c1befaf0a8b19fdd3b22e824f4bfc10f8882db67 (patch) | |
| tree | 7cb4482bb67c65f67d24074d1cf2677836893731 | |
| parent | 7db500b50be5f59ce65785a2cc35a8587e7e6cd1 (diff) | |
| download | emacs-c1befaf0a8b19fdd3b22e824f4bfc10f8882db67.tar.gz emacs-c1befaf0a8b19fdd3b22e824f4bfc10f8882db67.zip | |
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)
| -rw-r--r-- | lisp/erc/erc-backend.el | 7 | ||||
| -rw-r--r-- | lisp/erc/erc-common.el | 5 | ||||
| -rw-r--r-- | 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." | |||
| 1913 | (tgt (car (erc-response.command-args parsed))) | 1913 | (tgt (car (erc-response.command-args parsed))) |
| 1914 | (msg (erc-response.contents parsed))) | 1914 | (msg (erc-response.contents parsed))) |
| 1915 | (defvar erc-minibuffer-ignored) | 1915 | (defvar erc-minibuffer-ignored) |
| 1916 | (if (or (erc-ignored-user-p sender-spec) | 1916 | (defvar erc-ignore-list) |
| 1917 | (erc-ignored-reply-p msg tgt proc)) | 1917 | (defvar erc-ignore-reply-list) |
| 1918 | (if (or (and erc-ignore-list (erc-ignored-user-p sender-spec)) | ||
| 1919 | (and erc-ignore-reply-list (erc-ignored-reply-p msg tgt proc))) | ||
| 1918 | (when erc-minibuffer-ignored | 1920 | (when erc-minibuffer-ignored |
| 1919 | (message "Ignored %s from %s to %s" cmd sender-spec tgt)) | 1921 | (message "Ignored %s from %s to %s" cmd sender-spec tgt)) |
| 1920 | (let* ((sndr (erc-parse-user sender-spec)) | 1922 | (let* ((sndr (erc-parse-user sender-spec)) |
| @@ -1929,7 +1931,6 @@ add things to `%s' instead." | |||
| 1929 | ,@erc--display-context)) | 1931 | ,@erc--display-context)) |
| 1930 | s buffer | 1932 | s buffer |
| 1931 | fnick) | 1933 | fnick) |
| 1932 | (setf (erc-response.contents parsed) msg) | ||
| 1933 | (setq buffer (erc-get-buffer (if privp nick tgt) proc)) | 1934 | (setq buffer (erc-get-buffer (if privp nick tgt) proc)) |
| 1934 | ;; Even worth checking for empty target here? (invalid anyway) | 1935 | ;; Even worth checking for empty target here? (invalid anyway) |
| 1935 | (unless (or buffer noticep (string-empty-p tgt) (eq ?$ (aref tgt 0)) | 1936 | (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." | |||
| 498 | (define-inline erc-get-server-user (nick) | 498 | (define-inline erc-get-server-user (nick) |
| 499 | "Find NICK in the current server's `erc-server-users' hash table." | 499 | "Find NICK in the current server's `erc-server-users' hash table." |
| 500 | (inline-letevals (nick) | 500 | (inline-letevals (nick) |
| 501 | (inline-quote (erc-with-server-buffer | 501 | (inline-quote |
| 502 | (gethash (erc-downcase ,nick) erc-server-users))))) | 502 | (gethash (erc-downcase ,nick) |
| 503 | (erc-with-server-buffer erc-server-users))))) | ||
| 503 | 504 | ||
| 504 | (defmacro erc--with-dependent-type-match (type &rest features) | 505 | (defmacro erc--with-dependent-type-match (type &rest features) |
| 505 | "Massage Custom :type TYPE with :match function that pre-loads FEATURES." | 506 | "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." | |||
| 7718 | (setq erc-default-recipients d2) | 7718 | (setq erc-default-recipients d2) |
| 7719 | (error "Current target is not a QUERY")))) | 7719 | (error "Current target is not a QUERY")))) |
| 7720 | 7720 | ||
| 7721 | ;; FIXME move all ignore-related functionality to its own module, | ||
| 7722 | ;; required and enabled by default (until some major version change). | ||
| 7721 | (defun erc-ignored-user-p (spec) | 7723 | (defun erc-ignored-user-p (spec) |
| 7722 | "Return non-nil if SPEC matches something in `erc-ignore-list'. | 7724 | "Return non-nil if SPEC matches something in `erc-ignore-list'. |
| 7723 | 7725 | ||