Skip to content

Instantly share code, notes, and snippets.

@takaxp
Last active September 11, 2017 02:53
Show Gist options
  • Select an option

  • Save takaxp/5c907500e4e8f4b9b63f107b0c843725 to your computer and use it in GitHub Desktop.

Select an option

Save takaxp/5c907500e4e8f4b9b63f107b0c843725 to your computer and use it in GitHub Desktop.
proposed patch for yatex
*** yatex/yatex.el 2017-09-11 11:22:34.000000000 +0900
--- yatex.el 2017-09-11 11:52:33.000000000 +0900
***************
*** 1,16 ****
! ;;; yatex.el --- Yet Another tex-mode for emacs //–ì’¹// -*- coding: sjis -*-
! ;;; (c)1991-2017 by HIROSE Yuuji.[yuuji@yatex.org]
! ;;; Last modified Sun Sep 10 21:19:43 2017 on firestorm
! ;;; $Id$
! ;;; The latest version of this software is always available at;
! ;;; https://www.yatex.org/
;;; Code:
(require 'yatexlib)
(defconst YaTeX-revision-number "1.80"
"Revision number of running yatex.el")
! ;---------- Local variables ----------
(defvar YaTeX-prefix "\C-c"
"*Prefix key to call YaTeX functions.
You can select favorite prefix key by setq in your ~/.emacs.")
--- 1,35 ----
! ;;; yatex.el --- Yet Another tex-mode //–ì’¹// -*- coding: sjis -*- -*- lexical-binding: t; -*-
!
! ;; Copyright (C) 2017 HIROSE Yuuji.
!
! ;; Author: HIROSE Yuuji.[yuuji@yatex.org]
! ;; Keywords: tex
! ;; Version: 1.81
! ;; URL: https://www.yatex.org/
!
! ;; This program is distributed as a free software. You can
! ;; use/copy/modify/redistribute this software freely but with NO warranty to
! ;; anything as a result of using this software. Adopting code from this
! ;; program is also free. But I would not do contract act.
!
! ;; This software can be also treated with:
! ;; ``The 2-Clause BSD License'' (BSD-2-Clause) since 2017-09-09, yatex 1.80.
!
! ;;; Commentary:
!
! ;; YaTeX is an intelligent, acquisitive and integrated package which reduces
! ;; your efforts of composing LaTeX source on Emacs. YaTeX has its brothers on
! ;; other distinguished Editors on DOS and Windows, Vz, Wz, Hidemaru, xyzzy.
! ;; You can write your document with the same interface on any platform if you
! ;; are using YaTeX family.
;;; Code:
+
(require 'yatexlib)
(defconst YaTeX-revision-number "1.80"
"Revision number of running yatex.el")
! ;;---------- Local variables ----------
(defvar YaTeX-prefix "\C-c"
"*Prefix key to call YaTeX functions.
You can select favorite prefix key by setq in your ~/.emacs.")
***************
*** 271,278 ****
(define-abbrev-table 'yatex-mode-abbrev-table ())
! ;------------ Completion table ------------
! ; Set tex-section-like command possible completion
(defvar section-table
(append
'(("part") ("chapter") ("chapter*") ("section") ("section*")
--- 290,297 ----
(define-abbrev-table 'yatex-mode-abbrev-table ())
! ;;------------ Completion table ------------
! ;; Set tex-section-like command possible completion
(defvar section-table
(append
'(("part") ("chapter") ("chapter*") ("section") ("section*")
***************
*** 360,366 ****
(append YaTeX-ams-math-begin-alist YaTeX-ams-math-gathering-alist)
"*Standard AMS-LaTeX(2e) environment completion table.")
! ; Set tex-environment possible completion
(defvar env-table
(append
'(("quote") ("quotation") ("center") ("verse") ("document")
--- 379,385 ----
(append YaTeX-ams-math-begin-alist YaTeX-ams-math-gathering-alist)
"*Standard AMS-LaTeX(2e) environment completion table.")
! ;; Set tex-environment possible completion
(defvar env-table
(append
'(("quote") ("quotation") ("center") ("verse") ("document")
***************
*** 389,395 ****
(defvar user-env-table nil)
(defvar tmp-env-table nil)
! ; Set {\Large }-like completion
(defvar fontsize-table
'(("rm") ("em") ("bf") ("boldmath") ("it") ("sl") ("sf") ("sc") ("tt")
("dg") ("dm")
--- 408,414 ----
(defvar user-env-table nil)
(defvar tmp-env-table nil)
! ;; Set {\Large }-like completion
(defvar fontsize-table
'(("rm") ("em") ("bf") ("boldmath") ("it") ("sl") ("sf") ("sc") ("tt")
("dg") ("dm")
***************
*** 446,456 ****
(defvar user-singlecmd-table nil)
(defvar tmp-singlecmd-table nil)
! ;---------- Key mode map ----------
! ;;;
;; Create new key map: YaTeX-mode-map
;; Do not change this section.
! ;;;
(defvar YaTeX-mode-map nil
"Keymap used in YaTeX mode")
--- 465,475 ----
(defvar user-singlecmd-table nil)
(defvar tmp-singlecmd-table nil)
! ;;---------- Key mode map ----------
! ;;
;; Create new key map: YaTeX-mode-map
;; Do not change this section.
! ;;
(defvar YaTeX-mode-map nil
"Keymap used in YaTeX mode")
***************
*** 469,477 ****
(defvar YaTeX-math-mode nil
"Holds whether current mode is math-mode.")
! ;;;
;; Define key table
! ;;;
(if YaTeX-mode-map
nil
(setq YaTeX-mode-map (make-sparse-keymap))
--- 488,496 ----
(defvar YaTeX-math-mode nil
"Holds whether current mode is math-mode.")
! ;;
;; Define key table
! ;;
(if YaTeX-mode-map
nil
(setq YaTeX-mode-map (make-sparse-keymap))
***************
*** 588,594 ****
(define-key YaTeX-mode-map (car key) 'YaTeX-math-insert-sequence)
(define-key YaTeX-recursive-map (car key) 'YaTeX-math-insert-sequence)))
YaTeX-math-key-list))
! ;---------- Define other variable ----------
(defvar YaTeX-env-name "document" "*Initial tex-environment completion")
(defvar YaTeX-section-name
(if YaTeX-use-LaTeX2e "documentclass" "documentstyle")
--- 607,613 ----
(define-key YaTeX-mode-map (car key) 'YaTeX-math-insert-sequence)
(define-key YaTeX-recursive-map (car key) 'YaTeX-math-insert-sequence)))
YaTeX-math-key-list))
! ;;---------- Define other variable ----------
(defvar YaTeX-env-name "document" "*Initial tex-environment completion")
(defvar YaTeX-section-name
(if YaTeX-use-LaTeX2e "documentclass" "documentstyle")
***************
*** 641,650 ****
(modify-syntax-entry
(string-to-char s) " " YaTeX-mode-syntax-table-nonparen))))
! ;---------- Provide YaTeX-mode ----------
! ;;;
;; Major mode definition
! ;;;
(defun yatex-mode ()
" Yet Another LaTeX mode: Major mode for editing input files of LaTeX.
-You can invoke processes concerning LaTeX typesetting by
--- 660,669 ----
(modify-syntax-entry
(string-to-char s) " " YaTeX-mode-syntax-table-nonparen))))
! ;;---------- Provide YaTeX-mode ----------
! ;;
;; Major mode definition
! ;;
(defun yatex-mode ()
" Yet Another LaTeX mode: Major mode for editing input files of LaTeX.
-You can invoke processes concerning LaTeX typesetting by
***************
*** 748,754 ****
(YaTeX-read-user-completion-table)
(and (fboundp 'YaTeX-hilit-setup-alist) (YaTeX-hilit-setup-alist))
(makunbound 'inenv)
! ;(turn-on-auto-fill) ;1.63 -> 1.79off
(if (fboundp 'electric-indent-local-mode)
(electric-indent-local-mode YaTeX-electric-indent-mode))
(and (= 0 (buffer-size)) (file-exists-p YaTeX-template-file)
--- 767,773 ----
(YaTeX-read-user-completion-table)
(and (fboundp 'YaTeX-hilit-setup-alist) (YaTeX-hilit-setup-alist))
(makunbound 'inenv)
! ;;(turn-on-auto-fill) ;1.63 -> 1.79off
(if (fboundp 'electric-indent-local-mode)
(electric-indent-local-mode YaTeX-electric-indent-mode))
(and (= 0 (buffer-size)) (file-exists-p YaTeX-template-file)
***************
*** 756,762 ****
(insert-file-contents (expand-file-name YaTeX-template-file)))
(run-hooks 'text-mode-hook 'yatex-mode-hook))
! ;---------- Define YaTeX-mode functions ----------
(defvar YaTeX-ec "\\" "Escape character of current mark-up language.")
(defvar YaTeX-ec-regexp (regexp-quote YaTeX-ec))
(defvar YaTeX-struct-begin
--- 775,781 ----
(insert-file-contents (expand-file-name YaTeX-template-file)))
(run-hooks 'text-mode-hook 'yatex-mode-hook))
! ;;---------- Define YaTeX-mode functions ----------
(defvar YaTeX-ec "\\" "Escape character of current mark-up language.")
(defvar YaTeX-ec-regexp (regexp-quote YaTeX-ec))
(defvar YaTeX-struct-begin
***************
*** 780,788 ****
;; (concat YaTeX-ec "%1{%2}")
;; "Keyword to make section.")
! ;;;
;; autoload section
! ;;;
;;autoload from yatexprc.el
(autoload 'YaTeX-visit-main "yatexprc" "Visit main LaTeX file." t)
--- 799,807 ----
;; (concat YaTeX-ec "%1{%2}")
;; "Keyword to make section.")
! ;;
;; autoload section
! ;;
;;autoload from yatexprc.el
(autoload 'YaTeX-visit-main "yatexprc" "Visit main LaTeX file." t)
***************
*** 836,844 ****
;;autoload from yatexpkg.el
(autoload 'YaTeX-package-auto-usepackage "yatexpkg" "Auto \\usepackage" t)
! ;;;
;; YaTeX-mode functions
! ;;;
(defun YaTeX-insert-begin-end (env region-mode)
"Insert \\begin{mode-name} and \\end{mode-name}.
This works also for other defined begin/end tokens to define the structure."
--- 855,863 ----
;;autoload from yatexpkg.el
(autoload 'YaTeX-package-auto-usepackage "yatexpkg" "Auto \\usepackage" t)
! ;;
;; YaTeX-mode functions
! ;;
(defun YaTeX-insert-begin-end (env region-mode)
"Insert \\begin{mode-name} and \\end{mode-name}.
This works also for other defined begin/end tokens to define the structure."
***************
*** 1567,1577 ****
((= (preceding-char) ?\\ )
(YaTeX-insert-inherit "|\\|")
(backward-char 2))
! ; ((and (YaTeX-closable-p)
! ; (/= (preceding-char) ?|)
! ; (/= (following-char) ?|))
! ; (YaTeX-insert-inherit "||")
! ; (backward-char 1))
(t (YaTeX-self-insert arg))))
(defvar YaTeX-use-jmode-hook
--- 1586,1596 ----
((= (preceding-char) ?\\ )
(YaTeX-insert-inherit "|\\|")
(backward-char 2))
! ; ((and (YaTeX-closable-p)
! ; (/= (preceding-char) ?|)
! ; (/= (following-char) ?|))
! ; (YaTeX-insert-inherit "||")
! ; (backward-char 1))
(t (YaTeX-self-insert arg))))
(defvar YaTeX-use-jmode-hook
***************
*** 1823,1830 ****
YaTeX-default-pop-window-height))
(select-window (get-lru-window))
(switch-to-buffer buffer)))))
! ;(setq string (concat "\\" scmd "{" label "}"))
! ;(setq string (concat "\\\\" scmd "{" (regexp-quote label) "}"))
(setq string (YaTeX-replace-format scmd "k" (regexp-quote label)))
(setq direc (if (string-match "ref\\|cite" scmd)
're-search-forward 're-search-backward))
--- 1842,1849 ----
YaTeX-default-pop-window-height))
(select-window (get-lru-window))
(switch-to-buffer buffer)))))
! ;;(setq string (concat "\\" scmd "{" label "}"))
! ;;(setq string (concat "\\\\" scmd "{" (regexp-quote label) "}"))
(setq string (YaTeX-replace-format scmd "k" (regexp-quote label)))
(setq direc (if (string-match "ref\\|cite" scmd)
're-search-forward 're-search-backward))
***************
*** 2444,2450 ****
(setq p (1- (point)) bsl t)
(setq p (point)))
(forward-list 1)
! ;(YaTeX-goto-open-paren t)
(if kill-contents (delete-region p (point))
(backward-delete-char 1)
(cond
--- 2463,2469 ----
(setq p (1- (point)) bsl t)
(setq p (point)))
(forward-list 1)
! ;(YaTeX-goto-open-paren t) ;
(if kill-contents (delete-region p (point))
(backward-delete-char 1)
(cond
***************
*** 2673,2681 ****
((YaTeX-change-math-image))
(t (message "I don't know what to change."))))
! ;;;
! ;Check availability of add-in functions
! ;;;
(cond
((featurep 'yatexadd) nil) ;Already provided.
((progn (load "yatexadd" t) (featurep 'yatexadd)) nil)
--- 2692,2700 ----
((YaTeX-change-math-image))
(t (message "I don't know what to change."))))
! ;;
! ;;Check availability of add-in functions ;
! ;;
(cond
((featurep 'yatexadd) nil) ;Already provided.
((progn (load "yatexadd" t) (featurep 'yatexadd)) nil)
***************
*** 2771,2777 ****
YaTeX-item-regexp YaTeX-comment-prefix p t))
(progn
(goto-char (match-end 0))
! ;(setq c (current-column))
(if (string-match "desc" env)
(setq c 6)
(setq cc (current-column))
--- 2790,2796 ----
YaTeX-item-regexp YaTeX-comment-prefix p t))
(progn
(goto-char (match-end 0))
! ;;(setq c (current-column))
(if (string-match "desc" env)
(setq c 6)
(setq cc (current-column))
***************
*** 2983,2992 ****
(or (and (boundp 'inenv) inenv)
(or (YaTeX-inner-environment t) "document"))))
(apply 'YaTeX-saved-indent-new-comment-line (if soft (list soft))))
! ; ((and (eq major-mode 'yahtml-mode)
! ; (string-match
! ; "^[Pp][Rr][Ee]" (yahtml-inner-environment-but "^[Aa]\\b" t)))
! ; (yahtml-indent-new-commnet-line))
((and (eq major-mode 'yatex-mode) ;1997/2/4
(YaTeX-in-math-mode-p)) nil) ;1996/12/30
(t (let (fill-prefix)
--- 3002,3011 ----
(or (and (boundp 'inenv) inenv)
(or (YaTeX-inner-environment t) "document"))))
(apply 'YaTeX-saved-indent-new-comment-line (if soft (list soft))))
! ;; ((and (eq major-mode 'yahtml-mode)
! ;; (string-match
! ;; "^[Pp][Rr][Ee]" (yahtml-inner-environment-but "^[Aa]\\b" t)))
! ;; (yahtml-indent-new-commnet-line))
((and (eq major-mode 'yatex-mode) ;1997/2/4
(YaTeX-in-math-mode-p)) nil) ;1996/12/30
(t (let (fill-prefix)
***************
*** 3282,3285 ****
(run-hooks 'yatex-mode-load-hook)
;; `History' was moved to ChangeLog
! ;----------------------------- End of yatex.el -----------------------------
--- 3301,3305 ----
(run-hooks 'yatex-mode-load-hook)
;; `History' was moved to ChangeLog
!
! ;;; yatex.el ends here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment