emacs-devel
[Top][All Lists]
Advanced

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

Re: command-error-function default handler


From: Jarek Czekalski
Subject: Re: command-error-function default handler
Date: Sun, 27 Oct 2013 14:48:30 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120824 Thunderbird/15.0


W dniu 2013-10-27 04:44, Stefan Monnier pisze:
The way to do that right is as follows:
- change command-error-function's default value to not be nil.
- don't set command-error-function via `setq' but via `add-function'.
The first step may require changes to the C code.

Now I noticed that in current state of Emacs command-error-function may not be used by a package. Only user can use it. If a package grabs it, no other package can use it. So no package at all may grab it as a result.

A cumbersome workaround is possible. If the value is nil, create a first handler with standard output included. If the value is not nil (there is already other handler), do add-function and don't produce standard output. But this is a workaround, not a reasonable usage of the feature.

In the meantime I probably found the answer to my question. Looking at usage of print_error_message in other files I came up with something that resembles the default handler behaviour:

(defun test-handler (&optional conditions context source)
  (message "%s%s: %s" context source (error-message-string conditions))
  ; we would also like to ring a bell here
)

So this is probably something that could be added to docs. Still this feature is not yet useful for packages. A package is the place where I wanted to use it. See related bug report: 15670 [1]

If I am wrong, please correct me.

Jarek

[1] http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15670




reply via email to

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