unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12254: 24.2; completion fails backward-char
@ 2012-08-22  2:40 Leo
  2012-08-22 16:17 ` Stefan Monnier
  2012-08-29 18:05 ` Stefan Monnier
  0 siblings, 2 replies; 6+ messages in thread
From: Leo @ 2012-08-22  2:40 UTC (permalink / raw)
  To: 12254

[-- Attachment #1: Type: text/plain, Size: 248 bytes --]

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

[-- Attachment #2: b.el --]
[-- Type: application/emacs-lisp, Size: 401 bytes --]

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

* bug#12254: 24.2; completion fails backward-char
  2012-08-22  2:40 bug#12254: 24.2; completion fails backward-char Leo
@ 2012-08-22 16:17 ` Stefan Monnier
  2012-08-29 18:05 ` Stefan Monnier
  1 sibling, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2012-08-22 16:17 UTC (permalink / raw)
  To: Leo; +Cc: 12254

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





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

* bug#12254: 24.2; completion fails backward-char
  2012-08-22  2:40 bug#12254: 24.2; completion fails backward-char Leo
  2012-08-22 16:17 ` Stefan Monnier
@ 2012-08-29 18:05 ` Stefan Monnier
  2012-08-30 12:05   ` Leo
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2012-08-29 18:05 UTC (permalink / raw)
  To: Leo; +Cc: 12254-done

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





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

* bug#12254: 24.2; completion fails backward-char
  2012-08-29 18:05 ` Stefan Monnier
@ 2012-08-30 12:05   ` Leo
  2012-08-30 15:39     ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Leo @ 2012-08-30 12:05 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 12254

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





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

* bug#12254: 24.2; completion fails backward-char
  2012-08-30 12:05   ` Leo
@ 2012-08-30 15:39     ` Stefan Monnier
  2012-08-30 22:25       ` Leo
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2012-08-30 15:39 UTC (permalink / raw)
  To: Leo; +Cc: 12254

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






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

* bug#12254: 24.2; completion fails backward-char
  2012-08-30 15:39     ` Stefan Monnier
@ 2012-08-30 22:25       ` Leo
  0 siblings, 0 replies; 6+ messages in thread
From: Leo @ 2012-08-30 22:25 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 12254

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





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

end of thread, other threads:[~2012-08-30 22:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-22  2:40 bug#12254: 24.2; completion fails backward-char Leo
2012-08-22 16:17 ` Stefan Monnier
2012-08-29 18:05 ` Stefan Monnier
2012-08-30 12:05   ` Leo
2012-08-30 15:39     ` Stefan Monnier
2012-08-30 22:25       ` Leo

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