From: Ted Zlatanov <tzz@lifelogs.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Yuta Yamada <cokesboy@gmail.com>, emacs-devel@gnu.org
Subject: Re: mykie.el
Date: Tue, 07 Jan 2014 18:21:57 -0500 [thread overview]
Message-ID: <871u0jcr8q.fsf@flea.lifelogs.com> (raw)
In-Reply-To: <jwvbnzoprr9.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 06 Jan 2014 19:37:01 -0500")
On Mon, 06 Jan 2014 19:37:01 -0500 Stefan Monnier <monnier@iro.umontreal.ca> wrote:
SM> Is that really much better than [vanilla Emacs lisp]?
>> Yes. The difference is huge for a beginner.
SM> I'm far from convinced. The beginner will have to learn the
SM> mykie-specific sublanguage. Maybe it's slightly simpler, but then this
SM> effort won't help him understand other code.
That's a problem with anything that hides code complexity, and yet we do
it all the time. I doubt beginners can handle `pcase' and the
subtleties of context-sensitive key definitions, so I think for this
specific case the simplification is necessary.
SM> Making it easier to customize Emacs is great, but it's better if it also
SM> gets you some way towards hacking on Emacs so as to become a contributor.
I completely disagree with that line of thinking.
SM> Of course, there are cosmetic issues in the mykie.el syntax that rub me
SM> the wrong way. Most obvious is the need to quote code. I already spend
SM> enough time telling people not to quote their lambdas and trying to fix
SM> code that abuses `eval' in all kinds of useless ways.
That's a good point.
...
SM> (global-set-key "C-j"
SM> (sm-combined-command
SM> (:C-u&eolp (fill-region (point-at-bol) (point-at-eol)))
SM> (:region 'query-replace-regexp)
SM> (t
SM> (delete-trailing-whitespace)
SM> (case major-mode
SM> (org-mode (org-return-indent))
SM> (t (newline-and-indent))))))
SM> And sm-combined-command is a very simple macro:
SM> (defconst sm-combined-command-predicates
SM> '((:region . (use-region-p))
SM> (:C-u . current-prefix-arg)
SM> (:C-u&eolp . (and current-prefix-arg (eolp)))
SM> ...))
SM> (defmacro sm-combined-command (branches)
SM> `(lambda ()
SM> (interactive)
SM> (cond
SM> ,@(mapcar (lambda (branch)
SM> `(,(or (cdr (assq (car branch)
SM> sm-combined-command-predicates))
SM> (car branch))
SM> ,@(pcase (cdr branch)
SM> (`(',cmd) `((call-interactively ',cmd)))
SM> (,cmds cmds))))
SM> branches))))
That's very nice (you and your pcase :). I think it's fairly difficult
to explain *how* it works to a beginner and would need lots of
documentation, but from the user's standpoint it's exactly what I was
hoping to bring out of mykie.el. The developers can then contribute
more predicates and the users can happily use them.
The important question for you and Yamada-san is, would you be
interested in something like `sm-combined-command' in the Emacs core,
regardless of how mykie.el evolves? Then mykie.el can remain a place
for experimentation and perhaps it can use `sm-combined-command'
internally, enriching it with special extensions that maybe don't make
sense in the core.
The other way I imagine is to put mykie.el in the GNU ELPA, but I would
rather enable this facility by default if there are no objections.
Ted
next prev parent reply other threads:[~2014-01-07 23:21 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-03 20:09 mykie.el Ted Zlatanov
2014-01-03 21:37 ` mykie.el Bozhidar Batsov
2014-01-04 1:08 ` mykie.el Yuta Yamada
2014-01-06 22:47 ` mykie.el, mykie.el Ted Zlatanov
2014-01-06 23:00 ` enable MELPA & Marmalade by defaul [was: mykie.el] Drew Adams
2014-01-06 23:42 ` Óscar Fuentes
2014-01-07 0:29 ` Drew Adams
2014-01-07 1:08 ` Eric Brown
2014-01-07 5:39 ` Drew Adams
2014-01-07 8:33 ` Nic Ferrier
2014-01-07 8:38 ` David Kastrup
2014-01-07 14:41 ` Grim Schjetne
2014-01-07 15:12 ` Stephen Berman
2014-01-07 17:44 ` Drew Adams
2014-01-07 20:55 ` Stephen Berman
2014-01-08 11:52 ` Tassilo Horn
2014-01-08 13:19 ` David Kastrup
2014-01-08 14:02 ` Stefan Monnier
2014-01-08 17:19 ` enable MELPA & Marmalade by defaul Glenn Morris
2014-01-07 17:44 ` enable MELPA & Marmalade by defaul [was: mykie.el] Drew Adams
2014-01-08 3:41 ` Richard Stallman
2014-01-08 4:26 ` Bob Bobeck
2014-01-08 10:50 ` Nic Ferrier
2014-01-08 17:54 ` Achim Gratz
2014-01-09 3:00 ` Andy Moreton
2014-01-09 6:55 ` Nic Ferrier
2014-01-09 7:55 ` Tassilo Horn
2014-01-09 11:24 ` chad
2014-01-09 18:15 ` Achim Gratz
2014-01-08 3:23 ` Stephen J. Turnbull
2014-01-08 10:32 ` David Kastrup
2014-01-07 16:53 ` Richard Stallman
2014-01-08 3:15 ` Stephen J. Turnbull
2014-01-08 9:27 ` Richard Stallman
[not found] ` <<a62bb795-44d9-44dd-b17a-d5294c21d2b0@default>
[not found] ` <<E1W0Zto-0000A5-VX@fencepost.gnu.org>
2014-01-07 17:44 ` Drew Adams
2014-01-07 16:16 ` Ted Zlatanov
2014-01-07 17:44 ` Drew Adams
2014-01-08 3:41 ` Richard Stallman
2014-01-04 2:02 ` mykie.el Yuta Yamada
2014-01-04 4:34 ` mykie.el Stefan Monnier
2014-01-04 8:36 ` mykie.el Leo Liu
2014-01-05 8:10 ` mykie.el Mitchel Humpherys
2014-01-05 10:29 ` mykie.el Leo Liu
2014-01-06 16:09 ` mykie.el Nicolas Richard
2014-01-06 22:38 ` mykie.el Ted Zlatanov
2014-01-07 0:37 ` mykie.el Stefan Monnier
2014-01-07 23:21 ` Ted Zlatanov [this message]
2014-01-08 3:24 ` mykie.el Stefan Monnier
2014-01-08 15:44 ` mykie.el Ted Zlatanov
2014-01-08 16:11 ` mykie.el Stefan Monnier
2014-01-08 16:38 ` mykie.el Ted Zlatanov
2014-01-08 17:24 ` mykie.el Stefan Monnier
2014-01-09 8:13 ` mykie.el Tassilo Horn
2014-01-09 15:29 ` mykie.el Stefan Monnier
2014-01-09 18:43 ` mykie.el Yuta Yamada
2014-01-11 20:23 ` mykie.el Yuta Yamada
2014-01-12 14:45 ` mykie.el Stefan Monnier
2014-01-12 18:32 ` mykie.el Yuta Yamada
2014-01-12 19:46 ` mykie.el Stefan Monnier
2014-01-12 22:51 ` mykie.el Yuta Yamada
2014-01-13 3:38 ` mykie.el Stefan Monnier
2014-01-13 4:59 ` mykie.el Yuta Yamada
2014-01-13 14:03 ` mykie.el Stefan Monnier
2014-01-13 16:09 ` mykie.el Yuta Yamada
2014-01-08 21:21 ` mykie.el Yuta Yamada
2014-01-06 5:31 ` mykie.el Yuta Yamada
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=871u0jcr8q.fsf@flea.lifelogs.com \
--to=tzz@lifelogs.com \
--cc=cokesboy@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.