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

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

Re: replacing a function with another one


From: Michael Heerdegen
Subject: Re: replacing a function with another one
Date: Wed, 12 Mar 2014 00:51:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

lee <address@hidden> writes:

> The idea is very simple:  When patterns are to be read from another
> buffer, switch to that buffer before they are being read.  Before
> applying them, switch back to the original buffer.
>
> I can´t do that with `with-current-buffer´ because two different functions
> need to be advised to do it, and I can´t get add-advice to work with
> :around.
>
> Why shouldn´t I switch buffers?  They are switched back anyway.

But what the code that's being run in the meantime, between your
advices?  Then, the wrong buffer is current.  That can't work.

> One thing I haven´t been able to figure out is how hi-lock.el decides
> what the lines it writes to the buffer are prepended with.  In one
> buffer, it puts "// Hi-lock ...", in another one, it´s "# Hi-lock ...".
> Then it searches patterns with '"\\<" hi-lock-file-patterns-prefix ":"',
> and apparently it will not find patterns prepended with "//" when it
> figures that they should be prepended with "#".

When writing the specification to he buffer, it calls `comment-region',
which DTRT in any mode.

`hi-lock-find-patterns' indeed doesn't seem to search only inside
comments, it just searches the whole buffer for the regexp

   (concat "\\<" hi-lock-file-patterns-prefix ":")


Regards,

Michael.





reply via email to

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