emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suppressing beginning/end-of-buffer error messages (WAS: GNU Emacs r


From: martin rudalics
Subject: Re: Suppressing beginning/end-of-buffer error messages (WAS: GNU Emacs raison d'etre)
Date: Sat, 23 May 2020 10:22:21 +0200

> If you set directly, then getting hold of the original value of
> command-error-function becomes bit trickier. The following should do
> the same, but I prefer the add-function version since it depends less
> on the order of evaluation.
>
>      (defvar original-command-error-function command-error-function)
>      (defun ignore-edge-of-buffer-errors (error context signaller)
>        (unless (memq (car error) '(beginning-of-buffer end-of-buffer))
>          (funcall original-command-error-function
>                   error context signaller)))
>      (setq command-error-function #'ignore-edge-of-buffer-errors)

Then probably

(defvar original-command-error-function)

(defun ignore-edge-of-buffer-errors (error context signaller)
  (unless (memq (car error) '(beginning-of-buffer end-of-buffer))
    (funcall original-command-error-function
             error context signaller)))

(setq original-command-error-function #'command-error-function
      command-error-function #'ignore-edge-of-buffer-errors)

would be more appropriate.

> (alternatively, you can hardcode command-error-default-function, but
> then you lose other additions to command-error-function, like
> help-command-error-confusable-suggestions)

And maybe 'minibuffer-error-function'.  So I'll stick with your original
proposal making it the first occurrence of 'add-function' in my initial
file.

Thanks, martin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]