auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 04b9a6d1: Improve shortvrb.sty support


From: Arash Esbati
Subject: Re: master 04b9a6d1: Improve shortvrb.sty support
Date: Mon, 24 Apr 2023 14:29:11 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Hi Keita,

Ikumi Keita <ikumi@ikumi.que.jp> writes:

> branch: master
> commit 04b9a6d1f9c7337e1f500721c9ad32029f3fb4c8
> Author: Ikumi Keita <ikumi@ikumi.que.jp>
> Commit: Ikumi Keita <ikumi@ikumi.que.jp>
>
>     Improve shortvrb.sty support
>     
>     * style/shortvrb.el ("shortvrb"): Install new syntax table which
>     assigns "string quotes" syntax to chars in `LaTeX-shortvrb-chars'.
>     Change syntax of those chars in `font-lock-syntax-table' from "generic
>     string delimiters" to "string quotes" so that they won't interfere
>     with each other.
> [...]
> diff --git a/style/shortvrb.el b/style/shortvrb.el
> index a8b4cd17..e6de0608 100644
> --- a/style/shortvrb.el
> +++ b/style/shortvrb.el
> @@ -69,12 +69,21 @@
>                    (cons str str)))
>                LaTeX-shortvrb-chars)))
>  
> +   ;; Syntax
> +   ;; N.B. This doesn't handle backslash just before the closing
> +   ;; delimiter like |xyz\| correctly.  We hope we can live with that.
> +   (when LaTeX-shortvrb-chars
> +     (let ((st (make-syntax-table (syntax-table))))
> +       (dolist (c LaTeX-shortvrb-chars)
> +         (modify-syntax-entry c "\"" st))
> +       (set-syntax-table st)))
> +
>     ;; Fontification
>     (when (and LaTeX-shortvrb-chars
>                (featurep 'font-latex)
>                (eq TeX-install-font-lock 'font-latex-setup))
>       (font-latex-add-to-syntax-alist
> -      (mapcar (lambda (char) (cons char "|"))
> +      (mapcar (lambda (char) (cons char "\""))
>                LaTeX-shortvrb-chars))
>  
>       (font-latex-add-keywords '(("MakeShortVerb"   "*{")

You installed the change above some time ago and I was thinking if we
could fix the N.B. comment by making a change like this:

--8<---------------cut here---------------start------------->8---
diff --git a/style/shortvrb.el b/style/shortvrb.el
index e6de0608..59d31101 100644
--- a/style/shortvrb.el
+++ b/style/shortvrb.el
@@ -82,9 +82,21 @@
    (when (and LaTeX-shortvrb-chars
               (featurep 'font-latex)
               (eq TeX-install-font-lock 'font-latex-setup))
-     (font-latex-add-to-syntax-alist
-      (mapcar (lambda (char) (cons char "\""))
-              LaTeX-shortvrb-chars))
+     ;; (font-latex-add-to-syntax-alist
+     ;;  (mapcar (lambda (char) (cons char "\""))
+     ;;          LaTeX-shortvrb-chars))
+
+     (dolist (c LaTeX-shortvrb-chars)
+       (let ((s (char-to-string c)))
+         (add-to-list 'font-latex-syntactic-keywords-extra
+                      `(,(concat "\\(" s "\\)"
+                                 ".*?"
+                                 "\\(" (regexp-quote TeX-esc) "*\\)"
+                                 "\\(" s "\\)")
+                        (1 "\"") (2 ".") (3 "\"")))))
+
+     ;; Tell font-lock about the update
+     (font-latex-set-syntactic-keywords)

      (font-latex-add-keywords '(("MakeShortVerb"   "*{")
                                 ("DeleteShortVerb" "{"))
--8<---------------cut here---------------end--------------->8---

WDYT?

Best, Arash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]