From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ian Zimmerman Newsgroups: gmane.emacs.help Subject: Re: Syntax highlight (problem with 'concat) Date: Mon, 02 Jan 2006 19:43:39 -0800 (PST) Message-ID: <871wzq2cye.fsf@gmail.com> References: <20060103033426.GA1812@johnsons-web.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1136259842 26669 80.91.229.2 (3 Jan 2006 03:44:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 3 Jan 2006 03:44:02 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 03 04:44:00 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Etd5Y-0006sK-Hv for geh-help-gnu-emacs@m.gmane.org; Tue, 03 Jan 2006 04:43:56 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Etd7A-0000kv-3y for geh-help-gnu-emacs@m.gmane.org; Mon, 02 Jan 2006 22:45:36 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Etd6x-0000jN-CH for help-gnu-emacs@gnu.org; Mon, 02 Jan 2006 22:45:23 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Etd6v-0000iI-8t for help-gnu-emacs@gnu.org; Mon, 02 Jan 2006 22:45:22 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Etd6u-0000iD-Uh for help-gnu-emacs@gnu.org; Mon, 02 Jan 2006 22:45:21 -0500 Original-Received: from [66.249.82.196] (helo=xproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Etd84-0002Sz-Ln for help-gnu-emacs@gnu.org; Mon, 02 Jan 2006 22:46:32 -0500 Original-Received: by xproxy.gmail.com with SMTP id t11so1472856wxc for ; Mon, 02 Jan 2006 19:43:39 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:to:cc:subject:references:from:in-reply-to:message-id:lines:user-agent:mime-version:content-type:date; b=A8D0PFRNRhRYDvaAkkPmJygXIDlDDq4nlqRAmSvprl6ySJcCeGklQb27FazHWN6es+7jlbAJ/NtzVSBNmq2pp5aQAl8W12uH0iYbecYTUINjwyMEEmYzQdvDmu8q4Wrl5dtr1Yyf99K4ytrAcTCAaGxLtm5tTBjdvLjVfd+lJ6k= Original-Received: by 10.70.118.1 with SMTP id q1mr13055695wxc; Mon, 02 Jan 2006 19:43:39 -0800 (PST) Original-Received: from unicorn ( [72.60.106.112]) by mx.gmail.com with ESMTP id h34sm20836008wxd.2006.01.02.19.43.38; Mon, 02 Jan 2006 19:43:39 -0800 (PST) Original-Received: from itz by unicorn with local (Exim 4.60) (envelope-from ) id 1Etd5F-0001Cm-Si; Mon, 02 Jan 2006 22:43:37 -0500 Original-To: Tim Johnson In-Reply-To: <20060103033426.GA1812@johnsons-web.com> Original-Lines: 40 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:32367 Archived-At: Tim> Hello: Tim> I'm attempting to create a derived mode for lisp using the example Tim> from this URL: Tim> http://www.emacswiki.org/cgi-bin/wiki/DerivedMode Tim> ;; Note the line in the code below where I use the 'concat form Tim> ;; This line does not provide the syntax highlighting that I desire. Tim> ;; However, the line above with the literal regexp string *does* Tim> ;; highlight correctly Tim> ;; Any hints on how to correct the usage of the 'concat form will Tim> ;; be greatly appreciated. Tim> (define-derived-mode tj-lisp-mode lisp-mode "tj-lisp" Tim> "Major Mode for extending standard lisp mode" Tim> (defconst tj-lisp-user-keywords (regexp-opt '("print" "setq"))) Tim> (defconst tj-word-begin "\\b\\(") Tim> (defconst tj-word-end "\\)\\b") Tim> ;;register keywords Tim> (setq tj-lisp-font-lock-keywords Tim> (list '("\\b\\(if\\|progn\\)\\b" . font-lock-loop-face) Tim> '("\\b\\(print\\|setq\\)\\b" . font-lock-user-keyword-face) ;; good, line below is bad Tim> ;'((concat tj-word-begin tj-lisp-user-keywords tj-word-end) . font-lock-user-keyword-face) Tim> )) Tim> (font-lock-mode)) Tim> ;; TIA Tim> tj The quote around the last item in the list applies to _everything_ inside. So your concat call never actually happens. What you want is something like ... (cons (concat tj-word-begin tj-lisp-user-keywords tj-word-end) 'font-lock-user-keyword-face) ... or use quasi-quotes (see Elisp manual) -- A true pessimist won't be discouraged by a little success.