From c3a0486a19e442d84596ce6b595b111afcd9b9d1 Mon Sep 17 00:00:00 2001 From: Olivier Certner Date: Thu, 14 Jan 2021 18:20:26 +0100 Subject: [PATCH 2/4] ERC: Track: Clarify documentation on tracked buffers and add references * lisp/erc/erc-track.el (erc-modified-channels-alist): Clarify what the list contains. Add references to variables and functions involved in displaying tracked buffers from this list. * lisp/erc/erc-track.el (erc-make-mode-line-buffer-name): Describe exactly the algorithm, and reference custom variables that influence it. --- lisp/erc/erc-track.el | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el index e53f7fb22d..8b9f88ee2a 100644 --- a/lisp/erc/erc-track.el +++ b/lisp/erc/erc-track.el @@ -283,14 +283,19 @@ nil - don't add to mode line." Each element is a list with form (BUFFER COUNT . FACE) where BUFFER is a buffer object of the channel the entry corresponds to, COUNT is a number indicating how often activity was noticed, -and FACE is a face (or a list of faces) to use when displaying the -buffer's name. +and FACE is a face (or a list of faces, combined as usual) to use +when displaying the buffer's name in the mode line. -Entries in this list should only happen for buffers where activity occurred -while the buffer was not visible. +Entries in this list are only added/updated for buffers that were +not visible when activity occurred in them, and are removed for +each buffer as soon as it becomes visible again (or if the server +is disconnected, provided `erc-track-remove-disconnected-buffers' +is true). -See also `erc-track-faces-priority-list', -`erc-track-faces-normal-list' and `erc-track-showcount'.") +For how the face is chosen for a buffer, see +`erc-track-find-face' and `erc-track-priority-faces-only'. For +how buffers are then displayed in the mode line, see +`erc-modified-channels-display'.") (defcustom erc-track-showcount nil "If non-nil, count of unseen messages will be shown for each channel." @@ -652,8 +657,14 @@ ARGS are ignored." "The face to use when mouse is over channel names in the mode line.") (defun erc-make-mode-line-buffer-name (string buffer &optional faces count) - "Return STRING as a button that switches to BUFFER when clicked. -If FACES are provided, color STRING with them." + "Returns a button that switches to BUFFER when clicked. +STRING is the string in the button. It is possibly suffixed with +the number of unread messages, according to variables +`erc-track-showcount' and `erc-track-showcount-string'. + +If `erc-track-use-faces' is true and FACES are provided, format +STRING with them. When the mouse hovers above the button, STRING +is displayed according to `erc-track-mouse-face'." ;; We define a new sparse keymap every time, because 1. this data ;; structure is very small, the alternative would require us to ;; defvar a keymap, 2. the user is not interested in customizing it -- 2.30.0