emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [elpa] master 68bcf86 2/4: package/names: :group can be given a list


From: David Kastrup
Subject: Re: [elpa] master 68bcf86 2/4: package/names: :group can be given a list
Date: Mon, 12 Jan 2015 22:41:25 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Artur Malabarba <address@hidden> writes:

> I'll use the backquoted version. But I'm at a place of spotty internet
> at the moment, so it may take me a few days.

Many versions of quoted lambda functions may these days be _so_ much
better written using lexical binding instead that I think XEmacs should
really try catching up here.  Otherwise the amount of code that cannot
be easily brought to run on XEmacs will likely become much larger.

I'm currently writing some package, and there are things like

(defun lily-pitch-insert-for (note)
  "Calculate a pitch insertion routine for Midi note NOTE.

This takes a look at `lily-midi-keysig' and determines the proper
enharmonic variant to insert."
  (lambda () (interactive)
    (lily-note-insert
     (apply #'lily-notename (lily-midi-to-note note)))))

or

(defun midikbd-filter-create ()
  "Create one Midi process filter keeping state across calls."
  (let ((state (make-vector 9 nil)))
    (lambda (_process string)
      (setq unread-command-events
            (append unread-command-events
                    (mapcar (lambda (x) (aref midikbd-keys x))
                            (ccl-execute-on-string 'midikbd-decoder
                                                   state string t t)))))))

and other stuff.  That's quite nicer and more efficient than the awkward

(defun midikbd-filter-create ()
  "Create one Midi process filter keeping state across calls."
  (let ((state (make-vector 9 nil)))
    `(lambda (_process string)
      (setq unread-command-events
            (append unread-command-events
                    (mapcar (lambda (x) (aref midikbd-keys x))
                            (ccl-execute-on-string 'midikbd-decoder
                                                   ,state string t t)))))))

or similar.

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]