mirror of
https://github.com/vale981/ement.el
synced 2025-03-05 09:21:37 -05:00
Change: (formatter ?S) Abbreviate long displaynames
This commit is contained in:
parent
b98843a82d
commit
5e4fe25b71
1 changed files with 13 additions and 8 deletions
|
@ -749,14 +749,19 @@ BODY is wrapped in a lambda form that binds `event', `room', and
|
||||||
(ement-room-define-event-formatter ?S
|
(ement-room-define-event-formatter ?S
|
||||||
"Sender display name."
|
"Sender display name."
|
||||||
(ignore session)
|
(ignore session)
|
||||||
(let ((sender (ement-room--format-user (ement-event-sender event) room)))
|
(pcase-let ((sender (ement-room--format-user (ement-event-sender event) room))
|
||||||
(when (and (not ement-room-sender-in-headers)
|
((cl-struct ement-room (local (map buffer))) room))
|
||||||
(< (string-width sender) ement-room-left-margin-width))
|
(with-current-buffer buffer
|
||||||
;; Using :align-to or :width space display properties doesn't
|
(setf sender
|
||||||
;; seem to have any effect in the margin, so we make a string.
|
(if (and (not ement-room-sender-in-headers)
|
||||||
(setf sender (concat (make-string (- ement-room-left-margin-width (string-width sender))
|
(< (string-width sender) ement-room-left-margin-width))
|
||||||
? )
|
;; Using :align-to or :width space display properties doesn't
|
||||||
sender)))
|
;; seem to have any effect in the margin, so we make a string.
|
||||||
|
(concat (make-string (- ement-room-left-margin-width (string-width sender))
|
||||||
|
? )
|
||||||
|
sender)
|
||||||
|
;; String wider than margin: truncate it.
|
||||||
|
(truncate-string-to-width sender ement-room-left-margin-width nil nil "…"))))
|
||||||
;; NOTE: I'd like to add a help-echo function to display the sender ID, but the Emacs
|
;; NOTE: I'd like to add a help-echo function to display the sender ID, but the Emacs
|
||||||
;; manual says that there is currently no way to make text in the margins mouse-sensitive.
|
;; manual says that there is currently no way to make text in the margins mouse-sensitive.
|
||||||
;; So `ement-room--format-user' returns a string propertized with `help-echo' as a string.
|
;; So `ement-room--format-user' returns a string propertized with `help-echo' as a string.
|
||||||
|
|
Loading…
Add table
Reference in a new issue