# HG changeset patch # User yuuji@gentei.org # Date 1297654800 -32400 # Node ID a521e761f82c14dab0ce81b74be14ee536c20c0f # Parent af550c574ae1b5d6865a0f6103f06926fa6434b0 New add-in function YaTeX::label automatically adds \ref{} string to kill-ring. diff -r af550c574ae1 -r a521e761f82c yatexadd.el --- a/yatexadd.el Mon Dec 27 19:17:13 2010 +0900 +++ b/yatexadd.el Mon Feb 14 12:40:00 2011 +0900 @@ -2,7 +2,7 @@ ;;; YaTeX add-in functions. ;;; yatexadd.el rev.18 ;;; (c)1991-2006 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Thu Sep 9 09:08:19 2010 on firestorm +;;; Last modified Mon Feb 14 12:32:10 2011 on firestorm ;;; $Id$ ;;; @@ -1119,6 +1119,26 @@ (bury-buffer YaTeX-label-buffer))) label))))) +(defun YaTeX::label (argp &optional refname) + "Read label name and return it with copying \\ref{LABEL-NAME} to kill-ring." + (cond + ((= argp 1) + (let*((dlab (if (boundp (intern-soft "old")) + old ;if called via YaTeX-change-section (tricky...) + (YaTeX::ref-default-label))) + (label (read-string "New label name: " (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) + (message (concat "`%s'" msg) refstr key))) + label)))) + + (fset 'YaTeX::pageref 'YaTeX::ref) (defun YaTeX::tabref (argp) ; For the style file of IPSJ journal (YaTeX::ref