# HG changeset patch # User HIROSE Yuuji # Date 1663883192 -32400 # Node ID 7810c4ec21fecb332ccea42d7ae36df2421dc662 # Parent 921d58902dca38391da2bcfc08fa89cc1fd71515 Move wrapper functions former part of the file for the clarity. diff -r 921d58902dca -r 7810c4ec21fe yatexlib.el --- a/yatexlib.el Fri Sep 23 06:29:04 2022 +0900 +++ b/yatexlib.el Fri Sep 23 06:46:32 2022 +0900 @@ -1,7 +1,7 @@ ;;; yatexlib.el --- YaTeX and yahtml common libraries -*- coding: sjis -*- ;;; ;;; (c)1994-2019 by HIROSE Yuuji.[yuuji@yatex.org] -;;; Last modified Thu Sep 22 11:17:54 2022 on firestorm +;;; Last modified Fri Sep 23 06:43:32 2022 on firestorm ;;; $Id$ ;;; Code: @@ -119,6 +119,38 @@ "*Main LaTeX source file name used when %#! expression doesn't exist.") (make-variable-buffer-local 'YaTeX-parent-file) +;;; +;; Emacs 21 compensational wrapper +;;; +(defun YaTeX-minibuffer-begin () + (if (fboundp 'field-beginning) + (field-beginning (point-max)) + (point-min))) + +(defun YaTeX-minibuffer-end () + (if (fboundp 'field-end) + (field-end (point-max)) + (point-max))) + +(defun YaTeX-minibuffer-string () + (buffer-substring (YaTeX-minibuffer-begin) (YaTeX-minibuffer-end))) + +(defun YaTeX-minibuffer-erase () + (if (eq (selected-window) (minibuffer-window)) + (if (fboundp 'delete-field) (delete-field) (erase-buffer)))) + +(fset 'YaTeX-buffer-substring + (if (fboundp 'buffer-substring-no-properties) + 'buffer-substring-no-properties + 'buffer-substring)) +(fset 'YaTeX-substring + (if (fboundp 'substring-no-properties) + 'substring-no-properties + 'substing)) + +(defun YaTeX-region-active-p () + (and (fboundp 'region-active-p) (region-active-p))) + ;---------- Define default key bindings on YaTeX mode map ---------- ;;;###autoload (defun YaTeX-kanji-ptex-mnemonic () @@ -631,7 +663,8 @@ "Return (buffer-substring (match-beginning n) (match-beginning m)). Optional third argument STR gives substring from string STR." (if (match-beginning n) - (if str (substring str n (or m n)) + (if str (YaTeX-substring + str (match-beginning m) (match-end (or m n))) (YaTeX-buffer-substring (match-beginning n) (match-end (or m n)))))) @@ -1387,34 +1420,6 @@ bindlist)))) ;;; -;; Emacs 21 compensational wrapper -;;; -(defun YaTeX-minibuffer-begin () - (if (fboundp 'field-beginning) - (field-beginning (point-max)) - (point-min))) - -(defun YaTeX-minibuffer-end () - (if (fboundp 'field-end) - (field-end (point-max)) - (point-max))) - -(defun YaTeX-minibuffer-string () - (buffer-substring (YaTeX-minibuffer-begin) (YaTeX-minibuffer-end))) - -(defun YaTeX-minibuffer-erase () - (if (eq (selected-window) (minibuffer-window)) - (if (fboundp 'delete-field) (delete-field) (erase-buffer)))) - -(fset 'YaTeX-buffer-substring - (if (fboundp 'buffer-substring-no-properties) - 'buffer-substring-no-properties - 'buffer-substring)) - -(defun YaTeX-region-active-p () - (and (fboundp 'region-active-p) (region-active-p))) - -;;; ;; hilit19 vs. font-lock ;;; (defvar YaTeX-19-functions-font-lock-direct