all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Lisp: interactive-p fails in nested catch or condition-case calls in byte-compiled code
@ 2002-11-15 21:42 Greg Hill
  0 siblings, 0 replies; only message in thread
From: Greg Hill @ 2002-11-15 21:42 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1654 bytes --]

If you call (interactive-p)
    from inside a (catch... or (condition-case...
       that is nested within a higher-level (catch... or (condition-case...,

then when you run the code interactively,
    if the code has NOT been byte-compiled,
       it works correctly (interactive-p returns t);
    but if the code HAS been byte-compiled,
       it fails (interactive-p returns nil).

The code below illustrates the problem if you run it both 
byte-compiled and not byte-compiled, and compare the results.


(defun cctest ()
   (interactive)
   (catch 'cctest
     (message "before condition-case in catch, (interactive-p) = %s"
	     (interactive-p))
     (condition-case nil
	(message "---inside condition-case in catch, (interactive-p) = %s"
		(interactive-p))
       (error nil))
     (message "after condition-case in catch, (interactive-p) = %s"
	     (interactive-p))
     (catch 'cctest
       (message "---inside catch in catch, (interactive-p) = %s"
	       (interactive-p)))
     (message "after catch in catch, (interactive-p) = %s"
	     (interactive-p)))

   (message "")

   (condition-case nil
       (progn
	(message "before catch in condition-case, (interactive-p) = %s"
		(interactive-p))
	(catch 'cctest
	  (message "---inside catch in condition-case, (interactive-p) = %s"
		   (interactive-p)))
	(message "after catch in condition-case, (interactive-p) = %s"
		(interactive-p))
	(condition-case nil
	    (message "---inside condition-case in condition-case, 
(interactive-p) = %s"
		     (interactive-p))
	  (error nil))
	(message "after condition-case in condition-case, (interactive-p) = %s"
		(interactive-p)))
     (error nil)))

[-- Attachment #2: Type: text/html, Size: 3783 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-11-15 21:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-15 21:42 Lisp: interactive-p fails in nested catch or condition-case calls in byte-compiled code Greg Hill

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.