emacs-zlc
emacs-zlc copied to clipboard
After using zlc, history in minibuffer will be unable to use.
When opening a minibuffer (ex:M-x), you can use [up/down] to get previous commands, directories, files....etc.
However zlc will make this function unable to work. When press M-x and [up/down], it appears "No buffer named Completions" or "Args out of range: 5, 20"...etc.
(I installed zlc by add these to my .emacs)
;;Zsh style completetion!
(add-to-list 'load-path "~/.emacs.d/lisps/emacs-zlc-master/")
(require 'zlc)
(let ((map minibuffer-local-map))
;;; like menu select
(define-key map (kbd "<down>") 'zlc-select-next-vertical)
(define-key map (kbd "<up>") 'zlc-select-previous-vertical)
(define-key map (kbd "<right>") 'zlc-select-next)
(define-key map (kbd "<left>") 'zlc-select-previous)
;;; reset selection
(define-key map (kbd "C-c") 'zlc-reset)
)
OK, I guess that the cause of your problem is in your .emacs
file. Does your .emacs
override the key definition of (kbd "<down>")
and (kbd "<up>")
in minibuffer-local-map
? In other words, does it have settings like the following example?
(let ((map minibuffer-local-map))
;;; like menu select
(define-key map (kbd "<down>") 'zlc-select-next-vertical)
(define-key map (kbd "<up>") 'zlc-select-previous-vertical)
)
If your .emacs
does have it, remove it. If doesn't, it's a problem in zlc.el
. Try the latest zlc.el
and check if the problem is solved.
Anyway, adding the following settings will solve your problem, though this is not a good way.
(let ((map minibuffer-local-map))
(define-key map (kbd "<down>") 'next-history-element)
(define-key map (kbd "<up>") 'previous-history-element)
)
- Sorry, I forgot to say that zlc's completion works well in C-x C-f, but have problems in other conditions, such as M-x.
- No, my .emacs doesn't contain the setting like that at all. (though I don't sure if I've installed any .el related to this...)
- Has zlc been updated in these 2 days? I don't know why I just downloaded latest zlc.el from Github and installed, (i) zlc became unusable at all (the highlight selected bar didn't appear.As press [up/down] it gets message like "Args out of range: 0, 5")... (ii) M-x history became unavailable, too.
Thanks for the detailed information.
No, my .emacs doesn't contain the setting like that at all.
I found a suspicious part in your setting that you showed on your first post. If your config include the following settings,
(let ((map minibuffer-local-map))
;;; like menu select
(define-key map (kbd "<down>") 'zlc-select-next-vertical)
(define-key map (kbd "<up>") 'zlc-select-previous-vertical)
(define-key map (kbd "<right>") 'zlc-select-next)
(define-key map (kbd "<left>") 'zlc-select-previous)
;;; reset selection
(define-key map (kbd "C-c") 'zlc-reset)
)
then, remove settings related to (kbd "<down>")
and (kbd "<up>")
as follows.
(let ((map minibuffer-local-map))
;;; like menu select
(define-key map (kbd "<right>") 'zlc-select-next)
(define-key map (kbd "<left>") 'zlc-select-previous)
;;; reset selection
(define-key map (kbd "C-c") 'zlc-reset)
)
Has zlc been updated in these 2 days?
The last update of zlc is about a month ago. It contains a change that breaks the backward-compatibility: now you have to enable the zlc explicitly after requiring it, as follows.
(require 'zlc)
(zlc-mode t)
So, in summary, I hope that by changing your zlc-related settings to the following one will solve your problem.
(add-to-list 'load-path "~/.emacs.d/lisps/emacs-zlc-master/")
(require 'zlc)
(zlc-mode t)
(let ((map minibuffer-local-map))
;;; like menu select
(define-key map (kbd "<right>") 'zlc-select-next)
(define-key map (kbd "<left>") 'zlc-select-previous)
;;; reset selection
(define-key map (kbd "C-c") 'zlc-reset)
)
If it won't solve your problem, give me the following two additional information.
- The result of
M-x emacs-version
(C-u M-x emacs-version
at*scratch*
bufffer to retrieve the result easily) - The value of
minibuffer-local-map
Thank for patiently and detailed reply. A.After removing these two lines indeed solve "some" problems :
(define-key map (kbd "<down>") 'zlc-select-next-vertical)
(define-key map (kbd "<up>") 'zlc-select-previous-vertical)
But: (i) zlc's completions become quite inconvenient when vertically selecting. (ii) M-x still have problem when I press [left/right] for correcting mistakes.
B.
GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-09-22 on batsu, modified by Debian
minibuffer-local-map is a variable defined in `C source code'.
Its value is shown below.
This variable is potentially risky when used as a file local variable.
Documentation:
Default keymap to use when reading from the minibuffer.
Value: (keymap
(18 . helm-minibuffer-history)
(3 . zlc-reset)
(left . zlc-select-previous)
(right . zlc-select-next)
(S-tab . zlc-select-previous)
(backtab . zlc-select-previous)
(menu-bar keymap
(minibuf "Minibuf" keymap
(previous menu-item "Previous History Item" previous-history-element :help "Put previous minibuffer history element in the minibuffer")
(next menu-item "Next History Item" next-history-element :help "Put next minibuffer history element in the minibuffer")
(isearch-backward menu-item "Isearch History Backward" isearch-backward :help "Incrementally search minibuffer history backward")
(isearch-forward menu-item "Isearch History Forward" isearch-forward :help "Incrementally search minibuffer history forward")
(return menu-item "Enter" exit-minibuffer :key-sequence "
" :help "Terminate input and exit minibuffer")
(quit menu-item "Quit" abort-recursive-edit :help "Abort input and exit minibuffer")
"Minibuf"))
(10 . exit-minibuffer)
(13 . exit-minibuffer)
(7 . abort-recursive-edit)
(C-tab . file-cache-minibuffer-complete)
(9 . self-insert-command)
(up . zlc-select-previous-vertical)
(prior . previous-history-element)
(down . zlc-select-next-vertical)
(next . next-history-element)
(27 keymap
(114 . previous-matching-history-element)
(115 . next-matching-history-element)
(112 . previous-history-element)
(110 . next-history-element)))
C. And I just found a slightly strange repeatable (at least with my Emacs)...question(?), which I don't know if it make sense for debugging.
1. Quit Emacs.
2. Run Emacs.
3. C-x C-f [up/down] => save-current-buffer: No buffer named *Completions* (After this, [Tab] cannot use and echo "Args out of range: 0, 14")
4. C-g C-g C-g
5. C-x C-f [left/right] =>zlc--do-select: Args out of range: 0, 14 (After this, [Tab] cannot use and echo "Args out of range: 0, 14", too.)
6. C-g C-g C-g
7. C-x C-f [Tab] => completions list appears, zlc works perfect (and [up/down/left/right] are ok).
8. C-g C-g C-g`
9. C-x C-f [up/down] =>Strangly, minibuffer output the results in the order of the completions list, instead of history.
Well...I upgrade my Emacs23 to 24.2, but this question still exist. I've disabled zlc.el temporarily at first. Nevertheless, I realized soon that I can't bear an Emacs without zlc.el (汗...)
So I enabled zlc.el, adding following to .emacs
(define-key minibuffer-local-must-match-map "\C-p" 'previous-history-element)
(define-key minibuffer-local-must-match-map "\C-n" 'next-history-element)
(define-key minibuffer-local-completion-map "\C-p" 'previous-history-element)
(define-key minibuffer-local-completion-map "\C-n" 'next-history-element)
(define-key minibuffer-local-map "\C-p" 'previous-history-element)
(define-key minibuffer-local-map "\C-n" 'next-history-element)
...And [up/down/left/right] are used in zlc completions; [C-p/M-p/C-n/M-n] in history.
This is absolutely not a good or smart solution, but it works at least. =w="
(By the way, I've try Icicles.el, but I dislike its overdone "enhancement" which lack of customizing spaces. For example, M-x cannot use history at all, it become "M-x M-h")
OK, I think I understand your problem; You want arrow keys (<up>
, <down>
, <left>
, and <right>
) to behave in minibuffer
- as original minibuffer behavior (e.g., history-selection), if completion lists are not displayed, and
- as zlc selection movement, if completion lists are displayed.
This is a missing feature for current zlc.el, and I think it should be implemented.
I'll tackle with this issue by making zlc-minor-mode
. Wait for further reports :pray:
How's this going? I just ran into the same issue.