From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Wolfram Fenske Newsgroups: gmane.emacs.gnus.general,gmane.emacs.devel Subject: Re: defcustom :version Date: Thu, 30 Mar 2006 21:53:55 +0200 Message-ID: <86y7yrvhd8.fsf@student.uni-magdeburg.de> 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> <87zmj8zm7x.fsf@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 1143748502 32125 80.91.229.2 (30 Mar 2006 19:55:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 30 Mar 2006 19:55:02 +0000 (UTC) Cc: ding@gnus.org, emacs-devel@gnu.org Original-X-From: ding-owner+m10979@lists.math.uh.edu Thu Mar 30 21:54:59 2006 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FP3EL-00051C-2G for ding-account@gmane.org; Thu, 30 Mar 2006 21:54:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1FP3EE-0001Nd-00; Thu, 30 Mar 2006 13:54:46 -0600 Original-Received: from nas02.math.uh.edu ([129.7.128.40]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1FP3DZ-0001NY-00 for ding@lists.math.uh.edu; Thu, 30 Mar 2006 13:54:05 -0600 Original-Received: from quimby.gnus.org ([80.91.224.244]) by nas02.math.uh.edu with esmtp (Exim 4.52) id 1FP3DW-00027h-I7 for ding@lists.math.uh.edu; Thu, 30 Mar 2006 13:54:05 -0600 Original-Received: from mail.uni-magdeburg.de ([141.44.1.10]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1FP3DU-0000eC-00 for ; Thu, 30 Mar 2006 21:54:00 +0200 Original-Received: from sunny.urz.uni-magdeburg.de ([141.44.8.7]) by mail.uni-magdeburg.de with esmtp (EXIM Version 4.43) id 1FP3DR-0007IM-Sr; Thu, 30 Mar 2006 21:54:00 +0200 Original-Received: from hondo (pD9516383.dip0.t-ipconnect.de [217.81.99.131]) (authenticated bits=0) by sunny.urz.uni-magdeburg.de (8.12.10/8.12.10) with ESMTP id k2UJrsTH027924 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Thu, 30 Mar 2006 21:53:56 +0200 Original-To: Bill Wohler In-Reply-To: <87zmj8zm7x.fsf@olgas.newt.com> (Bill Wohler's message of "Wed, 29 Mar 2006 18:43:14 -0800") User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.18 (berkeley-unix) X-Spam-Score: -2.6 (--) X-Spam-Report: ---- Start SpamAssassin results -2.6 points, 5.0 required; -2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] 0.0 AWL AWL: From: address is in the auto white-list ---- End of SpamAssassin results X-Scan-Signature: b3802ab67213a06c53942eeea07bb096 X-Spam-Score: -2.6 (--) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: news.gmane.org gmane.emacs.gnus.general:62452 gmane.emacs.devel:52228 Archived-At: Bill Wohler 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