emacs-devel
[Top][All Lists]
Advanced

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

Vsignaling_function type, 3rd argument of command-error-function


From: Jarek Czekalski
Subject: Vsignaling_function type, 3rd argument of command-error-function
Date: Fri, 01 Nov 2013 14:20:43 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130801 Thunderbird/17.0.8

I am not sure what was the emacs revision I had then, could be between 114500 and 114600. I was testing command error function and noticed that the "signal" argument was a symbol. And print_error_message kind of expects it would be a symbol, because only in such a case the signal is printed (print.c):

  /* If we know from where the error was signaled, show it in
   *Messages*.  */
  if (!NILP (caller) && SYMBOLP (caller))
    {

I was trying end-of-buffer error, which was presented in *Messages* as:
signal: end of buffer.

Now I see that the type of this object changed to compiled-function. So this code doesn't catch it and prints only "end of buffer".

Could you say something about this change and whether it was intentional?

A general question (request) would be: please document what is the type of the object passed to command-error-function. Currently it is described as "the Lisp function within which the error was signaled".

This is important when command-error-function is to be widely used.

As the last part comes my testing code, which shows that sometimes (in case of cause-error function) the signal is of type symbol.

(defun test-handler (&optional conditions context source)
  (setq out (get-buffer-create "dupa-err"))
  (setq error-msg (error-message-string conditions))
(setq msg (format "context:%s\nsource:%s\nmsg:%s" context source error-msg))
  (print msg out)
  (print (concat "source type: " (symbol-name (type-of source))) out)
)

(setq command-error-function 'test-handler)

(defun cause-error ()
  (interactive)
  (string= 1 1)
)
(global-set-key (kbd "C-t") 'cause-error)

BTW dupa means ass in Polish, sorry for bad language in testing proc :) I should stop using this word as a buffer name.

Jarek




reply via email to

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