From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: lisp-font-lock-syntactic-face-function Date: Wed, 18 May 2005 11:11:23 +0200 Message-ID: <428B06BB.6070701@gmx.at> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1116431242 10010 80.91.229.2 (18 May 2005 15:47:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 18 May 2005 15:47:22 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 18 17:47:11 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DYQi3-0007Zx-6b for ged-emacs-devel@m.gmane.org; Wed, 18 May 2005 17:43:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DYQk9-0002gq-Le for ged-emacs-devel@m.gmane.org; Wed, 18 May 2005 11:45:57 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DYL4o-00017R-7z for emacs-devel@gnu.org; Wed, 18 May 2005 05:42:54 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DYL1r-0000B5-L7 for emacs-devel@gnu.org; Wed, 18 May 2005 05:39:59 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DYKhD-0007Ft-4w for emacs-devel@gnu.org; Wed, 18 May 2005 05:18:34 -0400 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1DYKnM-0004I9-Mp for emacs-devel@gnu.org; Wed, 18 May 2005 05:24:52 -0400 Original-Received: (qmail invoked by alias); 18 May 2005 09:09:58 -0000 Original-Received: from N809P030.adsl.highway.telekom.at (EHLO [62.47.45.30]) [62.47.45.30] by mail.gmx.net (mp012) with SMTP; 18 May 2005 11:09:58 +0200 X-Authenticated: #14592706 User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en Original-To: emacs-devel@gnu.org X-Y-GMX-Trusted: 0 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:37266 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:37266 In `lisp-font-lock-syntactic-face-function' the expression (eq n (or (get sym 'doc-string-elt) 3)) causes to paint _every_ third string subexpression of a top-level expression with `font-lock-doc-face'. That's annoying in a number of cases like, for example, `define-abbrev'. Why not simplify this to (eq n (get sym 'doc-string-elt)) and provide the necessary additional doc-string-elts like, (put 'defgroup 'doc-string-elt 3) (put 'defface 'doc-string-elt 3) (put 'defalias 'doc-string-elt 3) (put 'defvaralias 'doc-string-elt 3) (put 'define-obsolete-function-alias 'doc-string-elt 4) (put 'define-obsolete-variable-alias 'doc-string-elt 4) (put 'defimage 'doc-string-elt 3) (put 'define-category 'doc-string-elt 2) (put 'define-widget 'doc-string-elt 3) Also, the while loop in `lisp-font-lock-syntactic-face-function' seems overly expensive: For example, any top-level expression terminating with a string requires to backward-sexp from the start of the string to the start of the expression just to find out that the string is not a doc-string. I tried the following with the puts from above and encountered no problems so far: (defun lisp-font-lock-syntactic-face-function (state) (if (nth 3 state) (if (and (eq (nth 0 state) 1) (nth 1 state) ; is this needed ??? (save-excursion (let* ((from (1+ (nth 1 state))) ; is 1+ OK here ??? (sym (intern-soft (buffer-substring from (progn (goto-char from) (forward-sexp 1) (point))))) (doc-string-elt (get sym 'doc-string-elt))) (and (numberp doc-string-elt) ; check for > 0 too ??? (condition-case nil (progn (forward-sexp (1- doc-string-elt)) (forward-comment (buffer-size)) ;; the last two lines could be replaced by: ;; (forward-sexp doc-string-elt) ;; (backward-sexp) (= (point) (nth 8 state))) (scan-error nil)))))) font-lock-doc-face font-lock-string-face) font-lock-comment-face))