From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/62442 Path: news.gmane.org!not-for-mail From: Bill Wohler Newsgroups: gmane.emacs.devel,gmane.emacs.gnus.general Subject: Re: defcustom :version Date: Wed, 29 Mar 2006 18:43:14 -0800 Organization: Newt Software Message-ID: <87zmj8zm7x.fsf@olgas.newt.com> References: <15499.1142047137@olgas.newt.com> <200603110447.k2B4lbt10750@raven.dms.auburn.edu> <9584.1142109654@olgas.newt.com> <17232.1142195412@olgas.newt.com> <6274.1143596753@olgas.newt.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1143686637 19928 80.91.229.2 (30 Mar 2006 02:43:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 30 Mar 2006 02:43:57 +0000 (UTC) Cc: ding@gnus.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 30 04:43:55 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FOn8W-0006hA-OZ for ged-emacs-devel@m.gmane.org; Thu, 30 Mar 2006 04:43:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FOn8W-00074A-BZ for ged-emacs-devel@m.gmane.org; Wed, 29 Mar 2006 21:43:48 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FOn8J-00071p-SY for emacs-devel@gnu.org; Wed, 29 Mar 2006 21:43:35 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FOn8I-0006yu-Bx for emacs-devel@gnu.org; Wed, 29 Mar 2006 21:43:35 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FOn8I-0006yg-75 for emacs-devel@gnu.org; Wed, 29 Mar 2006 21:43:34 -0500 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FOnAM-0000eU-Vz for emacs-devel@gnu.org; Wed, 29 Mar 2006 21:45:43 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FOn8A-0006e0-OB for emacs-devel@gnu.org; Thu, 30 Mar 2006 04:43:26 +0200 Original-Received: from adsl-69-236-187-78.dsl.pltn13.pacbell.net ([69.236.187.78]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 30 Mar 2006 04:43:26 +0200 Original-Received: from wohler by adsl-69-236-187-78.dsl.pltn13.pacbell.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 30 Mar 2006 04:43:26 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 64 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: adsl-69-236-187-78.dsl.pltn13.pacbell.net User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:gwJ2oX49ToTrU/mgcJZP8U6lk38= X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:52216 gmane.emacs.gnus.general:62442 Archived-At: Richard Stallman 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 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.