]> git.eshelyaron.com Git - emacs.git/commitdiff
Add rcirc-omit-unless-requested option
authorPhilip Kaludercic <philipk@posteo.net>
Thu, 30 Sep 2021 14:25:48 +0000 (16:25 +0200)
committerPhilip Kaludercic <philipk@posteo.net>
Thu, 30 Sep 2021 14:25:48 +0000 (16:25 +0200)
* 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

doc/misc/rcirc.texi
lisp/net/rcirc.el

index 20971293ed13a747a66effa83ed8e9ee5e42e6ed..a4ca54a8b01e27ff065ef4e8838722ffd4a473ef 100644 (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
index ba7fbbf6b7d12c6effc5479362645b506b53a297..c18748ae0999b7ca812c04b41ea12da19da5e409 100644 (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)