yatex
diff yatexhie.el @ 60:9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yahtml: don't count <a>tag contents as column in <pre>
yahtml: support [prefix] c against src="", align="".
and many many more
author | yuuji |
---|---|
date | Fri, 24 Jan 1997 09:04:06 +0000 |
parents | 5d94deabb9f9 |
children | 0eb6997bee16 |
line diff
1.1 --- a/yatexhie.el Sun Jan 22 14:20:46 1995 +0000 1.2 +++ b/yatexhie.el Fri Jan 24 09:04:06 1997 +0000 1.3 @@ -2,21 +2,22 @@ 1.4 ;;; YaTeX hierarchy browser. 1.5 ;;; yatexhie.el 1.6 ;;; (c )1995 by HIROSE Yuuji [yuuji@ae.keio.ac.jp] 1.7 -;;; Last modified Sun Jan 22 23:15:25 1995 on landcruiser 1.8 +;;; Last modified Thu Feb 2 23:55:59 1995 on figaro 1.9 ;;; $Id$ 1.10 1.11 ;; ----- Customizable variables ----- 1.12 -(defvar YaTeX-hierarchy-inspect-mode t 1.13 - "*Non-nil inspects the contents of file of cursor position.") 1.14 - 1.15 +(defvar YaTeX-hierarchy-ignore-heading-regexp 1.16 + "\\$[A-Z][a-z]+: .* \\$\\|-\\*- .* -\\*-" 1.17 + "*Regexp of lines to ignore as files' headline.") 1.18 1.19 ;; ----- General variables ----- 1.20 (defvar YaTeX-default-TeX-extensions "\\.\\(tex\\|sty\\)") 1.21 (defvar YaTeX-hierarchy-current-main nil) 1.22 (defvar YaTeX-hierarchy-buffer-message 1.23 (concat 1.24 - "n)ext p)rev N)extsamelev P)revsamelev u)p K)ill-buffer RET)select" 1.25 - (if (and YaTeX-emacs-19 window-system) " Mouse2)select" ""))) 1.26 + "n)ext p)rev N)extsame P)revsame u)p K)illbuf RET)select" 1.27 + (if (and YaTeX-emacs-19 window-system) " Mouse2)select" "") 1.28 + " ?)help")) 1.29 (defvar YaTeX-hierarchy-saved-wc nil "Saved window configuration.") 1.30 1.31 ;; ----- Functions for parsing hierarchy ----- 1.32 @@ -81,23 +82,30 @@ 1.33 (save-excursion 1.34 (set-buffer (find-file-noselect file)) 1.35 (save-excursion 1.36 - (goto-char (point-min)) 1.37 - (cond 1.38 - ((and 1.39 - (YaTeX-re-search-active-forward 1.40 - (concat YaTeX-ec-regexp YaTeX-sectioning-regexp) 1.41 - YaTeX-comment-prefix nil t) 1.42 - (re-search-forward "{\\([^}]+\\)}" nil t)) 1.43 - (goto-char (match-beginning 1)) 1.44 - (skip-chars-forward " \t\n") 1.45 - (buffer-substring (point) 1.46 - (min (point-end-of-line) 1.47 - (match-end 1)))) 1.48 - ((re-search-forward "^ *%\\([^#]\\)" nil t) 1.49 - (goto-char (match-beginning 1)) 1.50 - (skip-chars-forward " \t") 1.51 - (buffer-substring (point) (point-end-of-line))) 1.52 - (t ""))))) 1.53 + (let (p) 1.54 + (goto-char (point-min)) 1.55 + (cond 1.56 + ((re-search-forward 1.57 + (concat YaTeX-ec-regexp YaTeX-sectioning-regexp) nil t) 1.58 + (search-forward "{") 1.59 + (forward-char -1) 1.60 + (setq p (condition-case nil 1.61 + (progn (forward-list 1) (1- (point))) 1.62 + (error (point-end-of-line)))) 1.63 + (goto-char (1+ (match-beginning 0))) 1.64 + (skip-chars-forward " \t\n") 1.65 + (buffer-substring (point) (min (point-end-of-line) p))) 1.66 + ((catch 'found 1.67 + (while (re-search-forward "^ *%\\([^#]\\)" nil t) 1.68 + (or (re-search-forward 1.69 + YaTeX-hierarchy-ignore-heading-regexp 1.70 + (point-end-of-line) t) 1.71 + (throw 'found t)))) 1.72 + (beginning-of-line) 1.73 + (search-forward "%") 1.74 + (skip-chars-forward "% \t") 1.75 + (buffer-substring (point) (point-end-of-line))) 1.76 + (t "")))))) 1.77 1.78 (defun YaTeX-display-a-hierachy (hier level) 1.79 "Put a HIER of document hierarchy. 1.80 @@ -177,12 +185,19 @@ 1.81 1.82 \\[YaTeX-hierarchy-next] next line 1.83 \\[YaTeX-hierarchy-prev] previous line 1.84 -\\[YaTeX-hierarchy-forward] move forward in same level 1.85 -\\[YaTeX-hierarchy-backward] move backward in same level 1.86 +\\[YaTeX-hierarchy-forward] move forward in the same level 1.87 +\\[YaTeX-hierarchy-backward] move backward in the same level 1.88 \\[YaTeX-hierarchy-up-document] move to parent file 1.89 \\[delete-other-windows] delete other windows 1.90 \\[other-window] other window 1.91 -\\[YaTeX-hierarchy-show] show buffer contents in the next window 1.92 +\\[shrink-window] shrink window 1.93 +\\[enlarge-window] enlarge window 1.94 +\\[YaTeX-hierarchy-show] show file contents in the next window 1.95 +\\[YaTeX-hierarchy-scroll-up] scroll up file contents buffer 1.96 +\\[YaTeX-hierarchy-scroll-down] scroll down file contents buffer 1.97 +\\[YaTeX-hierarchy-top] show the top of file contents 1.98 +\\[YaTeX-hierarchy-bottom] show the bottom of file contents 1.99 +\\[YaTeX-hierarchy-lastpos] return to the previous position 1.100 \\[YaTeX-hierarchy-select] select file 1.101 \\[YaTeX-hierarchy-mouse-select] select 1.102 " 1.103 @@ -214,7 +229,7 @@ 1.104 (interactive "p") 1.105 (forward-line arg) 1.106 (skip-chars-forward "- +\\|") 1.107 - (if (and (/= arg 0) YaTeX-hierarchy-inspect-mode (not quiet)) 1.108 + (if (and (/= arg 0) (not quiet)) 1.109 (YaTeX-hierarchy-select t)) 1.110 (message YaTeX-hierarchy-buffer-message)) 1.111 1.112 @@ -278,7 +293,9 @@ 1.113 (interactive "p") 1.114 (YaTeX-hierarchy-next 0) ;move to file name column 1.115 (if (bolp) (error "Not on file name line")) 1.116 - (let ((file (buffer-substring (point) (point-end-of-line)))) 1.117 + (let ((file (buffer-substring 1.118 + (point) 1.119 + (progn (skip-chars-forward "^ \t") (point))))) 1.120 (YaTeX-hierarchy-next arg) 1.121 (cond 1.122 ((get-buffer file) 1.123 @@ -321,13 +338,51 @@ 1.124 (set-window-configuration (car YaTeX-hierarchy-saved-wc)) 1.125 (bury-buffer nil))) 1.126 1.127 -(defun YaTeX-hierarchy-toggle-inspection (arg) 1.128 - "Toggle inspection mode of YaTeX-hierarchy buffer." 1.129 +(defun YaTeX-hierarchy-scroll-up (arg &optional action) 1.130 + "Scroll up file contents of YaTeX-hierarchy." 1.131 (interactive "P") 1.132 - (setq YaTeX-hierarchy-inspect-mode 1.133 - (or arg (not YaTeX-hierarchy-inspect-mode))) 1.134 - (message "YaTeX hierarchy inspection mode %s" 1.135 - (if YaTeX-hierarchy-inspect-mode "ON" "OFF"))) 1.136 + (YaTeX-hierarchy-next 0 t) 1.137 + (let*((bufname (buffer-substring 1.138 + (point) 1.139 + (save-excursion (skip-chars-forward "^ \t") (point)))) 1.140 + (buf (get-buffer bufname)) 1.141 + (cw (selected-window))) 1.142 + (cond 1.143 + ((and buf (get-buffer-window buf)) 1.144 + (select-window (get-buffer-window buf))) 1.145 + ((and buf (YaTeX-showup-buffer buf nil t)) t) 1.146 + (t (YaTeX-hierarchy-select nil))) 1.147 + (unwind-protect 1.148 + (cond 1.149 + ((eq action 'down) (scroll-down arg)) 1.150 + ((eq action 'top) (beginning-of-buffer)) 1.151 + ((eq action 'bottom) (end-of-buffer)) 1.152 + ((eq action 'last) (exchange-point-and-mark)) 1.153 + (t (scroll-up arg))) 1.154 + (select-window cw)))) 1.155 + 1.156 +(defun YaTeX-hierarchy-scroll-down (arg) 1.157 + "Scroll down file contents of YaTeX-hierarchy." 1.158 + (interactive "P") 1.159 + (YaTeX-hierarchy-scroll-up arg 'down)) 1.160 + 1.161 +(defun YaTeX-hierarchy-top () 1.162 + "Show the top of YaTeX-hierarchy inspection buffer's." 1.163 + (interactive) 1.164 + (YaTeX-hierarchy-scroll-up nil 'top) 1.165 +) 1.166 + 1.167 +(defun YaTeX-hierarchy-bottom () 1.168 + "Show the top of YaTeX-hierarchy inspection buffer's." 1.169 + (interactive) 1.170 + (YaTeX-hierarchy-scroll-up nil 'bottom) 1.171 +) 1.172 + 1.173 +(defun YaTeX-hierarchy-lastpos () 1.174 + "Go to last position in YaTeX-hierarchy buffer." 1.175 + (interactive) 1.176 + (YaTeX-hierarchy-scroll-up nil 'last) 1.177 +) 1.178 1.179 ;; ----- Setting up keymap ----- 1.180 (defvar YaTeX-hierarchy-mode-map nil "Keymap used in YaTeX-hierarchy-mode.") 1.181 @@ -347,9 +402,17 @@ 1.182 (define-key YaTeX-hierarchy-mode-map "K" 'YaTeX-hierarchy-kill-buffer) 1.183 (define-key YaTeX-hierarchy-mode-map "1" 'delete-other-windows) 1.184 (define-key YaTeX-hierarchy-mode-map "o" 'other-window) 1.185 + (define-key YaTeX-hierarchy-mode-map "-" 'shrink-window) 1.186 + (define-key YaTeX-hierarchy-mode-map "+" 'enlarge-window) 1.187 (define-key YaTeX-hierarchy-mode-map "." 'YaTeX-hierarchy-show) 1.188 + (define-key YaTeX-hierarchy-mode-map " " 'YaTeX-hierarchy-scroll-up) 1.189 + (define-key YaTeX-hierarchy-mode-map "b" 'YaTeX-hierarchy-scroll-down) 1.190 + (define-key YaTeX-hierarchy-mode-map "\C-?" 'YaTeX-hierarchy-scroll-down) 1.191 (define-key YaTeX-hierarchy-mode-map "\C-m" 'YaTeX-hierarchy-select) 1.192 - (define-key YaTeX-hierarchy-mode-map ";" 'YaTeX-hierarchy-toggle-inspection) 1.193 + (define-key YaTeX-hierarchy-mode-map "<" 'YaTeX-hierarchy-top) 1.194 + (define-key YaTeX-hierarchy-mode-map ">" 'YaTeX-hierarchy-bottom) 1.195 + (define-key YaTeX-hierarchy-mode-map "'" 'YaTeX-hierarchy-lastpos) 1.196 + (define-key YaTeX-hierarchy-mode-map "g" 'YaTeX-hierarchy-select) 1.197 (define-key YaTeX-hierarchy-mode-map "q" 'YaTeX-hierarchy-quit) 1.198 (define-key YaTeX-hierarchy-mode-map "?" 'describe-mode) 1.199 (if (and YaTeX-emacs-19 window-system)