mirror of
https://github.com/vale981/ement.el
synced 2025-03-05 09:21:37 -05:00
Tidy: (ement-room--format-message)
Also improve error message.
This commit is contained in:
parent
4b7d925bab
commit
5e66aa244d
1 changed files with 4 additions and 4 deletions
|
@ -3071,11 +3071,11 @@ Format defaults to `ement-room-message-format-spec', which see."
|
|||
(goto-char (point-min))
|
||||
(while (search-forward "%" nil t)
|
||||
(cond
|
||||
;; Quoted percent sign.
|
||||
((eq (char-after) ?%)
|
||||
;; Quoted percent sign.
|
||||
(delete-char 1))
|
||||
;; Valid format spec.
|
||||
((looking-at "\\([-0-9.]*\\)\\([a-zA-Z]\\)")
|
||||
;; Valid format spec.
|
||||
(let* ((num (match-string 1))
|
||||
(spec (string-to-char (match-string 2)))
|
||||
(formatter (or (alist-get spec ement-room-event-formatters)
|
||||
|
@ -3102,9 +3102,9 @@ Format defaults to `ement-room-message-format-spec', which see."
|
|||
;; Leaving the old code commented in case there's a better solution.)
|
||||
(delete-region (1- (match-beginning 0)) (match-end 0))
|
||||
(insert text))))
|
||||
;; Signal an error on bogus format strings.
|
||||
(t
|
||||
(error "Invalid format string"))))
|
||||
;; Signal an error on bogus format strings.
|
||||
(error "ement-room--format-message: Invalid format string: %S" format))))
|
||||
;; Propertize margin text.
|
||||
(when ement-room--format-message-wrap-prefix
|
||||
(when-let ((wrap-prefix-end (next-single-property-change (point-min) 'wrap-prefix-end)))
|
||||
|
|
Loading…
Add table
Reference in a new issue