[Top][All Lists]

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

[VM] vm-interactive-p no longer working

From: Piet van Oostrum
Subject: [VM] vm-interactive-p no longer working
Date: Tue, 11 Nov 2014 12:45:04 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (darwin)

Environment: Aquamacs 3.0 / Mac OS X 10.6.8 / VM 8.2.0b

I recently noticed that the vm-follow-summary-cursor behaviour was no
longer working. I used to move my cursor in the VM Summary buffer and
then hit s or d or so. But now it no longer operated on the message
where the cursor was positioned, but on the current message instead.

I could trace this back to (vm-interactive-p) no longer giving t in an
interactive call to for example vm-delete-message. It appears no longer
to work in Emacs 24 (Aquamacs 3.0 is based on Emacs 24).

In Emacs 24 interactive-p is obsolete and the VM code tries to cope with
that but it fails. The code in vm-misc.el is:

(fset 'vm-interactive-p
      (if (fboundp 'interactive-p)      ; Xemacs or Gnu Emacs under obsolescence
        (lambda () (called-interactively-p 'any))))

Now in Emacs 24 interactive-p is a function that itself calls
called-interactively-p. To cope with the extra layer of indirection
called-interactively-p has a special test to see if it was called from
interactive-p and then skips this stack frame to inspect the function
that called interactive-p. However, this only works when the function is
really called interactive-p, and not with a function fset to

Also the alternative definition (lambda () (called-interactively-p
'any)) would not work either as then called-interactively-p is called
from that lambda fedined funcion and not from the actual interactively
called function like vm-delete-message. There is an indirection level
too much.

I think this can only be solved by making vm-interactive-p a macro
rather than a function. I found the following solution works:

(if (fboundp 'called-interactively-p)
        (defmacro vm-interactive-p ()
          '(called-interactively-p 'any))
  (defmacro vm-interactive-p ()

(I reversed the test that chooses the proper definition).

I think all files using vm-interactive-p have directly or indirectly an
    (require 'vm-misc) 

I also noticed that there are a few instances where interactive-p is
called directly. For a future release these should also be changed to
vm-interactive-p, I think. Otherwise a future Emacs version might
completely obliterate interactive-p and we then have a problem.
Piet van Oostrum <address@hidden>
PGP key: [8DAE142BE17999C4]

reply via email to

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