GNU bug report logs - #12254
24.2; completion fails backward-char

Previous Next

Package: emacs;

Reported by: Leo <sdl.web <at> gmail.com>

Date: Wed, 22 Aug 2012 02:42:01 UTC

Severity: normal

Tags: notabug

Found in version 24.2

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12254 in the body.
You can then email your comments to 12254 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org:
bug#12254; Package emacs. (Wed, 22 Aug 2012 02:42:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org. (Wed, 22 Aug 2012 02:42:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.2; completion fails backward-char
Date: Wed, 22 Aug 2012 10:40:25 +0800
[Message part 1 (text/plain, inline)]
This is a regression. It doesn't happen in Emacs 23.4.

1. Emacs -q -l b.el (b.el is attached)
2. M-x b-mode
3. Type I followed by <tab> to complete to IGNORE
4. C-b

In step 4, C-b could not move backwards; point appears to be trapped
there.

Leo
[b.el (application/emacs-lisp, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12254; Package emacs. (Wed, 22 Aug 2012 16:18:01 GMT) Full text and rfc822 format available.

Message #8 received at 12254 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo <sdl.web <at> gmail.com>
Cc: 12254 <at> debbugs.gnu.org
Subject: Re: bug#12254: 24.2; completion fails backward-char
Date: Wed, 22 Aug 2012 12:17:27 -0400
Thanks for those bug reports, Leo.
I'm probably to blame for most/all of those completion problems, but I'm
just coming back from a vacation and have to prepare for the "beginning
of the end of the semester" (for reasons of student strikes (tho
I guess it's probably more due to government's obtuseness), we're about
to resume classes for the last 4 weeks of the winter semester ;-).
So, I'll try to look at it ASAP, but you may have to wait a week or two.


        Stefan




Added tag(s) notabug. Request was from Stefan Monnier <monnier <at> iro.umontreal.ca> to control <at> debbugs.gnu.org. (Wed, 29 Aug 2012 18:07:01 GMT) Full text and rfc822 format available.

Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Wed, 29 Aug 2012 18:07:02 GMT) Full text and rfc822 format available.

Notification sent to Leo <sdl.web <at> gmail.com>:
bug acknowledged by developer. (Wed, 29 Aug 2012 18:07:02 GMT) Full text and rfc822 format available.

Message #15 received at 12254-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo <sdl.web <at> gmail.com>
Cc: 12254-done <at> debbugs.gnu.org
Subject: Re: bug#12254: 24.2; completion fails backward-char
Date: Wed, 29 Aug 2012 14:05:19 -0400
tags 12254 notabug
thanks

> (defun b-completion-at-point ()
>   (let ((beg (progn
>                (skip-syntax-backward "w")
>                (point)))
>         (end (progn
>                (skip-syntax-forward "w")
>                (point))))
>     (list beg end '("IGNORE" "DEBUG" "HELLO"))))

This needs to save-excursion.

> This is a regression. It doesn't happen in Emacs 23.4.

That's only because completion-at-point-functions is used less often so
the bug in the above code doesn't bite as often.
But your above completion function is already buggy in Emacs-23.4 since
it can't complete "IG!R" to "IGNORE", whereas after adding the
save-excursion such completion works just fine.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12254; Package emacs. (Thu, 30 Aug 2012 12:07:01 GMT) Full text and rfc822 format available.

Message #18 received at 12254 <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 12254 <at> debbugs.gnu.org
Subject: Re: bug#12254: 24.2; completion fails backward-char
Date: Thu, 30 Aug 2012 20:05:03 +0800
On 2012-08-30 02:05 +0800, Stefan Monnier wrote:
> That's only because completion-at-point-functions is used less often so
> the bug in the above code doesn't bite as often.
> But your above completion function is already buggy in Emacs-23.4 since
> it can't complete "IG!R" to "IGNORE", whereas after adding the
> save-excursion such completion works just fine.

Thank you for this.

This isn't clear on the documentation on completion-at-point-functions.
It is a trap that one can easily fall into. I wonder if you may add a
note in the doc-string of completion-at-point-functions. Thanks.

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12254; Package emacs. (Thu, 30 Aug 2012 15:42:02 GMT) Full text and rfc822 format available.

Message #21 received at 12254 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Leo <sdl.web <at> gmail.com>
Cc: 12254 <at> debbugs.gnu.org
Subject: Re: bug#12254: 24.2; completion fails backward-char
Date: Thu, 30 Aug 2012 11:39:59 -0400
> This isn't clear on the documentation on completion-at-point-functions.
> It is a trap that one can easily fall into. I wonder if you may add a
> note in the doc-string of completion-at-point-functions. Thanks.

How 'bout the patch below?


        Stefan


=== modified file 'lisp/minibuffer.el'
--- lisp/minibuffer.el	2012-08-14 17:10:38 +0000
+++ lisp/minibuffer.el	2012-08-30 15:39:14 +0000
@@ -1821,7 +1821,9 @@
  `:predicate'	a predicate that completion candidates need to satisfy.
  `:exclusive'	If `no', means that if the completion table fails to
    match the text at point, then instead of reporting a completion
-   failure, the completion should try the next completion function.")
+   failure, the completion should try the next completion function.
+As is the case with most hooks, the functions are responsible to preserve
+things like point and current buffer.")
 
 (defvar completion--capf-misbehave-funs nil
   "List of functions found on `completion-at-point-functions' that misbehave.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12254; Package emacs. (Thu, 30 Aug 2012 22:27:02 GMT) Full text and rfc822 format available.

Message #24 received at 12254 <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 12254 <at> debbugs.gnu.org
Subject: Re: bug#12254: 24.2; completion fails backward-char
Date: Fri, 31 Aug 2012 06:25:31 +0800
On 2012-08-30 23:39 +0800, Stefan Monnier wrote:
> === modified file 'lisp/minibuffer.el'
> --- lisp/minibuffer.el	2012-08-14 17:10:38 +0000
> +++ lisp/minibuffer.el	2012-08-30 15:39:14 +0000
> @@ -1821,7 +1821,9 @@
>   `:predicate'	a predicate that completion candidates need to satisfy.
>   `:exclusive'	If `no', means that if the completion table fails to
>     match the text at point, then instead of reporting a completion
> -   failure, the completion should try the next completion function.")
> +   failure, the completion should try the next completion function.
> +As is the case with most hooks, the functions are responsible to preserve
> +things like point and current buffer.")
>  
>  (defvar completion--capf-misbehave-funs nil
>    "List of functions found on `completion-at-point-functions' that misbehave.

Thank you. That looks good ;)

Leo




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 28 Sep 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 263 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.