Skip to content

Instantly share code, notes, and snippets.

@munepi
Created April 3, 2013 06:36
Show Gist options
  • Save munepi/5298924 to your computer and use it in GitHub Desktop.
Save munepi/5298924 to your computer and use it in GitHub Desktop.
an YaTeX http://www.yatex.org/ extension of Auto Complete Mode http://cx4a.org/software/auto-complete/ We remark that we recommend auto-complete-latex https://bitbucket.org/tequilasunset/auto-complete-latex :)
;;; auto-complete-yatex.el --- A YaTeX extention for Auto Complete Mode
;; Copyright (C) 2008-2011 Munehiro Yamamoto
;; Author: Munehiro Yamamoto <[email protected]>
;; Keywords: YaTeX LaTeX TeX
;; Version: 1.3.1.1
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; History:
;; 2011-08-24 Munehiro Yamamoto <[email protected]>
;;
;; * supported auto-complete-mode v1.3.1
;;
;; 2008-03-04 Munehiro Yamamoto <[email protected]>
;;
;; * added original YaTeX keywords to ac-yatex-keywords
;; * defvar ac-yatex-user-keywords
;;
;; 2008-03-01 Munehiro Yamamoto <[email protected]>
;;
;; * first release
;;
(require 'auto-complete)
(require 'yatex)
(require 'yatexadd)
;(require 'yatexmth)
;(require 'yatexpkg)
;(require 'yatexsec)
(defvar ac-source-yatex-user-candiates nil
"A list of your YaTeX keywords.")
(defvar ac-source-yatex-candiates
;; (sort
(append
ac-source-yatex-user-candiates
;; yatex.el
section-table user-section-table tmp-section-table
YaTeX-math-begin-list
YaTeX-math-gathering-list
env-table user-env-table tmp-env-table
fontsize-table user-fontsize-table tmp-fontsize-table
singlecmd-table user-singlecmd-table tmp-singlecmd-table
;; yatexadd.el
YaTeX:style-parameters-default
YaTeX:style-parameters-private
YaTeX:style-parameters-local
;; YaTeX:documentstyles-default
;; YaTeX:documentstyles-private
;; YaTeX:documentstyles-local
;; YaTeX:documentstyle-options-default
;; YaTeX:documentstyle-options-private
;; YaTeX:documentstyle-options-local
YaTeX:documentclass-options-default
YaTeX:documentclass-options-private
YaTeX:documentclass-options-local
YaTeX:documentclasses-default
YaTeX:documentclasses-private
YaTeX:documentclasses-local
YaTeX:latex2e-named-color-alist
YaTeX:latex2e-basic-color-alist
YaTeX::usepackage-alist-default
YaTeX::usepackage-alist-private
YaTeX::usepackage-alist-local
;; yatexmth.el
;YaTeX-math-sign-alist
;YaTeX-greek-key-alist
;; yatexpkg.el
;YaTeX-package-alist-default
;YaTeX-package-graphics-driver-alist
;YaTeX-package-alist-private
;; yatexsec.el
;YaTeX-sectioning-level
);; #'(lambda (a b) (> (length a) (length b)))
)
(defvar ac-source-yatex
'((candidates
. (lambda ()
(all-completions ac-target ac-source-yatex-candiates))))
"A Source of YaTeX keywords")
(defun ac-yatex-setup ()
(add-to-list 'ac-modes 'yatex-mode)
(add-to-list 'ac-sources 'ac-source-yatex)
)
(add-hook 'yatex-mode-hook 'ac-yatex-setup)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(provide 'auto-complete-yatex)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Local Variables:
;; mode: emacs-lisp
;; End:
@munepi
Copy link
Author

munepi commented Apr 11, 2013

wnn7egg による日本語入力モードのとき、auto-complete-mode を off にするには、以下のようにしていた。

(defadvice toggle-input-method (after wnn7egg-activate activate)
  (if wnn7-activate
      (global-auto-complete-mode 0) (global-auto-complete-mode 1)))

同じようにして、一般には以下でいけるみたい。

(defadvice toggle-input-method (after current-input-method activate)
  (if current-input-method
      (global-auto-complete-mode 0) (global-auto-complete-mode 1)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment