unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* possible bug in M-/ (dabbrev-expand)
@ 2007-04-21 16:14 Dieter Wilhelm
  2007-04-23  1:31 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Dieter Wilhelm @ 2007-04-21 16:14 UTC (permalink / raw)
  Cc: help-gnu-emacs

The following message is a courtesy copy of an article
that has been posted to gmane.emacs.devel as well.

Hi

I deemed it an especially good idea to have function which is
searching something in a buffer when there are changes to the content.
(GNU Emacs 22.0.95.1 (i486-pc-linux-gnu, GTK+ Version 2.8.20) of
2007-03-02 on pacem, modified by Debian.)

When I install such a function in the following way (for example in
the *scratch* buffer):

   $ emacs -Q -D 

   (defun bla ( &optional a b c) ;dummy variables
     (interactive)
     (save-excursion
       (re-search-forward "a" nil 'noerror)))

   (add-hook 'after-change-functions 'bla nil t)

and I try to M-/ something at the buffer beginning, the cursor does
not remain after the expansion but skips somewhere into the buffer.

I'm not sure whether this is a bug of M-/ or this is just a stupid
approach to have such an functionality after a buffer change?  It
would be nice if you could give me some advice before I submit a
possibly unnecessary bug report.

-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

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

* Re: possible bug in M-/ (dabbrev-expand)
  2007-04-21 16:14 possible bug in M-/ (dabbrev-expand) Dieter Wilhelm
@ 2007-04-23  1:31 ` Stefan Monnier
  2007-04-23 20:01   ` Dieter Wilhelm
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2007-04-23  1:31 UTC (permalink / raw)
  To: Dieter Wilhelm; +Cc: help-gnu-emacs, emacs-devel

>    (defun bla ( &optional a b c) ;dummy variables
>      (interactive)
>      (save-excursion
>        (re-search-forward "a" nil 'noerror)))

>    (add-hook 'after-change-functions 'bla nil t)

You probably need to save-match-data as well.


        Stefan

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

* Re: possible bug in M-/ (dabbrev-expand)
  2007-04-23  1:31 ` Stefan Monnier
@ 2007-04-23 20:01   ` Dieter Wilhelm
  0 siblings, 0 replies; 3+ messages in thread
From: Dieter Wilhelm @ 2007-04-23 20:01 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>    (defun bla ( &optional a b c) ;dummy variables
>>      (interactive)
>>      (save-excursion
>>        (re-search-forward "a" nil 'noerror)))
>
>>    (add-hook 'after-change-functions 'bla nil t)
>
> You probably need to save-match-data as well.
>

Yes you are right, thank you very much.

-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

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

end of thread, other threads:[~2007-04-23 20:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-21 16:14 possible bug in M-/ (dabbrev-expand) Dieter Wilhelm
2007-04-23  1:31 ` Stefan Monnier
2007-04-23 20:01   ` Dieter Wilhelm

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).