@@ -211,21 +211,26 @@ when the major mode is an element of the cdr. See
211211(defun bind-map--lookup-major-modes (mode )
212212 " Return a list of implicated modes depending on the values of
213213`bind-map-use-remapped-modes' and `bind-map-use-aliased-modes' .
214- If both are nil, just return `mode' . If
215- `bind-map-use-remapped-modes' is non-nil, also return mode to
216- which it has been remapped in `major-mode-remap-alist' (if
217- applicable). If `bind-map-use-aliased-modes' is non-nil, also
214+ If both are nil, just return `mode' .
215+ If `bind-map-use-remapped-modes' is non-nil, also return mode
216+ to which it has been remapped in `major-mode-remap-alist'
217+ or `major-mode-remap-defaults' (if applicable).
218+ If `bind-map-use-aliased-modes' is non-nil, also
218219return any modes for which `mode' is an alias (if applicable).
219220Note: finding aliased modes relies on `function-alias-p' , which
220221is only available on Emacs 29.1+."
221222 (let ((r-mode
222- (or (and bind-map-use-remapped-modes
223- (boundp 'major-mode-remap-alist )
224- (alist-get mode major-mode-remap-alist))))
223+ (when bind-map-use-remapped-modes
224+ (cond ((fboundp 'major-mode-remap )
225+ ; ; bound in Emacs 30
226+ (major-mode-remap mode))
227+ ((boundp 'major-mode-remap-alist )
228+ ; ; bound in Emacs 29
229+ (alist-get mode major-mode-remap-alist)))))
225230 (a-modes (and bind-map-use-aliased-modes
226231 (fboundp 'function-alias-p )
227232 (function-alias-p mode))))
228- (delq nil (append (list mode r-mode) a-modes))))
233+ (delete-dups ( delq nil (append (list mode r-mode) a-modes) ))))
229234
230235(defun bind-map-add-to-major-mode-list (activate-var major-mode-list )
231236 " Add (ACTIVATE-VAR . MAJOR-MODE-LIST) to
0 commit comments