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

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

Re: ~`symbol-function' to get code as list even when byte-compiled?


From: Emanuel Berg
Subject: Re: ~`symbol-function' to get code as list even when byte-compiled?
Date: Mon, 25 May 2015 19:16:28 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Barry Margolin <barmar@alum.mit.edu> writes:

> You can probably prevent it from being compiled,
> maybe something like:
>
> (setf (symbol-function 'number-one-jump) '(lambda
> (&optional not-used) ...))

Yeah, but if I were to do special treatment, then
I might as well put

    (remove-hook 'w3m-display-hook 'number-one-jump)

in "number-one-jump" and have it compiled like
all others!

The reason for this idea, which I should have said in
the OP, is that I have many such jump functions, e.g.:

    (defun emacs-wiki-jump (&optional not-used)
      (if (search-forward "EmacsWiki" (point-max) t)
          (beginning-of-line) ))

    (defun urban-jump (&optional not-used)
      (when (search-forward "Top Definition" (point-max) t)
        (w3m-next-anchor)
        (recenter-top-bottom 0) ))

So instead of putting the corresponding remove-hook in
every one, this is what "enable-jump" does. Only it
doesn't work if the jump functions are compiled, which
didn't occurred to me when I got the idea and wrote
the code.

> But can't you do something equivalent by using
> advice instead of self-modifying code?

Possibly - how would that work?

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

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