* Lisp error when using M-x
@ 2021-01-10 20:38 wael-zwaiter
2021-01-10 20:42 ` wael-zwaiter
0 siblings, 1 reply; 11+ messages in thread
From: wael-zwaiter @ 2021-01-10 20:38 UTC (permalink / raw)
To: Help Gnu Emacs
Am getting a problem when hitting M-x, with the following error.
Debugger entered--Lisp error: (wrong-type-argument commandp counsel-M-x)
call-interactively(counsel-M-x nil nil)
command-execute(counsel-M-x)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Lisp error when using M-x
2021-01-10 20:38 Lisp error when using M-x wael-zwaiter
@ 2021-01-10 20:42 ` wael-zwaiter
2021-01-10 20:54 ` Óscar Fuentes
0 siblings, 1 reply; 11+ messages in thread
From: wael-zwaiter @ 2021-01-10 20:42 UTC (permalink / raw)
To: wael-zwaiter; +Cc: Help Gnu Emacs
The problem occurs with ivy as follows. How is best to have the keybindings?
(require 'ivy)
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq ivy-count-format "(%d/%d) ")
(global-set-key (kbd "C-s") 'swiper-isearch)
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "M-y") 'counsel-yank-pop)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
(global-set-key (kbd "<f1> l") 'counsel-find-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
(global-set-key (kbd "<f2> j") 'counsel-set-variable)
(global-set-key (kbd "C-x b") 'ivy-switch-buffer)
(global-set-key (kbd "C-c v") 'ivy-push-view)
(global-set-key (kbd "C-c V") 'ivy-pop-view) )
> Sent: Monday, January 11, 2021 at 8:38 AM
> From: wael-zwaiter@gmx.com
> To: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Lisp error when using M-x
>
> Am getting a problem when hitting M-x, with the following error.
>
> Debugger entered--Lisp error: (wrong-type-argument commandp counsel-M-x)
> call-interactively(counsel-M-x nil nil)
> command-execute(counsel-M-x)
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Lisp error when using M-x
2021-01-10 20:42 ` wael-zwaiter
@ 2021-01-10 20:54 ` Óscar Fuentes
2021-01-10 21:03 ` Stefan Monnier
0 siblings, 1 reply; 11+ messages in thread
From: Óscar Fuentes @ 2021-01-10 20:54 UTC (permalink / raw)
To: help-gnu-emacs
wael-zwaiter@gmx.com writes:
> The problem occurs with ivy as follows. How is best to have the keybindings?
>
> (require 'ivy)
> (ivy-mode 1)
> (setq ivy-use-virtual-buffers t)
> (setq ivy-count-format "(%d/%d) ")
>
> (global-set-key (kbd "C-s") 'swiper-isearch)
> (global-set-key (kbd "M-x") 'counsel-M-x)
Probably you need a (require 'counsel) and a (require 'swiper) as well
before those two lines.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Lisp error when using M-x
2021-01-10 20:54 ` Óscar Fuentes
@ 2021-01-10 21:03 ` Stefan Monnier
2021-01-10 21:10 ` wael-zwaiter
2021-01-10 21:17 ` wael-zwaiter
0 siblings, 2 replies; 11+ messages in thread
From: Stefan Monnier @ 2021-01-10 21:03 UTC (permalink / raw)
To: help-gnu-emacs
>> The problem occurs with ivy as follows. How is best to have the keybindings?
>>
>> (require 'ivy)
>> (ivy-mode 1)
How did you install `ivy`? The normal installation via `package.el`
should make the above `require` unnecessary.
>> (setq ivy-use-virtual-buffers t)
>> (setq ivy-count-format "(%d/%d) ")
>>
>> (global-set-key (kbd "C-s") 'swiper-isearch)
>> (global-set-key (kbd "M-x") 'counsel-M-x)
>
> Probably you need a (require 'counsel) and a (require 'swiper) as well
> before those two lines.
But shouldn't those packages's autoloads take care of that already?
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Lisp error when using M-x
2021-01-10 21:03 ` Stefan Monnier
@ 2021-01-10 21:10 ` wael-zwaiter
2021-01-10 21:17 ` wael-zwaiter
1 sibling, 0 replies; 11+ messages in thread
From: wael-zwaiter @ 2021-01-10 21:10 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
> Sent: Monday, January 11, 2021 at 9:03 AM
> From: "Stefan Monnier" <monnier@iro.umontreal.ca>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Lisp error when using M-x
>
> >> The problem occurs with ivy as follows. How is best to have the keybindings?
> >>
> >> (require 'ivy)
> >> (ivy-mode 1)
>
> How did you install `ivy`? The normal installation via `package.el`
> should make the above `require` unnecessary.
I am using ivy from source.
> >> (setq ivy-use-virtual-buffers t)
> >> (setq ivy-count-format "(%d/%d) ")
> >>
> >> (global-set-key (kbd "C-s") 'swiper-isearch)
> >> (global-set-key (kbd "M-x") 'counsel-M-x)
> >
> > Probably you need a (require 'counsel) and a (require 'swiper) as well
> > before those two lines.
>
> But shouldn't those packages's autoloads take care of that already?
If you say so
> Stefan
>
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Lisp error when using M-x
2021-01-10 21:03 ` Stefan Monnier
2021-01-10 21:10 ` wael-zwaiter
@ 2021-01-10 21:17 ` wael-zwaiter
2021-01-10 22:55 ` Óscar Fuentes
1 sibling, 1 reply; 11+ messages in thread
From: wael-zwaiter @ 2021-01-10 21:17 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
Have done
(global-unset-key (kbd "C-i"))
But, C-i is still doing TAB.
> Sent: Monday, January 11, 2021 at 9:03 AM
> From: "Stefan Monnier" <monnier@iro.umontreal.ca>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Lisp error when using M-x
>
> >> The problem occurs with ivy as follows. How is best to have the keybindings?
> >>
> >> (require 'ivy)
> >> (ivy-mode 1)
>
> How did you install `ivy`? The normal installation via `package.el`
> should make the above `require` unnecessary.
>
> >> (setq ivy-use-virtual-buffers t)
> >> (setq ivy-count-format "(%d/%d) ")
> >>
> >> (global-set-key (kbd "C-s") 'swiper-isearch)
> >> (global-set-key (kbd "M-x") 'counsel-M-x)
> >
> > Probably you need a (require 'counsel) and a (require 'swiper) as well
> > before those two lines.
>
> But shouldn't those packages's autoloads take care of that already?
>
>
> Stefan
>
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Lisp error when using M-x
2021-01-10 21:17 ` wael-zwaiter
@ 2021-01-10 22:55 ` Óscar Fuentes
2021-01-10 22:59 ` wael-zwaiter
0 siblings, 1 reply; 11+ messages in thread
From: Óscar Fuentes @ 2021-01-10 22:55 UTC (permalink / raw)
To: help-gnu-emacs
wael-zwaiter@gmx.com writes:
> Have done
>
> (global-unset-key (kbd "C-i"))
>
> But, C-i is still doing TAB.
IIRC a few key bindings are hard-coded. You can set the key binding to
something else, but you can't remove the "base" binding.
If you don't want C-i to do TAB, you can set the binding to a do-nothing
command:
(global-set-key (kbd "C-i") (lambda () (interactive)))
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Lisp error when using M-x
2021-01-10 22:55 ` Óscar Fuentes
@ 2021-01-10 22:59 ` wael-zwaiter
2021-01-10 23:33 ` Óscar Fuentes
2021-01-11 4:25 ` Robert Thorpe
0 siblings, 2 replies; 11+ messages in thread
From: wael-zwaiter @ 2021-01-10 22:59 UTC (permalink / raw)
To: Óscar Fuentes; +Cc: help-gnu-emacs
I want to use C-i for ivy related commands.
(global-set-key (kbd "C-i C-s") 'swiper)
(global-set-key (kbd "C-i C-r") 'ivy-resume)
(global-set-key (kbd "C-i C-i") 'ivy-resume)
(global-set-key (kbd "C-i M-x") 'counsel-M-x)
(global-set-key (kbd "C-i C-f") 'counsel-find-file)
> Sent: Monday, January 11, 2021 at 10:55 AM
> From: "Óscar Fuentes" <ofv@wanadoo.es>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Lisp error when using M-x
>
> wael-zwaiter@gmx.com writes:
>
> > Have done
> >
> > (global-unset-key (kbd "C-i"))
> >
> > But, C-i is still doing TAB.
>
> IIRC a few key bindings are hard-coded. You can set the key binding to
> something else, but you can't remove the "base" binding.
>
> If you don't want C-i to do TAB, you can set the binding to a do-nothing
> command:
>
> (global-set-key (kbd "C-i") (lambda () (interactive)))
>
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Lisp error when using M-x
2021-01-10 22:59 ` wael-zwaiter
@ 2021-01-10 23:33 ` Óscar Fuentes
2021-01-11 0:00 ` wael-zwaiter
2021-01-11 4:25 ` Robert Thorpe
1 sibling, 1 reply; 11+ messages in thread
From: Óscar Fuentes @ 2021-01-10 23:33 UTC (permalink / raw)
To: help-gnu-emacs
wael-zwaiter@gmx.com writes:
> I want to use C-i for ivy related commands.
>
> (global-set-key (kbd "C-i C-s") 'swiper)
> (global-set-key (kbd "C-i C-r") 'ivy-resume)
> (global-set-key (kbd "C-i C-i") 'ivy-resume)
> (global-set-key (kbd "C-i M-x") 'counsel-M-x)
> (global-set-key (kbd "C-i C-f") 'counsel-find-file)
For that you need to convert C-i to a prefix key. This seems to work:
(defvar cikm (make-keymap))
(global-set-key (kbd "C-i") cikm)
(global-set-key (kbd "C-i C-s") (lambda () (interactive) (message "hi!")))
Please note that Emacs has some guidelines about choosing keybindings:
some are reserved for users, some for external packages and some others
for Emacs itself.
See the "Key Bindings" node in the Emacs manual.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Lisp error when using M-x
2021-01-10 23:33 ` Óscar Fuentes
@ 2021-01-11 0:00 ` wael-zwaiter
0 siblings, 0 replies; 11+ messages in thread
From: wael-zwaiter @ 2021-01-11 0:00 UTC (permalink / raw)
To: Óscar Fuentes; +Cc: help-gnu-emacs
Hitting C-i it is still saying TAB.
> Sent: Monday, January 11, 2021 at 11:33 AM
> From: "Óscar Fuentes" <ofv@wanadoo.es>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Lisp error when using M-x
>
> wael-zwaiter@gmx.com writes:
>
> > I want to use C-i for ivy related commands.
> >
> > (global-set-key (kbd "C-i C-s") 'swiper)
> > (global-set-key (kbd "C-i C-r") 'ivy-resume)
> > (global-set-key (kbd "C-i C-i") 'ivy-resume)
> > (global-set-key (kbd "C-i M-x") 'counsel-M-x)
> > (global-set-key (kbd "C-i C-f") 'counsel-find-file)
>
> For that you need to convert C-i to a prefix key. This seems to work:
>
> (defvar cikm (make-keymap))
> (global-set-key (kbd "C-i") cikm)
> (global-set-key (kbd "C-i C-s") (lambda () (interactive) (message "hi!")))
>
> Please note that Emacs has some guidelines about choosing keybindings:
> some are reserved for users, some for external packages and some others
> for Emacs itself.
>
> See the "Key Bindings" node in the Emacs manual.
>
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Lisp error when using M-x
2021-01-10 22:59 ` wael-zwaiter
2021-01-10 23:33 ` Óscar Fuentes
@ 2021-01-11 4:25 ` Robert Thorpe
1 sibling, 0 replies; 11+ messages in thread
From: Robert Thorpe @ 2021-01-11 4:25 UTC (permalink / raw)
To: wael-zwaiter; +Cc: help-gnu-emacs
wael-zwaiter@gmx.com writes:
> I want to use C-i for ivy related commands.
>
> (global-set-key (kbd "C-i C-s") 'swiper)
> (global-set-key (kbd "C-i C-r") 'ivy-resume)
> (global-set-key (kbd "C-i C-i") 'ivy-resume)
> (global-set-key (kbd "C-i M-x") 'counsel-M-x)
> (global-set-key (kbd "C-i C-f") 'counsel-find-file)
Just a bit of general advice....
In Emacs if the keys beginning with C-c followed by an unescaped letter
are reserved for the user. For example "C-c a" or "C-c b". That prefix
is specifically for the user adding things. If you add thing there then
they certainly won't collide with other things. Note that the keys
beginning C-c and ending with another ctrl key are used by major modes.
So, although "C-c a" will always be free "C-c C-a" is probably used.
Secondly, if you want to use counsel then I suggest replacing the
standard keybindings. Replace M-x with counsel-M-x, there is no reason
to have both of them. The same is true of find-file, you may as well
just over-ride "C-x C-f" with counsel-find-file. So you may as well
just do:
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
This is what the Ivy/counsel/swiper manual suggests. Try it out and see
if you like it. If you don't you can go back to the original in-built
version or try out the other alternatives.
For the other keys I would do this:
(global-set-key (kbd "C-c s") 'swiper)
(global-set-key (kbd "C-c r") 'ivy-resume)
Lastly, if you want to use Emacs in a terminal emulator then there's a
problem with C-i. In a terminal emulator (or a linux console screen)
C-i and tab always do the same thing. So, if you press tab it will do
the same thing as C-i. In your case that means it'll run your prefix
key. So, there will be no way to press tab in the terminal. This is
not an Emacs problem, it's a problem of the interface between
terminal-emulators and programs. For some of these keys it can be fixed
by changing terminal configuration.
BR,
Robert Thorpe
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-01-11 4:25 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-10 20:38 Lisp error when using M-x wael-zwaiter
2021-01-10 20:42 ` wael-zwaiter
2021-01-10 20:54 ` Óscar Fuentes
2021-01-10 21:03 ` Stefan Monnier
2021-01-10 21:10 ` wael-zwaiter
2021-01-10 21:17 ` wael-zwaiter
2021-01-10 22:55 ` Óscar Fuentes
2021-01-10 22:59 ` wael-zwaiter
2021-01-10 23:33 ` Óscar Fuentes
2021-01-11 0:00 ` wael-zwaiter
2021-01-11 4:25 ` Robert Thorpe
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).