Re: Back out of minibuffer

2017-10-12 Thread Dmitry Alexandrov
>>> Is there a convenient way to make e.g. M-x followed by backspace exit
>>> the minibuffer -- similar to how colon (evil-ex) followed by backspace
>>> behaves? (I'm learning Emacs and Evil at the same time ...)
>>
>> Try with C-g (CTRL+g)[1]. C-g is also considered a proper way to abort
>> almost any running/typed command.
>
> Thank you, I did discover C-g -- I also bound [escape] to the same thing (as 
> follows) because of my existing
> habits:
>
>> (define-key minibuffer-local-must-match-map [escape] 'abort-recursive-edit)

No good.  ESC is handy sometimes as a sticky meta.  The best example is when 
you want to type ‘M-x keyboard-escape-quit’ — the exit command that is stronger 
than C-g (keyboard-quit).  Out of a box it’s on triple escape (ESC ESC ESC), 
you could type ‘M-ESC ESC’ instead, of course, but this is less convenient.

It is possible, by the way, to map it to double ESC without side-effects 
(almost), even globally:

| (define-key global-map (kbd "ESC ESC") #'keyboard-escape-quit)

> However I notice that I reflexively use backspace to exit the minibuffer -- 
> rather than unlearn, I'd like to
> teach Emacs to obey ... Is there a convenient way?

No idea, whether this qualify as a convenient way, but I cannot see a problem:

--8<---cut here---start->8---
(defun minibuffer-delete-backward-char-or-keyboard-quit (n  killflag)
  (interactive "p\nP")
  (if (= (point) (minibuffer-prompt-end))
  (minibuffer-keyboard-quit)
(delete-backward-char n killflag)))

(define-key minibuffer-local-map
  (kbd "DEL") #'minibuffer-delete-backward-char-or-keyboard-quit)
--8<---cut here---end--->8---

This acts as quit whenever you are DEL’ing through the left boundary, not only 
when the minibuffer is empty, so e. g. ‘M-x M-p DEL’ is also quit.  If you 
don’t like this, change (point) to (point-max).

___
implementations-list mailing list
implementations-list@lists.ourproject.org
https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list


Re: Back out of minibuffer

2017-10-04 Thread Sanel Zukan
Maybe to bind DEL/deletechar/backspace (backspace) key?

Best,
Sanel

Jack Bates  writes:
> Thank you, I did discover C-g -- I also bound [escape] to the same thing 
> (as follows) because of my existing habits:
>
>> (define-key minibuffer-local-must-match-map [escape] 'abort-recursive-edit)
>
> However I notice that I reflexively use backspace to exit the minibuffer 
> -- rather than unlearn, I'd like to teach Emacs to obey ... Is there a 
> convenient way?
>
> Thanks!
>
> On 02/10/17 03:57 PM, Sanel Zukan wrote:
>> Try with C-g (CTRL+g)[1]. C-g is also considered a proper way to abort
>> almost any running/typed command.
>> 
>> [1]
>> https://www.gnu.org/software/emacs/manual/html_node/emacs/Basic-Minibuffer.html
>> 
>> Best,
>> Sanel
>> 
>> Jack Bates  writes:
>>> Is there a convenient way to make e.g. M-x followed by backspace exit
>>> the minibuffer -- similar to how colon (evil-ex) followed by backspace
>>> behaves? (I'm learning Emacs and Evil at the same time ...)
>>>
>>> Thanks!
>>>
>>> ___
>>> implementations-list mailing list
>>> implementations-list@lists.ourproject.org
>>> https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list

___
implementations-list mailing list
implementations-list@lists.ourproject.org
https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list


Back out of minibuffer

2017-10-02 Thread Jack Bates
Is there a convenient way to make e.g. M-x followed by backspace exit 
the minibuffer -- similar to how colon (evil-ex) followed by backspace 
behaves? (I'm learning Emacs and Evil at the same time ...)


Thanks!

___
implementations-list mailing list
implementations-list@lists.ourproject.org
https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list