emacs-diffs
[Top][All Lists]
Advanced

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

master 2534a4737f7 6/7: Fix regression in erc-button-add-button


From: F. Jason Park
Subject: master 2534a4737f7 6/7: Fix regression in erc-button-add-button
Date: Sun, 31 Dec 2023 10:07:49 -0500 (EST)

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

    Fix regression in erc-button-add-button
    
    * lisp/erc/erc-button.el (erc-button--nick): Abide by recommended
    internal naming convention and use "cusr" instead of "cuser" for
    referring to an `erc-channel-user' object.
    (erc-button--fallback-cmem-function,
    erc-button--get-user-from-spkr-prop): Use new, preferred name
    `erc-channel-members' for `erc-channel-users' table.
    (erc-button-add-nickname-buttons): Use "cmem" instead of "cuser" to
    refer to values of the `erc-channel-members' table, which are cons
    cells, not `erc-channel-user' objects.  Use updated slot name `cusr'
    when initializing `erc-button--nick' object.
    (erc-button-add-button): Honor wishes of
    `erc-button--modify-nick-function' advice members when they set the
    `nickname-face' slot of the passed-around `erc-button--nick' object to
    nil to indicate a desire to forgo adding a face while still
    buttonizing the inserted nick with `erc-data', etc.  (Bug#67767)
---
 lisp/erc/erc-button.el | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el
index 3d7cfee907a..d3bfc32992b 100644
--- a/lisp/erc/erc-button.el
+++ b/lisp/erc/erc-button.el
@@ -366,8 +366,8 @@ specified by `erc-button-alist'."
   ( user nil :type (or null erc-server-user)
     ;; Not necessarily present in `erc-server-users'.
     :documentation "A possibly nil or spoofed `erc-server-user'.")
-  ( cuser nil :type (or null erc-channel-user)
-    ;; The CDR of a value from an `erc-channel-users' table.
+  ( cusr nil :type (or null erc-channel-user)
+    ;; The CDR of a value from an `erc-channel-members' table.
     :documentation "A possibly nil `erc-channel-user'.")
   ( nickname-face erc-button-nickname-face :type symbol
     :documentation "Temp `erc-button-nickname-face' while buttonizing.")
@@ -397,7 +397,7 @@ be updated at will.")
   "Function to determine channel member if not found in the usual places.
 Called with DOWNCASED-NICK, NICK, NICK-BOUNDS, and COUNT when
 `erc-button-add-nickname-buttons' cannot find a user object for
-DOWNCASED-NICK in `erc-channel-users' or `erc-server-users'.
+DOWNCASED-NICK in `erc-channel-members' or `erc-server-users'.
 NICK-BOUNDS is a cons of buffer positions, and COUNT is a number
 incremented with each visit, starting at 1.")
 
@@ -407,7 +407,7 @@ But only do so when COUNT is 1, meaning this is the first 
button
 candidate in the just-inserted message."
   (and-let* (((= 1 count))
              (nick (erc--check-msg-prop 'erc--spkr)))
-    (gethash nick erc-channel-users)))
+    (gethash nick erc-channel-members)))
 
 ;; Historical or fictitious users.  As long as these two structs
 ;; remain superficial "subclasses" with the same slots and defaults,
@@ -481,11 +481,11 @@ retrieve it during buttonizing via
          (word (buffer-substring-no-properties (car bounds) (cdr bounds)))
          (down (erc-downcase word)))
       (let* ((nick-obj t)
-             (cuser (and erc-channel-users
-                         (or (gethash down erc-channel-users)
-                             (funcall erc-button--fallback-cmem-function
-                                      down word bounds seen))))
-             (user (or (and cuser (car cuser))
+             (cmem (and erc-channel-members
+                        (or (gethash down erc-channel-members)
+                            (funcall erc-button--fallback-cmem-function
+                                     down word bounds seen))))
+             (user (or (and cmem (car cmem))
                        (and erc-server-users (gethash down erc-server-users))))
              (data (list word)))
         (when (or (not (functionp form))
@@ -493,7 +493,7 @@ retrieve it during buttonizing via
                        (setq nick-obj (funcall form (make-erc-button--nick
                                                      :bounds bounds :data data
                                                      :downcased down :user user
-                                                     :cuser (cdr cuser)))
+                                                     :cusr (cdr cmem)))
                              data (erc-button--nick-data nick-obj)
                              bounds (erc-button--nick-bounds nick-obj))))
           (erc-button-add-button (car bounds) (cdr bounds) (nth 3 entry)
@@ -557,9 +557,9 @@ REGEXP is the regular expression which matched for this 
button."
   (if nick-p
       (when erc-button-nickname-face
         (erc--merge-prop from to 'font-lock-face
-                         (or (and (erc-button--nick-p nick-p)
-                                  (erc-button--nick-nickname-face nick-p))
-                             erc-button-nickname-face)
+                         (if (erc-button--nick-p nick-p)
+                             (erc-button--nick-nickname-face nick-p)
+                           erc-button-nickname-face)
                          nil (and (erc-button--nick-p nick-p)
                                   (erc-button--nick-face-cache nick-p))))
     (when erc-button-face



reply via email to

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