From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Mastro Newsgroups: gmane.emacs.help Subject: Help with font-lock / syntax-propertize-function Date: Fri, 19 Dec 2014 09:53:10 -0800 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1419011635 17032 80.91.229.3 (19 Dec 2014 17:53:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Dec 2014 17:53:55 +0000 (UTC) To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 19 18:53:49 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Y21kI-0004Qm-Ii for geh-help-gnu-emacs@m.gmane.org; Fri, 19 Dec 2014 18:53:46 +0100 Original-Received: from localhost ([::1]:59995 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y21kI-0003oE-4Z for geh-help-gnu-emacs@m.gmane.org; Fri, 19 Dec 2014 12:53:46 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y21k5-0003mw-Ph for help-gnu-emacs@gnu.org; Fri, 19 Dec 2014 12:53:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y21k4-00079G-E1 for help-gnu-emacs@gnu.org; Fri, 19 Dec 2014 12:53:33 -0500 Original-Received: from mail-ob0-x22d.google.com ([2607:f8b0:4003:c01::22d]:38415) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y21k4-00079C-7K for help-gnu-emacs@gnu.org; Fri, 19 Dec 2014 12:53:32 -0500 Original-Received: by mail-ob0-f173.google.com with SMTP id uy5so13599918obc.4 for ; Fri, 19 Dec 2014 09:53:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=rtpBRvYkSa25efJ5yZnSl6a2vSGtMpU4l7d5Hf3HxZk=; b=q6Qd6wiqh+adAsfjkideEge/zQkKBR8wQ3n+f60ysyuFono8KgWsbuFetfOL4CcO3r PKWT/tDewqAVXALJv/mjxzGMIlZn9Ov8VfFi32CPhwC3FbJ4fSeFhethlcVF2G9MyQYU GSVgworoK7sHvwI+z66xyBRnVnJhRFz8td7fnRnNzFSeVDrHgauNfF5M+/1IH3RC5Nl9 bYkBpp3480FeNmVdvV1eVO/2z74gsEXCzGXI1R3HXnUxWDBH94NVJnZDHgpYFRj1kdaa TEM3mFotG2qpESiQtGGsWh32d3ARvEVwnhlwduJtI8ahdaOZHkIWc/0Zr2nOvyucgmjh ouFg== X-Received: by 10.182.205.164 with SMTP id lh4mr5473573obc.5.1419011610689; Fri, 19 Dec 2014 09:53:30 -0800 (PST) Original-Received: by 10.76.12.162 with HTTP; Fri, 19 Dec 2014 09:53:10 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c01::22d X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:101680 Archived-At: Hello Emacsers, I'm trying to customize the fontification done by SQL mode in Emacs 24.4 (the PostgreSQL product, though IIUC that's not relevant to this situation). Column names that need to be quoted are put in double quotes. By default, the text within the double quotes is fontified as if it were not in quotes. So if I have a column name like "Date of Birth", the word "Date" is fontified like a type name. (My understanding is that this is because double quotes are treated as punctuation rather than string delimiters). I find that a little distracting - it makes it harder to tell where the column name starts. What I'd like to do is force the text within double quotes not to be fontified at all. However, even after reading the relevant manual sections and some very useful blog posts[1][2] I'm still not sure how to go about this. I've cargo-culted some code, unsuccessfully. Any pointers on what I'm doing wrong? (defun my-sql-syntax-propertize-function (beg end) (goto-char beg) (funcall (syntax-propertize-rules ((rx "\"" (1+ not-newline) "\"") (0 (ignore (my-sql-syntax-propertize-double-quotes))))))) (defun my-sql-syntax-propertize-double-quotes () (let ((beg (match-beginning 0)) (end (match-end 0))) (put-text-property beg end 'font-lock-face nil))) (defun my-sql-add-syntax-propertize-function () (setq-local syntax-propertize-function #'my-sql-syntax-propertize-function)) (add-hook 'sql-mode-hook #'my-sql-add-syntax-propertize-function) Thanks [1] http://www.lunaryorn.com/2014/03/12/syntactic-fontification-in-emacs.html [2] http://www.lunaryorn.com/2014/06/16/advanced-syntactic-fontification.html -- john