unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#45767: icomplete-in-buffer completion does not work with dabbrev-completion
@ 2021-01-10 12:37 simon254--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-05-06 19:04 ` bug#45767: bug#45768: icomplete-mode does not provide in region completion for dabbrev-completion Lars Ingebrigtsen
  0 siblings, 1 reply; 11+ messages in thread
From: simon254--- via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-01-10 12:37 UTC (permalink / raw)
  To: 45767

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





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

* bug#45767: bug#45768: icomplete-mode does not provide in region completion for dabbrev-completion
  2021-01-10 12:37 bug#45767: icomplete-in-buffer completion does not work with dabbrev-completion simon254--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-05-06 19:04 ` Lars Ingebrigtsen
  2022-05-06 19:38   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-05-08 18:08   ` bug#45768: " Juri Linkov
  0 siblings, 2 replies; 11+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-06 19:04 UTC (permalink / raw)
  To: simon254; +Cc: 45768, Stefan Monnier, 45767

simon254@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





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

* bug#45767: bug#45768: icomplete-mode does not provide in region completion for dabbrev-completion
  2022-05-06 19:04 ` bug#45767: bug#45768: icomplete-mode does not provide in region completion for dabbrev-completion Lars Ingebrigtsen
@ 2022-05-06 19:38   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-05-07 10:16     ` Lars Ingebrigtsen
  2022-05-08 18:08   ` bug#45768: " Juri Linkov
  1 sibling, 1 reply; 11+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-05-06 19:38 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 45768, simon254, 45767

Lars Ingebrigtsen [2022-05-06 21:04:18] wrote:

> simon254@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






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

* bug#45767: bug#45768: icomplete-mode does not provide in region completion for dabbrev-completion
  2022-05-06 19:38   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-05-07 10:16     ` Lars Ingebrigtsen
  2022-05-07 14:22       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-07 10:16 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 45768, simon254, 45767

Stefan Monnier <monnier@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





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

* bug#45767: bug#45768: icomplete-mode does not provide in region completion for dabbrev-completion
  2022-05-07 10:16     ` Lars Ingebrigtsen
@ 2022-05-07 14:22       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-05-07 15:51         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-05-07 14:22 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 45768, simon254, 45767

Lars Ingebrigtsen [2022-05-07 12:16:16] wrote:
> Stefan Monnier <monnier@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






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

* bug#45767: bug#45768: icomplete-mode does not provide in region completion for dabbrev-completion
  2022-05-07 14:22       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-05-07 15:51         ` Lars Ingebrigtsen
  0 siblings, 0 replies; 11+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-07 15:51 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 45768, simon254, 45767

Stefan Monnier <monnier@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





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

* bug#45768: bug#45767: bug#45768: icomplete-mode does not provide in region completion for dabbrev-completion
  2022-05-06 19:04 ` bug#45767: bug#45768: icomplete-mode does not provide in region completion for dabbrev-completion Lars Ingebrigtsen
  2022-05-06 19:38   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-05-08 18:08   ` Juri Linkov
  2022-05-09  9:47     ` Lars Ingebrigtsen
  1 sibling, 1 reply; 11+ messages in thread
From: Juri Linkov @ 2022-05-08 18:08 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 45768, simon254, Stefan Monnier, 45767

>> (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?





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

* bug#45767: bug#45768: icomplete-mode does not provide in region completion for dabbrev-completion
  2022-05-08 18:08   ` bug#45768: " Juri Linkov
@ 2022-05-09  9:47     ` Lars Ingebrigtsen
  2022-05-09 18:41       ` Juri Linkov
  0 siblings, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-09  9:47 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 45768, simon254, Stefan Monnier, 45767

Juri Linkov <juri@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





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

* bug#45767: bug#45768: icomplete-mode does not provide in region completion for dabbrev-completion
  2022-05-09  9:47     ` Lars Ingebrigtsen
@ 2022-05-09 18:41       ` Juri Linkov
  2022-05-09 21:23         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 11+ messages in thread
From: Juri Linkov @ 2022-05-09 18:41 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 45768, simon254, Stefan Monnier, 45767

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





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

* bug#45767: bug#45768: icomplete-mode does not provide in region completion for dabbrev-completion
  2022-05-09 18:41       ` Juri Linkov
@ 2022-05-09 21:23         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-05-19 16:58           ` Juri Linkov
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-05-09 21:23 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 45768, Lars Ingebrigtsen, simon254, 45767

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






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

* bug#45767: bug#45768: icomplete-mode does not provide in region completion for dabbrev-completion
  2022-05-09 21:23         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-05-19 16:58           ` Juri Linkov
  0 siblings, 0 replies; 11+ messages in thread
From: Juri Linkov @ 2022-05-19 16:58 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 45768, Lars Ingebrigtsen, simon254, 45767

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





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

end of thread, other threads:[~2022-05-19 16:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-10 12:37 bug#45767: icomplete-in-buffer completion does not work with dabbrev-completion simon254--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-06 19:04 ` bug#45767: bug#45768: icomplete-mode does not provide in region completion for dabbrev-completion Lars Ingebrigtsen
2022-05-06 19:38   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-07 10:16     ` Lars Ingebrigtsen
2022-05-07 14:22       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-07 15:51         ` Lars Ingebrigtsen
2022-05-08 18:08   ` bug#45768: " Juri Linkov
2022-05-09  9:47     ` Lars Ingebrigtsen
2022-05-09 18:41       ` Juri Linkov
2022-05-09 21:23         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-19 16:58           ` Juri Linkov

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