From: Wolfram Fenske <Wolfram.Fenske@Student.Uni-Magdeburg.DE>
Cc: ding@gnus.org, emacs-devel@gnu.org
Subject: Re: defcustom :version
Date: Thu, 30 Mar 2006 21:53:55 +0200 [thread overview]
Message-ID: <86y7yrvhd8.fsf@student.uni-magdeburg.de> (raw)
In-Reply-To: <87zmj8zm7x.fsf@olgas.newt.com> (Bill Wohler's message of "Wed, 29 Mar 2006 18:43:14 -0800")
Bill Wohler <wohler@newt.com> writes:
> [...]
>
> On a related note, the MH-E and Gnus projects need to provide
> backwards compatibility for Emacsen that do not have the
> :package-version keyword. I wrote a bit of code to strip the
> :package-version keyword and its value before passing it on to
> defgroup/defcustom, but have a bit of a bug which I'm sure one of you
> can fix handily.
>
> Given the code below, if mh-package-version-defined-flag is nil, the
> mh-strip-package-version function does strip the :package-version
> keyword and its value, but alas it turns ARGS into (ARGS). For
> example, here is the output of macroexpand on the mh-e group:
>
> [...]
>
> How do I "unlistify" what mh-strip-package-version returns, or
> restructure the program to make it unnecessary to do so? I'm not a
> strong macro writer, so any other suggestions are solicited as well.
> Thanks!
>
>
> (defvar mh-package-version-defined-flag (and (not mh-xemacs-flag)
> (>= emacs-major-version 22))
> "Non-nil means `defgroup' and `defcustom' support :package-version.")
>
> (defmacro mh-defgroup (symbol members doc &rest args)
> "Declare SYMBOL as a customization group containing MEMBERS.
> See documentation for `defgroup' for a description of the arguments
> SYMBOL, MEMBERS, DOC and ARGS.
> This macro is used by Emacs versions that lack the :package-version
> keyword, introduced in Emacs 22."
> (declare (doc-string 3))
> (let ((args (if mh-package-version-defined-flag
> args
> (mh-strip-package-version args))))
> `(defgroup ,symbol ,members ,doc ,args)))
I think you should replace that last expression with
`(defgroup ,symbol ,members ,doc ,@args)
",@" works like "," but in addition it "splices" the value into the
enclosing list. E. g.
(let ((a 1)
(b '(2 3)))
`(,a ,b))
evaluates to (1 (2 3)) but
(let ((a 1)
(b '(2 3)))
`(,a ,@b))
evaluates to (1 2 3).
> (defun mh-strip-package-version (args)
> "Strip :package-version keyword and its value from ARGS."
> (let (seen)
> (loop for keyword in args
> if (cond ((eq keyword ':package-version) (setq seen t) nil)
> (seen (setq seen nil) nil)
> (t t))
> collect keyword)))
Regards
Wolfram Fenske
next prev parent reply other threads:[~2006-03-30 19:53 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-11 3:18 Bill Wohler
2006-03-11 4:47 ` Luc Teirlinck
2006-03-11 20:40 ` Bill Wohler
2006-03-12 12:47 ` Richard Stallman
2006-03-12 20:30 ` Bill Wohler
2006-03-13 12:55 ` Richard Stallman
2006-03-14 2:58 ` Bill Wohler
2006-03-29 1:45 ` Bill Wohler
2006-03-29 23:02 ` Richard Stallman
2006-03-30 2:43 ` Bill Wohler
2006-03-30 3:11 ` Luc Teirlinck
2006-03-30 17:28 ` Bill Wohler
2006-03-31 17:28 ` Richard Stallman
2006-03-31 18:11 ` Bill Wohler
2006-04-01 13:46 ` Richard Stallman
2006-04-11 0:10 ` Bill Wohler
2006-04-01 14:23 ` Eli Zaretskii
2006-03-31 3:10 ` Richard Stallman
2006-03-30 19:53 ` Wolfram Fenske [this message]
2006-03-30 21:18 ` Bill Wohler
2006-04-07 18:44 ` Bill Wohler
2006-04-08 16:17 ` Richard Stallman
2006-04-10 23:49 ` Bill Wohler
2006-03-12 12:47 ` Richard Stallman
2006-03-12 14:54 ` Luc Teirlinck
2006-03-13 1:26 ` Richard Stallman
2006-03-14 3:26 ` Luc Teirlinck
2006-03-14 3:37 ` Luc Teirlinck
2006-03-14 16:09 ` Richard Stallman
2006-03-14 17:49 ` Bill Wohler
2006-03-15 20:20 ` Richard Stallman
2006-03-15 20:25 ` Bill Wohler
2006-03-14 23:32 ` Luc Teirlinck
2006-03-15 0:06 ` Bill Wohler
2006-03-15 1:36 ` Luc Teirlinck
2006-03-15 2:09 ` Bill Wohler
2006-03-17 16:32 ` Richard Stallman
2006-03-15 20:21 ` Richard Stallman
2006-03-11 5:02 ` Luc Teirlinck
2006-03-11 13:57 ` Reiner Steib
2006-03-11 23:57 ` Bill Wohler
2006-03-11 23:46 ` Richard Stallman
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86y7yrvhd8.fsf@student.uni-magdeburg.de \
--to=wolfram.fenske@student.uni-magdeburg.de \
--cc=ding@gnus.org \
--cc=emacs-devel@gnu.org \
/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.
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 NNTP newsgroup(s).