yatex
changeset 122:57d3d9abd661 dev
Search %# built-in value for parent if not found in current buffer.
author | yuuji@gentei.org |
---|---|
date | Mon, 24 May 2010 14:55:07 +0900 |
parents | 4f89dd9d83f2 |
children | 590fc51462c7 |
files | yatexprc.el |
diffstat | 1 files changed, 21 insertions(+), 11 deletions(-) [+] |
line diff
1.1 --- a/yatexprc.el Fri Feb 12 21:31:45 2010 +0900 1.2 +++ b/yatexprc.el Mon May 24 14:55:07 2010 +0900 1.3 @@ -2,7 +2,7 @@ 1.4 ;;; YaTeX process handler. 1.5 ;;; yatexprc.el 1.6 ;;; (c)1993-2009 by HIROSE Yuuji.[yuuji@yatex.org] 1.7 -;;; Last modified Mon Sep 28 10:47:11 2009 on firestorm 1.8 +;;; Last modified Mon May 24 14:50:24 2010 on firestorm 1.9 ;;; $Id$ 1.10 1.11 ;(require 'yatex) 1.12 @@ -811,7 +811,7 @@ 1.13 1.14 (defun YaTeX-visit-main (&optional setbuf) 1.15 "Switch buffer to main LaTeX source. 1.16 -Use set-buffer instead of switch-to-buffer if the optional second argument 1.17 +Use set-buffer instead of switch-to-buffer if the optional argument 1.18 SETBUF is t(Use it only from Emacs-Lisp program)." 1.19 (interactive "P") 1.20 (if (and (interactive-p) setbuf) (setq YaTeX-parent-file nil)) 1.21 @@ -876,15 +876,25 @@ 1.22 1.23 (defun YaTeX-get-builtin (key) 1.24 "Read source built-in command of %# usage." 1.25 - (save-excursion 1.26 - (goto-char (point-min)) 1.27 - (if (and (re-search-forward 1.28 - (concat "^" (regexp-quote (concat "%#" key))) nil t) 1.29 - (not (eolp))) 1.30 - (YaTeX-buffer-substring 1.31 - (progn (skip-chars-forward " " (point-end-of-line))(point)) 1.32 - (point-end-of-line)) 1.33 - nil))) 1.34 + (catch 'builtin 1.35 + (let ((bl (delq nil (list (current-buffer) 1.36 + (and YaTeX-parent-file 1.37 + (get-file-buffer YaTeX-parent-file)))))) 1.38 + (save-excursion 1.39 + (while bl 1.40 + (set-buffer (car bl)) 1.41 + (save-excursion 1.42 + (goto-char (point-min)) 1.43 + (if (and (re-search-forward 1.44 + (concat "^" (regexp-quote (concat "%#" key))) nil t) 1.45 + (not (eolp))) 1.46 + (throw 'builtin 1.47 + (YaTeX-buffer-substring 1.48 + (progn 1.49 + (skip-chars-forward " \t" (point-end-of-line)) 1.50 + (point)) 1.51 + (point-end-of-line))))) 1.52 + (setq bl (cdr bl))))))) 1.53 1.54 (defun YaTeX-save-buffers () 1.55 "Save buffers whose major-mode is equal to current major-mode."