[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 220/299: Convert TeX-auto-add-type to a macro.
From: |
Stefan Monnier |
Subject: |
[elpa] 220/299: Convert TeX-auto-add-type to a macro. |
Date: |
Sun, 02 Nov 2014 03:11:34 +0000 |
monnier pushed a commit to branch externals/auctex
in repository elpa.
commit f4d3f2840e8f448a329b223c081bce556eb6ca67
Author: Tassilo Horn <address@hidden>
Date: Tue Feb 4 08:27:19 2014 +0100
Convert TeX-auto-add-type to a macro.
* tex.el (TeX-auto-add-type): Convert to macro.
* lpath.el: Don't silence byte-compiler.
* latex.el (LaTeX-auto-style, LaTeX-auto-arguments)
(LaTeX-auto-optional, LaTeX-auto-env-args): Defvar explicitly
before use.
---
ChangeLog | 10 ++++++++
latex.el | 25 ++++++++++++--------
lpath.el | 1 -
tex.el | 72 +++++++++++++++++++++++++++++++++----------------------------
4 files changed, 64 insertions(+), 44 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f3145ac..c33cd2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2014-02-04 Tassilo Horn <address@hidden>
+
+ * tex.el (TeX-auto-add-type): Convert to macro.
+
+ * lpath.el: Don't silence byte-compiler.
+
+ * latex.el (LaTeX-auto-style, LaTeX-auto-arguments)
+ (LaTeX-auto-optional, LaTeX-auto-env-args): Defvar explicitly
+ before use.
+
2014-01-29 Tassilo Horn <address@hidden>
* tex-buf.el (TeX-command-query): Use default parameter of
diff --git a/latex.el b/latex.el
index 0ed4bcf..b2dad4a 100644
--- a/latex.el
+++ b/latex.el
@@ -1149,6 +1149,21 @@ You may use `LaTeX-item-list' to change the routines
used to insert the item."
;;; Parser
+(defvar LaTeX-auto-style nil)
+(defvar LaTeX-auto-arguments nil)
+(defvar LaTeX-auto-optional nil)
+(defvar LaTeX-auto-env-args nil)
+
+(TeX-auto-add-type "label" "LaTeX")
+(TeX-auto-add-type "bibitem" "LaTeX")
+(TeX-auto-add-type "environment" "LaTeX")
+(TeX-auto-add-type "bibliography" "LaTeX" "bibliographies")
+(TeX-auto-add-type "index-entry" "LaTeX" "index-entries")
+(TeX-auto-add-type "pagestyle" "LaTeX")
+(TeX-auto-add-type "counter" "LaTeX")
+(TeX-auto-add-type "length" "LaTeX")
+(TeX-auto-add-type "savebox" "LaTeX" "saveboxes")
+
(defvar LaTeX-auto-minimal-regexp-list
'(("\\\\document\\(style\\|class\\)\
\\(\\[\\(\\([^#\\%]\\|%[^\n\r]*[\n\r]\\)*\\)\\]\\)?\
@@ -1482,16 +1497,6 @@ The value is actually the tail of the list of options
given to PACKAGE."
(add-hook 'TeX-auto-cleanup-hook 'LaTeX-auto-cleanup)
-(TeX-auto-add-type "label" "LaTeX")
-(TeX-auto-add-type "bibitem" "LaTeX")
-(TeX-auto-add-type "environment" "LaTeX")
-(TeX-auto-add-type "bibliography" "LaTeX" "bibliographies")
-(TeX-auto-add-type "index-entry" "LaTeX" "index-entries")
-(TeX-auto-add-type "pagestyle" "LaTeX")
-(TeX-auto-add-type "counter" "LaTeX")
-(TeX-auto-add-type "length" "LaTeX")
-(TeX-auto-add-type "savebox" "LaTeX" "saveboxes")
-
(fset 'LaTeX-add-bibliographies-auto
(symbol-function 'LaTeX-add-bibliographies))
(defun LaTeX-add-bibliographies (&rest bibliographies)
diff --git a/lpath.el b/lpath.el
index 34eff14..2a090b1 100644
--- a/lpath.el
+++ b/lpath.el
@@ -3,6 +3,5 @@
;; Make sure we get the right files.
(setq load-path (cons "." load-path)
- byte-compile-warnings nil
TeX-lisp-directory "<none>"
TeX-auto-global "<none>")
diff --git a/tex.el b/tex.el
index 3ef7afd..0d6280e 100644
--- a/tex.el
+++ b/tex.el
@@ -3203,39 +3203,6 @@ The algorithm is as follows:
(defconst TeX-auto-parser-local 3)
(defconst TeX-auto-parser-change 4)
-(defun TeX-auto-add-type (name prefix &optional plural)
- "Add information about NAME to the parser using PREFIX.
-
-Optional third argument PLURAL is the plural form of TYPE.
-By default just add an `s'.
-
-This function create a set of variables and functions to maintain a
-separate type of information in the parser."
- (let* ((names (or plural (concat name "s")))
- (tmp (intern (concat prefix "-auto-" name)))
- (add (intern (concat prefix "-add-" names)))
- (local (intern (concat prefix "-" name "-list")))
- (change (intern (concat prefix "-" name "-changed"))))
- ;; Append new type to `TeX-auto-parser' in order to make `style' type
always
- ;; the first.
- (add-to-list 'TeX-auto-parser (list name tmp add local change) t)
- (set local nil)
- (make-variable-buffer-local local)
- (set change nil)
- (make-variable-buffer-local change)
- (fset add `(lambda (&rest entries)
- ,(concat "Add information about " (upcase name)
- " to the current buffer.
-Generated by `TeX-auto-add-type'.")
- (TeX-auto-add-information ,name entries)))
- (fset local `(lambda nil
- ,(concat "List of " names
- " active in the current buffer.
-Generated by `TeX-auto-add-type'.")
- (TeX-auto-list-information ,name)))
- (add-hook 'TeX-remove-style-hook
- `(lambda nil (setq ,(symbol-name local) nil)))))
-
(defun TeX-auto-add-information (name entries)
"For NAME in `TeX-auto-parser' add ENTRIES."
(let* ((entry (assoc name TeX-auto-parser))
@@ -3279,6 +3246,45 @@ Generated by `TeX-auto-add-type'.")
(message "Removing duplicates... done"))
(symbol-value local)))
+(defmacro TeX-auto-add-type (name prefix &optional plural)
+ "Add information about NAME to the parser using PREFIX.
+
+Optional third argument PLURAL is the plural form of TYPE.
+By default just add an `s'.
+
+This function create a set of variables and functions to maintain a
+separate type of information in the parser."
+ (let* ((names (or plural (concat name "s")))
+ (tmp (intern (concat prefix "-auto-" name)))
+ (add (intern (concat prefix "-add-" names)))
+ (local (intern (concat prefix "-" name "-list")))
+ (change (intern (concat prefix "-" name "-changed")))
+ (vardoc (concat "Information about " names
+ " in the current buffer.
+Generated by `TeX-auto-add-type'.")))
+ `(progn
+ (defvar ,tmp nil ,vardoc)
+ (defvar ,local nil ,vardoc)
+ (make-variable-buffer-local ',local)
+ (defvar ,change nil ,vardoc)
+ (make-variable-buffer-local ',change)
+ (defun ,add (&rest ,(intern names))
+ ,(concat "Add information about " (upcase names)
+ " to the current buffer.
+Generated by `TeX-auto-add-type'.")
+ (TeX-auto-add-information ,name ,(intern names)))
+ (defun ,local ()
+ ,(concat "List of " names
+ " active in the current buffer.
+Generated by `TeX-auto-add-type'.")
+ (TeX-auto-list-information ,name))
+ ;; Append new type to `TeX-auto-parser' in order to make `style' type
+ ;; always the first.
+ (add-to-list 'TeX-auto-parser ',(list name tmp add local change) t)
+ (add-hook 'TeX-remove-style-hook
+ (lambda ()
+ (setq ,local nil))))))
+
(TeX-auto-add-type "symbol" "TeX")
(defvar TeX-auto-apply-hook nil
- [elpa] 210/299: Make search for \begin and \end case sensitive., (continued)
- [elpa] 210/299: Make search for \begin and \end case sensitive., Stefan Monnier, 2014/11/01
- [elpa] 214/299: Fix syntactic fontification., Stefan Monnier, 2014/11/01
- [elpa] 215/299: Declare LaTeX-shortvrb-chars as safe local variable., Stefan Monnier, 2014/11/01
- [elpa] 212/299: Distinguish between numbered and unnumbered sections., Stefan Monnier, 2014/11/01
- [elpa] 216/299: Add a ^L so that the file local variable example isn't picked up., Stefan Monnier, 2014/11/01
- [elpa] 217/299: Use default parameter of completing-read., Stefan Monnier, 2014/11/01
- [elpa] 218/299: Use default parameter of `completing-read'., Stefan Monnier, 2014/11/01
- [elpa] 213/299: *** empty log message ***, Stefan Monnier, 2014/11/01
- [elpa] 219/299: Add WHEN arg to make-obsolete calls, Stefan Monnier, 2014/11/01
- [elpa] 221/299: Add an english style., Stefan Monnier, 2014/11/01
- [elpa] 220/299: Convert TeX-auto-add-type to a macro.,
Stefan Monnier <=
- [elpa] 222/299: New variable to pass options to the TeX processor., Stefan Monnier, 2014/11/01
- [elpa] 224/299: Fix selection of default environment in LaTeX-environment., Stefan Monnier, 2014/11/01
- [elpa] 225/299: Fix minor documentation bug., Stefan Monnier, 2014/11/01
- [elpa] 229/299: Advice instead of fset + redefine., Stefan Monnier, 2014/11/01
- [elpa] 228/299: Squash a byte-compiler warning., Stefan Monnier, 2014/11/01
- [elpa] 226/299: Improve defaults for filling., Stefan Monnier, 2014/11/01
- [elpa] 230/299: Fix bug causing endless package queries., Stefan Monnier, 2014/11/01
- [elpa] 232/299: Fix some FIXMEs., Stefan Monnier, 2014/11/01
- [elpa] 223/299: Prompt for packages inside LaTeX-env-document., Stefan Monnier, 2014/11/01
- [elpa] 233/299: Prevent an infinite loop in TeX-command-expand., Stefan Monnier, 2014/11/01