|
From: | Jarek Czekalski |
Subject: | Re: using command-error-function in emacspeak |
Date: | Tue, 05 Nov 2013 20:57:29 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120824 Thunderbird/15.0 |
W dniu 2013-11-05 20:01, Stefan Monnier pisze:
(add-function command-error-function something) ;; forgive me wrong syntax here should do the same as (setq command-error-function something) in case when command-error-function is nil beforehand.But that can't be right. E.g. (add-function :before command-error-function (lambda (&rest _ignore) (cl-incf command-error-function-counter))) Should not affect Emacs's behavior other than to keep a counter of calls to command-error-function. But (setq command-error-function (lambda (&rest _ignore) (cl-incf command-error-function-counter)) will not do that, since it will instead silence all the command-error messages.Stefan
So this is regarding command-error-function specific variable, right? Not add-function in general? This will be fixed soon, the patch is waiting for a review.
Are there examples of any other ...-function variables that work in this way: nil has a special meaning and nil value results in calling some system hidden handler? I think this is not a good logic to follow. The better is this:
nil value for a AAA-function variable means that no action is taken when AAA happens.
When this logic is used, add-function should operate on nil values as well as on function values.
Which logic is used in general in Emacs for ...-function variables - I don't know. If you can point me to some reading, that would help. Currently I try to understand it by intuition.
I also reviewed a couple of examples: adaptive-fill-function - nil by default, means no action browse-url-browser-function - not nil buffer-stale-function - not nil comment-indent-function - not nil ... stopped, this seems to confirm my logic.add-function may be used by packages for their own goals, but nil value should always have a common meaning. No action seems to be intuitive.
Jarek
[Prev in Thread] | Current Thread | [Next in Thread] |