From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yuta Yamada Newsgroups: gmane.emacs.devel Subject: Re: mykie.el Date: Wed, 08 Jan 2014 16:21:15 -0500 (EST) Message-ID: <20140108.162115.372784771199541841.cokesboy@gmail.com> References: <871u0jcr8q.fsf@flea.lifelogs.com> <87bnzma369.fsf@flea.lifelogs.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1389216115 20165 80.91.229.3 (8 Jan 2014 21:21:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 8 Jan 2014 21:21:55 +0000 (UTC) Cc: tzz@lifelogs.com, monnier@iro.umontreal.ca To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 08 22:22:01 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 1W10ZW-00031y-2z for ged-emacs-devel@m.gmane.org; Wed, 08 Jan 2014 22:21:54 +0100 Original-Received: from localhost ([::1]:48999 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W10ZV-0002GP-Lr for ged-emacs-devel@m.gmane.org; Wed, 08 Jan 2014 16:21:53 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W10ZK-0002G1-85 for emacs-devel@gnu.org; Wed, 08 Jan 2014 16:21:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W10ZB-00031z-Rr for emacs-devel@gnu.org; Wed, 08 Jan 2014 16:21:42 -0500 Original-Received: from mail-ie0-x235.google.com ([2607:f8b0:4001:c03::235]:54945) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W10ZB-0002rr-CZ for emacs-devel@gnu.org; Wed, 08 Jan 2014 16:21:33 -0500 Original-Received: by mail-ie0-f181.google.com with SMTP id e14so2526777iej.26 for ; Wed, 08 Jan 2014 13:21:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:to:cc:subject:from:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=6MFhdoqBpxBqO/JxapBQIrlQbQZaGhKQV8cb6WOwhgk=; b=SyX2w/fjdWkXtPF3Zb4e41FStw6nbwVEPrerBTXGZ+Gdo2RGApv5vPMII5yLzRKrDv UpNAyfIMtaavJuojDZ0PWH68ue7DA46yx63MS+4VFOA+Tai8+sUu0iiezHdEh8Ohs8D1 P3bNK6iaK+Z96PCbjn9ilExpUQych/K+Ohcb9hui4cRSLzRRXu3jNspPjfJWrwJ98IbQ W8Y2TNqOhPRfiP1Gzkx626COJtZsFRDP6zCABNns0z1ez/idUTJ/h8U0XBebQhEXqoYH D0AVAARZjAaVNzAZytP5sCtDzU153exz0iA9t1t1O/04USClNCeDyHf00Ft0cNZg5Soj OpfQ== X-Received: by 10.50.27.42 with SMTP id q10mr40086igg.33.1389216088749; Wed, 08 Jan 2014 13:21:28 -0800 (PST) Original-Received: from localhost ([205.189.187.4]) by mx.google.com with ESMTPSA id c10sm10754345igx.4.2014.01.08.13.21.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 13:21:28 -0800 (PST) In-Reply-To: <87bnzma369.fsf@flea.lifelogs.com> X-Mailer: Mew version 6.5 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4001:c03::235 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:167814 Archived-At: > > SM> You could add it to subr-x.el (after 24.4), > > > Wonderful, thanks. Yamada-san, WDYT? Do you want to work on the > > approach Stefan suggested in the Emacs core and integrate mykie.el with > > it, or would you rather keep mykie.el separate from this work? > > Oh, I misunderstood meaning. (Sorry I'm English learner yet.) That means mykie can in the Emacs core if mykie fixed the cosmetic problems. right? If it's yes. I would like mykie to in the Emacs core. I already fixed some cosmetic issues at future branch. done: - delete needless quotation - treat 't symbol as default function almost done: - delete wrong eval(remaining two eval...) yet: - use parenthesized syntax to lispish - mykie:global-set-key -> other name However current mykie took just different approach to check conditions. Below function is mykie's core logic. (defun* mykie (&rest args &allow-other-keys) (catch 'done ;; ↓ check wheter ignore major-mode overriding (loop initially (when (eq 'exit (mykie:init args)) (return)) ;; collect user specified keywords with keywords = (loop for arg in args if (keywordp arg) collect arg) ;; conditions separate three group: region, C-u, otherwise for conditions in mykie:group-conditions ;; check region-acitive-p or current-prefix-arg if needed if (funcall mykie:precheck-function conditions) do (loop with conds = (symbol-value conditions) for keyword in keywords ;; conds is like (:C-u&eolp . (eolp)) if (and (loop for (expect . c) in conds if (or (eq expect keyword) ;; irregular case for :MAJOR-MODE ;; C-u*N, M-N (and (stringp expect) (string-match expect (symbol-name keyword)))) do (return t)) (mykie:predicate conds keyword)) do (progn (setq mykie:current-state keyword) ;; do specific command (mykie:execute (plist-get args keyword)) (throw 'done 'done))) ;; do :default or t's function if function was not found finally (mykie:execute (or (plist-get args :default) (plist-get args t))))) ;; for :repeat (unless (mykie:repeat-p) (setq mykie:current-point (point)))) I like pre check function that can ignore needless conditions. Is it ok? There is a merit. User don't need useless (region-active-p) or current-prefix-arg when user register user's condition. About remaining cosmetic issues, - mykie:global-set-key -> ather name and use combind macro Above mykie function can call like this (mykie :default '(message "default") :C-u '(message "C-u")) I don't have much experience of lisp macro. So I can't say correctly whether it can implement by lisp macro. But can we use like this?: (defmacro sm-combind-command (&rest branches) `(lambda () (interactive) (apply 'mykie ,branches))) I tried above macro, but I couldn't use correctly. Could someone help me? Or Is it impossible? yet: - use parenthesized syntax to lispish I prefer without parenthesized syntax. But if we can use above macro then it's easy to create parenthesized syntax or not too. Sorry long sentence. I want to know current mykie can use at next Emacs core. Or do I need more change? Yuta