From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.cc-mode.general,gmane.emacs.devel Subject: Re: Old-style backquotes in cc-vars.el Date: Fri, 19 Oct 2007 09:29:05 +0200 Message-ID: <87bqavmuke.fsf@ambire.localdomain> References: <20071006163101.GA2565@muc.de> <87y7egjdr6.fsf@ambire.localdomain> <59233.128.165.123.18.1192124471.squirrel@webmail.lanl.gov> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1192779066 14441 80.91.229.12 (19 Oct 2007 07:31:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Oct 2007 07:31:06 +0000 (UTC) To: bug-cc-mode@gnu.org, emacs-devel@gnu.org Original-X-From: cc-mode-help-bounces@lists.sourceforge.net Fri Oct 19 09:31:06 2007 Return-path: Envelope-to: sf-cc-mode-help@m.gmane.org Original-Received: from lists-outbound.sourceforge.net ([66.35.250.225]) by lo.gmane.org with esmtp (Exim 4.50) id 1IimJy-0007i9-0p for sf-cc-mode-help@m.gmane.org; Fri, 19 Oct 2007 09:31:02 +0200 Original-Received: from sc8-sf-list1-new.sourceforge.net (sc8-sf-list1-new-b.sourceforge.net [10.3.1.93]) by sc8-sf-spam2.sourceforge.net (Postfix) with ESMTP id 5B30F1601B; Fri, 19 Oct 2007 00:30:54 -0700 (PDT) Original-Received: from sc8-sf-mx2-b.sourceforge.net ([10.3.1.92] helo=mail.sourceforge.net) by sc8-sf-list1-new.sourceforge.net with esmtp (Exim 4.43) id 1IimJo-0002u7-4O for cc-mode-help@lists.sourceforge.net; Fri, 19 Oct 2007 00:30:52 -0700 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by mail.sourceforge.net with esmtps (TLSv1:AES256-SHA:256) (Exim 4.44) id 1IimJm-0007Wj-GI for cc-mode-help@lists.sourceforge.net; Fri, 19 Oct 2007 00:30:52 -0700 Original-Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IimJA-0002SM-Pn for bug-cc-mode@gnu.org; Fri, 19 Oct 2007 03:30:12 -0400 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1IimJ5-0006Xj-Tu for bug-cc-mode@gnu.org; Fri, 19 Oct 2007 03:30:10 -0400 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on monty-python X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed version=3.1.0 Original-Received: from ppp-153-34.21-151.libero.it ([151.21.34.153] helo=ambire.localdomain) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IimJ5-0006Wh-6J; Fri, 19 Oct 2007 03:30:07 -0400 Original-Received: from ttn by ambire.localdomain with local (Exim 4.63) (envelope-from ) id 1IimI5-0002oR-M7; Fri, 19 Oct 2007 09:29:05 +0200 In-Reply-To: <59233.128.165.123.18.1192124471.squirrel@webmail.lanl.gov> (Davis Herring's message of "Thu\, 11 Oct 2007 10\:41\:11 -0700 \(PDT\)") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.97 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-Spam-Score: 1.0 (+) X-Spam-Report: Spam Filtering performed by sourceforge.net. See http://spamassassin.org/tag/ for more details. Report problems to http://sf.net/tracker/?func=add&group_id=1&atid=200001 1.0 FORGED_RCVD_HELO Received: contains a forged HELO X-BeenThere: cc-mode-help@lists.sourceforge.net X-Mailman-Version: 2.1.8 Precedence: list List-Id: "Bug reports, feature requests, and general talk about CC Mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: cc-mode-help-bounces@lists.sourceforge.net Errors-To: cc-mode-help-bounces@lists.sourceforge.net Xref: news.gmane.org gmane.emacs.cc-mode.general:4808 gmane.emacs.devel:81197 Archived-At: () "Davis Herring" () Thu, 11 Oct 2007 10:41:11 -0700 (PDT) Are we sure that it's okay to do all these evaluations at macro expansion time -- that is, do any of them depend on runtime things? the original defcustom-c-stylevar evals so i thought continuing the practice (regardless of the wisdom of the approach) would not be harmful. in fact, in the most recent revision (tested a bit, this time -- bonus!), VAL is no longer evalled. And what is (eval (list 'identity foo))) supposed to do differently than (eval foo)? nothing, thanks for pointing this out -- i learn a lot from nothing these days! i use the latter form now. the former was fuzzy thinking and baby-in-the-background-crying induced. please find below the revised defcustom-c-stylevar usurper. substantial changes from the previous revision: - docstring, reflecting best how i understand things - new form `(declare (debug ...))' - form `(radio ...)' is quoted i consider all these changes bugfixes (and, thus, potentially bug-harboring). please scrutinize them equally. as mentioned before, this was (lightly) tested. i even went so far as to invoke customize (shudder) and mouse around a bit. now if you'll excuse me, i have to go wash my hands... :-/ [cc trimmed to ml] thi _____________________________________________________________ (defmacro defcustom-c-stylevar (name val doc &rest args) "Define a style variable NAME with VAL and DOC. More precisely, convert the given `:type FOO', mined out of ARGS, to an aggregate `:type (radio STYLE (PREAMBLE FOO))', append some some boilerplate documentation to DOC, arrange for the fallback value of NAME to be VAL, and call `custom-declare-variable' to do the rest of the work. STYLE stands for the choice where the value is taken from some style setting. PREAMBLE is optionally prepended to FOO; that is, if FOO contains :tag or :value, the respective two-element list component is ignored." (declare (debug (symbolp form stringp &rest))) (let* ((expanded-doc (concat doc " This is a style variable. Apart from the valid values described above, it can be set to the symbol `set-from-style'. In that case, it takes its value from the style system (see `c-default-style' and `c-style-alist') when a CC Mode buffer is initialized. Otherwise, the value set here overrides the style system (there is a variable `c-old-style-variable-behavior' that changes this, though).")) (typ (eval (plist-get args :type))) (type (if (consp typ) typ (list typ))) (head (car type)) (tail (cdr type)) (newt (append (unless (plist-get tail :tag) '(:tag "Override style settings")) (unless (plist-get tail :value) `(:value ,val)) tail)) (aggregate `'(radio (const :tag "Use style settings" set-from-style) ,(cons head newt)))) `(progn (c-set-stylevar-fallback ',name ,val) (custom-declare-variable ',name ''set-from-style ,expanded-doc ,@(plist-put args :type aggregate))))) ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/