comparison yatexlib.el @ 590:7810c4ec21fe draft

Move wrapper functions former part of the file for the clarity.
author HIROSE Yuuji <yuuji@gentei.org>
date Fri, 23 Sep 2022 06:46:32 +0900
parents 44c9b313c68d
children 38a414d755c1
comparison
equal deleted inserted replaced
589:921d58902dca 590:7810c4ec21fe
1 ;;; yatexlib.el --- YaTeX and yahtml common libraries -*- coding: sjis -*- 1 ;;; yatexlib.el --- YaTeX and yahtml common libraries -*- coding: sjis -*-
2 ;;; 2 ;;;
3 ;;; (c)1994-2019 by HIROSE Yuuji.[yuuji@yatex.org] 3 ;;; (c)1994-2019 by HIROSE Yuuji.[yuuji@yatex.org]
4 ;;; Last modified Thu Sep 22 11:17:54 2022 on firestorm 4 ;;; Last modified Fri Sep 23 06:43:32 2022 on firestorm
5 ;;; $Id$ 5 ;;; $Id$
6 6
7 ;;; Code: 7 ;;; Code:
8 8
9 ;; High-precedence compatible function 9 ;; High-precedence compatible function
116 (define-key YaTeX-typesetting-mode-map "q" 'delete-window)) 116 (define-key YaTeX-typesetting-mode-map "q" 'delete-window))
117 117
118 (defvar YaTeX-parent-file nil 118 (defvar YaTeX-parent-file nil
119 "*Main LaTeX source file name used when %#! expression doesn't exist.") 119 "*Main LaTeX source file name used when %#! expression doesn't exist.")
120 (make-variable-buffer-local 'YaTeX-parent-file) 120 (make-variable-buffer-local 'YaTeX-parent-file)
121
122 ;;;
123 ;; Emacs 21 compensational wrapper
124 ;;;
125 (defun YaTeX-minibuffer-begin ()
126 (if (fboundp 'field-beginning)
127 (field-beginning (point-max))
128 (point-min)))
129
130 (defun YaTeX-minibuffer-end ()
131 (if (fboundp 'field-end)
132 (field-end (point-max))
133 (point-max)))
134
135 (defun YaTeX-minibuffer-string ()
136 (buffer-substring (YaTeX-minibuffer-begin) (YaTeX-minibuffer-end)))
137
138 (defun YaTeX-minibuffer-erase ()
139 (if (eq (selected-window) (minibuffer-window))
140 (if (fboundp 'delete-field) (delete-field) (erase-buffer))))
141
142 (fset 'YaTeX-buffer-substring
143 (if (fboundp 'buffer-substring-no-properties)
144 'buffer-substring-no-properties
145 'buffer-substring))
146 (fset 'YaTeX-substring
147 (if (fboundp 'substring-no-properties)
148 'substring-no-properties
149 'substing))
150
151 (defun YaTeX-region-active-p ()
152 (and (fboundp 'region-active-p) (region-active-p)))
121 153
122 ;---------- Define default key bindings on YaTeX mode map ---------- 154 ;---------- Define default key bindings on YaTeX mode map ----------
123 ;;;###autoload 155 ;;;###autoload
124 (defun YaTeX-kanji-ptex-mnemonic () 156 (defun YaTeX-kanji-ptex-mnemonic ()
125 "Return the kanji-mnemonic of pTeX from current buffer's coding-system." 157 "Return the kanji-mnemonic of pTeX from current buffer's coding-system."
629 ;;;###autoload 661 ;;;###autoload
630 (defun YaTeX-match-string (n &optional m str) 662 (defun YaTeX-match-string (n &optional m str)
631 "Return (buffer-substring (match-beginning n) (match-beginning m)). 663 "Return (buffer-substring (match-beginning n) (match-beginning m)).
632 Optional third argument STR gives substring from string STR." 664 Optional third argument STR gives substring from string STR."
633 (if (match-beginning n) 665 (if (match-beginning n)
634 (if str (substring str n (or m n)) 666 (if str (YaTeX-substring
667 str (match-beginning m) (match-end (or m n)))
635 (YaTeX-buffer-substring (match-beginning n) 668 (YaTeX-buffer-substring (match-beginning n)
636 (match-end (or m n)))))) 669 (match-end (or m n))))))
637 670
638 ;;;###autoload 671 ;;;###autoload
639 (defun YaTeX-minibuffer-complete () 672 (defun YaTeX-minibuffer-complete ()
1383 (mapcar 1416 (mapcar
1384 (function 1417 (function
1385 (lambda (bind) 1418 (lambda (bind)
1386 (define-key (symbol-value keymap) (vector (car bind)) (cdr bind)))) 1419 (define-key (symbol-value keymap) (vector (car bind)) (cdr bind))))
1387 bindlist)))) 1420 bindlist))))
1388
1389 ;;;
1390 ;; Emacs 21 compensational wrapper
1391 ;;;
1392 (defun YaTeX-minibuffer-begin ()
1393 (if (fboundp 'field-beginning)
1394 (field-beginning (point-max))
1395 (point-min)))
1396
1397 (defun YaTeX-minibuffer-end ()
1398 (if (fboundp 'field-end)
1399 (field-end (point-max))
1400 (point-max)))
1401
1402 (defun YaTeX-minibuffer-string ()
1403 (buffer-substring (YaTeX-minibuffer-begin) (YaTeX-minibuffer-end)))
1404
1405 (defun YaTeX-minibuffer-erase ()
1406 (if (eq (selected-window) (minibuffer-window))
1407 (if (fboundp 'delete-field) (delete-field) (erase-buffer))))
1408
1409 (fset 'YaTeX-buffer-substring
1410 (if (fboundp 'buffer-substring-no-properties)
1411 'buffer-substring-no-properties
1412 'buffer-substring))
1413
1414 (defun YaTeX-region-active-p ()
1415 (and (fboundp 'region-active-p) (region-active-p)))
1416 1421
1417 ;;; 1422 ;;;
1418 ;; hilit19 vs. font-lock 1423 ;; hilit19 vs. font-lock
1419 ;;; 1424 ;;;
1420 (defvar YaTeX-19-functions-font-lock-direct 1425 (defvar YaTeX-19-functions-font-lock-direct

yatex.org