Skip to content

Commit 65e6f12

Browse files
committed
Use replace-regexp-in-string
... for compatibility with Emacs versions prior to Emacs 27.
1 parent 6f32c57 commit 65e6f12

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

god-mode.el

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,12 @@ returns a keymap to allow further key input, or nil if completely unbound."
358358
((string-match "\\(.*\\) C-\\(.\\)$" key-string)
359359
(let* ((prefix (match-string 1 key-string))
360360
(last (match-string 2 key-string))
361-
(fallback-key (string-trim-right (format "%s %s" prefix last)))
361+
(key-str (format "%s %s" prefix last))
362+
(fallback-key (if (>= emacs-major-version 27)
363+
(string-trim-right key-str)
364+
(replace-regexp-in-string
365+
"[ \t\n\r]+$" "" ;; Remove trailing whitespace
366+
key-str)))
362367
(fallback-vector (read-kbd-macro fallback-key t))
363368
(fallback-binding (key-binding fallback-vector)))
364369
(cond

0 commit comments

Comments
 (0)