unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Tianxiang Xiong <tianxiang.xiong@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Subject: Have `define-key` return the keymap
Date: Sat, 13 May 2017 01:19:17 -0700	[thread overview]
Message-ID: <CACMkxixPJZmoKb0zSWJ5oAC4LaEZbJJJmePC-XMZ1XPbOmxSwg@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 393 bytes --]

Would there be any issues with / objections to having `define-key` return
the keymap it adds a key to? It currently returns `nil`, making it a
statement (bleh!) rather than a function.

If `define-key` returned the keymap, calls to it could be chained together
in convenient ways, e.g.

```
(thread-first (make-sparse-keymap)
  (define-key (kbd "a") #'foo)
  (define-key (kbd "b") #'bar))
```

[-- Attachment #2: Type: text/html, Size: 574 bytes --]

             reply	other threads:[~2017-05-13  8:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-13  8:19 Tianxiang Xiong [this message]
2017-05-13  8:32 ` Have `define-key` return the keymap Andreas Schwab
2017-05-13  9:11   ` Tianxiang Xiong
2017-05-13 12:21 ` Michael Heerdegen
2017-05-13 14:58   ` Drew Adams
2017-05-13 15:12     ` Kaushal Modi
2017-05-13 15:13     ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=CACMkxixPJZmoKb0zSWJ5oAC4LaEZbJJJmePC-XMZ1XPbOmxSwg@mail.gmail.com \
    --to=tianxiang.xiong@gmail.com \
    --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 public inbox

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

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).