GNU bug report logs - #45768
icomplete-mode does not provide in region completion for dabbrev-completion

Previous Next

Package: emacs;

Reported by: Simon Lang <simon.lang <at> mailbox.org>

Date: Sun, 10 Jan 2021 16:07:02 UTC

Severity: normal

Tags: moreinfo

Merged with 45767

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 45768 in the body.
You can then email your comments to 45768 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 bug-gnu-emacs <at> gnu.org:
bug#45768; Package emacs. (Sun, 10 Jan 2021 16:07:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Simon Lang <simon.lang <at> mailbox.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 10 Jan 2021 16:07:02 GMT) Full text and rfc822 format available.

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

From: Simon Lang <simon.lang <at> mailbox.org>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: icomplete-mode does not provide in region completion for
 dabbrev-completion
Date: Sun, 10 Jan 2021 13:26:45 +0000 (GMT)
emacs -Q
in *scratch* evaluate
(setq icomplete-in-buffer t)
(icomplete-mode t)

type:
asdf1
asdf2
asdf followed by C-M-/ (dabbrev-completion) 
->  default completion is invoked, not icomplete-mode


In GNU Emacs 27.1 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95))
   of 2020-08-12 built on builder10-14.porkrind.org
Windowing system distributor 'Apple', version 10.3.1894
System Description:    Mac OS X 10.15.7

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
   'configure --with-ns '--enable-locallisppath=/Library/Application
   Support/Emacs/${version}/site-lisp:/Library/Application
   Support/Emacs/site-lisp' --with-modules'

Configured features:
NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES
THREADS JSON PDUMPER

Important settings:
     value of $LANG: en_GB.UTF-8
     locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
     tooltip-mode: t
     global-eldoc-mode: t
     eldoc-mode: t
     electric-indent-mode: t
     mouse-wheel-mode: t
     tool-bar-mode: t
     menu-bar-mode: t
     file-name-shadow-mode: t
     global-font-lock-mode: t
     font-lock-mode: t
     blink-cursor-mode: t
     auto-composition-mode: t
     auto-encryption-mode: t
     auto-compression-mode: t
     line-number-mode: t
     transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core term/tty-colors frame
minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite charscript charprop case-table epa-hook jka-cmpr-hook help
simple abbrev obarray cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
threads kqueue cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 44811 6704)
   (symbols 48 5927 1)
   (strings 32 15254 1703)
   (string-bytes 1 504784)
   (vectors 16 10174)
   (vector-slots 8 126879 9518)
   (floats 8 19 39)
   (intervals 56 189 0)
   (buffers 1000 11))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45768; Package emacs. (Sun, 10 Jan 2021 18:57:01 GMT) Full text and rfc822 format available.

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

From: simon254 <at> mailbox.org
To: "45768 <at> debbugs.gnu.org" <45768 <at> debbugs.gnu.org>
Subject: this is a duplication because of dealyed bug tracker ack
Date: Sun, 10 Jan 2021 16:09:20 +0000 (GMT)
please delete ; sorry about that




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45768; Package emacs. (Sun, 10 Jan 2021 19:09:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: simon254 <at> mailbox.org
Cc: "45768 <at> debbugs.gnu.org" <45768 <at> debbugs.gnu.org>
Subject: Re: bug#45768: icomplete-mode does not provide in region completion
 for dabbrev-completion
Date: Sun, 10 Jan 2021 20:08:17 +0100
simon254 <at> mailbox.org writes:

> please delete ; sorry about that

OK; merged with 45767.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Forcibly Merged 45767 45768. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 10 Jan 2021 19:09:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45768; Package emacs. (Fri, 06 May 2022 19:05:03 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: simon254 <at> mailbox.org
Cc: 45768 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 45767 <at> debbugs.gnu.org
Subject: Re: bug#45768: icomplete-mode does not provide in region completion
 for dabbrev-completion
Date: Fri, 06 May 2022 21:04:18 +0200
simon254 <at> mailbox.org writes:

> emacs -Q
> in *scratch* evaluate
> (setq icomplete-in-buffer t)
> (icomplete-mode t)
>
> type:
> asdf1
> asdf2
> asdf followed by C-M-/ (dabbrev-completion) 
> -> default completion is invoked, not icomplete-mode

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

I can reproduce this on the current trunk, too, but skimming the code,
I'm not quite sure how this is supposed to work.  I've added Stefan to
the CCs; it looks like he added the icomplete-in-buffer thing back in
2013.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 06 May 2022 19:05:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45768; Package emacs. (Fri, 06 May 2022 19:40:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 45768 <at> debbugs.gnu.org, simon254 <at> mailbox.org, 45767 <at> debbugs.gnu.org
Subject: Re: bug#45768: icomplete-mode does not provide in region completion
 for dabbrev-completion
Date: Fri, 06 May 2022 15:38:54 -0400
Lars Ingebrigtsen [2022-05-06 21:04:18] wrote:

> simon254 <at> mailbox.org writes:
>
>> emacs -Q
>> in *scratch* evaluate
>> (setq icomplete-in-buffer t)
>> (icomplete-mode t)
>>
>> type:
>> asdf1
>> asdf2
>> asdf followed by C-M-/ (dabbrev-completion) 
>> -> default completion is invoked, not icomplete-mode
>
> (I'm going through old bug reports that unfortunately weren't resolved
> at the time.)
>
> I can reproduce this on the current trunk, too, but skimming the code,
> I'm not quite sure how this is supposed to work.  I've added Stefan to
> the CCs; it looks like he added the icomplete-in-buffer thing back in
> 2013.

The problem is that `icomplete-in-buffer` relies on
`completion-in-region-mode-predicate` being passed to
`completion-in-region` (this is needed so Icomplete can know when you've
finished the completion), which `completion-at-point` does but which
`dabbrev-completion` does not do, so `icomplete-in-buffer` is not used
when completing via `dabbrev-completion`.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45768; Package emacs. (Sat, 07 May 2022 10:17:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 45768 <at> debbugs.gnu.org, simon254 <at> mailbox.org, 45767 <at> debbugs.gnu.org
Subject: Re: bug#45768: icomplete-mode does not provide in region completion
 for dabbrev-completion
Date: Sat, 07 May 2022 12:16:16 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> The problem is that `icomplete-in-buffer` relies on
> `completion-in-region-mode-predicate` being passed to
> `completion-in-region` (this is needed so Icomplete can know when you've
> finished the completion), which `completion-at-point` does but which
> `dabbrev-completion` does not do, so `icomplete-in-buffer` is not used
> when completing via `dabbrev-completion`.

I see.  I've now added this to the doc string on icomplete-in-buffer,
and since this is working as intended, I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 45768 <at> debbugs.gnu.org and Simon Lang <simon.lang <at> mailbox.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 07 May 2022 10:17:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45768; Package emacs. (Sat, 07 May 2022 14:24:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 45768 <at> debbugs.gnu.org, simon254 <at> mailbox.org, 45767 <at> debbugs.gnu.org
Subject: Re: bug#45768: icomplete-mode does not provide in region completion
 for dabbrev-completion
Date: Sat, 07 May 2022 10:22:32 -0400
Lars Ingebrigtsen [2022-05-07 12:16:16] wrote:
> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> The problem is that `icomplete-in-buffer` relies on
>> `completion-in-region-mode-predicate` being passed to
>> `completion-in-region` (this is needed so Icomplete can know when you've
>> finished the completion), which `completion-at-point` does but which
>> `dabbrev-completion` does not do, so `icomplete-in-buffer` is not used
>> when completing via `dabbrev-completion`.
> I see.  I've now added this to the doc string on icomplete-in-buffer,
> and since this is working as intended, I'm closing this bug report.

No, it's not working as intended: what I wrote just means that the
problem is in `dabbrev-completion` which shouldn't just call
`completion-in-region` as it does.  It should either do it within
a let-binding of `completion-in-region-mode-predicate` or with a call
to `completion-at-point` instead (which will take care to bind
`completion-in-region-mode-predicate`).

I just pushed a patch doing the latter (and providing a new
`dabbrev-capf` function).


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45768; Package emacs. (Sat, 07 May 2022 15:52:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 45768 <at> debbugs.gnu.org, simon254 <at> mailbox.org, 45767 <at> debbugs.gnu.org
Subject: Re: bug#45768: icomplete-mode does not provide in region completion
 for dabbrev-completion
Date: Sat, 07 May 2022 17:51:42 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> No, it's not working as intended: what I wrote just means that the
> problem is in `dabbrev-completion` which shouldn't just call
> `completion-in-region` as it does.  It should either do it within
> a let-binding of `completion-in-region-mode-predicate` or with a call
> to `completion-at-point` instead (which will take care to bind
> `completion-in-region-mode-predicate`).
>
> I just pushed a patch doing the latter (and providing a new
> `dabbrev-capf` function).

Ah; thanks.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45768; Package emacs. (Sun, 08 May 2022 18:10:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 45768 <at> debbugs.gnu.org, simon254 <at> mailbox.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 45767 <at> debbugs.gnu.org
Subject: Re: bug#45767: bug#45768: icomplete-mode does not provide in region
 completion for dabbrev-completion
Date: Sun, 08 May 2022 21:08:07 +0300
>> (setq icomplete-in-buffer t)
>> (icomplete-mode t)
>>
>> type:
>> asdf1
>> asdf2
>> asdf followed by C-M-/ (dabbrev-completion)
>> -> default completion is invoked, not icomplete-mode
>
> I can reproduce this on the current trunk, too, but skimming the code,
> I'm not quite sure how this is supposed to work.

Could you explain where do you see that icomplete-mode is not invoked?
Should it enable icomplete keys in the buffer?  Or there is some
visual difference before the fixes and after?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45768; Package emacs. (Mon, 09 May 2022 09:48:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 45768 <at> debbugs.gnu.org, simon254 <at> mailbox.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 45767 <at> debbugs.gnu.org
Subject: Re: bug#45767: bug#45768: icomplete-mode does not provide in region
 completion for dabbrev-completion
Date: Mon, 09 May 2022 11:47:31 +0200
Juri Linkov <juri <at> linkov.net> writes:

> Could you explain where do you see that icomplete-mode is not invoked?
> Should it enable icomplete keys in the buffer?  Or there is some
> visual difference before the fixes and after?

Stefan fixed this now, I think?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45768; Package emacs. (Mon, 09 May 2022 19:01:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 45768 <at> debbugs.gnu.org, simon254 <at> mailbox.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 45767 <at> debbugs.gnu.org
Subject: Re: bug#45767: bug#45768: icomplete-mode does not provide in region
 completion for dabbrev-completion
Date: Mon, 09 May 2022 21:41:13 +0300
>> Could you explain where do you see that icomplete-mode is not invoked?
>> Should it enable icomplete keys in the buffer?  Or there is some
>> visual difference before the fixes and after?
>
> Stefan fixed this now, I think?

How do you see that it's fixed?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45768; Package emacs. (Mon, 09 May 2022 21:24:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juri Linkov <juri <at> linkov.net>
Cc: 45768 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>,
 simon254 <at> mailbox.org, 45767 <at> debbugs.gnu.org
Subject: Re: bug#45767: bug#45768: icomplete-mode does not provide in region
 completion for dabbrev-completion
Date: Mon, 09 May 2022 17:23:00 -0400
Juri Linkov [2022-05-09 21:41:13] wrote:
>>> Could you explain where do you see that icomplete-mode is not invoked?
>>> Should it enable icomplete keys in the buffer?  Or there is some
>>> visual difference before the fixes and after?
>> Stefan fixed this now, I think?
> How do you see that it's fixed?

Try the recipe given in the bug report.  You should see now that after
M-C-/ the possible completions get listed (in icomplete-mode style) on
the same line (via an overlay).

The `icomplete-in-buffer` functionality is very rough around the edges.
I only implemented it as a kind of "proof of concept".  I think things
like `corfu-mode` work much better (because they don't displace
existing text in the buffer, they are just drawn on top of it).
[ To be honest, in my memory (from when I wrote the code), the list was
  shown in the echo area rather than "inline".  ]


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#45768; Package emacs. (Thu, 19 May 2022 17:04:02 GMT) Full text and rfc822 format available.

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

From: Juri Linkov <juri <at> linkov.net>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 45768 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>,
 simon254 <at> mailbox.org, 45767 <at> debbugs.gnu.org
Subject: Re: bug#45767: bug#45768: icomplete-mode does not provide in region
 completion for dabbrev-completion
Date: Thu, 19 May 2022 19:58:40 +0300
> Try the recipe given in the bug report.  You should see now that after
> M-C-/ the possible completions get listed (in icomplete-mode style) on
> the same line (via an overlay).

Sorry, I temporarily removed these lines from `completion-at-point`:

              (completion-in-region-mode-predicate
               (lambda ()
                 ;; We're still in the same completion field.
                 (let ((newstart (car-safe (funcall hookfun))))
                   (and newstart (= newstart start)))))

to be able to use the new `minibuffer-next-completion`
(this puzzle is still unsolved).

> The `icomplete-in-buffer` functionality is very rough around the edges.
> I only implemented it as a kind of "proof of concept".  I think things
> like `corfu-mode` work much better (because they don't displace
> existing text in the buffer, they are just drawn on top of it).

Now `C-,` (icomplete-backward-completions) and `C-.` (icomplete-forward-completions)
work fine inline after `M-C-/`.  But typing `C-j` (icomplete-force-complete-and-exit)
erases the current buffer and replaces its contents with the selected completion.
Then it signals an error while trying to call `exit-minibuffer`.  It seems inline
completions need more work to be as smooth as in the minibuffer.

> [ To be honest, in my memory (from when I wrote the code), the list was
>   shown in the echo area rather than "inline".  ]

Maybe as an option inline completion could just activate the minibuffer
with initial input as a string under point from the original buffer.
This will allow to use normal completion in the minibuffer.  Then
exiting the minibuffer will replace the initial string with the string
returned from the minibuffer.




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

This bug report was last modified 1 year and 285 days ago.

Previous Next


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