yatex

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 diff
     1.1 --- a/yatex.new	Wed Dec 31 23:00:01 2014 +0900
     1.2 +++ b/yatex.new	Sun Jan 04 00:39:44 2015 +0900
     1.3 @@ -1,6 +1,10 @@
     1.4  	What's new in YaTeX/yahtml
     1.5  	野鳥/yahtml - 各バージョンの変更点について
     1.6  
     1.7 +1.79	=== yatex ===
     1.8 +	数式環境など特定環境内の [prefix] t e で On-the-fly preview 発動。
     1.9 +
    1.10 +
    1.11  1.78	Drag&Dropサポートを追加。
    1.12  	tabular環境内で2連続以上Tabで、1カラム進む機能を追加。
    1.13  	=== yatex ===
     2.1 --- a/yatex19.el	Wed Dec 31 23:00:01 2014 +0900
     2.2 +++ b/yatex19.el	Sun Jan 04 00:39:44 2015 +0900
     2.3 @@ -1,6 +1,6 @@
     2.4  ;;; yatex19.el -- YaTeX facilities for Emacs 19 or later
     2.5  ;;; (c)1994-2013 by HIROSE Yuuji.[yuuji@yatex.org]
     2.6 -;;; Last modified Sun Dec 21 14:03:48 2014 on firestorm
     2.7 +;;; Last modified Sat Jan  3 23:45:25 2015 on firestorm
     2.8  ;;; $Id$
     2.9  
    2.10  ;;; Code:
    2.11 @@ -484,6 +484,14 @@
    2.12  
    2.13  (defun YaTeX-19-create-face (sym fgcolor &optional bgcolor)
    2.14    "Create face named SYM with face of FGCOLOR/BGCOLOR."
    2.15 +  (if (consp fgcolor)
    2.16 +      (setq fgcolor (if (eq YaTeX-background-mode 'light)
    2.17 +			(car fgcolor)
    2.18 +		      (cdr fgcolor))))
    2.19 +  (if (consp bgcolor)
    2.20 +      (setq bgcolor (if (eq YaTeX-background-mode 'light)
    2.21 +			(car bgcolor)
    2.22 +		      (cdr bgcolor))))
    2.23    (cond
    2.24     ((and YaTeX-use-font-lock (fboundp 'defface))
    2.25      (custom-declare-face
    2.26 @@ -632,7 +640,8 @@
    2.27  		    (if single (list single 0 'macro))))))))))
    2.28  
    2.29  ;;2006/6/23 new face, `delimiter' introduced
    2.30 -(YaTeX-19-create-face 'delimiter "saddlebrown" "ivory")
    2.31 +(YaTeX-19-create-face
    2.32 + 'delimiter '("saddlebrown" . "lightyellow") '("ivory". "navy"))
    2.33  
    2.34  ;;(YaTeX-19-collect-macros)	;causes an error
    2.35  (defun YaTeX-hilit-setup-alist ()
     3.1 --- a/yatex23.el	Wed Dec 31 23:00:01 2014 +0900
     3.2 +++ b/yatex23.el	Sun Jan 04 00:39:44 2015 +0900
     3.3 @@ -1,6 +1,6 @@
     3.4  ;;; yatex23.el --- YaTeX facilities for Emacs 23 or later -*- coding: sjis -*-
     3.5  ;;; (c)2014 by HIROSE Yuuji.[yuuji@yatex.org]
     3.6 -;;; Last modified Tue Dec 23 12:44:35 2014 on firestorm
     3.7 +;;; Last modified Sat Jan  3 23:34:41 2015 on firestorm
     3.8  ;;; $Id$
     3.9  
    3.10  ;;; Code:
    3.11 @@ -89,6 +89,20 @@
    3.12  	(insert "\\input{" path "}"))))
    3.13       (t (message "%s" action)))))
    3.14  
    3.15 +(defvar YaTeX-on-the-fly-bg-face '("#f0f0c0" . "#404020")
    3.16 +  "Background color of on-the-fly preview image activated environment.")
    3.17 +(defvar YaTeX-on-the-fly-overlay nil
    3.18 +  "Overlay of on-the-fly preview image")
    3.19 +(defface YaTeX-on-the-fly-activated-face
    3.20 +  (list
    3.21 +   (list (list '(class color))
    3.22 +	 (list ':background
    3.23 +	       (if (eq YaTeX-background-mode 'light)
    3.24 +		   (car YaTeX-on-the-fly-bg-face)
    3.25 +		 (cdr YaTeX-on-the-fly-bg-face))))
    3.26 +   (list t (list ':bold t)))
    3.27 +  "Face of on-the-fly preview image mode")
    3.28 +
    3.29  (provide 'yatex23)
    3.30  
    3.31  ; Local variables:
     4.1 --- a/yatexlib.el	Wed Dec 31 23:00:01 2014 +0900
     4.2 +++ b/yatexlib.el	Sun Jan 04 00:39:44 2015 +0900
     4.3 @@ -1,7 +1,7 @@
     4.4  ;;; yatexlib.el --- YaTeX and yahtml common libraries
     4.5  ;;; 
     4.6  ;;; (c)1994-2013 by HIROSE Yuuji.[yuuji@yatex.org]
     4.7 -;;; Last modified Mon Dec 29 13:54:17 2014 on sdr
     4.8 +;;; Last modified Sun Jan  4 00:16:04 2015 on firestorm
     4.9  ;;; $Id$
    4.10  
    4.11  ;;; Code:
    4.12 @@ -1428,7 +1428,7 @@
    4.13      '((((class static-color)) (:bold t))
    4.14        (((type tty)) (:bold t))
    4.15        (((class color) (background dark)) (:foreground "khaki" :bold t))
    4.16 -      (((class color) (background light)) (:foreground "Goldenrod"))
    4.17 +      (((class color) (background light)) (:foreground "DarkGoldenrod4"))
    4.18        (t (:bold t :underline t)))
    4.19      "Font Lock mode face used to highlight formula."
    4.20      :group 'font-lock-faces)
    4.21 @@ -1438,7 +1438,7 @@
    4.22      '((((class static-color)) (:bold t))
    4.23        (((type tty)) (:bold t))
    4.24        (((class color) (background dark))
    4.25 -       (:foreground "saddlebrown" :background "ivory" :bold t))
    4.26 +       (:foreground "lightyellow3" :background "navy" :bold t))
    4.27        (((class color) (background light)) (:foreground "red"))
    4.28        (t (:bold t :underline t)))
    4.29      "Font Lock mode face used to highlight delimiters."
    4.30 @@ -1451,7 +1451,7 @@
    4.31        (((class color) (background dark))
    4.32         (:foreground "khaki" :bold t :underline t))
    4.33        (((class color) (background light))
    4.34 -       (:foreground "Goldenrod" :underline t))
    4.35 +       (:foreground "DarkGoldenrod4" :underline t))
    4.36        (t (:bold t :underline t)))
    4.37      "Font Lock mode face used to highlight subscripts in formula."
    4.38      :group 'font-lock-faces)
    4.39 @@ -1463,7 +1463,7 @@
    4.40        (((class color) (background dark))
    4.41         (:bold nil :foreground "ivory" :background "lightyellow4"))
    4.42        (((class color) (background light))
    4.43 -       (:underline t :foreground "gold"))
    4.44 +       (:underline t :foreground "DarkGoldenrod3"))
    4.45        (t (:bold t :underline t)))
    4.46      "Font Lock mode face used to highlight superscripts in formula."
    4.47      :group 'font-lock-faces)
     5.1 --- a/yatexprc.el	Wed Dec 31 23:00:01 2014 +0900
     5.2 +++ b/yatexprc.el	Sun Jan 04 00:39:44 2015 +0900
     5.3 @@ -1,7 +1,7 @@
     5.4  ;;; yatexprc.el --- YaTeX process handler
     5.5  ;;; 
     5.6  ;;; (c)1993-2014 by HIROSE Yuuji.[yuuji@yatex.org]
     5.7 -;;; Last modified Wed Dec 31 22:42:56 2014 on sdr
     5.8 +;;; Last modified Sat Jan  3 23:37:49 2015 on firestorm
     5.9  ;;; $Id$
    5.10  
    5.11  ;;; Code:
    5.12 @@ -404,8 +404,10 @@
    5.13        (put 'dvi2-command 'file buffer)
    5.14        (put 'dvi2-command 'offset lineinfo))))
    5.15  
    5.16 -(defvar YaTeX-use-image-preview t
    5.17 -  "*Use or else view graphic preview image via [prefix] t e.")
    5.18 +(defvar YaTeX-use-image-preview "jpg"
    5.19 +  "*Nil means not using image preview by [prefix] t e.
    5.20 +Acceptable value is one of \"jpg\" or \"png\", which specifies
    5.21 +format of preview image.")
    5.22  (defvar YaTeX-preview-image-mode-map nil
    5.23    "Keymap used in YaTeX-preview-image-mode")
    5.24  (defun YaTeX-preview-image-mode ()
    5.25 @@ -436,7 +438,8 @@
    5.26  
    5.27  (defvar YaTeX-typeset-dvi2image-chain
    5.28    (cond
    5.29 -   ((YaTeX-executable-find "dvipng")
    5.30 +   ((and (equal YaTeX-use-image-preview "png")
    5.31 +	 (YaTeX-executable-find "dvipng"))
    5.32      (list "dvipng %b.dvi"))
    5.33     ((YaTeX-executable-find YaTeX-cmd-dvips)
    5.34      (list
    5.35 @@ -460,7 +463,8 @@
    5.36  (defun YaTeX-typeset-conv2image-chain ()
    5.37    (let*((proc (or YaTeX-typeset-process YaTeX-typeset-conv2image-process))
    5.38  	(prevname (process-name proc))
    5.39 -	(texput "texput") (format "jpg")
    5.40 +	(texput "texput")
    5.41 +	(format YaTeX-use-image-preview)
    5.42  	(target (concat texput "." format))
    5.43  	(math (get 'YaTeX-typeset-conv2image-chain 'math))
    5.44  	(srctype (or (get 'YaTeX-typeset-conv2image-chain 'srctype)
    5.45 @@ -571,7 +575,7 @@
    5.46       ;; If condition changed from last call, do it
    5.47       ((and (/= p (preceding-char))
    5.48  	   (/= q (char-after (- (point) 1)))
    5.49 -	   (not (string= st (YaTeX-buffer-substring s e))))
    5.50 +	   (not (string= st (YaTeX-buffer-substring s (min e (point-max))))))
    5.51        (YaTeX-typeset-environment)))))
    5.52  
    5.53  (defun YaTeX-typeset-environment ()
    5.54 @@ -600,7 +604,15 @@
    5.55  		       (YaTeX-buffer-substring b e)
    5.56  		       (current-time)))
    5.57  	    (YaTeX-typeset-region 'YaTeX-typeset-conv2image-chain)
    5.58 -	    (if usetimer (YaTeX-typeset-environment-auto)))
    5.59 +	    (if usetimer
    5.60 +		(progn
    5.61 +		  (if YaTeX-on-the-fly-overlay
    5.62 +		      (move-overlay YaTeX-on-the-fly-overlay b e)
    5.63 +		    (overlay-put
    5.64 +		     (setq YaTeX-on-the-fly-overlay (make-overlay b e))
    5.65 +		     'face 'YaTeX-on-the-fly-activated-face))
    5.66 +		  (YaTeX-typeset-environment-auto)
    5.67 +		  )))
    5.68  	(YaTeX-typeset-region)))))
    5.69  
    5.70  (defvar YaTeX-on-the-fly-preview-image (string-to-number "0.1")
    5.71 @@ -628,6 +640,7 @@
    5.72    (interactive)
    5.73    (cancel-timer YaTeX-typeset-environment-timer)
    5.74    (setq YaTeX-typeset-environment-timer nil)
    5.75 +  (delete-overlay YaTeX-on-the-fly-overlay)
    5.76    (message "Auto-preview canceled"))
    5.77  
    5.78