changeset 81776:7fa3928586ff

(tex-fontify-script) (tex-font-script-display): New variables to make display of superscripts and subscripts customizable. (tex-font-lock-suscript, tex-font-lock-match-suscript): Use them.
author Reiner Steib <Reiner.Steib@gmx.de>
date Mon, 09 Jul 2007 19:14:48 +0000
parents 63eac91e9690
children 6306681bf3b4
files lisp/ChangeLog lisp/textmodes/tex-mode.el
diffstat 2 files changed, 28 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Jul 09 14:45:13 2007 +0000
+++ b/lisp/ChangeLog	Mon Jul 09 19:14:48 2007 +0000
@@ -1,3 +1,10 @@
+2007-07-09  Reiner Steib  <Reiner.Steib@gmx.de>
+
+	* textmodes/tex-mode.el (tex-fontify-script)
+	(tex-font-script-display): New variables to make display of
+	superscripts and subscripts customizable.
+	(tex-font-lock-suscript, tex-font-lock-match-suscript): Use them.
+
 2007-07-09  Richard Stallman  <rms@gnu.org>
 
 	* isearch.el (isearch-edit-string): Call to isearch-push-state
@@ -372,6 +379,7 @@
 	* font-lock.el (lisp-font-lock-keywords-2): Recognize the new \(?1:..\)
 	syntax as well.  Reported by Juri Linkov <juri@jurta.org>.
 
+>>>>>>> 1.11328
 2007-06-28  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
 	* dnd.el (dnd-get-local-file-name): Set fixcase to t in call to
--- a/lisp/textmodes/tex-mode.el	Mon Jul 09 14:45:13 2007 +0000
+++ b/lisp/textmodes/tex-mode.el	Mon Jul 09 19:14:48 2007 +0000
@@ -243,6 +243,21 @@
   :options '("''" "\">" "\"'" ">>" "ยป")
   :group 'tex)
 
+(defcustom tex-fontify-script t
+  "If non-nil, fontify subscript and superscript strings."
+  :type 'boolean
+  :group 'tex)
+(put 'tex-fontify-script 'safe-local-variable 'booleanp)
+
+(defcustom tex-font-script-display '(-0.3 . 0.3)
+  "Display specification for subscript and superscript content.
+The car is used for subscript, the cdr is used for superscripts."
+  :group 'tex
+  :type '(cons (choice (float :tag "Subscript")
+		       (const :tag "No lowering" nil))
+	       (choice (float :tag "Superscript")
+		       (const :tag "No raising" nil))))
+
 (defvar tex-last-temp-file nil
   "Latest temporary file generated by \\[tex-region] and \\[tex-buffer].
 Deleted when the \\[tex-region] or \\[tex-buffer] is next run, or when the
@@ -593,13 +608,14 @@
 		  (setq pos (1- pos) odd (not odd)))
 		odd))
     (if (eq (char-after pos) ?_)
-	'(face subscript display (raise -0.3))
-      '(face superscript display (raise +0.3)))))
+	`(face subscript display (raise ,(car tex-font-script-display)))
+      `(face superscript display (raise ,(cdr tex-font-script-display))))))
 
 (defun tex-font-lock-match-suscript (limit)
   "Match subscript and superscript patterns up to LIMIT."
-  (when (re-search-forward "[_^] *\\([^\n\\{}]\\|\
-\\\\\\([a-zA-Z@]+\\|[^ \t\n]\\)\\|\\({\\)\\)" limit t)
+  (when (and tex-fontify-script
+	     (re-search-forward "[_^] *\\([^\n\\{}]\\|\
+\\\\\\([a-zA-Z@]+\\|[^ \t\n]\\)\\|\\({\\)\\)" limit t))
     (when (match-end 3)
       (let ((beg (match-beginning 3))
 	    (end (save-restriction