all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* sql-mode: strange syntax highlighting, Emacs 25.1.1
@ 2016-09-26 13:47 Aleksandar Simic
  0 siblings, 0 replies; only message in thread
From: Aleksandar Simic @ 2016-09-26 13:47 UTC (permalink / raw)
  To: help-gnu-emacs

Hello

When using sql-mode to write SQL which uses parameter placeholders,
unexpected words are syntax highlighted. Or better, parts of the word.

For example, I have the following:

SELECT * FROM foo WHERE created_at = :created-at

This is under:
Emacs version 25.1.1
sql.el version 3.5 (that comes with Emacs 25.1.1)

The same behaviour is present in my customised Emacs or in Emacs invoked
with '--no-init-file'.

In the last word `:created-at', `at' is highlighted, whereas `:created-' is
not.

I can see in sql.el that `at' is listed as ANSI reserved keyword. But
the above `at' is part of a word.

Executing: C-u C-x =

on `a' in `at' I get the following properties:

There are text properties here:
  face                 font-lock-keyword-face
  fontified            t

The same properties are shown for `t' in `at'.


But when I execute: C-u C-x =
on any of the characters that make ':created-', I get just:

There are text properties here:
  fontified            t


The same issue is present if I have the following examples, all the
`at', have a different face to the rest of the word:

SELECT * FROM foo WHERE created_at = :created-at-at-at
SELECT * FROM foo WHERE created_at = :at-created

Looking at sql-font-lock-keywords-builder in sql.el, which takes three
arguments: face, boundaries and the optional third argument keywords,
there is the following:

(or boundaries '("\\b" . "\\b"))

I couldn't figure out a way of passing in the boundaries that I'd
want/need, short of re-creating a new `product' (i.e. adding all new
syntax highlighting for a new database).

DIRTY HACK: If I tweak the values of the `boundaries', directly in
sql-font-lock-keywords-builder, the `-at' part of the word is treated
as I'd expect: that part of the word doesn't have a different face to
the first part of the word.

But obviously that is not ideal. So what is the correct way of dealing
with something like this?

Thank you for your time,
Aleksandar


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-09-26 13:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-26 13:47 sql-mode: strange syntax highlighting, Emacs 25.1.1 Aleksandar Simic

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.