From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Michael Mauger Newsgroups: gmane.emacs.devel Subject: Feature request: Easy customisation of sql-mode product keywords Date: Mon, 03 Jun 2019 02:17:34 +0000 Message-ID: Reply-To: Michael Mauger Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="46438"; mail-complaints-to="usenet@blaine.gmane.org" To: "emacs-devel\\@gnu.org" , Nik Clayton Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 03 04:27:00 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hXcgd-000Bwd-1k for ged-emacs-devel@m.gmane.org; Mon, 03 Jun 2019 04:26:59 +0200 Original-Received: from localhost ([127.0.0.1]:56525 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hXcgb-0001oN-2b for ged-emacs-devel@m.gmane.org; Sun, 02 Jun 2019 22:26:57 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:42085) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hXcgU-0001nq-U2 for emacs-devel@gnu.org; Sun, 02 Jun 2019 22:26:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hXcXl-0005mE-QJ for emacs-devel@gnu.org; Sun, 02 Jun 2019 22:17:51 -0400 Original-Received: from mail2.protonmail.ch ([185.70.40.22]:12938) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hXcXl-0005kF-BB for emacs-devel@gnu.org; Sun, 02 Jun 2019 22:17:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=default; t=1559528262; bh=MAn+uF29UWUmE5LPPeEb0ouPfVq2zU9/3Mw2L3FpD/k=; h=Date:To:From:Reply-To:Subject:Feedback-ID:From; b=vg8v3WDqoQqUFuwNvTx1IyTTTS+X4eWrPkEUVSRE6OxO7NnQv332TeRXWtPikRNse UFVq+Fx8hrcGcOHHA8jKFOlTv1wAf3KkHsJQOgbCCQKyFMgq2jMUTCqYeTT5uAFFKG lCasWawtEZZIjvTryNBsLW+K+BWKAwA1tuNU6p+A= Feedback-ID: b6CpL0MxcIA6fpHRkn3ZHzWS0Hoqxbtv_SrHfEzC9D85cLvnRsVk4rKaAOJUw48iy20W0W1VX4whjBYFluIX0w==:Ext:ProtonMail X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.70.40.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:237202 Archived-At: On Tue, 7 May 2019 19:33:59 +0200, Nic Clayton said: > Hi, I've got a feature request for sql-mode. > > [not 100% certain if this list was better than bug-gnu-emacs, but > https://www.emacswiki.org/emacs/MichaelMauger mentioned monitoring this > list, so I figured it was a better fit]> Sorry for the delay in responding-- I've been laid up for a while... > I'd like to be able to easily either: > > 1. Configure the mode to only recongnise keywords in uppercase, or > 2. Customise the keywords associated with an SQL product in sql-mode. > > ... > >=C2=A0 SELECT name >=C2=A0=C2=A0=C2=A0 FROM track >=C2=A0=C2=A0 WHERE trackid =3D 1222; > > the "name" on the first line is highlighted as a keyword. Because it is, = it > shows up in sql-mode-ansi-font-lock-keywords. > There are two ways to alter the keyword locking in your case: 1) Set `sql-mode-ansi-font-lock-keywords` to nil and rely upon only on the dialect keywords =C2=A0=C2=A0=C2=A0 (setq sql-mode-ansi-font-lock-keywords nil) 2) Add keyword matching rules that override the default settings so that yo= u get highlighting that you want. =C2=A0=C2=A0=C2=A0 (sql-add-product-keywords 'mysql =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (cons =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (regexp-opt '("name" "table_name= " "index_name" "constraint_name") 'symbols) '(quote default)))=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 I am looking to add more sophisticated font locking to sql-mode to avoid highlighting keywords in places where the syntax isn't looking for one. > > Best, N Hopefully this helps. Happy Hacking! -- MICHAEL@MAUGER.COM // FSF and EFF member // GNU Emacs sql.el maintainer