Fix loading follow.el

* lisp/follow.el (follow-mode-prefix-key): Avoid changing
follow-mode-map before it is defined.  (Bug#76977)
* test/lisp/follow-tests.el: New file.
This commit is contained in:
Stefan Kangas 2025-03-13 08:13:24 +01:00
parent ae33aad7f5
commit b51fb2e107
2 changed files with 35 additions and 2 deletions

View file

@ -234,8 +234,9 @@ After that, changing the prefix key requires manipulating keymaps."
:type 'string
:set (lambda (symbol value)
(defvar follow-mode-map) (defvar follow-mode-submap)
(keymap-unset follow-mode-map (symbol-value symbol))
(keymap-set follow-mode-map value follow-mode-submap)
(when (boundp 'follow-mode-map)
(keymap-unset follow-mode-map (symbol-value symbol))
(keymap-set follow-mode-map value follow-mode-submap))
(set-default symbol value))
:group 'follow
:version "31.1")

32
test/lisp/follow-tests.el Normal file
View file

@ -0,0 +1,32 @@
;;; follow-tests.el --- Tests for follow.el -*- lexical-binding: t; -*-
;; Copyright (C) 2025 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Code:
(require 'follow)
(ert-deftest follow-tests-do-nothing-test ()
;; Placeholder test to verify that loading `follow' succeeds.
;; Suppresses an ERT warning due to the absence of tests.
;;
;; Remove this test if real tests are added later.
)
(provide 'follow-tests)
;;; follow-tests.el ends here