yatex
changeset 247:3e3ccba06ca1 dev
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 |
files | yatexadd.el yatexlib.el |
diffstat | 2 files changed, 29 insertions(+), 12 deletions(-) [+] |
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"
2.1 --- a/yatexlib.el Fri Feb 10 09:09:08 2012 +0900 2.2 +++ b/yatexlib.el Fri Feb 10 12:31:58 2012 +0900 2.3 @@ -2,7 +2,7 @@ 2.4 ;;; YaTeX and yahtml common libraries, general functions and definitions 2.5 ;;; yatexlib.el 2.6 ;;; (c)1994-2012 by HIROSE Yuuji.[yuuji@yatex.org] 2.7 -;;; Last modified Thu Feb 9 08:32:18 2012 on firestorm 2.8 +;;; Last modified Fri Feb 10 12:30:49 2012 on firestorm 2.9 ;;; $Id$ 2.10 2.11 ;; General variables 2.12 @@ -1523,6 +1523,17 @@ 2.13 (throw 'found (car alist))) 2.14 (setq alist (cdr alist)))))) 2.15 2.16 +(defun YaTeX-push-to-kill-ring (string) 2.17 + "Push STRING to kill-ring, then show guidance message." 2.18 + (and (stringp string) (string< "" string) 2.19 + (let ((key (key-description (where-is-internal 'yank nil t))) 2.20 + (msg 2.21 + (if YaTeX-japan 2.22 + " をkill-ringに入れました。次のyank(%s)で貼付できます" 2.23 + " is stored into kill-ring. Paste it by yank(%s)."))) 2.24 + (kill-new string) 2.25 + (message (concat "`%s'" msg) string key)))) 2.26 + 2.27 ;;; 2.28 ;; Functions for the Installation time 2.29 ;;;