yatex

diff yatexadd.el @ 247:3e3ccba06ca1

Construct `bb=...' line automatically and push it into kill-ring.
author yuuji@gentei.org
date Fri, 10 Feb 2012 12:31:58 +0900
parents 9105918e45a2
children b9771459243e
line diff
     1.1 --- a/yatexadd.el	Fri Feb 10 09:09:08 2012 +0900
     1.2 +++ b/yatexadd.el	Fri Feb 10 12:31:58 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 Thu Feb  9 09:33:55 2012 on firestorm
     1.8 +;;; Last modified Fri Feb 10 09:50:00 2012 on firestorm
     1.9  ;;; $Id$
    1.10  
    1.11  ;;;
    1.12 @@ -1225,17 +1225,11 @@
    1.13  		  (format "New %s name: " (or labname "label"))
    1.14  		  (cons dlab 1))))
    1.15        (if (string< "" label)
    1.16 -	  (let ((refstr (format "\\%s{%s}" (or refname "ref") label))
    1.17 -		(key (key-description (where-is-internal 'yank nil t)))
    1.18 -		(msg
    1.19 -		 (if YaTeX-japan
    1.20 -		     "をkill-ringに入れました。yank(%s)で取り出せます。"
    1.21 -		   " is stored into kill-ring.  Paste it by yank(%s).")))
    1.22 -	    (kill-new refstr)
    1.23 +	  (let ((refstr (format "\\%s{%s}" (or refname "ref") label)))
    1.24 +	    (YaTeX-push-to-kill-ring refstr)
    1.25  	    (and chmode
    1.26  		 (not (equal old label))
    1.27 -		 (YaTeX::label-rename-refs old label))
    1.28 -	    (message (concat "`%s'" msg) refstr key)))
    1.29 +		 (YaTeX::label-rename-refs old label))))
    1.30        label))))
    1.31        
    1.32  
    1.33 @@ -1897,7 +1891,19 @@
    1.34  
    1.35  (defun YaTeX::includegraphics (argp)
    1.36    "Add-in for \\includegraphics"
    1.37 -  (YaTeX::include argp "Image File: "))
    1.38 +  (let ((imgfile (YaTeX::include argp "Image File: "))
    1.39 +	(case-fold-search t) info bb)
    1.40 +    (and (string-match "\\.\\(jpe?g\\|png\\|gif\\|bmp\\)$" imgfile)
    1.41 +	 (file-exists-p imgfile)
    1.42 +	 (or (fboundp 'yahtml-get-image-info)
    1.43 +	     (progn
    1.44 +	       (load "yahtml" t) (featurep 'yahtml))) ;(require 'yahtml nil t)
    1.45 +	 (setq info (yahtml-get-image-info imgfile))
    1.46 +	 (car info)			;if has width value
    1.47 +	 (car (cdr info))		;if has height value
    1.48 +	 (setq bb (format "bb=%d %d %d %d" 0 0 (car info) (car (cdr info))))
    1.49 +	 (YaTeX-push-to-kill-ring bb))
    1.50 +    imgfile))
    1.51   
    1.52  (defun YaTeX::verbfile (argp)
    1.53    "Add-in for \\verbfile"