yatex
changeset 454:aaa655456752 dev
Label completion filter by M-c, M-e, M-i, M-s, M-m
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Wed, 22 Feb 2017 08:47:39 +0859 |
parents | f38293cfe508 |
children | bf2497be3ec5 |
files | yatex.new yatexadd.el |
diffstat | 2 files changed, 316 insertions(+), 238 deletions(-) [+] |
line diff
1.1 --- a/yatex.new Tue Feb 21 19:57:32 2017 +0859 1.2 +++ b/yatex.new Wed Feb 22 08:47:39 2017 +0859 1.3 @@ -1,6 +1,10 @@ 1.4 What's new in YaTeX/yahtml 1.5 野鳥/yahtml - 各バージョンの変更点について 1.6 1.7 +1.80 string-to-int除外と同時に emacs-18 をサポート外に。 1.8 + == yatex == 1.9 + ラベル補完バッファで M-e, M-i 等でラベル種の絞り込み可能。 1.10 + 1.11 1.79 別フレームに同一バッファがあるときのミニバッファ入力で、 1.12 ポイント位置がずれるEmacsの問題への対策を入れた。 1.13 === yatex ===
2.1 --- a/yatexadd.el Tue Feb 21 19:57:32 2017 +0859 2.2 +++ b/yatexadd.el Wed Feb 22 08:47:39 2017 +0859 2.3 @@ -1,6 +1,6 @@ 2.4 ;;; yatexadd.el --- YaTeX add-in functions -*- coding: sjis -*- 2.5 ;;; (c)1991-2017 by HIROSE Yuuji.[yuuji@yatex.org] 2.6 -;;; Last modified Thu Jan 5 23:13:23 2017 on firestorm 2.7 +;;; Last modified Wed Feb 22 08:17:25 2017 on firestorm 2.8 ;;; $Id$ 2.9 2.10 ;;; Code: 2.11 @@ -404,11 +404,12 @@ 2.12 (defvar YaTeX-label-menu-other 2.13 (if YaTeX-japan "':他のバッファのラベル\n" "':LABEL IN OTHER BUFFER.\n")) 2.14 (defvar YaTeX-label-menu-repeat 2.15 - (if YaTeX-japan ".:直前の\\refと同じ\n" "/:REPEAT LAST \ref{}\n")) 2.16 + (if YaTeX-japan ".:直前の\\refと同じ\n" ".:REPEAT LAST \\ref{}\n")) 2.17 (defvar YaTeX-label-menu-any 2.18 (if YaTeX-japan "*:任意の文字列\n" "*:ANY STRING.\n")) 2.19 (defvar YaTeX-label-buffer "*Label completions*") 2.20 -(defvar YaTeX-label-guide-msg "Select label and hit RETURN.") 2.21 +(defvar YaTeX-label-guide-msg 2.22 + "[RET] on the Label. M-a)All M-c)Capt M-e)Eqn M-i)Itm M-s)Sec M-m)misc") 2.23 (defvar YaTeX-label-select-map nil 2.24 "Key map used in label selection buffer.") 2.25 (defun YaTeX::label-setup-key-map () 2.26 @@ -434,6 +435,12 @@ 2.27 (define-key YaTeX-label-select-map "'" 'YaTeX::label-search-tag) 2.28 (define-key YaTeX-label-select-map "." 'YaTeX::label-search-tag) 2.29 (define-key YaTeX-label-select-map "*" 'YaTeX::label-search-tag) 2.30 + (define-key YaTeX-label-select-map "\M-a" 'YaTeX::label-sel-all) 2.31 + (define-key YaTeX-label-select-map "\M-c" 'YaTeX::label-sel-cap) 2.32 + (define-key YaTeX-label-select-map "\M-e" 'YaTeX::label-sel-eqn) 2.33 + (define-key YaTeX-label-select-map "\M-i" 'YaTeX::label-sel-item) 2.34 + (define-key YaTeX-label-select-map "\M-s" 'YaTeX::label-sel-sec) 2.35 + (define-key YaTeX-label-select-map "\M-m" 'YaTeX::label-sel-misc) 2.36 (message "Setting up label selection mode map...Done") 2.37 (let ((key ?A)) 2.38 (while (<= key ?Z) 2.39 @@ -462,6 +469,38 @@ 2.40 (goto-char (match-beginning 0)))) 2.41 (message YaTeX-label-guide-msg))) 2.42 2.43 +(defun YaTeX::label-sel-* (type &optional any) 2.44 + "Label type filtering out in YaTeX Label completion buffer" 2.45 + (save-excursion 2.46 + (let (ov) 2.47 + (goto-char (point-min)) 2.48 + (while (not (eobp)) 2.49 + (goto-char (next-overlay-change (point))) 2.50 + (if (null (setq ov (car-safe (overlays-at (point))))) 2.51 + nil ;do nothin if overlays not found 2.52 + (overlay-put 2.53 + ov 'invisible (not (or any 2.54 + (eq (overlay-get ov 'type) type))))))))) 2.55 + 2.56 +(defun YaTeX::label-sel-all () 2.57 + (interactive) 2.58 + (YaTeX::label-sel-* 'any 'any)) 2.59 +(defun YaTeX::label-sel-cap () 2.60 + (interactive) 2.61 + (YaTeX::label-sel-* 'cap)) 2.62 +(defun YaTeX::label-sel-eqn () 2.63 + (interactive) 2.64 + (YaTeX::label-sel-* 'eqn)) 2.65 +(defun YaTeX::label-sel-item () 2.66 + (interactive) 2.67 + (YaTeX::label-sel-* 'item)) 2.68 +(defun YaTeX::label-sel-sec () 2.69 + (interactive) 2.70 + (YaTeX::label-sel-* 'sec)) 2.71 +(defun YaTeX::label-sel-misc () 2.72 + (interactive) 2.73 + (YaTeX::label-sel-* 'misc)) 2.74 + 2.75 ; (defun YaTeX::ref (argp &optional labelcmd refcmd) 2.76 ; (cond 2.77 ; ((= argp 1) 2.78 @@ -680,7 +719,7 @@ 2.79 (if (condition-case nil 2.80 (progn 2.81 (goto-char curtop) 2.82 - (YaTeX-goto-corresponding-environment)) 2.83 + (YaTeX-goto-corresponding-environment nil t 'nonstop)) 2.84 (error nil)) 2.85 (setq end (point))) 2.86 (goto-char inspoint) 2.87 @@ -814,6 +853,261 @@ 2.88 "*ref補完で収集するセクショニングコマンドの下限レベル 2.89 YaTeX-sectioning-levelの数値で指定.") 2.90 2.91 +(defun YaTeX::ref-1 () 2.92 + ;; Sub-function of YaTeX::ref() for recursive call 2.93 + ;; DO NOT CALL FROM OTHER FUNCTIONS but YaTeX:ref() 2.94 + (while (YaTeX-re-search-active-forward 2.95 + regexp ;;counter 2.96 + percent nil t) 2.97 + ;(goto-char (match-beginning 0)) 2.98 + (setq e0 (match-end 0)) 2.99 + (cond 2.100 + ;; 2.101 + ;;2005/10/21 Skip it if predicate function returns nil 2.102 + ((and predf 2.103 + (let ((md (match-data))) 2.104 + (prog1 2.105 + (condition-case nil 2.106 + (not (funcall predf)) 2.107 + (error nil)) 2.108 + (store-match-data md))))) 2.109 + ((YaTeX-literal-p) nil) 2.110 + ((YaTeX-match-string 1) 2.111 + ;;if standard counter commands found 2.112 + (setq cmd (YaTeX-match-string 2) 2.113 + m0 (match-beginning 0)) 2.114 + (setq match-point (match-beginning 0)) 2.115 + (or initl 2.116 + (if (< p (point)) (setq initl lnum))) 2.117 + (cond 2.118 + ;; In any case, variables e0 should be set 2.119 + ((and YaTeX-use-AMS-LaTeX 2.120 + (string-match YaTeX::ref-nestable-counter-regexp cmd)) 2.121 + (let (label) 2.122 + (skip-chars-forward "}") 2.123 + (setq label (buffer-substring 2.124 + (point) (min (+ 80 (point)) (point-max)))) 2.125 + ;; to skip (maybe)auto-generated comment 2.126 + (skip-chars-forward " \t") 2.127 + (if (looking-at YaTeX-comment-prefix) 2.128 + (forward-line 1)) 2.129 + (setq e0 (point)) 2.130 + (skip-chars-forward " \t\n") 2.131 + (if (looking-at "\\\\label{\\([^}]+\\)}") 2.132 + (setq label (format "(labe:%s)" (YaTeX-match-string 1)) 2.133 + e0 (match-end 1))) 2.134 + (funcall output (format "--subequation--%s" label) e0 'eqn))) 2.135 + ((string-match mathenvs cmd) ;;if matches mathematical env 2.136 + (skip-chars-forward "}") 2.137 + (setq x (point) 2.138 + envname (substring 2.139 + cmd (match-beginning 0) (match-end 0))) 2.140 + (save-restriction 2.141 + (narrow-to-region 2.142 + m0 2.143 + (save-excursion 2.144 + (YaTeX-re-search-active-forward 2.145 + (setq endrx (format "%send{%s}" YaTeX-ec-regexp 2.146 + (regexp-quote envname))) 2.147 + percent nil t))) 2.148 + (catch 'scan 2.149 + (while (YaTeX-re-search-active-forward 2.150 + (concat 2.151 + "\\\\end{\\(" (regexp-quote envname) "\\)" ;;(1) 2.152 + "\\|\\\\\\(notag\\)" ;;2 2.153 + (if (string-match 2.154 + YaTeX::ref-mathenv-exp1-regexp cmd) 2.155 + "" "\\|\\(\\\\\\\\\\)$") ;;3 2.156 + ) 2.157 + percent nil t) 2.158 + (let*((quit (match-beginning 1)) 2.159 + (notag (match-beginning 2)) 2.160 + (newln (match-beginning 3)) 2.161 + (label ".......................") l2 2.162 + (e (point)) (m0 (match-beginning 0)) 2.163 + (ln (YaTeX-string-width label))) 2.164 + (cond 2.165 + (notag 2.166 + (YaTeX-re-search-active-forward 2.167 + "\\\\\\\\" percent nil 1) 2.168 + (setq x (point))) ;use x as \label search bound 2.169 + ((and newln ; `\\' found 2.170 + (not (equal (YaTeX-inner-environment) 2.171 + envname))) 2.172 + (YaTeX-end-of-environment) 2.173 + (goto-char (match-end 0))) 2.174 + (t 2.175 + (if (YaTeX-re-search-active-backward 2.176 + YaTeX::ref-labeling-regexp 2.177 + percent x t) 2.178 + ;; if \label{x} in math-expression, display it 2.179 + ;; because formula source is hard to recognize 2.180 + (progn 2.181 + (goto-char (match-end 0)) 2.182 + (setq l2 (format "\"label:%s\"" 2.183 + (buffer-substring 2.184 + (1- (point)) 2.185 + (progn (forward-sexp -1) 2.186 + (1+ (point)))))) 2.187 + (setq label 2.188 + (if (< (YaTeX-string-width l2) ln) 2.189 + (concat 2.190 + l2 2.191 + (substring 2.192 + label 2.193 + 0 (- ln (YaTeX-string-width l2)))) 2.194 + l2)) 2.195 + (goto-char e))) 2.196 + (funcall output 2.197 + (concat 2.198 + label " " 2.199 + (buffer-substring x m0)) 2.200 + x 'eqn) 2.201 + (cond 2.202 + ((YaTeX-quick-in-environment-p 2.203 + YaTeX-math-gathering-list) 2.204 + ;; if here is inner split/cases/gathered env., 2.205 + ;; counter for here is only one. 2.206 + ;; Go out this environment and, 2.207 + (YaTeX-end-of-environment) 2.208 + ;; search next expression unit boundary. 2.209 + (YaTeX-re-search-active-forward 2.210 + (concat endrx "\\|\\\\begin{") 2.211 + percent nil 1) 2.212 + (end-of-line))) 2.213 + (if quit (throw 'scan t))))) 2.214 + (setq x (point))))) 2.215 + (setq e0 (point))) 2.216 + ((string-match enums cmd) 2.217 + ;(skip-chars-forward "} \t\n") 2.218 + (save-restriction 2.219 + (narrow-to-region 2.220 + (point) 2.221 + (save-excursion 2.222 + (YaTeX-goto-corresponding-environment nil t 'nonstop) (point))) 2.223 + (forward-line 1) 2.224 + (let ((b0 nil) mb0) 2.225 + (while (not (eobp)) 2.226 + (setq x (and 2.227 + (YaTeX-re-search-active-forward 2.228 + (concat YaTeX-ec-regexp "item\\s ") 2.229 + percent nil 1) 2.230 + (match-beginning 0))) 2.231 + 2.232 + (if b0 ;Inspect sentence after previous \item 2.233 + (save-excursion 2.234 + (save-restriction 2.235 + (let ((md (match-data))) ;save-match-data 2.236 + (unwind-protect 2.237 + (progn 2.238 + (narrow-to-region b0 (or x (point))) 2.239 + (goto-char (point-min)) 2.240 + (let ((x x)) (YaTeX::ref-1)) 2.241 + (goto-char (point-max))) 2.242 + (store-match-data md)))))) 2.243 + (if x ;Output THIS \item line 2.244 + (funcall 2.245 + output 2.246 + (concat 2.247 + existlabel 2.248 + (buffer-substring 2.249 + (match-beginning 0) 2.250 + (if (re-search-forward itemsep nil t) 2.251 + (progn (goto-char (match-beginning 0)) 2.252 + (skip-chars-backward " \t") 2.253 + (1- (point))) 2.254 + (point-end-of-line)))) 2.255 + x 'item)) 2.256 + (setq b0 (point)) 2.257 + )) 2.258 + (setq e0 (point-max)))) 2.259 + ((string-match "bibitem" cmd) ;maybe generated by myself 2.260 + (setq label "") 2.261 + (skip-chars-forward " \t") 2.262 + (if (looking-at "{") ;sure to be true!! 2.263 + (forward-list 1)) 2.264 + (let ((list '(30 10 65)) 2.265 + (delim ";") q lim len l str) 2.266 + (save-excursion 2.267 + (setq lim (if (re-search-forward itemsep nil 1) 2.268 + (match-beginning 0) (point)))) 2.269 + (while list 2.270 + (skip-chars-forward " \t\n\\") 2.271 + (setq q (looking-at "[\"'{]") 2.272 + len (car list) 2.273 + str 2.274 + (buffer-substring 2.275 + (point) 2.276 + (progn 2.277 + (if q (forward-sexp 1) 2.278 + (search-forward delim lim 1) 2.279 + (forward-char -1)) 2.280 + (point)))) 2.281 + (if (> (setq l (YaTeX-string-width str)) len) 2.282 + (setq str (concat 2.283 + (YaTeX-truncate-string-width 2.284 + str (- len (if q 5 4))) 2.285 + "... " 2.286 + (if q (substring str -1))))) 2.287 + (if (< (setq l (YaTeX-string-width str)) len) 2.288 + (setq str (concat str (make-string (- len l) ? )))) 2.289 + (if (looking-at delim) (goto-char (match-end 0))) 2.290 + (setq label (concat label " " str) 2.291 + list (cdr list))) 2.292 + (funcall output label match-point 'bib))) 2.293 + ;;else, simple section-type counter 2.294 + ((= (char-after (1- (point))) ?{) 2.295 + (setq label (buffer-substring 2.296 + (match-beginning 0) 2.297 + (progn (forward-char -1) 2.298 + (forward-list 1) 2.299 + (point)))) 2.300 + (funcall output label match-point 2.301 + (if (string-match "caption" cmd) 'cap 'sec)) 2.302 + ;; Skip preceding label if exists 2.303 + (if (YaTeX::ref-getset-label (current-buffer) match-point t) 2.304 + (goto-char (get 'YaTeX::ref-getset-label 'foundpoint))) 2.305 + (if (save-excursion 2.306 + (skip-chars-forward "\t \n") 2.307 + (looking-at YaTeX::ref-labeling-regexp)) 2.308 + (setq e0 (match-end 0)))) 2.309 + (t 2.310 + (skip-chars-forward " \t") 2.311 + (setq label (buffer-substring 2.312 + (match-beginning 0) 2.313 + (if (re-search-forward 2.314 + itemsep 2.315 + nil t) 2.316 + (progn 2.317 + (goto-char (match-beginning 0)) 2.318 + (skip-chars-backward " \t") 2.319 + (1- (point))) 2.320 + (point-end-of-line)))) 2.321 + (funcall output label match-point 'misc) 2.322 + (if (save-excursion 2.323 + (skip-chars-forward "\t \n") 2.324 + (looking-at YaTeX::ref-labeling-regexp)) 2.325 + (setq e0 (match-end 0))))) 2.326 + ) ;;put label buffer 2.327 + ;; 2.328 + ;; if user defined label found 2.329 + (t 2.330 + ;; memorize line number and label into property 2.331 + (goto-char (match-beginning 0)) 2.332 + (let ((list YaTeX::ref-labeling-regexp-alist) 2.333 + (cache (symbol-plist 'YaTeX::ref-labeling-regexp))) 2.334 + (while list 2.335 + (if (looking-at (car (car list))) 2.336 + (progn 2.337 + (setq label (YaTeX-match-string 0)) 2.338 + (put 'YaTeX::ref-labeling-regexp lnum 2.339 + (YaTeX-match-string (cdr (car list)))) 2.340 + (funcall output label 0) ;;0 is dummy, never used 2.341 + (setq list nil))) 2.342 + (setq list (cdr list)))) 2.343 + )) 2.344 + (goto-char e0))) 2.345 + 2.346 (defun YaTeX::ref (argp &optional labelcmd refcmd predf) 2.347 (setplist 'YaTeX::ref-labeling-regexp nil) ;erase memory cache 2.348 (require 'yatexsec) 2.349 @@ -854,14 +1148,22 @@ 2.350 (percent (regexp-quote YaTeX-comment-prefix)) 2.351 (output 2.352 (function 2.353 - (lambda (label p) 2.354 + (lambda (label p &optional type) ;type: 'eqn 'item 'cap 'sec 'misc 2.355 (while (setq x (string-match "[\n\t]" label)) 2.356 (aset label x ? )) 2.357 (while (setq x (string-match " +" label)) 2.358 (setq label (concat 2.359 (substring label 0 (1+ (match-beginning 0))) 2.360 (substring label (match-end 0))))) 2.361 - (princ (format "%c: <<%s>>\n" (+ (% lnum 26) ?A) label)) 2.362 + (save-excursion 2.363 + (set-buffer standard-output) 2.364 + (overlay-put 2.365 + (make-overlay 2.366 + (point) 2.367 + (progn 2.368 + (insert (format "%c: <<%s>>\n" (+ (% lnum 26) ?A) label)) 2.369 + (point))) 2.370 + 'type type)) 2.371 (setq point-list (cons p point-list)) 2.372 (message "Collecting labels... %d" lnum) 2.373 (setq lnum (1+ lnum))))) 2.374 @@ -890,238 +1192,10 @@ 2.375 (goto-char (point-min)) 2.376 (let ((standard-output (get-buffer YaTeX-label-buffer)) existlabel) 2.377 (princ (format "=== LABELS in [%s] ===\n" (buffer-name buf))) 2.378 - (while (YaTeX-re-search-active-forward 2.379 - regexp ;;counter 2.380 - percent nil t) 2.381 - ;(goto-char (match-beginning 0)) 2.382 - (setq e0 (match-end 0)) 2.383 - (cond 2.384 - ;; 2.385 - ;;2005/10/21 Skip it if predicate function returns nil 2.386 - ((and predf 2.387 - (let ((md (match-data))) 2.388 - (prog1 2.389 - (condition-case nil 2.390 - (not (funcall predf)) 2.391 - (error nil)) 2.392 - (store-match-data md))))) 2.393 - ((YaTeX-literal-p) nil) 2.394 - ((YaTeX-match-string 1) 2.395 - ;;if standard counter commands found 2.396 - (setq cmd (YaTeX-match-string 2) 2.397 - m0 (match-beginning 0)) 2.398 - (setq match-point (match-beginning 0)) 2.399 - (or initl 2.400 - (if (< p (point)) (setq initl lnum))) 2.401 - (cond 2.402 - ;; In any case, variables e0 should be set 2.403 - ((and YaTeX-use-AMS-LaTeX 2.404 - (string-match YaTeX::ref-nestable-counter-regexp cmd)) 2.405 - (let (label) 2.406 - (skip-chars-forward "}") 2.407 - (setq label (buffer-substring 2.408 - (point) (min (+ 80 (point)) (point-max)))) 2.409 - ;; to skip (maybe)auto-generated comment 2.410 - (skip-chars-forward " \t") 2.411 - (if (looking-at YaTeX-comment-prefix) 2.412 - (forward-line 1)) 2.413 - (setq e0 (point)) 2.414 - (skip-chars-forward " \t\n") 2.415 - (if (looking-at "\\\\label{\\([^}]+\\)}") 2.416 - (setq label (format "(labe:%s)" (YaTeX-match-string 1)) 2.417 - e0 (match-end 1))) 2.418 - (funcall output (format "--subequation--%s" label) e0))) 2.419 - ((string-match mathenvs cmd) ;;if matches mathematical env 2.420 - (skip-chars-forward "}") 2.421 - (setq x (point) 2.422 - envname (substring 2.423 - cmd (match-beginning 0) (match-end 0))) 2.424 - (save-restriction 2.425 - (narrow-to-region 2.426 - m0 2.427 - (save-excursion 2.428 - (YaTeX-re-search-active-forward 2.429 - (setq endrx (format "%send{%s}" YaTeX-ec-regexp 2.430 - (regexp-quote envname))) 2.431 - percent nil t))) 2.432 - (catch 'scan 2.433 - (while (YaTeX-re-search-active-forward 2.434 - (concat 2.435 - "\\\\end{\\(" (regexp-quote envname) "\\)";;(1) 2.436 - "\\|\\\\\\(notag\\)" ;;2 2.437 - (if (string-match 2.438 - YaTeX::ref-mathenv-exp1-regexp cmd) 2.439 - "" "\\|\\(\\\\\\\\\\)$") ;;3 2.440 - ) 2.441 - percent nil t) 2.442 - (let*((quit (match-beginning 1)) 2.443 - (notag (match-beginning 2)) 2.444 - (newln (match-beginning 3)) 2.445 - (label ".......................") l2 2.446 - (e (point)) (m0 (match-beginning 0)) 2.447 - (ln (YaTeX-string-width label))) 2.448 - (cond 2.449 - (notag 2.450 - (YaTeX-re-search-active-forward 2.451 - "\\\\\\\\" percent nil 1) 2.452 - (setq x (point))) ;use x as \label search bound 2.453 - ((and newln ; `\\' found 2.454 - (not (equal (YaTeX-inner-environment) 2.455 - envname))) 2.456 - (YaTeX-end-of-environment) 2.457 - (goto-char (match-end 0))) 2.458 - (t 2.459 - (if (YaTeX-re-search-active-backward 2.460 - YaTeX::ref-labeling-regexp 2.461 - percent x t) 2.462 - ;; if \label{x} in math-expression, display it 2.463 - ;; because formula source is hard to recognize 2.464 - (progn 2.465 - (goto-char (match-end 0)) 2.466 - (setq l2 (format "\"label:%s\"" 2.467 - (buffer-substring 2.468 - (1- (point)) 2.469 - (progn (forward-sexp -1) 2.470 - (1+ (point)))))) 2.471 - (setq label 2.472 - (if (< (YaTeX-string-width l2) ln) 2.473 - (concat 2.474 - l2 2.475 - (substring 2.476 - label 2.477 - 0 (- ln (YaTeX-string-width l2)))) 2.478 - l2)) 2.479 - (goto-char e))) 2.480 - (funcall output 2.481 - (concat 2.482 - label " " 2.483 - (buffer-substring x m0)) 2.484 - x) 2.485 - (cond 2.486 - ((YaTeX-quick-in-environment-p 2.487 - YaTeX-math-gathering-list) 2.488 - ;; if here is inner split/cases/gathered env., 2.489 - ;; counter for here is only one. 2.490 - ;; Go out this environment and, 2.491 - (YaTeX-end-of-environment) 2.492 - ;; search next expression unit boundary. 2.493 - (YaTeX-re-search-active-forward 2.494 - (concat endrx "\\|\\\\begin{") 2.495 - percent nil 1) 2.496 - (end-of-line))) 2.497 - (if quit (throw 'scan t))))) 2.498 - (setq x (point))))) 2.499 - (setq e0 (point))) 2.500 - ((string-match enums cmd) 2.501 - ;(skip-chars-forward "} \t\n") 2.502 - (save-restriction 2.503 - (narrow-to-region 2.504 - (point) 2.505 - (save-excursion 2.506 - (YaTeX-goto-corresponding-environment) (point))) 2.507 - (forward-line 1) 2.508 - (while (YaTeX-re-search-active-forward 2.509 - (concat YaTeX-ec-regexp "item\\s ") 2.510 - percent nil t) 2.511 - (setq x (match-beginning 0)) 2.512 - (funcall 2.513 - output 2.514 - (concat 2.515 - existlabel 2.516 - (buffer-substring 2.517 - (match-beginning 0) 2.518 - (if (re-search-forward itemsep nil t) 2.519 - (progn (goto-char (match-beginning 0)) 2.520 - (skip-chars-backward " \t") 2.521 - (1- (point))) 2.522 - (point-end-of-line)))) 2.523 - x)) 2.524 - (setq e0 (point-max)))) 2.525 - ((string-match "bibitem" cmd) ;maybe generated by myself 2.526 - (setq label "") 2.527 - (skip-chars-forward " \t") 2.528 - (if (looking-at "{") ;sure to be true!! 2.529 - (forward-list 1)) 2.530 - (let ((list '(30 10 65)) 2.531 - (delim ";") q lim len l str) 2.532 - (save-excursion 2.533 - (setq lim (if (re-search-forward itemsep nil 1) 2.534 - (match-beginning 0) (point)))) 2.535 - (while list 2.536 - (skip-chars-forward " \t\n\\") 2.537 - (setq q (looking-at "[\"'{]") 2.538 - len (car list) 2.539 - str 2.540 - (buffer-substring 2.541 - (point) 2.542 - (progn 2.543 - (if q (forward-sexp 1) 2.544 - (search-forward delim lim 1) 2.545 - (forward-char -1)) 2.546 - (point)))) 2.547 - (if (> (setq l (YaTeX-string-width str)) len) 2.548 - (setq str (concat 2.549 - (YaTeX-truncate-string-width 2.550 - str (- len (if q 5 4))) 2.551 - "... " 2.552 - (if q (substring str -1))))) 2.553 - (if (< (setq l (YaTeX-string-width str)) len) 2.554 - (setq str (concat str (make-string (- len l) ? )))) 2.555 - (if (looking-at delim) (goto-char (match-end 0))) 2.556 - (setq label (concat label " " str) 2.557 - list (cdr list))) 2.558 - (funcall output label match-point))) 2.559 - ;;else, simple section-type counter 2.560 - ((= (char-after (1- (point))) ?{) 2.561 - (setq label (buffer-substring 2.562 - (match-beginning 0) 2.563 - (progn (forward-char -1) 2.564 - (forward-list 1) 2.565 - (point)))) 2.566 - (funcall output label match-point) 2.567 - ;; Skip preceding label if exists 2.568 - (if (YaTeX::ref-getset-label (current-buffer) match-point t) 2.569 - (goto-char (get 'YaTeX::ref-getset-label 'foundpoint))) 2.570 - (if (save-excursion 2.571 - (skip-chars-forward "\t \n") 2.572 - (looking-at YaTeX::ref-labeling-regexp)) 2.573 - (setq e0 (match-end 0)))) 2.574 - (t 2.575 - (skip-chars-forward " \t") 2.576 - (setq label (buffer-substring 2.577 - (match-beginning 0) 2.578 - (if (re-search-forward 2.579 - itemsep 2.580 - nil t) 2.581 - (progn 2.582 - (goto-char (match-beginning 0)) 2.583 - (skip-chars-backward " \t") 2.584 - (1- (point))) 2.585 - (point-end-of-line)))) 2.586 - (funcall output label match-point) 2.587 - (if (save-excursion 2.588 - (skip-chars-forward "\t \n") 2.589 - (looking-at YaTeX::ref-labeling-regexp)) 2.590 - (setq e0 (match-end 0))))) 2.591 - ) ;;put label buffer 2.592 - ;; 2.593 - ;; if user defined label found 2.594 - (t 2.595 - ;; memorize line number and label into property 2.596 - (goto-char (match-beginning 0)) 2.597 - (let ((list YaTeX::ref-labeling-regexp-alist) 2.598 - (cache (symbol-plist 'YaTeX::ref-labeling-regexp))) 2.599 - (while list 2.600 - (if (looking-at (car (car list))) 2.601 - (progn 2.602 - (setq label (YaTeX-match-string 0)) 2.603 - (put 'YaTeX::ref-labeling-regexp lnum 2.604 - (YaTeX-match-string (cdr (car list)))) 2.605 - (funcall output label 0) ;;0 is dummy, never used 2.606 - (setq list nil))) 2.607 - (setq list (cdr list)))) 2.608 - )) 2.609 - (goto-char e0)) 2.610 + 2.611 + (YaTeX::ref-1) 2.612 + 2.613 + 2.614 (princ YaTeX-label-menu-other) 2.615 (princ YaTeX-label-menu-repeat) 2.616 (princ YaTeX-label-menu-any)