yatex
changeset 254:45ea6e6e5b26 dev
Add-in for \includegraphics offers "clip" option.
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Sun, 12 Feb 2012 10:28:54 +0900 |
parents | 90aa4b6d96e1 |
children | 214702e4df54 |
files | yatexadd.el |
diffstat | 1 files changed, 12 insertions(+), 7 deletions(-) [+] |
line diff
1.1 --- a/yatexadd.el Sat Feb 11 23:40:33 2012 +0900 1.2 +++ b/yatexadd.el Sun Feb 12 10:28:54 2012 +0900 1.3 @@ -2,7 +2,7 @@ 1.4 ;;; YaTeX add-in functions. 1.5 ;;; yatexadd.el rev.20 1.6 ;;; (c)1991-2012 by HIROSE Yuuji.[yuuji@yatex.org] 1.7 -;;; Last modified Sat Feb 11 23:36:21 2012 on firestorm 1.8 +;;; Last modified Sun Feb 12 10:23:23 2012 on firestorm 1.9 ;;; $Id$ 1.10 1.11 ;;; 1.12 @@ -1894,7 +1894,7 @@ 1.13 (let (width height (scale "") angle str) 1.14 (setq width (YaTeX-read-string-or-skip "Width: ") 1.15 height (YaTeX-read-string-or-skip "Height: ")) 1.16 - (or (string< width "") (string< "" height) 1.17 + (or (string< "" width) (string< "" height) 1.18 (setq scale (YaTeX-read-string-or-skip "Scale: "))) 1.19 (setq angle (YaTeX-read-string-or-skip "Angle(0-359): ")) 1.20 (setq str 1.21 @@ -1913,7 +1913,7 @@ 1.22 (defun YaTeX::includegraphics (argp) 1.23 "Add-in for \\includegraphics" 1.24 (let ((imgfile (YaTeX::include argp "Image File: ")) 1.25 - (case-fold-search t) info bb noupdate needclose) 1.26 + (case-fold-search t) info bb noupdate needclose c) 1.27 (and (string-match "\\.\\(jpe?g\\|png\\|gif\\|bmp\\)$" imgfile) 1.28 (file-exists-p imgfile) 1.29 (or (fboundp 'yahtml-get-image-info) 1.30 @@ -1925,9 +1925,10 @@ 1.31 (setq bb (format "bb=%d %d %d %d" 0 0 (car info) (car (cdr info)))) 1.32 (save-excursion 1.33 (cond 1.34 - ((and (YaTeX-re-search-active-backward 1.35 - "\\\\\\(includegraphics\\)\\|\\(bb=[ \t0-9]+\\)" 1.36 - YaTeX-comment-prefix nil t) 1.37 + ((and (save-excursion 1.38 + (YaTeX-re-search-active-backward 1.39 + "\\\\\\(includegraphics\\)\\|\\(bb=[-+ \t0-9]+\\)" 1.40 + YaTeX-comment-prefix nil t)) 1.41 (match-beginning 2) 1.42 (not (setq noupdate (equal (YaTeX-match-string 2) bb))) 1.43 (y-or-n-p (format "Update `bb=' line to `%s'?: " bb))) 1.44 @@ -1935,13 +1936,17 @@ 1.45 (replace-match bb)) 1.46 (noupdate nil) 1.47 ((and (match-beginning 1) 1.48 - (y-or-n-p "Insert `bb=...' line?: ")) 1.49 + (prog2 1.50 + (message "Insert `%s'? Y)es N)o C)yes+`clip': " bb) 1.51 + (memq (setq c (read-char)) '(?y ?Y ?\ ?c ?C)) 1.52 + (message ""))) 1.53 (goto-char (match-end 0)) 1.54 (message "") 1.55 (if (looking-at "\\[") (forward-char 1) 1.56 (insert-before-markers "[") 1.57 (setq needclose t)) 1.58 (insert-before-markers bb) 1.59 + (if (memq c '(?c ?C)) (insert-before-markers ",clip")) 1.60 (if needclose (insert-before-markers "]") 1.61 (or (looking-at "\\]") (insert-before-markers ",")))) 1.62 (t (YaTeX-push-to-kill-ring bb)))))