unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuta Yamada <cokesboy@gmail.com>
To: emacs-devel@gnu.org
Cc: tzz@lifelogs.com, monnier@iro.umontreal.ca
Subject: Re: mykie.el
Date: Wed, 08 Jan 2014 16:21:15 -0500 (EST)	[thread overview]
Message-ID: <20140108.162115.372784771199541841.cokesboy@gmail.com> (raw)
In-Reply-To: <87bnzma369.fsf@flea.lifelogs.com>

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



  parent reply	other threads:[~2014-01-08 21: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       ` mykie.el Ted Zlatanov
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             ` Yuta Yamada [this message]
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

  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=20140108.162115.372784771199541841.cokesboy@gmail.com \
    --to=cokesboy@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=tzz@lifelogs.com \
    /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).