all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniele Nicolodi <daniele@grinta.net>
To: emacs-devel@gnu.org
Subject: Re: completing-read a list of keywords
Date: Wed, 15 Apr 2020 16:13:51 -0600	[thread overview]
Message-ID: <00fd7d62-7ce7-3f77-d112-99f07738684f@grinta.net> (raw)
In-Reply-To: <60f739e2-1aa1-8925-fcb4-e1d20d4df778@grinta.net>

On 15-04-2020 13:32, Daniele Nicolodi wrote:
> On 15-04-2020 12:41, Joost Kremers wrote:
>>
>> On Wed, Apr 15 2020, Noam Postavsky wrote:
>>> On Wed, 15 Apr 2020 at 14:21, Daniele Nicolodi <daniele@grinta.net>
>>> wrote:
>>>
>>>> Thanks Noam! I didn't know about completing-read-multiple. It comes very
>>>> close to do what I want. However, I am unable to make it work for
>>>> elements separated by ", " as SPC is mapped to the complete action. Is
>>>> there a way to customize this behavior?
>>>
>>> (define-key crm-local-completion-map (kbd "SPC") #'self-insert-command)
>>
>> Or if you don't want to stomp on anyone's keybindings:
>>
>> ```
>> (let ((crm-local-must-match-map (make-composed-keymap '(keymap (32))
>> crm-local-must-match-map)))
>>  (completing-read-multiple ...)
>>  ...
>>  )
>> ```
> 
> Thanks!  Wouldn't it make sense to have a with-define-key macro to
> effectively do the same?

For whom may be interested, this macro may look like:

(defmacro with-define-key (keymap key def &rest body)
  (declare (indent 3) (debug t))
  `(let ((map (make-sparse-keymap)))
     (define-key map ,key ,def)
     (let ((,keymap (make-composed-keymap map ,keymap)))
       (progn ,@body))))

It requires a bit of contortions to get it accept a syntax equivalent to
define-key.

Cheers,
Dan



  reply	other threads:[~2020-04-15 22:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15 17:30 completing-read a list of keywords Daniele Nicolodi
2020-04-15 17:33 ` Noam Postavsky
2020-04-15 18:21   ` Daniele Nicolodi
2020-04-15 18:26     ` Noam Postavsky
2020-04-15 18:41       ` Joost Kremers
2020-04-15 19:32         ` Daniele Nicolodi
2020-04-15 22:13           ` Daniele Nicolodi [this message]
2020-04-15 19:13       ` Daniele Nicolodi
2020-04-15 18:55     ` Stefan Monnier
2020-04-15 20:15       ` Daniele Nicolodi
2020-04-15 22:42         ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2020-04-15 22:06 Roland Winkler
2020-04-15 22:44 ` Stefan Monnier
2020-04-18 22:07   ` Roland Winkler
2020-04-19  2:30     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00fd7d62-7ce7-3f77-d112-99f07738684f@grinta.net \
    --to=daniele@grinta.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.