# HG changeset patch # User yuuji@gentei.org # Date 1328844718 -32400 # Node ID 3e3ccba06ca1aa6c02f061a6ee1d78c21cdd7f63 # Parent 9105918e45a2a5cd4c4bc8fd810557fc8aea729a Construct `bb=...' line automatically and push it into kill-ring. diff -r 9105918e45a2 -r 3e3ccba06ca1 yatexadd.el --- a/yatexadd.el Fri Feb 10 09:09:08 2012 +0900 +++ b/yatexadd.el Fri Feb 10 12:31:58 2012 +0900 @@ -2,7 +2,7 @@ ;;; YaTeX add-in functions. ;;; yatexadd.el rev.20 ;;; (c)1991-2012 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Thu Feb 9 09:33:55 2012 on firestorm +;;; Last modified Fri Feb 10 09:50:00 2012 on firestorm ;;; $Id$ ;;; @@ -1225,17 +1225,11 @@ (format "New %s name: " (or labname "label")) (cons dlab 1)))) (if (string< "" label) - (let ((refstr (format "\\%s{%s}" (or refname "ref") label)) - (key (key-description (where-is-internal 'yank nil t))) - (msg - (if YaTeX-japan - "をkill-ringに入れました。yank(%s)で取り出せます。" - " is stored into kill-ring. Paste it by yank(%s)."))) - (kill-new refstr) + (let ((refstr (format "\\%s{%s}" (or refname "ref") label))) + (YaTeX-push-to-kill-ring refstr) (and chmode (not (equal old label)) - (YaTeX::label-rename-refs old label)) - (message (concat "`%s'" msg) refstr key))) + (YaTeX::label-rename-refs old label)))) label)))) @@ -1897,7 +1891,19 @@ (defun YaTeX::includegraphics (argp) "Add-in for \\includegraphics" - (YaTeX::include argp "Image File: ")) + (let ((imgfile (YaTeX::include argp "Image File: ")) + (case-fold-search t) info bb) + (and (string-match "\\.\\(jpe?g\\|png\\|gif\\|bmp\\)$" imgfile) + (file-exists-p imgfile) + (or (fboundp 'yahtml-get-image-info) + (progn + (load "yahtml" t) (featurep 'yahtml))) ;(require 'yahtml nil t) + (setq info (yahtml-get-image-info imgfile)) + (car info) ;if has width value + (car (cdr info)) ;if has height value + (setq bb (format "bb=%d %d %d %d" 0 0 (car info) (car (cdr info)))) + (YaTeX-push-to-kill-ring bb)) + imgfile)) (defun YaTeX::verbfile (argp) "Add-in for \\verbfile" diff -r 9105918e45a2 -r 3e3ccba06ca1 yatexlib.el --- a/yatexlib.el Fri Feb 10 09:09:08 2012 +0900 +++ b/yatexlib.el Fri Feb 10 12:31:58 2012 +0900 @@ -2,7 +2,7 @@ ;;; YaTeX and yahtml common libraries, general functions and definitions ;;; yatexlib.el ;;; (c)1994-2012 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Thu Feb 9 08:32:18 2012 on firestorm +;;; Last modified Fri Feb 10 12:30:49 2012 on firestorm ;;; $Id$ ;; General variables @@ -1523,6 +1523,17 @@ (throw 'found (car alist))) (setq alist (cdr alist)))))) +(defun YaTeX-push-to-kill-ring (string) + "Push STRING to kill-ring, then show guidance message." + (and (stringp string) (string< "" string) + (let ((key (key-description (where-is-internal 'yank nil t))) + (msg + (if YaTeX-japan + " をkill-ringに入れました。次のyank(%s)で貼付できます" + " is stored into kill-ring. Paste it by yank(%s)."))) + (kill-new string) + (message (concat "`%s'" msg) string key)))) + ;;; ;; Functions for the Installation time ;;;