emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 249/299: Backport from ELPA repository.


From: Stefan Monnier
Subject: [elpa] 249/299: Backport from ELPA repository.
Date: Sun, 02 Nov 2014 03:11:46 +0000

monnier pushed a commit to branch externals/auctex
in repository elpa.

commit a262726e254417918cb14a22ef4a6edd690d4562
Author: Tassilo Horn <address@hidden>
Date:   Fri May 23 09:16:58 2014 +0200

    Backport from ELPA repository.
    
    * tex-site.el (TeX-modes-set): Use advice-add if available.
    * font-latex.el (font-latex-make-sectioning-faces): Don't rely on
    dynamic scoping for `num'.
    (font-latex-make-built-in-keywords): Don't use `eval' needlessly.
    (font-latex-doctex-syntactic-keywords): Declare before first use.
    (font-latex-match-command-with-arguments):
    Stay away from `add-to-list' on let-bound variables.
    (font-latex-match-command-in-braces): Remove unused var `end'.
---
 ChangeLog      |   12 ++++++++++++
 font-latex.el  |   27 +++++++++++++--------------
 tex-site.el.in |   34 ++++++++++++++++++++--------------
 3 files changed, 45 insertions(+), 28 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index adbc04c..c873968 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2014-05-23  Stefan Monnier  <address@hidden>
+
+       Backport from ELPA repository.
+       * tex-site.el (TeX-modes-set): Use advice-add if available.
+       * font-latex.el (font-latex-make-sectioning-faces): Don't rely on
+       dynamic scoping for `num'.
+       (font-latex-make-built-in-keywords): Don't use `eval' needlessly.
+       (font-latex-doctex-syntactic-keywords): Declare before first use.
+       (font-latex-match-command-with-arguments):
+       Stay away from `add-to-list' on let-bound variables.
+       (font-latex-match-command-in-braces): Remove unused var `end'.
+
 2014-05-20  Mos´┐Ż Giordano  <address@hidden>
 
        * tex-buf.el: Update copyright years.
diff --git a/font-latex.el b/font-latex.el
index f2ad1f9..217d302 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -261,7 +261,7 @@ Emacs."
 
 Probably you don't want to customize this face directly.  Better
 change the base face `font-latex-sectioning-5-face' or customize the
-variable `font-latex-fontify-sectioning'." num)
+variable `font-latex-fontify-sectioning'." ',num)
          :group 'font-latex-highlighting-faces))
       (when (and (featurep 'xemacs)
                 ;; Do not touch customized  faces.
@@ -587,8 +587,8 @@ This is an internal variable which should not be set 
directly.
 Use `font-latex-add-keywords' instead.
 
 Generated by `font-latex-make-built-in-keywords'.")))
-      (eval `(make-variable-buffer-local
-             ',(intern (concat prefix name "-keywords-local"))))
+      (make-variable-buffer-local
+       (intern (concat prefix name "-keywords-local")))
 
       ;; defun font-latex-match-*-make
       ;; Note: The functions are byte-compiled at the end of font-latex.el.
@@ -606,8 +606,8 @@ Generated by `font-latex-make-built-in-keywords'.")
                 (dolist (elt keywords)
                   (let ((keyword (if (listp elt) (car elt) elt)))
                     (if (string-match "^[A-Za-z]" keyword)
-                        (add-to-list 'multi-char-macros keyword)
-                      (add-to-list 'single-char-macros keyword))))
+                        (push keyword multi-char-macros)
+                      (push keyword single-char-macros))))
                 (when (or multi-char-macros single-char-macros)
                   (setq ,(intern (concat prefix name))
                         (concat
@@ -652,8 +652,7 @@ Generated by `font-latex-make-built-in-keywords'.")
       ;; defvar font-latex-match-*
       (eval `(defvar ,(intern (concat prefix name))
               ,(intern (concat prefix name "-keywords"))))
-      (eval `(make-variable-buffer-local
-             ',(intern (concat prefix name))))
+      (make-variable-buffer-local (intern (concat prefix name)))
 
       ;; defun font-latex-match-*
       (font-latex-make-match-defun prefix name face type)
@@ -879,6 +878,9 @@ The car is used for subscript, the cdr is used for 
superscripts."
 The form should be the same as in `font-lock-syntactic-keywords'.")
 (make-variable-buffer-local 'font-latex-syntactic-keywords-extra)
 
+;; Set and updated in `font-latex-set-syntactic-keywords'.
+(defvar font-latex-doctex-syntactic-keywords nil)
+
 (defun font-latex-set-syntactic-keywords ()
   "Set the variable `font-latex-syntactic-keywords'.
 This function can be used to refresh the variable in case other
@@ -1452,13 +1454,13 @@ Returns nil if none of KEYWORDS is found."
                                          (match-beginning 0))
        (let* ((beg (match-beginning 0))
               end                 ; Used for multiline text property.
-              match-data match-beg syntax-error alternative spec
+              (match-data (list beg))
+              match-beg syntax-error alternative spec
               error-indicator-pos
               (spec-list (string-to-list
                           (or (cadr (assoc (match-string 1) keywords))
                               font-latex-command-with-args-default-spec)))
               (parse-sexp-ignore-comments t)) ; scan-sexps ignores comments
-         (add-to-list 'match-data beg)
          (goto-char (match-end 0))
          ;; Check for starred macro if first spec is an asterisk.
          (when (eq (car spec-list) ?*)
@@ -1466,7 +1468,7 @@ Returns nil if none of KEYWORDS is found."
            (skip-chars-forward "*" (1+ (point))))
          ;; Add current point to match data and use keyword face for
          ;; region from start to point.
-         (add-to-list 'match-data (point) t)
+         (nconc match-data (list (point)))
          (add-to-list 'font-latex-matched-faces 'font-lock-keyword-face)
          (setq end (point))
          (catch 'break
@@ -1572,7 +1574,7 @@ Returns nil if no command is found."
                                          (match-beginning 0))
        (let ((kbeg (match-beginning 0)) (kend (match-end 1))
              (beg  (match-end 0))
-             end cbeg cend
+             cbeg cend
              (parse-sexp-ignore-comments t)) ; scan-sexps ignores comments
          (goto-char kbeg)
          (if (not (eq (preceding-char) ?\{))
@@ -1927,9 +1929,6 @@ END marks boundaries for searching for quotation ends."
   (append font-latex-keywords-2
          '(("^%<[^>]*>" (0 font-latex-doctex-preprocessor-face t)))))
 
-;; Set and updated in `font-latex-set-syntactic-keywords'.
-(defvar font-latex-doctex-syntactic-keywords nil)
-
 ;; Copy and adaptation of `doctex-font-lock-^^A' in `tex-mode.el' of
 ;; CVS Emacs (March 2004)
 (defun font-latex-doctex-^^A ()
diff --git a/tex-site.el.in b/tex-site.el.in
index 3c43aae..8937315 100644
--- a/tex-site.el.in
+++ b/tex-site.el.in
@@ -116,13 +116,18 @@ definition."
   (let ((list TeX-mode-alist) elt)
     (while list
       (setq elt (car (pop list)))
-      (when (or update (null (get elt 'tex-saved)))
-       (when (fboundp elt)
-         (put elt 'tex-saved (symbol-function elt))))
-      (defalias elt
-       (if (memq elt value)
-           (intern (concat "TeX-" (symbol-name elt)))
-         (get elt 'tex-saved))))))
+      (let ((dst (intern (concat "TeX-" (symbol-name elt)))))
+        (if (fboundp 'advice-add)
+            (if (memq elt value)
+                (advice-add elt :override dst)
+              (advice-remove elt dst))
+          (when (or update (null (get elt 'tex-saved)))
+            (when (fboundp elt)
+              (put elt 'tex-saved (symbol-function elt))))
+          (defalias elt
+            (if (memq elt value)
+                dst
+              (get elt 'tex-saved))))))))
 
 (defcustom TeX-modes
   (mapcar 'car TeX-mode-alist)
@@ -134,13 +139,14 @@ set it with `TeX-modes-set'."
              (mapcar (lambda(x) (list 'const (car x))) TeX-mode-alist))
   :set 'TeX-modes-set
   :group 'AUCTeX
-  :initialize (lambda (var value)
-               (custom-initialize-reset var value)
-               (let ((list TeX-mode-alist))
-                 (while list
-                   (eval-after-load (cdar list)
-                     `(TeX-modes-set ',var ,var t))
-                   (setq list (cdr list))))))
+  :initialize(lambda (var value)
+              (custom-initialize-reset var value)
+              (unless (fboundp 'advice-add)
+                (let ((list TeX-mode-alist))
+                  (while list
+                    (eval-after-load (cdar list)
+                      `(TeX-modes-set ',var ,var t))
+                    (setq list (cdr list)))))) )
 
 (defconst AUCTeX-version "@AUCTEXVERSION@"
     "AUCTeX version.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]