unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Advising forward-char not working properly
@ 2003-06-13 10:02 Milan Zamazal
  2003-06-14 12:29 ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Milan Zamazal @ 2003-06-13 10:02 UTC (permalink / raw)


In GNU Emacs 21.3.2 (i386-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2003-06-03 on blackbird, modified by Debian

When I advise the function forward-char or backward-char, the advice is
not invoked if the function is called via its key binding.

Try to evaluate the following in *scratch*:

  (defadvice forward-char (after foo activate)
    (message "Advice called"))

Then type `C-f' in some buffer -- the advice isn't called.

Now try `M-x forward-char' -- the advice is called as expected.

I think this is a bug.  self-insert-command seems to have a similar
problem.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Advising forward-char not working properly
  2003-06-13 10:02 Advising forward-char not working properly Milan Zamazal
@ 2003-06-14 12:29 ` Richard Stallman
  2003-06-23  7:36   ` Milan Zamazal
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2003-06-14 12:29 UTC (permalink / raw)
  Cc: bug-gnu-emacs

    When I advise the function forward-char or backward-char, the advice is
    not invoked if the function is called via its key binding.

These functions are executed directly in many cases.

Advising built-in functions does not generally work.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Advising forward-char not working properly
  2003-06-14 12:29 ` Richard Stallman
@ 2003-06-23  7:36   ` Milan Zamazal
  2003-06-23  7:53     ` Kenichi Handa
  0 siblings, 1 reply; 4+ messages in thread
From: Milan Zamazal @ 2003-06-23  7:36 UTC (permalink / raw)
  Cc: bug-gnu-emacs

>>>>> "RS" == Richard Stallman <rms@gnu.org> writes:

            When I advise the function forward-char or backward-char,
        the advice is not invoked if the function is called via its key
        binding.

    RS> These functions are executed directly in many cases.

It's quite suspicious to me why invoking a command through `C-f' behaves
differently than calling it via `M-x forward-char'.  I'm not saying it's
a bug, but I wish Emacs were less mysterious :-|.
    
    RS> Advising built-in functions does not generally work.

If it is technically difficult to ensure full extensibility including
built-in functions, I can understand it, but it should be clearly
documented.  The only occurrence of the word `built' I could find in the
Elisp manual section about advising is

   - User Option: ad-default-compilation-action

  [...]

       A value of `like-original' specifies to compile
       the advice if the original definition of the advised function is
       compiled or a built-in function.

suggesting that there's no problem with advising built-in functions.

Regards,

Milan Zamazal

-- 
It's amazing how much better you feel once you've given up hope.
                                                (unknown source)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Advising forward-char not working properly
  2003-06-23  7:36   ` Milan Zamazal
@ 2003-06-23  7:53     ` Kenichi Handa
  0 siblings, 0 replies; 4+ messages in thread
From: Kenichi Handa @ 2003-06-23  7:53 UTC (permalink / raw)
  Cc: bug-gnu-emacs

In article <87znk9w8h6.fsf@zamazal.org>, Milan Zamazal <pdm@zamazal.org> writes:

>>>>>>  "RS" == Richard Stallman <rms@gnu.org> writes:
>             When I advise the function forward-char or backward-char,
>         the advice is not invoked if the function is called via its key
>         binding.

RS>  These functions are executed directly in many cases.

> It's quite suspicious to me why invoking a command through `C-f' behaves
> differently than calling it via `M-x forward-char'.  I'm not saying it's
> a bug, but I wish Emacs were less mysterious :-|.
    
Long ago, when Gerd implemented the new display engine, I
did some test to check the effect of those special handling
of forward-char, backward-char, and self-insert-command.  As
far as I remember, the result was that I couldn't see any
merit in those special handlings.  But, what I did was to
keep pressing C-f and C-b in the TUTORIAL buffer while
making the auto repeating ratio of the keyboard as fast as
possible.  As they are interactive commands and my machine
was a rather fast one, this test is not that reliable.  But
at least, there's a possibility that we no longer need those
special handling.

How about disabling those codes and see if users really
complain or not?

---
Ken'ichi HANDA
handa@m17n.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-06-23  7:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-13 10:02 Advising forward-char not working properly Milan Zamazal
2003-06-14 12:29 ` Richard Stallman
2003-06-23  7:36   ` Milan Zamazal
2003-06-23  7:53     ` Kenichi Handa

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).