[Top][All Lists]

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

24.3.50; `called-interactively-p' over the top

From: Drew Adams
Subject: 24.3.50; `called-interactively-p' over the top
Date: Tue, 4 Dec 2012 16:25:38 -0800

Debugger entered--Lisp error: (invalid-function
  #[771 "..." [internal--called-interactively-p--get-frame] 6 "\n\n(fn FRAME1
FRAME2 I)"](((t apply ad-Advice-narrow-to-region #<subr narrow-to-region> (3980
6800))) ((t apply ad-Advice-narrow-to-region #<subr narrow-to-region> (3980
6800))) (8))
  advice--called-interactively-skip(8 (t ad-Advice-narrow-to-region #<subr
narrow-to-region> 3980 6800) (t apply ad-Advice-narrow-to-region #<subr
narrow-to-region> (3980 6800)))
  run-hook-with-args-until-success(advice--called-interactively-skip 8 (t
ad-Advice-narrow-to-region #<subr narrow-to-region> 3980 6800) (t apply
ad-Advice-narrow-to-region #<subr narrow-to-region> (3980 6800)))
  (or (interactive-p) wide-n-push-anyway-p)
  (if (or (interactive-p) wide-n-push-anyway-p) (progn (wide-n-push start end)))
  (when (or (interactive-p) wide-n-push-anyway-p) (wide-n-push start end))
  (let (ad-return-value) (when (or (interactive-p) wide-n-push-anyway-p)
(wide-n-push start end)) (setq ad-return-value (with-no-warnings (funcall
ad--addoit-function start end))) ad-return-value)
  ad-Advice-narrow-to-region(#<subr narrow-to-region> 3980 6800)
  apply(ad-Advice-narrow-to-region #<subr narrow-to-region> (3980 6800))
  narrow-to-region(3980 6800)
  call-interactively(narrow-to-region nil nil)

The code that led to this is the following, from my library `wide-n.el':

(defadvice narrow-to-region
  (before push-wide-n-restrictions activate)
  "Push the region limits to `wide-n-restrictions'.
You can use `C-x n x' to widen to a previous buffer restriction."
  (when (or (interactive-p)  wide-n-push-anyway-p)
    (wide-n-push (ad-get-arg 0) (ad-get-arg 1))))

I byte-compiled this code in Emacs 21 and executed it in Emacs 24.  I
want to be able to use the same *.elc in 21, 22, 23, and 24.  I
typically byte-compile a library in the lowest Emacs version that the
library itself supports.  (In the case of Emacs 22/23 I sometimes
compile it in 23 - that has proven good for compatibility.)

It is really a shame that Emacs Dev seems to be plugging more and more
new macros into basic functions like this.

I haven't looked closely at the code, but I cannot imagine why
`called-interactively-p' (latter-day replacement for `interactive-p')
needs to generate code that adds a defvar for `base-index' with a
different default value each time.  Are you sure you are not
overengineering this?

It has for a long time been possible to get a fair amount of forward
compatibility among Emacs versions.  Up through Emacs 24.2, I would say.

Generally, unless one tried to take advantage of new features not
available in an older release, there was little or no problem.  No more,
it seems.  Emacs Dev seems to add new macros and use them willy nilly at
all levels.  The last one I ran into was not used in such a basic
function, at least.

Doing this for something used as often as `called-interactively-p'
effectively ensures that there will be no compatibility forward to Emacs
24 from any prior version.

Poor Emacs (users).

Trying to work around this would in effect mean either adding such macro
definitions to one's own Lisp code, even when not needed for older
supported Emacs versions, or maintaining multiple directories of one's
Emacs Lisp code for different Emacs versions and loading different *.elc
for the different Emacs versions.  Or not byte-compiling it...

I doubt that Emacs Dev would tolerate jumping through such hoops
themselves, if they too maintained code that supports multiple versions.

Seems sometimes like your idea of Emacs users does not include the
notion that they might also use Emacs Lisp - a not too emacsy point of
view, IMHO.  (I say that it _seems_ like that sometimes.)

In GNU Emacs (i386-mingw-nt5.1.2600)
 of 2012-12-03 on MS-W7-DANI
Bzr revision: 111077
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.7) --no-opt --enable-checking --cflags
 -Ic:/emacs/libs/libXpm-3.5.10/include -Ic:/emacs/libs/libXpm-3.5.10/src
 -Ic:/emacs/libs/libpng-1.2.37-lib/include -Ic:/emacs/libs/zlib-1.2.5

reply via email to

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