From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: mykie.el Date: Tue, 07 Jan 2014 18:21:57 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <871u0jcr8q.fsf@flea.lifelogs.com> References: <87bnzshlo5.fsf@flea.lifelogs.com> <87eh4kg2hv.fsf@flea.lifelogs.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1389136823 15069 80.91.229.3 (7 Jan 2014 23:20:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 7 Jan 2014 23:20:23 +0000 (UTC) Cc: Yuta Yamada , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 08 00:20:31 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W0fwj-0007xI-H1 for ged-emacs-devel@m.gmane.org; Wed, 08 Jan 2014 00:20:29 +0100 Original-Received: from localhost ([::1]:44016 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0fwj-0006d2-39 for ged-emacs-devel@m.gmane.org; Tue, 07 Jan 2014 18:20:29 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0fwc-0006XM-Gq for emacs-devel@gnu.org; Tue, 07 Jan 2014 18:20:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0fwX-0003xg-Q0 for emacs-devel@gnu.org; Tue, 07 Jan 2014 18:20:22 -0500 Original-Received: from mail-qe0-x229.google.com ([2607:f8b0:400d:c02::229]:64933) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0fwX-0003xb-KA for emacs-devel@gnu.org; Tue, 07 Jan 2014 18:20:17 -0500 Original-Received: by mail-qe0-f41.google.com with SMTP id gh4so1115831qeb.14 for ; Tue, 07 Jan 2014 15:20:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lifelogs.com; s=google; h=from:to:cc:subject:organization:references:mail-copies-to :gmane-reply-to-list:date:in-reply-to:message-id:user-agent :mime-version:content-type; bh=QpBc9dB8UMUaATZU8AZKd2MDVh5eU61oyntJ8DBfaKk=; b=nBrr0tq0jpOA5PhpmL8TpRbs5Fpj30dWIPu0towPmsGumyTTs9wWG/CdGB1k6llgeb ZO+RDgkwB/C47wJZwiDolC02ZkVfKrAlMaxowmmjAzPaaDdScpUnQeEmLxo7F+DdiEcv NAayzYTomBu4v5E1lTSDgIvHo/RvJZ89Eg4ok= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:organization:references :mail-copies-to:gmane-reply-to-list:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=QpBc9dB8UMUaATZU8AZKd2MDVh5eU61oyntJ8DBfaKk=; b=iNFAlOmQU7bpnrN5K22QKfND39xoL0Rnzra/IN+coh42K3a0k8TLhjZFQdHc1nCJ+M BjrDv95acsk4DwBzXb9OcxCi1spVAe1P3o4BCHrLmfi+uG4Y81q7XXn989TgIv5EPKe7 Cj0fLXQcK6vPHLPqt+oKHydbLwkQ9RJgUaUc5F0XkNlGZfayf7gzC68FWNfkIpHmHaXt V+7HZ78eReuRgi0PzFBlTwDjfZlvHV2ukkg8xa3i0Xpx0ig/CnX4szMGy0W/ls/kaBvR o1vA9T3ZmQRy+wc8S+ZbSNwoGSfgHTAahSicl48OWjMHlpbgHrPS2nJOuoVdb8OewXlp 9Jqw== X-Gm-Message-State: ALoCoQnrHV2/qc01UfCHiczCvEwJm+u4nKdkqK3PUy2GbsQJkEHWBXk26VG36TLUx29xQzwMuOP8 X-Received: by 10.49.34.207 with SMTP id b15mr201402762qej.49.1389136816883; Tue, 07 Jan 2014 15:20:16 -0800 (PST) Original-Received: from flea.lifelogs.com (c-98-229-61-72.hsd1.ma.comcast.net. [98.229.61.72]) by mx.google.com with ESMTPSA id o5sm113816965qeg.2.2014.01.07.15.20.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jan 2014 15:20:16 -0800 (PST) X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Copies-To: never Gmane-Reply-To-List: yes In-Reply-To: (Stefan Monnier's message of "Mon, 06 Jan 2014 19:37:01 -0500") User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c02::229 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:167684 Archived-At: On Mon, 06 Jan 2014 19:37:01 -0500 Stefan Monnier 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