From: Bill Wohler <wohler@newt.com>
Cc: ding@gnus.org
Subject: Re: defcustom :version
Date: Wed, 29 Mar 2006 18:43:14 -0800 [thread overview]
Message-ID: <87zmj8zm7x.fsf@olgas.newt.com> (raw)
In-Reply-To: E1FOjgF-0007hE-BW@fencepost.gnu.org
Richard Stallman <rms@gnu.org> writes:
> I think it is worth adding this code now,
> so that maintenance can be simpler.
Thank you.
> But first I would like a few other people to study the code
> and make sure there is no problem with it. Would people
> please study Bill's patch?
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:
(custom-declare-group (quote mh-e) nil
"Emacs interface to the MH mail system.
MH is the Rand Mail Handler. Other implementations include nmh
and GNU mailutils." (:link (quote (custom-manual "(mh-e)Top")) :group
(quote mail)))
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)))
(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)))
--
Bill Wohler <wohler@newt.com> http://www.newt.com/wohler/ GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.
next prev parent reply other threads:[~2006-03-30 2:43 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-11 3:18 defcustom :version 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 [this message]
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
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-04-11 16:57 ` Richard Stallman
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-14 19:08 ` Drew Adams
2006-03-15 20:20 ` Richard Stallman
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
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=87zmj8zm7x.fsf@olgas.newt.com \
--to=wohler@newt.com \
--cc=ding@gnus.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.
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).