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: Noam Postavsky
Subject: Re: Suppressing beginning/end-of-buffer error messages (WAS: GNU Emacs raison d'etre)
Date: Fri, 22 May 2020 08:46:16 -0400

On Fri, 22 May 2020 at 05:30, martin rudalics <address@hidden> wrote:

>  >      (defun ignore-edge-of-buffer-errors (default-fun error context 
> signaller)
>  >        (unless (memq (car error) '(beginning-of-buffer end-of-buffer))
>  >          (funcall default-fun error context signaller)))
>  >      (add-function :around command-error-function
>  >                    #'ignore-edge-of-buffer-errors)
>
> That will save me a lot of trouble.
>
> I suppose it would also work when I set 'command-error-function' to
> 'ignore-edge-of-buffer-errors' right away but the advice is probably
> cleaner.

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)

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



reply via email to

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