goes for ERC's imenu integration, which has 'imenu' now appearing in
the default value of 'erc-modules'.
+*** Function 'erc-get-user-mode-prefix' renamed.
+This utility has been renamed to 'erc-get-channel-membership-prefix'
+to better reflect its role of delivering a formatted "status prefix",
+like "+" (for "voice"), and to avoid confusion with user modes, like
+"+i" (for "invisible"). Additionally, its lone parameter is now
+overloaded to accept an 'erc-channel-user' object as well as a string.
+
*** Hidden messages contain a preceding rather than trailing newline.
ERC has traditionally only offered to hide messages involving fools,
but plans are to make hiding more powerful. Anyone depending on the
(info (erc-server-user-info user))
(login (erc-server-user-login user))
(name (erc-server-user-full-name user))
- (voice (and cuser (erc-channel-user-voice cuser)))
- (op (and cuser (erc-channel-user-op cuser)))
- (nick-str (concat (if op "@" "") (if voice "+" "") nick))
+ (nick-str (concat (erc-get-channel-membership-prefix cuser) nick))
(finger (concat login (when (or login host) "@") host))
(sbtoken (list finger name info (buffer-name buffer))))
(if (or login host name info) ; we want to be expandable
See also `erc-format-nick-function'."
(when user (erc-server-user-nickname user)))
-(defun erc-get-user-mode-prefix (user)
+(define-obsolete-function-alias 'erc-get-user-mode-prefix
+ #'erc-get-channel-membership-prefix "30.1")
+(defun erc-get-channel-membership-prefix (user)
+ "Return channel membership prefix for USER as a string.
+Ensure returned string has a `help-echo' text property with the
+corresponding verbose membership type, like \"voice\", as its
+value. Expect USER to be an `erc-channel-user' object or a
+string nickname, not necessarily downcased."
(when user
- (cond ((erc-channel-user-owner-p user)
+ (when (stringp user)
+ (setq user (and erc-channel-users (cdr (erc-get-channel-user user)))))
+ (cond ((null user) "")
+ ((erc-channel-user-owner user)
(propertize "~" 'help-echo "owner"))
- ((erc-channel-user-admin-p user)
+ ((erc-channel-user-admin user)
(propertize "&" 'help-echo "admin"))
- ((erc-channel-user-op-p user)
+ ((erc-channel-user-op user)
(propertize "@" 'help-echo "operator"))
- ((erc-channel-user-halfop-p user)
+ ((erc-channel-user-halfop user)
(propertize "%" 'help-echo "half-op"))
- ((erc-channel-user-voice-p user)
+ ((erc-channel-user-voice user)
(propertize "+" 'help-echo "voice"))
(t ""))))
-(defun erc-format-@nick (&optional user _channel-data)
+(defun erc-format-@nick (&optional user channel-data)
"Format the nickname of USER showing if USER has a voice, is an
operator, half-op, admin or owner. Owners have \"~\", admins have
\"&\", operators have \"@\" and users with voice have \"+\" as a
(when user
(let ((nick (erc-server-user-nickname user)))
(concat (propertize
- (erc-get-user-mode-prefix nick)
+ (erc-get-channel-membership-prefix channel-data)
'font-lock-face 'erc-nick-prefix-face)
nick))))
(let* ((open "<")
(close "> ")
(nick (erc-current-nick))
- (mode (erc-get-user-mode-prefix nick)))
+ (mode (erc-get-channel-membership-prefix nick)))
(concat
(propertize open 'font-lock-face 'erc-default-face)
(propertize mode 'font-lock-face 'erc-my-nick-prefix-face)
(defun erc--format-channel-status-prefix ()
"Return the current channel membership prefix."
(and (erc--target-channel-p erc--target)
- (erc-get-user-mode-prefix (erc-current-nick))))
+ (erc-get-channel-membership-prefix (erc-current-nick))))
(defun erc--format-modes (&optional no-query-p)
"Return a string of channel modes in channels and user modes elsewhere.