bug-gnu-emacs
[Top][All Lists]
Advanced

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

Lisp: interactive-p fails in nested catch or condition-case calls in byt


From: Greg Hill
Subject: Lisp: interactive-p fails in nested catch or condition-case calls in byte-compiled code
Date: Fri, 15 Nov 2002 13:42:44 -0800

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)))

reply via email to

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