unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Michalis V." <mvar.40k@gmail.com>
To: Diego Berrocal <cestdiego@gmail.com>
Cc: Lars Ingebrigtsen <larsi@gnus.org>,
	Noam Postavsky <npostavs@gmail.com>,
	24739@debbugs.gnu.org
Subject: bug#24739: 25.1; conf-mode can't handle non escaped single quotes
Date: Sat, 21 Aug 2021 18:39:04 +0300	[thread overview]
Message-ID: <874kbierjb.fsf@cnu407c2zx.nsn-intra.net> (raw)
In-Reply-To: <m3y30i5vy7.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 28 Jul 2019 11:50:56 +0200")

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Noam Postavsky <npostavs@gmail.com> writes:
>
>> Lars Ingebrigtsen <larsi@gnus.org> writes:
>>
>>>> firstProperty=Hi I'm Diego
>>>> secondProperty=I have a stringquote style.
>>
>>> No font-lock-string-face in sight, and there's no mention of it in the
>>> file.  So is this some general font-lock thing that's configured
>>> somewhere else?  Anybody know how this stuff works?
>>
>> font-lock-string-face comes from font-lock-syntactic-face-function,
>> because ' has string delimiter syntax in conf-mode (see
>> conf-mode-syntax-table).
>
> Hm...  Oh!
>
>     (modify-syntax-entry ?\' "\"" table)
>
> I was searching for ?' and only found the entry in
> conf-toml-mode-syntax-table.  I'll remove that superfluous backslash.
>
>> I think it should be possible to make a syntax-propertize rule that
>> catches unmatched quotes and sets them to punctuation syntax.  We do
>> something similar in sgml-syntax-propertize.
>
> I see.

hi,

this conf-mode doesn't seem to follow the syntax-propertize structure so
it doesn't look very trivial to do something similar as in sgml mode
(at least as far as i managed to grasp the concept in there)..But the
conf-mode author(s) seem like they were aware of this font-locking
problem and had this workaround instead:

(defun conf-quote-normal (arg)
  "Set the syntax of \\=' and \" to punctuation.
With prefix ARG, only do it for \\=' if 1, or only for \" if 2.
This only affects the current buffer.  Some conf files use quotes
to delimit strings, while others allow quotes as simple parts of
the assigned value.  In those files font locking will be wrong,
and you can correct it with this command.  (Some files even do
both, i.e. quotes delimit strings, except when they are
unbalanced, but hey...)"
  (interactive "P")
  (let ((table (copy-syntax-table (syntax-table))))
    (when (or (not arg) (= (prefix-numeric-value arg) 1))
      (modify-syntax-entry ?\' "." table))
    (when (or (not arg) (= (prefix-numeric-value arg) 2))
      (modify-syntax-entry ?\" "." table))
    (set-syntax-table table)
    (font-lock-flush)))


which is bound to C-c C-q and it will temporarily fix the incorrect string
font-locking.. Any chance if it is sufficient for you Diego or do you think
a more permanent solution should be implemented instead?

thank you in advance,
Michalis





  reply	other threads:[~2021-08-21 15:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19 16:37 bug#24739: 25.1; conf-mode can't handle non escaped single quotes Diego Berrocal
2019-07-27 13:43 ` Lars Ingebrigtsen
2019-07-27 16:53   ` Noam Postavsky
2019-07-28  9:50     ` Lars Ingebrigtsen
2021-08-21 15:39       ` Michalis V. [this message]
2021-08-22 21:40         ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874kbierjb.fsf@cnu407c2zx.nsn-intra.net \
    --to=mvar.40k@gmail.com \
    --cc=24739@debbugs.gnu.org \
    --cc=cestdiego@gmail.com \
    --cc=larsi@gnus.org \
    --cc=npostavs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).