changeset 163:a521e761f82c dev

New add-in function YaTeX::label automatically adds \ref{} string to kill-ring.
author yuuji@gentei.org
date Mon, 14 Feb 2011 12:40:00 +0900
parents af550c574ae1
children 59e47ed6b334
files yatexadd.el
diffstat 1 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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

yatex.org