Mercurial > hgrepos > hgweb.cgi > yatex
comparison yatex.el @ 545:ea6956f10ce7 dev
When %#SRC specified, should send content of that file.
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Sat, 02 Jun 2018 15:57:55 +0900 |
parents | ab6c176c676a |
children | e7356faf50df |
comparison
equal
deleted
inserted
replaced
544:ab6c176c676a | 545:ea6956f10ce7 |
---|---|
1 ;;; yatex.el --- Yet Another tex-mode for emacs //–ì’¹// -*- coding: sjis -*- | 1 ;;; yatex.el --- Yet Another tex-mode for emacs //–ì’¹// -*- coding: sjis -*- |
2 ;;; (c)1991-2018 by HIROSE Yuuji.[yuuji@yatex.org] | 2 ;;; (c)1991-2018 by HIROSE Yuuji.[yuuji@yatex.org] |
3 ;;; Last modified Fri Jun 1 08:30:26 2018 on firestorm | 3 ;;; Last modified Sat Jun 2 14:13:17 2018 on firestorm |
4 ;;; $Id$ | 4 ;;; $Id$ |
5 ;;; The latest version of this software is always available at; | 5 ;;; The latest version of this software is always available at; |
6 ;;; https://www.yatex.org/ | 6 ;;; https://www.yatex.org/ |
7 | 7 |
8 ;;; This program is distributed as a free software. You can | 8 ;;; This program is distributed as a free software. You can |
1953 | 1953 |
1954 ;;YaTeX-goto-corresponding-environment was moved to yatexlib | 1954 ;;YaTeX-goto-corresponding-environment was moved to yatexlib |
1955 | 1955 |
1956 (defun YaTeX-goto-corresponding-file (&optional other) | 1956 (defun YaTeX-goto-corresponding-file (&optional other) |
1957 "Visit or switch buffer of corresponding file, | 1957 "Visit or switch buffer of corresponding file, |
1958 looking at \\input or \\include or \\includeonly on current line." | 1958 looking at \\input or \\include or \\includeonly or %#SRC{} on current line." |
1959 (if (not (YaTeX-on-includes-p)) nil | 1959 (cond |
1960 ((YaTeX-on-includes-p) | |
1960 (let ((parent buffer-file-name) input-file b) | 1961 (let ((parent buffer-file-name) input-file b) |
1961 (save-excursion | 1962 (save-excursion |
1962 (if (and (re-search-forward "[{%]" (point-end-of-line) t) | 1963 (if (and (re-search-forward "[{%]" (point-end-of-line) t) |
1963 (= ?{ (char-after (match-beginning 0)))) | 1964 (= ?{ (char-after (match-beginning 0)))) |
1964 nil | 1965 nil |
1973 ((setq b (YaTeX-get-file-buffer input-file)) | 1974 ((setq b (YaTeX-get-file-buffer input-file)) |
1974 (goto-buffer-window b)) | 1975 (goto-buffer-window b)) |
1975 (t (YaTeX-switch-to-buffer input-file))) | 1976 (t (YaTeX-switch-to-buffer input-file))) |
1976 (or (YaTeX-get-builtin "!") | 1977 (or (YaTeX-get-builtin "!") |
1977 YaTeX-parent-file | 1978 YaTeX-parent-file |
1978 (setq YaTeX-parent-file parent))))) | 1979 (setq YaTeX-parent-file parent)))) |
1980 ;; On %#SRC{somefilters.src} | |
1981 ((YaTeX-on-SRC-p) | |
1982 (let ((src (YaTeX-match-string 1))) | |
1983 (if other (YaTeX-switch-to-buffer-other-window src) | |
1984 (goto-buffer-window (find-file-noselect src))))))) | |
1979 | 1985 |
1980 (defun YaTeX-goto-corresponding-BEGIN-END () | 1986 (defun YaTeX-goto-corresponding-BEGIN-END () |
1981 (if (not (YaTeX-on-BEGIN-END-p)) nil | 1987 (if (not (YaTeX-on-BEGIN-END-p)) nil |
1982 (if (cond | 1988 (if (cond |
1983 ((equal (match-beginning 0) (match-beginning 1)) ;if on %#BEGIN | 1989 ((equal (match-beginning 0) (match-beginning 1)) ;if on %#BEGIN |
2270 (save-excursion | 2276 (save-excursion |
2271 (let ((case-fold-search nil)) | 2277 (let ((case-fold-search nil)) |
2272 (beginning-of-line) | 2278 (beginning-of-line) |
2273 (re-search-forward | 2279 (re-search-forward |
2274 "\\(%#BEGIN\\)\\|\\(%#END\\)" (point-end-of-line) t)))) | 2280 "\\(%#BEGIN\\)\\|\\(%#END\\)" (point-end-of-line) t)))) |
2281 | |
2282 (defun YaTeX-on-SRC-p () | |
2283 (save-excursion | |
2284 (let ((case-fold-search nil)) | |
2285 (beginning-of-line) | |
2286 (re-search-forward | |
2287 "%#SRC{\\([^}]+\\)}" (point-end-of-line) t)))) | |
2275 | 2288 |
2276 (defun YaTeX-goto-corresponding-* (arg) | 2289 (defun YaTeX-goto-corresponding-* (arg) |
2277 "Parse current line and call suitable function." | 2290 "Parse current line and call suitable function." |
2278 (interactive "P") | 2291 (interactive "P") |
2279 (let (mm) | 2292 (let (mm) |