unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* No cl-lib replacement for define-modify-macro?
@ 2012-11-06  8:12 Glenn Morris
  2012-11-06 14:59 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2012-11-06  8:12 UTC (permalink / raw)
  To: emacs-devel


It seems that there is no cl-lib replacement for cl.el's define-modify-macro.
(I can't really see anything in gv.el that would replace it either.)
Is that intentional (because it is believed to be unused)?
It looks like cl-define-modify-macro would have exactly the same
definition as define-modify-macro, so I can't see a reason not to simply
move it to cl-lib.el and add an alias in cl.el.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: No cl-lib replacement for define-modify-macro?
  2012-11-06  8:12 No cl-lib replacement for define-modify-macro? Glenn Morris
@ 2012-11-06 14:59 ` Stefan Monnier
  2012-11-06 16:53   ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2012-11-06 14:59 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

> It seems that there is no cl-lib replacement for cl.el's define-modify-macro.
> (I can't really see anything in gv.el that would replace it either.)

The replacement is gv-letplace.


        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: No cl-lib replacement for define-modify-macro?
  2012-11-06 14:59 ` Stefan Monnier
@ 2012-11-06 16:53   ` Glenn Morris
  2012-11-06 18:03     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2012-11-06 16:53 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier wrote:

> The replacement is gv-letplace.

How do I write:

(define-modify-macro incf (&optional (n 1)) +)

using gv-letplace? (Forget about the "&optional" bit if necessary.)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: No cl-lib replacement for define-modify-macro?
  2012-11-06 16:53   ` Glenn Morris
@ 2012-11-06 18:03     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2012-11-06 18:03 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

>> The replacement is gv-letplace.
> How do I write:
> (define-modify-macro incf (&optional (n 1)) +)
> using gv-letplace? (Forget about the "&optional" bit if necessary.)

Guaranteed 100% untested:

   (defmacro incf (place &optional n)
     (gv-letplace (getter setter) place
       (macroexp-let2 nil v (or n 1)
         (funcall setter `(+ ,v ,getter)))))


-- Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-11-06 18:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-06  8:12 No cl-lib replacement for define-modify-macro? Glenn Morris
2012-11-06 14:59 ` Stefan Monnier
2012-11-06 16:53   ` Glenn Morris
2012-11-06 18:03     ` Stefan Monnier

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