emacs-devel
[Top][All Lists]
Advanced

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

RE: widen-one-level [was: Emacs's handling of line numbers]


From: Drew Adams
Subject: RE: widen-one-level [was: Emacs's handling of line numbers]
Date: Mon, 19 Apr 2010 09:31:19 -0700

> > > (defadvice narrow-to-region
> > >   (before push-restriction-stack activate)
> > >   (setq restriction-stack  (cons (cons start end) 
> > >                                  restriction-stack))
> > >   (when (and (= start 1) (= end (1+ (buffer-size))))
> > >     (setq restriction-stack  ())))
> > 
> > I also have something similar in my .emacs. I wonder if you 
> > noticed this problem. After advising narrow-to-region,
> > preloaded functions such as narrow-to-page narrow-to-defun
> > still use the original narrow-to-region ignoring the advice.
> 
> Yes, I noticed that too. Presumably it's because 
> `narrow-to-region' has its own byte code. At least that's my
> guess. `narrow-to-defun' is a lisp function, and it is
> byte-compiled, which presumably means the byte-code for 
> `narrow-to-region' is inlined.
> 
> Or something like that. Someone more knowledgable will no 
> doubt enlighten us.

One (ugly) solution is to copy the Lisp source code for `narrow-to-defun' and
`narrow-to-page' to the same library that advises `narrow-to-region'. That way,
the advised definition is used also for the other two.





reply via email to

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