[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 04b9a6d1: Improve shortvrb.sty support
From: |
Ikumi Keita |
Subject: |
master 04b9a6d1: Improve shortvrb.sty support |
Date: |
Thu, 7 Jul 2022 01:00:50 -0400 (EDT) |
branch: master
commit 04b9a6d1f9c7337e1f500721c9ad32029f3fb4c8
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>
Improve shortvrb.sty support
* latex.el (LaTeX-verbatim-p): Consult syntax parse instead of
font-latex face.
(LaTeX-common-initialization): Delete FIXME comment which is now
obsolete.
* 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.
---
latex.el | 9 ++++-----
style/shortvrb.el | 11 ++++++++++-
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/latex.el b/latex.el
index ac4b0c54..e8b81409 100644
--- a/latex.el
+++ b/latex.el
@@ -3713,8 +3713,9 @@ non-parenthetical delimiters, like \\verb+foo+, are
recognized."
"Return non-nil if position POS is in a verbatim-like construct."
(when pos (goto-char pos))
(save-match-data
- (or (when (fboundp 'font-latex-faces-present-p)
- (font-latex-faces-present-p 'font-latex-verbatim-face))
+ (or (progn
+ (syntax-propertize (point))
+ (nth 3 (syntax-ppss)))
(member (LaTeX-current-verbatim-macro)
(LaTeX-verbatim-macros-with-delims))
(member (TeX-current-macro) (LaTeX-verbatim-macros-with-braces))
@@ -7353,9 +7354,7 @@ function would return non-nil and `(match-string 1)'
would return
(set (make-local-variable 'fill-paragraph-function) #'LaTeX-fill-paragraph)
(set (make-local-variable 'adaptive-fill-mode) nil)
;; Cater for \verb|...| (and similar) contructs which should not be
- ;; broken. (FIXME: Make it work with shortvrb.sty (also loaded by
- ;; doc.sty) where |...| is allowed. Arbitrary delimiters may be
- ;; chosen with \MakeShortVerb{<char>}.)
+ ;; broken.
(add-to-list (make-local-variable 'fill-nobreak-predicate)
#'LaTeX-verbatim-p t)
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" "*{")
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 04b9a6d1: Improve shortvrb.sty support,
Ikumi Keita <=