auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] [elpa] externals/auctex cfb6b1f 7/9: Fontify content of c


From: Tassilo Horn
Subject: [AUCTeX-diffs] [elpa] externals/auctex cfb6b1f 7/9: Fontify content of comment environment
Date: Sun, 24 May 2020 03:27:54 -0400 (EDT)

branch: externals/auctex
commit cfb6b1fb5bf1d04aae82856ef30f73a83b9d1938
Author: Arash Esbati <address@hidden>
Commit: Arash Esbati <address@hidden>

    Fontify content of comment environment
    
    * style/verbatim.el ("verbatim"): Add fontification support for
    comment environment.  Delete unnecessary `function' in the hook.
---
 style/verbatim.el | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/style/verbatim.el b/style/verbatim.el
index 1fb7bdd..8491dfe 100644
--- a/style/verbatim.el
+++ b/style/verbatim.el
@@ -1,6 +1,6 @@
 ;;; verbatim.el --- Style hook for the verbatim package.
 
-;; Copyright (C) 2001 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2020 Free Software Foundation, Inc.
 
 ;; Author: Masayuki Ataka <address@hidden>
 ;; Maintainer: address@hidden
@@ -29,13 +29,28 @@
 
 ;;; Code
 
-(TeX-add-style-hook "verbatim"
- (function
-  (lambda ()
-    (LaTeX-add-environments
-     "comment")
-    (TeX-add-symbols
-     '("verbatiminput" TeX-arg-file))))
+(TeX-add-style-hook
+ "verbatim"
+ (lambda ()
+   (LaTeX-add-environments
+    "comment")
+   (TeX-add-symbols
+    '("verbatiminput" TeX-arg-file))
+
+   ;; Fontification:
+   ;; Code taken from `comment.sty'
+   (when (and (boundp 'font-latex-syntactic-keywords-extra)
+             (fboundp 'font-latex-update-font-lock)
+             (eq TeX-install-font-lock 'font-latex-setup))
+     ;; For syntactic fontification.
+     (add-to-list 'font-latex-syntactic-keywords-extra
+                 '("^[ \t]*\\\\begin *{comment}.*\\(\n\\)"
+                   (1 "!" t)))
+     (add-to-list 'font-latex-syntactic-keywords-extra
+                 '("^[ \t]*\\(\\\\\\)end *{comment}"
+                   (1 "!" t)))
+     ;; Tell font-lock about the update.
+     (font-latex-update-font-lock t)))
  LaTeX-dialect)
 
 (defvar LaTeX-verbatim-package-options nil



reply via email to

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