1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-22 07:09:54 +00:00

Add rcirc-omit-unless-requested option

* doc/misc/rcirc.texi (Notices): Update documentation
* lisp/net/rcirc.el (rcirc-pending-requests): Add local variable
(rcirc-omit-unless-requested): Add user option
(rcirc-print): Respect rcirc-omit-unless-requested
(rcirc-define-command): Update rcirc-pending-requests
This commit is contained in:
Philip Kaludercic 2021-09-30 16:25:48 +02:00
parent b5e3cc3bc5
commit a1789fd67b
2 changed files with 36 additions and 3 deletions

View File

@ -823,6 +823,19 @@ active and only omits a message if the nick has not been active. The
window @code{rcirc} considers is controlled by the
@code{rcirc-omit-threshold} variable.
@vindex rcirc-omit-unless-requested
Certain messages can be omitted by default, unless the user manual
requests them. For example, if you don't want to display @code{TOPIC}
and @code{NAMES} messages, after reconnecting, you can configure
@code{rcirc-omit-unless-requested} to hide:
@example
(setq rcirc-omit-unless-requested '("TOPIC" "NAMES"))
@end example
Now NAMES will only be displayed, after it has been requested via the
@code{rcirc-cmd-name} command.
@node Hacking and Tweaking
@chapter Hacking and Tweaking
@cindex hacking and tweaking

View File

@ -190,6 +190,19 @@ If nil, no maximum is applied."
(defvar-local rcirc-low-priority-flag nil
"Non-nil means activity in this buffer is considered low priority.")
(defvar-local rcirc-pending-requests '()
"List of pending requests.
See `rcirc-omit-unless-requested'.")
(defcustom rcirc-omit-unless-requested '()
"List of commands to only be requested if preceded by a command.
For example, if \"TOPIC\" is added to this list, TOPIC commands
will only be displayed if `rcirc-cmd-TOPIC' was previously
invoked. Commands will only be hidden if `rcirc-omit-mode' is
enabled."
:version "28.1"
:type '(repeat string))
(defcustom rcirc-omit-responses
'("JOIN" "PART" "QUIT" "NICK")
"Responses which will be hidden when `rcirc-omit-mode' is enabled."
@ -1958,9 +1971,15 @@ connection."
;; make text omittable
(let ((last-activity-lines (rcirc-elapsed-lines process sender target)))
(if (and (not (string= (rcirc-nick process) sender))
(member response rcirc-omit-responses)
(or (not last-activity-lines)
(< rcirc-omit-threshold last-activity-lines)))
(or (member response rcirc-omit-responses)
(and (member response rcirc-omit-unless-requested)
(if (member response rcirc-pending-requests)
(ignore (setq rcirc-pending-requests
(delete response rcirc-pending-requests)))
t)))
(or (member response rcirc-omit-unless-requested)
(not last-activity-lines)
(< rcirc-omit-threshold last-activity-lines)))
(put-text-property (point-min) (point-max)
'invisible 'rcirc-omit)
;; otherwise increment the line count
@ -2569,6 +2588,7 @@ that, an interactive form can specified."
(<= ,required (length ,argument) ,total)
(string-match ,regexp ,argument))
(user-error "Malformed input (%s): %S" ',command ,argument))
(push ,(upcase (symbol-name command)) rcirc-pending-requests)
(let ((process (or process (rcirc-buffer-process)))
(target (or target rcirc-target)))
(ignore target process)