yatex
diff yatexsec.el @ 78:5b19f901fa16
Initial revision
author | yuuji |
---|---|
date | Fri, 02 May 2003 11:23:59 +0000 |
parents | 0aaebd07dad0 |
children | 0734be649cb8 |
line diff
1.1 --- a/yatexsec.el Mon Dec 25 10:19:28 2000 +0000 1.2 +++ b/yatexsec.el Fri May 02 11:23:59 2003 +0000 1.3 @@ -1,8 +1,8 @@ 1.4 ;;; -*- Emacs-Lisp -*- 1.5 ;;; YaTeX sectioning browser. 1.6 ;;; yatexsec.el 1.7 -;;; (c ) 1994,1998,1999 by HIROSE Yuuji [yuuji@yatex.org] 1.8 -;;; Last modified Mon Dec 25 19:18:36 2000 on firestorm 1.9 +;;; (c ) 1994,1998,1999,2003 by HIROSE Yuuji [yuuji@yatex.org] 1.10 +;;; Last modified Wed Mar 5 13:19:11 2003 on firestorm 1.11 ;;; $Id$ 1.12 1.13 (defvar YaTeX-sectioning-level 1.14 @@ -115,20 +115,35 @@ 1.15 1.16 (defvar YaTeX-sectioning-buffer-parent nil) 1.17 (defun YaTeX-sectioning-buffer-jump-internal (&optional keep) 1.18 - (let (ptn (p (point))) ;save-excursion is NG because 1.19 - (beginning-of-line) ;this function should switch buffer 1.20 + (let ((p (point)) ;save-excursion is NG because 1.21 + ptn ln) ;this function should switch buffer 1.22 + (beginning-of-line) 1.23 (if (re-search-forward YaTeX-sectioning-regexp) 1.24 - (progn (setq ptn (buffer-substring 1.25 - (1- (match-beginning 0)) 1.26 - (progn (skip-chars-forward "^}") (1+ (point))))) 1.27 - (goto-char p) 1.28 - (YaTeX-showup-buffer YaTeX-sectioning-buffer-parent nil t) 1.29 - (goto-char (point-max)) 1.30 - (search-backward ptn) 1.31 - (if keep (goto-buffer-window YaTeX-sectioning-buffer)) 1.32 - (current-buffer)) 1.33 - nil)) 1.34 -) 1.35 + (progn 1.36 + (save-restriction 1.37 + (narrow-to-region (point-beginning-of-line) (point-end-of-line)) 1.38 + (setq ptn (buffer-substring 1.39 + (1- (match-beginning 0)) 1.40 + (progn (skip-chars-forward "^}") (1+ (point)))) 1.41 + ln (buffer-substring 1.42 + (progn (search-forward "line:") (match-end 0)) 1.43 + (progn (skip-chars-forward "0-9") (point))))) 1.44 + (goto-char p) 1.45 + (YaTeX-showup-buffer YaTeX-sectioning-buffer-parent nil t) 1.46 + (or 1.47 + (and ln (string< "" ln) 1.48 + (progn 1.49 + (goto-line (max 1 (1- (string-to-int ln)))) 1.50 + (and 1.51 + (search-forward ptn nil t) 1.52 + (goto-char (match-beginning 0))))) 1.53 + (progn 1.54 + (goto-char (point-max)) 1.55 + (search-backward ptn))) 1.56 + (if keep (goto-buffer-window YaTeX-sectioning-buffer)) 1.57 + (current-buffer)) 1.58 + nil))) 1.59 + 1.60 (defun YaTeX-sectioning-buffer-jump (&optional keep) 1.61 "Goto corresponding sectioning unit with current line in the next window. 1.62 If optional argument KEEP is non-nil, only shows the line."