Skip to content

Commit aaba533

Browse files
committed
Fix: (ement-room) browse-url-handlers in Emacs < 28.1
Thanks to @gearoid1:matrix.org for reporting.
1 parent fd46ea2 commit aaba533

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

ement-room.el

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ In that case, sender names are aligned to the margin edge.")
195195
(defvar ement-images-queue)
196196
(defvar ement-notify-limit-room-name-width)
197197

198+
;; Defined in Emacs 28.1: silence byte-compilation warning in earlier versions.
199+
(defvar browse-url-handlers)
200+
198201
;;;; Customization
199202

200203
(defgroup ement-room nil
@@ -1922,8 +1925,11 @@ and erases the buffer."
19221925
imenu-create-index-function #'ement-room--imenu-create-index-function
19231926
;; TODO: Use EWOC header/footer for, e.g. typing messages.
19241927
ement-ewoc (ewoc-create #'ement-room--pp-thing))
1925-
(setq-local browse-url-handlers (cons (cons ement-room-matrix.to-url-regexp #'ement-room-browse-url)
1926-
browse-url-handlers))
1928+
(when (boundp 'browse-url-handlers)
1929+
;; NOTE: This variable was added in Emacs 28.1. In earlier versions, these links
1930+
;; won't work within Ement.
1931+
(setq-local browse-url-handlers (cons (cons ement-room-matrix.to-url-regexp #'ement-room-browse-url)
1932+
browse-url-handlers)))
19271933
(setq-local completion-at-point-functions
19281934
'(ement-room--complete-members-at-point ement-room--complete-rooms-at-point))
19291935
(setq-local window-scroll-functions

0 commit comments

Comments
 (0)