1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 10:31:37 -08:00

Don't move point on undefined keystrokes in the article buffer

* lisp/gnus/gnus-art.el (gnus-article-read-summary-keys): Don't
move point on undefined commands (bug#38227).
This commit is contained in:
Lars Ingebrigtsen 2019-11-16 06:11:56 +01:00
parent 461101d67c
commit 246f050ab4

View file

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