]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't move point on undefined keystrokes in the article buffer
authorLars Ingebrigtsen <larsi@gnus.org>
Sat, 16 Nov 2019 05:11:56 +0000 (06:11 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 16 Nov 2019 05:11:56 +0000 (06:11 +0100)
* lisp/gnus/gnus-art.el (gnus-article-read-summary-keys): Don't
move point on undefined commands (bug#38227).

lisp/gnus/gnus-art.el

index 99f23713636ef8a25cf1719591c3d8aea2170f51..cfb185b3d1c3b267f5c1fc9ba99c5e7637686231 100644 (file)
@@ -6678,43 +6678,41 @@ not have a face in `gnus-article-boring-faces'."
           "An" "Ap" [?A (meta return)] [?A delete]))
        (nosave-in-article
         '("AS" "\C-d"))
-       keys new-sum-point)
+       keys new-sum-point gnus-pick-mode func)
     (with-current-buffer gnus-article-current-summary
-      (let (gnus-pick-mode)
-       (setq unread-command-events (nconc unread-command-events
-                                          (list (or key last-command-event)))
-             keys (read-key-sequence nil t))))
+      (setq unread-command-events (nconc unread-command-events
+                                        (list (or key last-command-event)))
+           keys (read-key-sequence nil t)
+           func (key-binding keys t)))
 
     (message "")
 
+    (when (eq func 'undefined)
+      (error "%s is undefined" keys))
+
     (cond
      ((eq (aref keys (1- (length keys))) ?\C-h)
       (gnus-article-describe-bindings (substring keys 0 -1)))
      ((or (member keys nosaves)
          (member keys nosave-but-article)
          (member keys nosave-in-article))
-      (let (func)
-       (with-current-buffer gnus-article-current-summary
-         ;; We disable the pick minor mode commands.
-         (let (gnus-pick-mode)
-           (setq func (key-binding keys t))))
-       (if (or (not func)
-               (numberp func))
-           (ding)
-         (unless (member keys nosave-in-article)
-           (set-buffer gnus-article-current-summary))
-         (when (and (symbolp func)
-                    (get func 'disabled))
-           (error "Function %s disabled" func))
-         (call-interactively func)
-         (setq new-sum-point (point)))
-       (when (member keys nosave-but-article)
-         (pop-to-buffer gnus-article-buffer))))
+      (if (or (not func)
+             (numberp func))
+         (ding)
+       (unless (member keys nosave-in-article)
+         (set-buffer gnus-article-current-summary))
+       (when (and (symbolp func)
+                  (get func 'disabled))
+         (error "Function %s disabled" func))
+       (call-interactively func)
+       (setq new-sum-point (point)))
+      (when (member keys nosave-but-article)
+       (pop-to-buffer gnus-article-buffer)))
      (t
       ;; These commands should restore window configuration.
       (let ((obuf (current-buffer))
            (owin (current-window-configuration))
-           win func in-buffer selected new-sum-start new-sum-hscroll err)
+           win in-buffer selected new-sum-start new-sum-hscroll err)
        (cond (not-restore-window
               (pop-to-buffer gnus-article-current-summary)
               (setq win (selected-window)))
@@ -6733,9 +6731,6 @@ not have a face in `gnus-article-boring-faces'."
                 (select-frame-set-input-focus (window-frame win))
                 (select-window win))))
        (setq in-buffer (current-buffer))
-       ;; We disable the pick minor mode commands.
-       (setq func (let (gnus-pick-mode)
-                    (key-binding keys t)))
        (when (and (symbolp func)
                   (get func 'disabled))
          (error "Function %s disabled" func))