all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Making a key binding work in minibuffer editing.
@ 2021-09-02 12:43 Perry E. Metzger
  2021-09-02 15:45 ` Stephen Berman
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Perry E. Metzger @ 2021-09-02 12:43 UTC (permalink / raw)
  To: emacs-devel

Howdy! So I'm reasonably happy with the (kludgy) way I've handled my ad 
hoc input method, but it doesn't work inside minibuffers because my 
magic keypress is handed by a global keymap entry and that doesn't seem 
to cover the minibuffer:

(define-key (current-global-map) (kbd "<f19>")
   (lambda (n)
     (interactive "p")
     (setq unread-input-method-events
           (append unread-input-method-events '(?¤)))))

Is there a keymap I can add this to which will also cover editing in 
minibuffers, so I can use my weird input method in isearch and that sort 
of thing as well?


Perry




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

* Re: Making a key binding work in minibuffer editing.
  2021-09-02 12:43 Making a key binding work in minibuffer editing Perry E. Metzger
@ 2021-09-02 15:45 ` Stephen Berman
  2021-09-02 18:14   ` Perry E. Metzger
  2021-09-02 15:48 ` [External] : " Drew Adams
  2021-09-02 19:28 ` Stefan Monnier
  2 siblings, 1 reply; 8+ messages in thread
From: Stephen Berman @ 2021-09-02 15:45 UTC (permalink / raw)
  To: Perry E. Metzger; +Cc: emacs-devel

On Thu, 2 Sep 2021 08:43:22 -0400 "Perry E. Metzger" <perry@piermont.com> wrote:

> Howdy! So I'm reasonably happy with the (kludgy) way I've handled my ad hoc
> input method, but it doesn't work inside minibuffers because my magic keypress
> is handed by a global keymap entry and that doesn't seem to cover the
> minibuffer:
>
> (define-key (current-global-map) (kbd "<f19>")
>   (lambda (n)
>     (interactive "p")
>     (setq unread-input-method-events
>           (append unread-input-method-events '(?¤)))))
>
> Is there a keymap I can add this to which will also cover editing in
> minibuffers, so I can use my weird input method in isearch and that sort of
> thing as well?

I'm don't know about a keymap per se, but maybe this will do:

  read-multilingual-string is a compiled Lisp function in
  ‘<emacs>/lisp/international/mule-cmds.el’.
  
  (read-multilingual-string PROMPT &optional INITIAL-INPUT INPUT-METHOD)
  
  Read a multilingual string from minibuffer, prompting with string PROMPT.
  The input method selected last time is activated in minibuffer.
  If optional second argument INITIAL-INPUT is non-nil, insert it in the
  minibuffer initially.
  Optional 3rd argument INPUT-METHOD specifies the input method to be activated
  instead of the one selected last time.  It is a symbol or a string.

Steve Berman



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

* RE: [External] : Making a key binding work in minibuffer editing.
  2021-09-02 12:43 Making a key binding work in minibuffer editing Perry E. Metzger
  2021-09-02 15:45 ` Stephen Berman
@ 2021-09-02 15:48 ` Drew Adams
  2021-09-02 18:15   ` Perry E. Metzger
  2021-09-02 19:28 ` Stefan Monnier
  2 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2021-09-02 15:48 UTC (permalink / raw)
  To: Perry E. Metzger, emacs-devel

> Is there a keymap I can add this to which will also cover editing in
> minibuffers, so I can use my weird input method in isearch and that sort
> of thing as well?

Caveat: I'm not following this thread.

In general, you can bind keys in the minibuffer
keymaps.  The most basic is `minibuffer-local-map'.

See the Elisp manual, nodes `Text from Minibuffer'
and `Completion Commands':

https://www.gnu.org/software/emacs/manual/html_node/elisp/Text-from-Minibuffer.html

https://www.gnu.org/software/emacs/manual/html_node/elisp/Completion-Commands.html

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

* Re: Making a key binding work in minibuffer editing.
  2021-09-02 15:45 ` Stephen Berman
@ 2021-09-02 18:14   ` Perry E. Metzger
  0 siblings, 0 replies; 8+ messages in thread
From: Perry E. Metzger @ 2021-09-02 18:14 UTC (permalink / raw)
  To: Stephen Berman; +Cc: emacs-devel

On 9/2/21 11:45, Stephen Berman wrote:
> On Thu, 2 Sep 2021 08:43:22 -0400 "Perry E. Metzger" <perry@piermont.com> wrote:
>
>> Howdy! So I'm reasonably happy with the (kludgy) way I've handled my ad hoc
>> input method, but it doesn't work inside minibuffers because my magic keypress
>> is handed by a global keymap entry and that doesn't seem to cover the
>> minibuffer:
>>
>> (define-key (current-global-map) (kbd "<f19>")
>>    (lambda (n)
>>      (interactive "p")
>>      (setq unread-input-method-events
>>            (append unread-input-method-events '(?¤)))))
>>
>> Is there a keymap I can add this to which will also cover editing in
>> minibuffers, so I can use my weird input method in isearch and that sort of
>> thing as well?
> I'm don't know about a keymap per se, but maybe this will do:
>
>    read-multilingual-string is a compiled Lisp function in
>    ‘<emacs>/lisp/international/mule-cmds.el’.
>    
>    (read-multilingual-string PROMPT &optional INITIAL-INPUT INPUT-METHOD)
>    

That doesn't help me unfortunately. It's there to read a string from 
lisp code. It doesn't change the key maps that are active when I hit C-s 
or what have you.

Perry




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

* Re: [External] : Making a key binding work in minibuffer editing.
  2021-09-02 15:48 ` [External] : " Drew Adams
@ 2021-09-02 18:15   ` Perry E. Metzger
  2021-09-02 19:05     ` Drew Adams
  0 siblings, 1 reply; 8+ messages in thread
From: Perry E. Metzger @ 2021-09-02 18:15 UTC (permalink / raw)
  To: Drew Adams, emacs-devel

On 9/2/21 11:48, Drew Adams wrote:
>> Is there a keymap I can add this to which will also cover editing in
>> minibuffers, so I can use my weird input method in isearch and that sort
>> of thing as well?
> Caveat: I'm not following this thread.
>
> In general, you can bind keys in the minibuffer
> keymaps.  The most basic is `minibuffer-local-map'.
>
> See the Elisp manual, nodes `Text from Minibuffer'
> and `Completion Commands':
>
> https://www.gnu.org/software/emacs/manual/html_node/elisp/Text-from-Minibuffer.html
>
> https://www.gnu.org/software/emacs/manual/html_node/elisp/Completion-Commands.html

So I have to explicitly bind that, there's no common map that will be 
inherited both by the global map and the minibuffer maps?


Perry





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

* RE: [External] : Making a key binding work in minibuffer editing.
  2021-09-02 18:15   ` Perry E. Metzger
@ 2021-09-02 19:05     ` Drew Adams
  0 siblings, 0 replies; 8+ messages in thread
From: Drew Adams @ 2021-09-02 19:05 UTC (permalink / raw)
  To: Perry E. Metzger, emacs-devel

> > In general, you can bind keys in the minibuffer
> > keymaps.  The most basic is `minibuffer-local-map'.
> >
> > See the Elisp manual, nodes `Text from Minibuffer'
> > and `Completion Commands':
> 
> So I have to explicitly bind that, there's no common map that will be
> inherited both by the global map and the minibuffer maps?

Correct.  Minibuffer keymaps are local to the minibuffer.

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

* Re: Making a key binding work in minibuffer editing.
  2021-09-02 12:43 Making a key binding work in minibuffer editing Perry E. Metzger
  2021-09-02 15:45 ` Stephen Berman
  2021-09-02 15:48 ` [External] : " Drew Adams
@ 2021-09-02 19:28 ` Stefan Monnier
  2021-09-02 20:25   ` [External] : " Drew Adams
  2 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2021-09-02 19:28 UTC (permalink / raw)
  To: Perry E. Metzger; +Cc: emacs-devel

> input method, but it doesn't work inside minibuffers because my magic
> keypress is handed by a global keymap entry and that doesn't seem to cover
> the minibuffer:
>
> (define-key (current-global-map) (kbd "<f19>")
>   (lambda (n)
>     (interactive "p")
>     (setq unread-input-method-events
>           (append unread-input-method-events '(?¤)))))

I'm not familiar with `unread-input-method-events`, but the `global-map`
is also used in the minibuffer, so I think you should first investigate
what makes you think your code "doesn't seem to cover the minibuffer".


        Stefan




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

* RE: [External] : Re: Making a key binding work in minibuffer editing.
  2021-09-02 19:28 ` Stefan Monnier
@ 2021-09-02 20:25   ` Drew Adams
  0 siblings, 0 replies; 8+ messages in thread
From: Drew Adams @ 2021-09-02 20:25 UTC (permalink / raw)
  To: Stefan Monnier, Perry E. Metzger; +Cc: emacs-devel

> the `global-map` is also used in the minibuffer

Yes, I wasn't clear in what I wrote in that regard.
I meant to say that minibuffer keymaps override
global mappings.  (And of course minor-mode maps
override the minibuffer maps.)



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

end of thread, other threads:[~2021-09-02 20:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-02 12:43 Making a key binding work in minibuffer editing Perry E. Metzger
2021-09-02 15:45 ` Stephen Berman
2021-09-02 18:14   ` Perry E. Metzger
2021-09-02 15:48 ` [External] : " Drew Adams
2021-09-02 18:15   ` Perry E. Metzger
2021-09-02 19:05     ` Drew Adams
2021-09-02 19:28 ` Stefan Monnier
2021-09-02 20:25   ` [External] : " Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.