From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mitchel Humpherys Newsgroups: gmane.emacs.devel Subject: Re: mykie.el Date: Sun, 05 Jan 2014 00:10:23 -0800 Message-ID: <87eh4myhlc.fsf@gmail.com> References: <87bnzshlo5.fsf@flea.lifelogs.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1388909468 1346 80.91.229.3 (5 Jan 2014 08:11:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 5 Jan 2014 08:11:08 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 05 09:11:13 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 1Vzine-0007lu-Ox for ged-emacs-devel@m.gmane.org; Sun, 05 Jan 2014 09:11:10 +0100 Original-Received: from localhost ([::1]:56951 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vzine-0006au-4a for ged-emacs-devel@m.gmane.org; Sun, 05 Jan 2014 03:11:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VzinW-0006an-VZ for emacs-devel@gnu.org; Sun, 05 Jan 2014 03:11:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VzinR-0006BZ-L4 for emacs-devel@gnu.org; Sun, 05 Jan 2014 03:11:02 -0500 Original-Received: from mail-pb0-x22f.google.com ([2607:f8b0:400e:c01::22f]:43480) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VzinR-0006BN-DW for emacs-devel@gnu.org; Sun, 05 Jan 2014 03:10:57 -0500 Original-Received: by mail-pb0-f47.google.com with SMTP id um1so17221519pbc.34 for ; Sun, 05 Jan 2014 00:10:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=s0FtiVCYtKSo2Xc6e2frtsjbNG/nmHIpXDwMIEXDm6w=; b=pxk1IJDkzYjmdRcxyqttNOtzRDpoQtza/YnGOhW1wKQF+juFIVxdZi6VgX3BEAj/SF B2iunceZlvgKAThqj5BTepTjVdurlNgmLv6cLAAwMcj9w/J6BIx5Cwq6RfvCD88dIFZO SNos1BkMiFDH/p5gmFJc8TO1mI0SyJe4/gQtaf/v0Cq2w2rYrWDLy9z1pvNO66Wwhd2l hfoPKbsoS/8mDCRozyBKLRXgyLFkAIvLfFjro/PgwFJ/ic6ZOmAvyfPR9wAPq0siFV1j LtcQ4pV4JZPDtjUfeGf/DzSevmB5SooSDQgUtc9ziVtgPxCmEO8+uZv/tu6qTsDsOaEm Fisg== X-Received: by 10.68.134.98 with SMTP id pj2mr112389536pbb.110.1388909454689; Sun, 05 Jan 2014 00:10:54 -0800 (PST) Original-Received: from localhost (ip72-197-240-81.sd.sd.cox.net. [72.197.240.81]) by mx.google.com with ESMTPSA id ik1sm120383187pbc.9.2014.01.05.00.10.26 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 05 Jan 2014 00:10:27 -0800 (PST) In-Reply-To: (Stefan Monnier's message of "Fri, 03 Jan 2014 23:34:01 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c01::22f 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:167348 Archived-At: On Fri, Jan 03 2014 at 08:34:01 PM, Stefan Monnier wrote: >> Here's an example of context-dependent usage: > >> (mykie:global-set-key "C-j" >> :default '(progn >> (delete-trailing-whitespace) >> (case major-mode >> (org-mode (org-return-indent)) >> (t (newline-and-indent)))) >> :C-u&eolp '(fill-region (point-at-bol) (point-at-eol)) >> :region 'query-replace-regexp) > >> (many other keywords are available, e.g. :prog for activating only in >> programming modes) > > Is that really much better than: > > (global-set-key "\C-j" > (lambda () > (interactive) > (cond > (current-prefix-arg (fill-region (point-at-bol) (point-at-eol))) > ((and (use-region-p) (eolp)) > (call-interactively 'query-replace-regexp)) > (t > (delete-trailing-whitespace) > (case major-mode > (org-mode (org-return-indent)) > (t (newline-and-indent))))))) Define "better". It's cool that yours is just vanilla Elisp but it took me about 5 seconds to fully parse the mykie version and about 20 seconds to fully parse your version. -- Mitch