* zsh-like zcomplete-mode based on icomplete-mode
@ 2022-04-09 18:45 Juri Linkov
2022-04-09 20:30 ` Tassilo Horn
2022-04-10 1:05 ` Ergus
0 siblings, 2 replies; 14+ messages in thread
From: Juri Linkov @ 2022-04-09 18:45 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 509 bytes --]
Here is the first version of the mode with the behavior like in zsh,
but that is based on icomplete-mode. So many customizable variables
and commands were copied from icomplete-mode, but instead of displaying
completions as an overlay in the minibuffer, in zcomplete-mode
completions are displayed in the standard *Completions* window.
All other icomplete features are preserved in zcomplete, such as
typing in the minibuffer continuously updates a list of possible
completions that match the typed string:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: zcomplete-mode.patch --]
[-- Type: text/x-diff, Size: 7256 bytes --]
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 2986aa192c..1e6b11bbd1 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -1063,6 +1063,173 @@ icomplete-completions
;;;###autoload (make-obsolete 'iswitchb-mode
;;;###autoload "use `icomplete-mode' or `ido-mode' instead." "24.4"))
+(defgroup zcomplete nil
+ "Show completions dynamically in *Completions* window from minibuffer."
+ :prefix "zcomplete-"
+ :link '(info-link "(emacs)Zcomplete")
+ :group 'minibuffer)
+
+(defcustom zcomplete-show-matches-on-no-input nil
+ "When non-nil, show completions when first prompting for input.
+This means to show completions even when the current minibuffer contents
+is the same as was the initial input after minibuffer activation.
+This also means that if you traverse the list of completions with
+commands and just hit RET without typing any characters,
+the match under point will be chosen instead of the default."
+ :type 'boolean)
+
+(defcustom zcomplete-with-completion-tables t
+ "Specialized completion tables with which Zcomplete should operate.
+If this is t, Zcomplete operates on all tables.
+Otherwise this should be a list of the completion tables (e.g.,
+`internal-complete-buffer') on which Zcomplete should operate."
+ :type '(choice (const :tag "All" t)
+ (repeat function)))
+
+(defcustom zcomplete-compute-delay .15
+ "Completions-computation stall, used only with large-number completions.
+See `zcomplete-delay-completions-threshold'."
+ :type 'number)
+
+(defcustom zcomplete-delay-completions-threshold 400
+ "Pending-completions number over which to apply `zcomplete-compute-delay'."
+ :type 'integer)
+
+(defcustom zcomplete-max-delay-chars 2
+ "Maximum number of initial chars to apply `zcomplete-compute-delay'."
+ :type 'integer)
+
+(defcustom zcomplete-minibuffer-setup-hook nil
+ "Zcomplete-specific customization of minibuffer setup.
+This hook is run during minibuffer setup if Zcomplete is active."
+ :type 'hook)
+
+\f
+(defvar zcomplete--initial-input nil
+ "Initial input in the minibuffer when `zcomplete-mode' was activated.
+Used to implement the option `zcomplete-show-matches-on-no-input'.")
+
+(defun zcomplete-post-command-hook (_ _ _)
+ (let ((non-essential t)) ;E.g. don't prompt for password!
+ (zcomplete-exhibit)))
+
+(defvar-keymap zcomplete-minibuffer-map
+ :doc "Keymap used by `zcomplete-mode' in the minibuffer."
+ "<remap> <minibuffer-complete-and-exit>" #'zcomplete-ret
+ "<left>" #'minibuffer-previous-completion
+ "<right>" #'minibuffer-next-completion
+ "<up>" #'zcomplete-previous-line-completion
+ "<down>" #'zcomplete-next-line-completion)
+
+(defun zcomplete-ret ()
+ "Exit minibuffer for zcomplete."
+ (interactive)
+ (remove-hook 'after-change-functions #'zcomplete-post-command-hook t)
+ (if (get-buffer-window "*Completions*" 0)
+ (minibuffer-choose-completion)
+ (minibuffer-complete-and-exit)))
+
+(defun zcomplete-previous-line-completion (&optional n)
+ "Run `previous-line' from the minibuffer in its completions window."
+ (interactive "p")
+ (with-minibuffer-completions-window
+ (when completions-highlight-face
+ (setq-local cursor-face-highlight-nonselected-window t))
+ (previous-line n)))
+
+(defun zcomplete-next-line-completion (&optional n)
+ "Run `next-line' from the minibuffer in its completions window."
+ (interactive "p")
+ (with-minibuffer-completions-window
+ (when completions-highlight-face
+ (setq-local cursor-face-highlight-nonselected-window t))
+ (next-line n)))
+
+\f
+;;;###autoload
+(define-minor-mode zcomplete-mode
+ "Toggle incremental minibuffer completion (Zcomplete mode).
+
+When this global minor mode is enabled, typing in the minibuffer
+continuously displays a list of possible completions that match
+the string you have typed. The list of completions is displayed
+in the *Completions* window.
+
+For more information, see Info node `(emacs)Zcomplete'.
+For options you can set, `\\[customize-group] zcomplete'.
+
+You can use the following key bindings to navigate and select
+completions:
+
+\\{zcomplete-minibuffer-map}"
+ :global t :group 'zcomplete
+ (remove-hook 'minibuffer-setup-hook #'zcomplete-minibuffer-setup)
+ (when zcomplete-mode
+ (add-hook 'minibuffer-setup-hook #'zcomplete-minibuffer-setup)))
+
+(defun zcomplete--completion-table ()
+ (if (window-minibuffer-p) minibuffer-completion-table
+ (or (nth 2 completion-in-region--data)
+ (message "In %S (w=%S): %S"
+ (current-buffer) (selected-window) (window-minibuffer-p)))))
+(defun zcomplete--field-string ()
+ (if (window-minibuffer-p)
+ (minibuffer-contents)
+ (buffer-substring-no-properties
+ (nth 0 completion-in-region--data)
+ (nth 1 completion-in-region--data))))
+(defun zcomplete--field-beg ()
+ (if (window-minibuffer-p) (minibuffer-prompt-end)
+ (nth 0 completion-in-region--data)))
+(defun zcomplete--field-end ()
+ (if (window-minibuffer-p) (point-max)
+ (nth 1 completion-in-region--data)))
+
+(defun zcomplete-simple-completing-p ()
+ "Non-nil if current window is a minibuffer that's doing simple completion."
+ (unless executing-kbd-macro
+ (let ((table (zcomplete--completion-table)))
+ (and table
+ (or (not (functionp table))
+ (eq zcomplete-with-completion-tables t)
+ (member table zcomplete-with-completion-tables))))))
+
+(defun zcomplete-minibuffer-setup ()
+ "Run in minibuffer on activation to establish incremental completion.
+Usually run by inclusion in `minibuffer-setup-hook'."
+ (when zcomplete-mode
+ (setq-local zcomplete--initial-input (zcomplete--field-string))
+ (use-local-map (make-composed-keymap zcomplete-minibuffer-map
+ (current-local-map)))
+ (add-hook 'after-change-functions #'zcomplete-post-command-hook nil t)
+ (run-hooks 'zcomplete-minibuffer-setup-hook)))
+
+(defun zcomplete-exhibit ()
+ "Update Zcomplete completions display.
+Should be run via minibuffer `post-command-hook'.
+See `zcomplete-mode' and `minibuffer-setup-hook'."
+ (when (and zcomplete-mode
+ (zcomplete-simple-completing-p)) ;Shouldn't be necessary.
+ (when (and (or zcomplete-show-matches-on-no-input
+ (not (equal (zcomplete--field-string)
+ zcomplete--initial-input)))
+ (or
+ ;; Don't bother with delay after certain number of chars:
+ (> (- (point) (zcomplete--field-beg))
+ zcomplete-max-delay-chars)
+ ;; Don't delay if the completions are known.
+ completion-all-sorted-completions
+ ;; Don't delay if alternatives number is small enough:
+ (and (sequencep (zcomplete--completion-table))
+ (< (length (zcomplete--completion-table))
+ zcomplete-delay-completions-threshold))
+ ;; Delay - give some grace time for next keystroke, before
+ ;; embarking on computing completions:
+ (sit-for zcomplete-compute-delay)))
+ (save-excursion
+ (minibuffer-completion-help)
+ (minibuffer-next-completion)))))
+
(provide 'icomplete)
;;;_* Local emacs vars.
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: zsh-like zcomplete-mode based on icomplete-mode
2022-04-09 18:45 zsh-like zcomplete-mode based on icomplete-mode Juri Linkov
@ 2022-04-09 20:30 ` Tassilo Horn
2022-04-10 7:38 ` Juri Linkov
2022-04-10 1:05 ` Ergus
1 sibling, 1 reply; 14+ messages in thread
From: Tassilo Horn @ 2022-04-09 20:30 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
Juri Linkov <juri@linkov.net> writes:
Hi Juri,
> Here is the first version of the mode with the behavior like in zsh,
> but that is based on icomplete-mode.
I wanted to give it a try with emacs -Q but quickly ran in this error
after M-x and tying a bit:
--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
next-completion(nil)
minibuffer-next-completion()
zcomplete-exhibit()
zcomplete-post-command-hook(5 6 0)
self-insert-command(1 109)
funcall-interactively(self-insert-command 1 109)
command-execute(self-insert-command)
completing-read-default("M-x " #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_48> #f(compiled-function (sym) #<bytecode -0x1e728887bf4ede31>) t nil extended-command-history nil nil)
read-extended-command()
byte-code("\302\30\11\303 \10E)\207" [execute-extended-command--last-typed current-prefix-arg nil read-extended-command] 3)
command-execute(execute-extended-command)
--8<---------------cut here---------------end--------------->8---
Same for C-x b.
--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
next-completion(nil)
minibuffer-next-completion()
zcomplete-exhibit()
zcomplete-post-command-hook(43 44 0)
self-insert-command(1 115)
funcall-interactively(self-insert-command 1 115)
command-execute(self-insert-command)
completing-read-default("Switch to buffer (default *Completions*): " internal-complete-buffer nil confirm-after-completion nil buffer-name-history "*Completions*" nil)
read-buffer-to-switch("Switch to buffer: ")
byte-code("\10?\205H\0\302 \203\16\0\303\202H\0\304 \305=\204\31\0\306\202H\0\11\307\267\202B\0\310\311!\202H\0\312\313\314\315 \"!\2038\0\316\303\211..." [switch-to-buffer-obey-display-actions switch-to-buffer-in-dedicated-window window-minibuffer-p nil window-dedicated-p t force-same-window #<hash-table eq 3/3 0x1fcfac3bff6d> user-error "Cannot switch buffers in a dedicated window" y-or-n-p format "Window is dedicated to %s; undedicate it?" window-buffer set-window-dedicated-p read-buffer-to-switch "Switch to buffer: "] 4)
command-execute(switch-to-buffer)
--8<---------------cut here---------------end--------------->8---
Bye,
Tassilo
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: zsh-like zcomplete-mode based on icomplete-mode
2022-04-09 18:45 zsh-like zcomplete-mode based on icomplete-mode Juri Linkov
2022-04-09 20:30 ` Tassilo Horn
@ 2022-04-10 1:05 ` Ergus
2022-04-10 7:38 ` Juri Linkov
1 sibling, 1 reply; 14+ messages in thread
From: Ergus @ 2022-04-10 1:05 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
On Sat, Apr 09, 2022 at 09:45:14PM +0300, Juri Linkov wrote:
>Here is the first version of the mode with the behavior like in zsh,
>but that is based on icomplete-mode. So many customizable variables
>and commands were copied from icomplete-mode, but instead of displaying
>completions as an overlay in the minibuffer, in zcomplete-mode
>completions are displayed in the standard *Completions* window.
>All other icomplete features are preserved in zcomplete, such as
>typing in the minibuffer continuously updates a list of possible
>completions that match the typed string:
>
Hi Juri:
After the first completion I get this:
minibuffer-next-completion: Wrong type argument: number-or-marker-p, nil
And it stops working...
SO I need something special?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: zsh-like zcomplete-mode based on icomplete-mode
2022-04-09 20:30 ` Tassilo Horn
@ 2022-04-10 7:38 ` Juri Linkov
2022-04-10 9:12 ` Tassilo Horn
0 siblings, 1 reply; 14+ messages in thread
From: Juri Linkov @ 2022-04-10 7:38 UTC (permalink / raw)
To: Tassilo Horn; +Cc: emacs-devel
>> Here is the first version of the mode with the behavior like in zsh,
>> but that is based on icomplete-mode.
>
> I wanted to give it a try with emacs -Q but quickly ran in this error
> after M-x and tying a bit:
>
> Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
> next-completion(nil)
> minibuffer-next-completion()
Sorry, I had a fix not pushed to master, now pushed.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: zsh-like zcomplete-mode based on icomplete-mode
2022-04-10 1:05 ` Ergus
@ 2022-04-10 7:38 ` Juri Linkov
2022-04-10 10:41 ` Ergus
0 siblings, 1 reply; 14+ messages in thread
From: Juri Linkov @ 2022-04-10 7:38 UTC (permalink / raw)
To: Ergus; +Cc: emacs-devel
>>Here is the first version of the mode with the behavior like in zsh,
>>but that is based on icomplete-mode. So many customizable variables
>>and commands were copied from icomplete-mode, but instead of displaying
>>completions as an overlay in the minibuffer, in zcomplete-mode
>>completions are displayed in the standard *Completions* window.
>>All other icomplete features are preserved in zcomplete, such as
>>typing in the minibuffer continuously updates a list of possible
>>completions that match the typed string:
>
> After the first completion I get this:
>
> minibuffer-next-completion: Wrong type argument: number-or-marker-p, nil
>
> And it stops working...
>
> SO I need something special?
I pushed a fix to master, please try again.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: zsh-like zcomplete-mode based on icomplete-mode
2022-04-10 7:38 ` Juri Linkov
@ 2022-04-10 9:12 ` Tassilo Horn
2022-04-10 16:31 ` [External] : " Drew Adams
2022-04-10 19:11 ` Juri Linkov
0 siblings, 2 replies; 14+ messages in thread
From: Tassilo Horn @ 2022-04-10 9:12 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
Juri Linkov <juri@linkov.net> writes:
>> Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
>> next-completion(nil)
>> minibuffer-next-completion()
>
> Sorry, I had a fix not pushed to master, now pushed.
Works now. It's quite nice. I'm not sure if it is expected that with
zcomplete-show-matches-on-no-input enabled, there are no *Completions*
shown initially. For example with C-x C-f, it would be nice to
immediately see the contents of the current directory.
Bye,
Tassilo
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: zsh-like zcomplete-mode based on icomplete-mode
2022-04-10 7:38 ` Juri Linkov
@ 2022-04-10 10:41 ` Ergus
2022-04-10 16:34 ` [External] : " Drew Adams
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Ergus @ 2022-04-10 10:41 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
On Sun, Apr 10, 2022 at 10:38:58AM +0300, Juri Linkov wrote:
>>>Here is the first version of the mode with the behavior like in zsh,
>>>but that is based on icomplete-mode. So many customizable variables
>>>and commands were copied from icomplete-mode, but instead of displaying
>>>completions as an overlay in the minibuffer, in zcomplete-mode
>>>completions are displayed in the standard *Completions* window.
>>>All other icomplete features are preserved in zcomplete, such as
>>>typing in the minibuffer continuously updates a list of possible
>>>completions that match the typed string:
>>
>> After the first completion I get this:
>>
>> minibuffer-next-completion: Wrong type argument: number-or-marker-p, nil
>>
>> And it stops working...
>>
>> SO I need something special?
>
>I pushed a fix to master, please try again.
>
Ok, now it works better... But this is not zsh completion anymore ;) The
dynamic table auto-refresh is nice for people who like icomplete/ido but
it is a different use case and after a while it starts becoming annoying
for quick uses... but this is a personal preference probably.
On the other hand I cannot use the up and down arrows anymore for search
in the history with commands like previous-complete-history-element
There is a detail when completion-format is one-column and it is when
using zcomplete-previous-line-completion, some candidates are not
highlighted... when we go to the last candidate and return... It seems
like the cursor goes at the end of the candidate where the face-cursor
is not set.
I will continue testing.
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [External] : Re: zsh-like zcomplete-mode based on icomplete-mode
2022-04-10 9:12 ` Tassilo Horn
@ 2022-04-10 16:31 ` Drew Adams
2022-04-10 19:11 ` Juri Linkov
1 sibling, 0 replies; 14+ messages in thread
From: Drew Adams @ 2022-04-10 16:31 UTC (permalink / raw)
To: Tassilo Horn, Juri Linkov; +Cc: emacs-devel@gnu.org
> I'm not sure if it is expected that with
> zcomplete-show-matches-on-no-input enabled,
> there are no *Completions* shown initially.
> For example with C-x C-f, it would be nice to
> immediately see the contents of the current directory.
I mentioned that (1) different users have different
preferences about this, and (2) it's possible to
have different preferences for different commands
(which is likely why you cited `C-x C-f').
Icicles provides user options for this, and it
lets commands provide appropriate default behavior.
E.g., a command that essentially uses *Completions*
as a menu can show that initially (and nevertheless
also be able to change that "menu" based on user
minibuffer input (pattern filtering).
There is no reasonable one-size-fits-all. There
can be a reasonable default behavior. There need
to be user knobs to control the behavior according
to preference - and preference not only in general
but even wrt particular commands and particular
contexts.
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [External] : Re: zsh-like zcomplete-mode based on icomplete-mode
2022-04-10 10:41 ` Ergus
@ 2022-04-10 16:34 ` Drew Adams
2022-04-10 19:16 ` Juri Linkov
2022-04-12 17:15 ` Juri Linkov
2 siblings, 0 replies; 14+ messages in thread
From: Drew Adams @ 2022-04-10 16:34 UTC (permalink / raw)
To: Ergus, Juri Linkov; +Cc: emacs-devel@gnu.org
> On the other hand I cannot use the up and down arrows
> anymore for search in the history with commands like
> previous-complete-history-element
Different keys need to be provided for cycling candidates
and cycling search-history elements. That's all.
And there can be other sequences of things to cycle
among, requiring still other next/previous key pairs.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: zsh-like zcomplete-mode based on icomplete-mode
2022-04-10 9:12 ` Tassilo Horn
2022-04-10 16:31 ` [External] : " Drew Adams
@ 2022-04-10 19:11 ` Juri Linkov
1 sibling, 0 replies; 14+ messages in thread
From: Juri Linkov @ 2022-04-10 19:11 UTC (permalink / raw)
To: Tassilo Horn; +Cc: emacs-devel
> Works now. It's quite nice. I'm not sure if it is expected that with
> zcomplete-show-matches-on-no-input enabled, there are no *Completions*
> shown initially. For example with C-x C-f, it would be nice to
> immediately see the contents of the current directory.
There are no completions shown initially because after adapting
icomplete-mode I removed the hook 'post-command-hook'
that is the workhorse of icomplete-mode and that is
called initially to handle no input, and replaced it
with the hook 'after-change-functions' because only
changes on the minibuffer should affect the shown
completions. So an additional call of zcomplete-exhibit
should be added to the end of zcomplete-minibuffer-setup.
Maybe these fixes should be applied to a new branch.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: zsh-like zcomplete-mode based on icomplete-mode
2022-04-10 10:41 ` Ergus
2022-04-10 16:34 ` [External] : " Drew Adams
@ 2022-04-10 19:16 ` Juri Linkov
2022-04-10 21:45 ` Ergus
2022-04-12 17:15 ` Juri Linkov
2 siblings, 1 reply; 14+ messages in thread
From: Juri Linkov @ 2022-04-10 19:16 UTC (permalink / raw)
To: Ergus; +Cc: emacs-devel
> Ok, now it works better... But this is not zsh completion anymore ;) The
> dynamic table auto-refresh is nice for people who like icomplete/ido but
> it is a different use case and after a while it starts becoming annoying
> for quick uses... but this is a personal preference probably.
zsh does the same when configured with
zstyle ':completion:*' menu select interactive
So we should have a variable to enable/disable interactive auto-refresh.
> On the other hand I cannot use the up and down arrows anymore for search
> in the history with commands like previous-complete-history-element
Another variable could provide at least 3 choices:
1. never enable arrows, then use only special keys like
in icomplete-mode C-./C-, but this is not quite convenient;
2. always enable arrows like in icomplete-vertical-mode,
but this disables history navigation;
3. enable arrows only when the Completions window is displayed,
this assumes that auto-refresh is disabled, otherwise
the Completions window is displayed almost always.
> There is a detail when completion-format is one-column and it is when
> using zcomplete-previous-line-completion, some candidates are not
> highlighted... when we go to the last candidate and return... It seems
> like the cursor goes at the end of the candidate where the face-cursor
> is not set.
This looks like bug#54374.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: zsh-like zcomplete-mode based on icomplete-mode
2022-04-10 19:16 ` Juri Linkov
@ 2022-04-10 21:45 ` Ergus
2022-04-11 16:53 ` Juri Linkov
0 siblings, 1 reply; 14+ messages in thread
From: Ergus @ 2022-04-10 21:45 UTC (permalink / raw)
To: Juri Linkov; +Cc: emacs-devel
On Sun, Apr 10, 2022 at 10:16:10PM +0300, Juri Linkov wrote:
>> Ok, now it works better... But this is not zsh completion anymore ;) The
>> dynamic table auto-refresh is nice for people who like icomplete/ido but
>> it is a different use case and after a while it starts becoming annoying
>> for quick uses... but this is a personal preference probably.
>
>zsh does the same when configured with
>
> zstyle ':completion:*' menu select interactive
>
Yes we already mention that, but such behavior is not the default, wo
when we say zsh behavior, that's not usually what a zsh user expects.
>So we should have a variable to enable/disable interactive auto-refresh.
>
>> On the other hand I cannot use the up and down arrows anymore for search
>> in the history with commands like previous-complete-history-element
>
>Another variable could provide at least 3 choices:
>
>1. never enable arrows, then use only special keys like
> in icomplete-mode C-./C-, but this is not quite convenient;
>
This will be like not having the zcomplete-mode enabled right?
>2. always enable arrows like in icomplete-vertical-mode,
> but this disables history navigation;
>
>3. enable arrows only when the Completions window is displayed,
> this assumes that auto-refresh is disabled, otherwise
> the Completions window is displayed almost always.
>
This is in my opinion the only real zsh like behavior. If completions
are not visible, it does not make sense to enable arrow navigation.
>> There is a detail when completion-format is one-column and it is when
>> using zcomplete-previous-line-completion, some candidates are not
>> highlighted... when we go to the last candidate and return... It seems
>> like the cursor goes at the end of the candidate where the face-cursor
>> is not set.
>
>This looks like bug#54374.
No, this only happens with the minibuffer navigation... with normal
navigation in completions there is not issue for me.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: zsh-like zcomplete-mode based on icomplete-mode
2022-04-10 21:45 ` Ergus
@ 2022-04-11 16:53 ` Juri Linkov
0 siblings, 0 replies; 14+ messages in thread
From: Juri Linkov @ 2022-04-11 16:53 UTC (permalink / raw)
To: Ergus; +Cc: emacs-devel
>> 1. never enable arrows, then use only special keys like
>> in icomplete-mode C-./C-, but this is not quite convenient;
>
> This will be like not having the zcomplete-mode enabled right?
Right, when it's not enabled, then M-up and M-down will do the same.
BTW, now I added a new custom 'minibuffer-completion-auto-choose'
instead of two sets of commands for the default use.
>> 2. always enable arrows like in icomplete-vertical-mode,
>> but this disables history navigation;
>>
>> 3. enable arrows only when the Completions window is displayed,
>> this assumes that auto-refresh is disabled, otherwise
>> the Completions window is displayed almost always.
>
> This is in my opinion the only real zsh like behavior. If completions
> are not visible, it does not make sense to enable arrow navigation.
Agreed. However, there is a technical problem: when :filter returns nil,
then <up> in the minibuffer falls back to the global binding `previous-line'
instead of the minibuffer history command. This needs debugging.
>>> There is a detail when completion-format is one-column and it is when
>>> using zcomplete-previous-line-completion, some candidates are not
>>> highlighted... when we go to the last candidate and return... It seems
>>> like the cursor goes at the end of the candidate where the face-cursor
>>> is not set.
>>
>> This looks like bug#54374.
>
> No, this only happens with the minibuffer navigation... with normal
> navigation in completions there is not issue for me.
Strange, I don't see this problem.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: zsh-like zcomplete-mode based on icomplete-mode
2022-04-10 10:41 ` Ergus
2022-04-10 16:34 ` [External] : " Drew Adams
2022-04-10 19:16 ` Juri Linkov
@ 2022-04-12 17:15 ` Juri Linkov
2 siblings, 0 replies; 14+ messages in thread
From: Juri Linkov @ 2022-04-12 17:15 UTC (permalink / raw)
To: Ergus; +Cc: emacs-devel
> There is a detail when completion-format is one-column and it is when
> using zcomplete-previous-line-completion, some candidates are not
> highlighted... when we go to the last candidate and return... It seems
> like the cursor goes at the end of the candidate where the face-cursor
> is not set.
This is because zcomplete-previous-line-completion is underdeveloped.
Some candidates are not highlighted when point moves to a line
without completions.
Ideally, it should be implemented in minibuffer.el, so up/down arrows
should wrap to the top/bottom of the current column like in zsh.
Patches welcome.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2022-04-12 17:15 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-09 18:45 zsh-like zcomplete-mode based on icomplete-mode Juri Linkov
2022-04-09 20:30 ` Tassilo Horn
2022-04-10 7:38 ` Juri Linkov
2022-04-10 9:12 ` Tassilo Horn
2022-04-10 16:31 ` [External] : " Drew Adams
2022-04-10 19:11 ` Juri Linkov
2022-04-10 1:05 ` Ergus
2022-04-10 7:38 ` Juri Linkov
2022-04-10 10:41 ` Ergus
2022-04-10 16:34 ` [External] : " Drew Adams
2022-04-10 19:16 ` Juri Linkov
2022-04-10 21:45 ` Ergus
2022-04-11 16:53 ` Juri Linkov
2022-04-12 17:15 ` 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).