[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 08ab3c1 23/78: Allow hiding ^ and _ script signs
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 08ab3c1 23/78: Allow hiding ^ and _ script signs |
Date: |
Mon, 19 Oct 2015 09:10:46 +0000 |
branch: externals/auctex
commit 08ab3c10d51f0956e8faca2c85f5e0d38bee4303
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>
Allow hiding ^ and _ script signs
* font-latex.el (font-latex-fontify-script): Add possible value
`multi-level' to allow raising/lowering scripts of scripts, and
another value `invisible' which in addition hides the ^ and _
characters in scripts.
(font-latex-match-script): Use it.
(font-latex-make-user-keywords): Add font-lock entry for script
signs.
(font-latex-script-invisible): New function.
---
ChangeLog | 7 ++++-
font-latex.el | 90 +++++++++++++++++++++++++++++++++++---------------------
2 files changed, 62 insertions(+), 35 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3d698b7..703db99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,13 @@
2015-09-03 Tassilo Horn <address@hidden>
* font-latex.el (font-latex-fontify-script): Add possible value
- `multi-level' to allow raising/lowering scripts of scripts.
+ `multi-level' to allow raising/lowering scripts of scripts, and
+ another value `invisible' which in addition hides the ^ and _
+ characters in scripts.
(font-latex-match-script): Use it.
+ (font-latex-make-user-keywords): Add font-lock entry for script
+ signs.
+ (font-latex-script-invisible): New function.
* tex.el (TeX-tex-mode): Don't ignore case when matching the
TeX-format-list regexes.
diff --git a/font-latex.el b/font-latex.el
index 2a9fc26..0df8a96 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -810,7 +810,7 @@ Generated by `font-latex-make-user-keywords'.")))
(add-to-list 'font-latex-keywords-1 item)
(add-to-list 'font-latex-keywords-2 item))
(dolist (item
- '((font-latex-match-math-env
+ `((font-latex-match-math-env
(0 'font-latex-warning-face t t)
(1 'font-latex-math-face append t))
(font-latex-match-math-envII
@@ -818,7 +818,8 @@ Generated by `font-latex-make-user-keywords'.")))
(font-latex-match-simple-command
(0 'font-latex-sedate-face append))
(font-latex-match-script
- (1 (font-latex-script (match-beginning 0)) append))))
+ (1 (font-latex-script (match-beginning 0)) append))
+ ("[_^]" (0 (font-latex-script-invisible (match-beginning 0)) t))))
(add-to-list 'font-latex-keywords-2 item t)))
(font-latex-make-user-keywords)
@@ -856,17 +857,23 @@ This feature does not work in XEmacs.
By default, super/subscripts are raised/lowered if this variable
is non-nil. This fontification only affects one level of
scripts, e.g., in x^y^z, the y and the z have the same size and
-are equally raised over x. If this variable is set to the symbol
-`multi-level', then y is raised above x, and z is raised above y.
-With many script levels, the text might become too small to be
-readable."
+are equally raised over x.
+
+If this variable is set to the symbol `multi-level', then y is
+raised above x, and z is raised above y. With many script
+levels, the text might become too small to be readable.
+
+If this variable is set to the symbol `invisible', then the
+effect is essentially like `multi-level' but additionally the
+script operators ^ and _ are not displayed."
:type '(choice (boolean :tag "Enabled")
- (const :tag "Multiple levels" multi-level))
+ (const :tag "Multiple levels" multi-level)
+ (const :tag "Hide ^ and _" invisible))
:group 'font-latex)
(put 'font-latex-fontify-script 'safe-local-variable
(lambda (val)
(or (TeX-booleanp val)
- (eq 'multi-level val))))
+ (memq val '(multi-level invisible)))))
(defcustom font-latex-script-display '((raise -0.3) . (raise 0.3))
"Display specification for subscript and superscript content.
@@ -1096,14 +1103,14 @@ have changed."
'(:inherit fixed-pitch)
'(:family "courier"))))
`((((class grayscale) (background light))
- (:foreground "DimGray" ,@font))
- (((class grayscale) (background dark))
- (:foreground "LightGray" ,@font))
- (((class color) (background light))
- (:foreground "SaddleBrown" ,@font))
- (((class color) (background dark))
- (:foreground "burlywood" ,@font))
- (t (,@font))))
+ (:foreground "DimGray" ,@font))
+ (((class grayscale) (background dark))
+ (:foreground "LightGray" ,@font))
+ (((class color) (background light))
+ (:foreground "SaddleBrown" ,@font))
+ (((class color) (background dark))
+ (:foreground "burlywood" ,@font))
+ (t (,@font))))
"Face used to highlight TeX verbatim environments."
:group 'font-latex-highlighting-faces)
@@ -1209,8 +1216,8 @@ triggers Font Lock to recognize the change."
;; `VirTeX-common-initialization' and place it in the different
;; `xxx-mode' calls instead, but _after_ `major-mode' is set.
(let ((defaults
- `((font-latex-keywords font-latex-keywords-1 font-latex-keywords-2)
- nil nil ,font-latex-syntax-alist nil))
+ `((font-latex-keywords font-latex-keywords-1 font-latex-keywords-2)
+ nil nil ,font-latex-syntax-alist nil))
(variables
'((font-lock-comment-start-regexp . "%")
(font-lock-mark-block-function . mark-paragraph)
@@ -1251,21 +1258,21 @@ triggers Font Lock to recognize the change."
(defun font-latex-jit-lock-force-redisplay (buf start end)
"Compatibility for Emacsen not offering `jit-lock-force-redisplay'."
- ;; The following block is an expansion of `jit-lock-force-redisplay'
- ;; and involved macros taken from CVS Emacs on 2007-04-28.
- (with-current-buffer buf
- (let ((modified (buffer-modified-p)))
- (unwind-protect
- (let ((buffer-undo-list t)
- (inhibit-read-only t)
- (inhibit-point-motion-hooks t)
- (inhibit-modification-hooks t)
- deactivate-mark
- buffer-file-name
- buffer-file-truename)
- (put-text-property start end 'fontified t))
- (unless modified
- (restore-buffer-modified-p nil))))))
+ ;; The following block is an expansion of `jit-lock-force-redisplay'
+ ;; and involved macros taken from CVS Emacs on 2007-04-28.
+ (with-current-buffer buf
+ (let ((modified (buffer-modified-p)))
+ (unwind-protect
+ (let ((buffer-undo-list t)
+ (inhibit-read-only t)
+ (inhibit-point-motion-hooks t)
+ (inhibit-modification-hooks t)
+ deactivate-mark
+ buffer-file-name
+ buffer-file-truename)
+ (put-text-property start end 'fontified t))
+ (unless modified
+ (restore-buffer-modified-p nil))))))
(defun font-latex-fontify-region (beg end &optional loudly)
"Fontify region from BEG to END.
@@ -1864,7 +1871,7 @@ END marks boundaries for searching for quotation ends."
(when (and font-latex-fontify-script
(re-search-forward "[_^] *\\([^\n\\{}]\\|\
\\\\\\(address@hidden|[^ \t\n]\\)\\|\\({\\)\\)" limit t))
- (if (and (not (eq 'multi-level font-latex-fontify-script))
+ (if (and (not (memq font-latex-fontify-script '(multi-level invisible)))
(font-latex-faces-present-p '(font-latex-subscript-face
font-latex-superscript-face)))
;; Apply subscript and superscript highlighting only once (in case
@@ -1916,6 +1923,21 @@ END marks boundaries for searching for quotation ends."
,(cdr font-latex-script-display))
'font-latex-superscript-face)))))
+(defun font-latex-script-invisible (pos)
+ "Make the super/subscript sign invisible."
+ (when (and (eq font-latex-fontify-script 'invisible)
+ (font-latex-faces-present-p 'font-latex-math-face pos)
+ (not (font-latex-faces-present-p '(font-lock-constant-face
+ font-lock-builtin-face
+ font-lock-comment-face
+ font-latex-verbatim-face) pos))
+ ;; Check for backslash quoting
+ (not (let ((odd nil)
+ (pos pos))
+ (while (eq (char-before pos) ?\\)
+ (setq pos (1- pos) odd (not odd)))
+ odd)))
+ `(face nil invisible t)))
;;; docTeX
- [elpa] externals/auctex 2648a58 06/78: New function to read labels., (continued)
- [elpa] externals/auctex 2648a58 06/78: New function to read labels., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex be9f14a 02/78: Add the missing starred version of \AddEnumerateCounter., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 30be9cc 09/78: Add support for prettify-symbols-mode, Tassilo Horn, 2015/10/19
- [elpa] externals/auctex eff71a7 10/78: Change | syntax to punctuation; fixes bug#21366, Tassilo Horn, 2015/10/19
- [elpa] externals/auctex a4d23f6 07/78: Add menu and new functions for error overview., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex a85d7c6 15/78: Add support for undocumented macros `\captionbox[*]'., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex a3e3ab8 14/78: Add new style transparent.el., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 8d5acb0 13/78: Do not indent the content of `filecontents[*]' env., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 57338ec 24/78: Improve my last commit, Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 400609e 18/78: New TeX--if-macro-fboundp compatibility macro, Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 08ab3c1 23/78: Allow hiding ^ and _ script signs,
Tassilo Horn <=
- [elpa] externals/auctex 0b3a6e8 12/78: Do not indent the content of `Form' environment., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 40963e5 08/78: Check engine before running LaTeX command., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 33cee84 19/78: Allow TeX-command-sequence to process the region, Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 513490f 22/78: Implement multi-level script fontification, Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 76eb240 25/78: Docfix, Tassilo Horn, 2015/10/19
- [elpa] externals/auctex a07f436 16/78: Implement TeX-update., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex dbc87df 17/78: Generate PDF via dvips+ps2pdf., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex dd9adef 21/78: Case-sensitive mode detection + AMS-TeX fixes, Tassilo Horn, 2015/10/19
- [elpa] externals/auctex da7419f 42/78: Add new style AlegreyaSans.el., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 9cfd5d8 47/78: Improve LaTeX-find-matching-end, Tassilo Horn, 2015/10/19