changeset 376:1bbd0c2b340f dev

When on-the-fly preview activated, overlay indicate its busy state. For overlay visibility, modify some foureground/background faces.
author HIROSE Yuuji <yuuji@gentei.org>
date Sun, 04 Jan 2015 00:39:44 +0900
parents afb8cb06b1d4
children 81413ee9c32d
files yatex.new yatex19.el yatex23.el yatexlib.el yatexprc.el
diffstat 5 files changed, 55 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/yatex.new	Wed Dec 31 23:00:01 2014 +0900
+++ b/yatex.new	Sun Jan 04 00:39:44 2015 +0900
@@ -1,6 +1,10 @@
 	What's new in YaTeX/yahtml
 	野鳥/yahtml - 各バージョンの変更点について
 
+1.79	=== yatex ===
+	数式環境など特定環境内の [prefix] t e で On-the-fly preview 発動。
+
+
 1.78	Drag&Dropサポートを追加。
 	tabular環境内で2連続以上Tabで、1カラム進む機能を追加。
 	=== yatex ===
--- a/yatex19.el	Wed Dec 31 23:00:01 2014 +0900
+++ b/yatex19.el	Sun Jan 04 00:39:44 2015 +0900
@@ -1,6 +1,6 @@
 ;;; yatex19.el -- YaTeX facilities for Emacs 19 or later
 ;;; (c)1994-2013 by HIROSE Yuuji.[yuuji@yatex.org]
-;;; Last modified Sun Dec 21 14:03:48 2014 on firestorm
+;;; Last modified Sat Jan  3 23:45:25 2015 on firestorm
 ;;; $Id$
 
 ;;; Code:
@@ -484,6 +484,14 @@
 
 (defun YaTeX-19-create-face (sym fgcolor &optional bgcolor)
   "Create face named SYM with face of FGCOLOR/BGCOLOR."
+  (if (consp fgcolor)
+      (setq fgcolor (if (eq YaTeX-background-mode 'light)
+			(car fgcolor)
+		      (cdr fgcolor))))
+  (if (consp bgcolor)
+      (setq bgcolor (if (eq YaTeX-background-mode 'light)
+			(car bgcolor)
+		      (cdr bgcolor))))
   (cond
    ((and YaTeX-use-font-lock (fboundp 'defface))
     (custom-declare-face
@@ -632,7 +640,8 @@
 		    (if single (list single 0 'macro))))))))))
 
 ;;2006/6/23 new face, `delimiter' introduced
-(YaTeX-19-create-face 'delimiter "saddlebrown" "ivory")
+(YaTeX-19-create-face
+ 'delimiter '("saddlebrown" . "lightyellow") '("ivory". "navy"))
 
 ;;(YaTeX-19-collect-macros)	;causes an error
 (defun YaTeX-hilit-setup-alist ()
--- a/yatex23.el	Wed Dec 31 23:00:01 2014 +0900
+++ b/yatex23.el	Sun Jan 04 00:39:44 2015 +0900
@@ -1,6 +1,6 @@
 ;;; yatex23.el --- YaTeX facilities for Emacs 23 or later -*- coding: sjis -*-
 ;;; (c)2014 by HIROSE Yuuji.[yuuji@yatex.org]
-;;; Last modified Tue Dec 23 12:44:35 2014 on firestorm
+;;; Last modified Sat Jan  3 23:34:41 2015 on firestorm
 ;;; $Id$
 
 ;;; Code:
@@ -89,6 +89,20 @@
 	(insert "\\input{" path "}"))))
      (t (message "%s" action)))))
 
+(defvar YaTeX-on-the-fly-bg-face '("#f0f0c0" . "#404020")
+  "Background color of on-the-fly preview image activated environment.")
+(defvar YaTeX-on-the-fly-overlay nil
+  "Overlay of on-the-fly preview image")
+(defface YaTeX-on-the-fly-activated-face
+  (list
+   (list (list '(class color))
+	 (list ':background
+	       (if (eq YaTeX-background-mode 'light)
+		   (car YaTeX-on-the-fly-bg-face)
+		 (cdr YaTeX-on-the-fly-bg-face))))
+   (list t (list ':bold t)))
+  "Face of on-the-fly preview image mode")
+
 (provide 'yatex23)
 
 ; Local variables:
--- a/yatexlib.el	Wed Dec 31 23:00:01 2014 +0900
+++ b/yatexlib.el	Sun Jan 04 00:39:44 2015 +0900
@@ -1,7 +1,7 @@
 ;;; yatexlib.el --- YaTeX and yahtml common libraries
 ;;; 
 ;;; (c)1994-2013 by HIROSE Yuuji.[yuuji@yatex.org]
-;;; Last modified Mon Dec 29 13:54:17 2014 on sdr
+;;; Last modified Sun Jan  4 00:16:04 2015 on firestorm
 ;;; $Id$
 
 ;;; Code:
@@ -1428,7 +1428,7 @@
     '((((class static-color)) (:bold t))
       (((type tty)) (:bold t))
       (((class color) (background dark)) (:foreground "khaki" :bold t))
-      (((class color) (background light)) (:foreground "Goldenrod"))
+      (((class color) (background light)) (:foreground "DarkGoldenrod4"))
       (t (:bold t :underline t)))
     "Font Lock mode face used to highlight formula."
     :group 'font-lock-faces)
@@ -1438,7 +1438,7 @@
     '((((class static-color)) (:bold t))
       (((type tty)) (:bold t))
       (((class color) (background dark))
-       (:foreground "saddlebrown" :background "ivory" :bold t))
+       (:foreground "lightyellow3" :background "navy" :bold t))
       (((class color) (background light)) (:foreground "red"))
       (t (:bold t :underline t)))
     "Font Lock mode face used to highlight delimiters."
@@ -1451,7 +1451,7 @@
       (((class color) (background dark))
        (:foreground "khaki" :bold t :underline t))
       (((class color) (background light))
-       (:foreground "Goldenrod" :underline t))
+       (:foreground "DarkGoldenrod4" :underline t))
       (t (:bold t :underline t)))
     "Font Lock mode face used to highlight subscripts in formula."
     :group 'font-lock-faces)
@@ -1463,7 +1463,7 @@
       (((class color) (background dark))
        (:bold nil :foreground "ivory" :background "lightyellow4"))
       (((class color) (background light))
-       (:underline t :foreground "gold"))
+       (:underline t :foreground "DarkGoldenrod3"))
       (t (:bold t :underline t)))
     "Font Lock mode face used to highlight superscripts in formula."
     :group 'font-lock-faces)
--- a/yatexprc.el	Wed Dec 31 23:00:01 2014 +0900
+++ b/yatexprc.el	Sun Jan 04 00:39:44 2015 +0900
@@ -1,7 +1,7 @@
 ;;; yatexprc.el --- YaTeX process handler
 ;;; 
 ;;; (c)1993-2014 by HIROSE Yuuji.[yuuji@yatex.org]
-;;; Last modified Wed Dec 31 22:42:56 2014 on sdr
+;;; Last modified Sat Jan  3 23:37:49 2015 on firestorm
 ;;; $Id$
 
 ;;; Code:
@@ -404,8 +404,10 @@
       (put 'dvi2-command 'file buffer)
       (put 'dvi2-command 'offset lineinfo))))
 
-(defvar YaTeX-use-image-preview t
-  "*Use or else view graphic preview image via [prefix] t e.")
+(defvar YaTeX-use-image-preview "jpg"
+  "*Nil means not using image preview by [prefix] t e.
+Acceptable value is one of \"jpg\" or \"png\", which specifies
+format of preview image.")
 (defvar YaTeX-preview-image-mode-map nil
   "Keymap used in YaTeX-preview-image-mode")
 (defun YaTeX-preview-image-mode ()
@@ -436,7 +438,8 @@
 
 (defvar YaTeX-typeset-dvi2image-chain
   (cond
-   ((YaTeX-executable-find "dvipng")
+   ((and (equal YaTeX-use-image-preview "png")
+	 (YaTeX-executable-find "dvipng"))
     (list "dvipng %b.dvi"))
    ((YaTeX-executable-find YaTeX-cmd-dvips)
     (list
@@ -460,7 +463,8 @@
 (defun YaTeX-typeset-conv2image-chain ()
   (let*((proc (or YaTeX-typeset-process YaTeX-typeset-conv2image-process))
 	(prevname (process-name proc))
-	(texput "texput") (format "jpg")
+	(texput "texput")
+	(format YaTeX-use-image-preview)
 	(target (concat texput "." format))
 	(math (get 'YaTeX-typeset-conv2image-chain 'math))
 	(srctype (or (get 'YaTeX-typeset-conv2image-chain 'srctype)
@@ -571,7 +575,7 @@
      ;; If condition changed from last call, do it
      ((and (/= p (preceding-char))
 	   (/= q (char-after (- (point) 1)))
-	   (not (string= st (YaTeX-buffer-substring s e))))
+	   (not (string= st (YaTeX-buffer-substring s (min e (point-max))))))
       (YaTeX-typeset-environment)))))
 
 (defun YaTeX-typeset-environment ()
@@ -600,7 +604,15 @@
 		       (YaTeX-buffer-substring b e)
 		       (current-time)))
 	    (YaTeX-typeset-region 'YaTeX-typeset-conv2image-chain)
-	    (if usetimer (YaTeX-typeset-environment-auto)))
+	    (if usetimer
+		(progn
+		  (if YaTeX-on-the-fly-overlay
+		      (move-overlay YaTeX-on-the-fly-overlay b e)
+		    (overlay-put
+		     (setq YaTeX-on-the-fly-overlay (make-overlay b e))
+		     'face 'YaTeX-on-the-fly-activated-face))
+		  (YaTeX-typeset-environment-auto)
+		  )))
 	(YaTeX-typeset-region)))))
 
 (defvar YaTeX-on-the-fly-preview-image (string-to-number "0.1")
@@ -628,6 +640,7 @@
   (interactive)
   (cancel-timer YaTeX-typeset-environment-timer)
   (setq YaTeX-typeset-environment-timer nil)
+  (delete-overlay YaTeX-on-the-fly-overlay)
   (message "Auto-preview canceled"))
 
 

yatex.org