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

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

[elpa] externals/auctex 3909e4c 06/36: Several changes suggested by byte


From: Stefan Monnier
Subject: [elpa] externals/auctex 3909e4c 06/36: Several changes suggested by byte-compiler warnings.
Date: Fri, 28 Nov 2014 17:25:40 +0000

branch: externals/auctex
commit 3909e4c2c21330218648415a87c1d3983dfbc2a5
Author: Stefan Monnier <address@hidden>
Date:   Tue Nov 4 08:59:29 2014 +0100

    Several changes suggested by byte-compiler warnings.
    
    * toolbar-x.el: Adjust copyright years.
    (require): Require cl at compile-time.
    (toolbarx-good-option-list-p): Use pushnew instead of add-to-list.
    
    * tex.el (url-unreserved-chars): Declare to silence byte-compiler.
    (TeX-tree-expand): Use pushnew instead of add-to-list.  Iterate
    path-list in reversed order.
    (TeX-style-path): Use mapc instead of mapcar for side-effects.
    (TeX-file-extensions, BibTeX-file-extensions)
    (TeX-Biber-file-extensions): Declare to silence byte-compiler.
    (TeX-tree-roots): Use pushnew instead of add-to-list.
    (TeX-search-files-by-type): Use setq/pushnew instead of
    dolist/add-to-list.
    (TeX-doc): Use pushnew instead of add-to-list.
    
    * tex-info.el (require): Require cl at compile-time.
    (Texinfo-insert-node): Use pushnew instead of add-to-list.
    (reftex-section-levels-all, reftex-level-indent)
    (reftex-label-menu-flags, reftex-tables-dirty): Always
    forward-declare (not only at compile-time).
    (when): declare-function only at compile-time.
    
    * tex-fold.el: Adjust copyright years.
    (require): Require cl at compile-time.
    (TeX-fold-region-macro-or-env, TeX-fold-update-at-point): Use
    pushnew instead of add-to-list.
    (TeX-fold-hide-item): Use setq instead of add-to-list.
    
    * tex-buf.el (font-lock-mode-enable-list)
    (font-lock-auto-fontify, font-lock-defaults-alist): Declare vars
    to silence byte-compiler.
    
    * multi-prompt.el: Adjust copyright years.
    (multi-prompt): Don't let-bind unused var done.
    (multi-prompt-next-must-match): Use minibuffer-completion-table
    instead of dynamically bound table.
    
    * latex.el (require): Require cl at compile-time.
    (title, name, level, done-mark, toc): Declare dynamic vars.
    (LaTeX-env-document, TeX-arg-index-tag, TeX-arg-document)
    (LaTeX-arg-usepackage, TeX-arg-verb, ): Rename unused arg.
    (LaTeX-listify-package-options): Use setq instead of add-to-list
    to add to local var.
    (reftex-ref-macro-prompt, TeX-arg-item-label-p)
    (TeX-arg-right-insert-p): Declare to silence byte-compiler.
    (LaTeX-indent-line): Use pushnew instead of add-to-list.
    (LaTeX-fill-move-to-break-point): Don't let-bind unused math-sep.
    (LaTeX-section-enable-symbol): Downcase arg.
    (LaTeX-indent-tabular): Use mapc instead of mapcar for
    side-effects.
    
    * context.el (done-mark, reference, title, name, level): Declare
    dynamic vars without global nil value.
    (ConTeXt-section): let-bind reference.  Remove binding of unused
    var toc.
    (ConTeXt-numbered-section-hook, ConTeXt-unnumbered-section-hook):
    Improve docstring.
    (ConTeXt-find-matching-stop): Don't let-bind pos.
    (ConTeXt-optional-argument-insert)
    (ConTeXt-required-argument-insert, ConTeXt-indent-line): Rename
    unused arg.
    (ConTeXt-mode-common-initialization): Use fboundp to check if
    make-local-hook is defined.
    
    * bib-cite.el: Expand copyright years.
    (bib-cite-is-XEmacs): Remove.
    (bib-cite-minor-mode, bib-cite-setup-highlight-mouse-keymap)
    (bib-etags, bib-highlight-mouse, bib-toggle-highlight)
    (bib-etags-find-noselect): Check for XEmacs with featurep.
    (bib-cite-setup-mouse-function): Rename unused arg.
    (bib-apropos): Use mapc instead of mapcar for side effects.
    (bib-cite-fontify-help-xemacs): Define only on XEmacs.
    (bib-cite-fontify-help-as-bibtex, bib-cite-fontify-help-as-latex):
    Check for XEmacs with featurep.  Fix fontification code.
    (bib-display-this-ref): Use point-min instead of 1.
    (TeX-auto-save, TeX-auto-update, TeX-auto-regexp-list): Declare to
    silence the byte-compiler.
    
    Signed-off-by: Tassilo Horn <address@hidden>
---
 ChangeLog       |   80 +++++++++++++++++++++++++++++++++++++++++++++++++++
 bib-cite.el     |   86 ++++++++++++++++++++++++++++--------------------------
 context.el      |   45 +++++++++++++++-------------
 latex.el        |   48 ++++++++++++++++++++----------
 multi-prompt.el |    7 ++--
 tex-buf.el      |    4 ++
 tex-fold.el     |   13 +++++---
 tex-info.el     |   25 +++++++++-------
 tex.el          |   56 ++++++++++++++++++++++-------------
 toolbar-x.el    |    7 ++--
 10 files changed, 249 insertions(+), 122 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9c12ab3..fa10208 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,83 @@
+2014-11-04  Stefan Monnier  <address@hidden>
+
+       * toolbar-x.el: Adjust copyright years.
+       (require): Require cl at compile-time.
+       (toolbarx-good-option-list-p): Use pushnew instead of add-to-list.
+
+       * tex.el (url-unreserved-chars): Declare to silence byte-compiler.
+       (TeX-tree-expand): Use pushnew instead of add-to-list.  Iterate
+       path-list in reversed order.
+       (TeX-style-path): Use mapc instead of mapcar for side-effects.
+       (TeX-file-extensions, BibTeX-file-extensions)
+       (TeX-Biber-file-extensions): Declare to silence byte-compiler.
+       (TeX-tree-roots): Use pushnew instead of add-to-list.
+       (TeX-search-files-by-type): Use setq/pushnew instead of
+       dolist/add-to-list.
+       (TeX-doc): Use pushnew instead of add-to-list.
+
+       * tex-info.el (require): Require cl at compile-time.
+       (Texinfo-insert-node): Use pushnew instead of add-to-list.
+       (reftex-section-levels-all, reftex-level-indent)
+       (reftex-label-menu-flags, reftex-tables-dirty): Always
+       forward-declare (not only at compile-time).
+       (when): declare-function only at compile-time.
+
+       * tex-fold.el: Adjust copyright years.
+       (require): Require cl at compile-time.
+       (TeX-fold-region-macro-or-env, TeX-fold-update-at-point): Use
+       pushnew instead of add-to-list.
+       (TeX-fold-hide-item): Use setq instead of add-to-list.
+
+       * tex-buf.el (font-lock-mode-enable-list)
+       (font-lock-auto-fontify, font-lock-defaults-alist): Declare vars
+       to silence byte-compiler.
+
+       * multi-prompt.el: Adjust copyright years.
+       (multi-prompt): Don't let-bind unused var done.
+       (multi-prompt-next-must-match): Use minibuffer-completion-table
+       instead of dynamically bound table.
+
+       * latex.el (require): Require cl at compile-time.
+       (title, name, level, done-mark, toc): Declare dynamic vars.
+       (LaTeX-env-document, TeX-arg-index-tag, TeX-arg-document)
+       (LaTeX-arg-usepackage, TeX-arg-verb, ): Rename unused arg.
+       (LaTeX-listify-package-options): Use setq instead of add-to-list
+       to add to local var.
+       (reftex-ref-macro-prompt, TeX-arg-item-label-p)
+       (TeX-arg-right-insert-p): Declare to silence byte-compiler.
+       (LaTeX-indent-line): Use pushnew instead of add-to-list.
+       (LaTeX-fill-move-to-break-point): Don't let-bind unused math-sep.
+       (LaTeX-section-enable-symbol): Downcase arg.
+       (LaTeX-indent-tabular): Use mapc instead of mapcar for
+       side-effects.
+
+       * context.el (done-mark, reference, title, name, level): Declare
+       dynamic vars without global nil value.
+       (ConTeXt-section): let-bind reference.  Remove binding of unused
+       var toc.
+       (ConTeXt-numbered-section-hook, ConTeXt-unnumbered-section-hook):
+       Improve docstring.
+       (ConTeXt-find-matching-stop): Don't let-bind pos.
+       (ConTeXt-optional-argument-insert)
+       (ConTeXt-required-argument-insert, ConTeXt-indent-line): Rename
+       unused arg.
+       (ConTeXt-mode-common-initialization): Use fboundp to check if
+       make-local-hook is defined.
+
+       * bib-cite.el: Expand copyright years.
+       (bib-cite-is-XEmacs): Remove.
+       (bib-cite-minor-mode, bib-cite-setup-highlight-mouse-keymap)
+       (bib-etags, bib-highlight-mouse, bib-toggle-highlight)
+       (bib-etags-find-noselect): Check for XEmacs with featurep.
+       (bib-cite-setup-mouse-function): Rename unused arg.
+       (bib-apropos): Use mapc instead of mapcar for side effects.
+       (bib-cite-fontify-help-xemacs): Define only on XEmacs.
+       (bib-cite-fontify-help-as-bibtex, bib-cite-fontify-help-as-latex):
+       Check for XEmacs with featurep.  Fix fontification code.
+       (bib-display-this-ref): Use point-min instead of 1.
+       (TeX-auto-save, TeX-auto-update, TeX-auto-regexp-list): Declare to
+       silence the byte-compiler.
+
 2014-11-03  Arash Esbati  <address@hidden>
 
        * style/zlmtt.el: New file.
diff --git a/bib-cite.el b/bib-cite.el
index 612641c..da074d2 100644
--- a/bib-cite.el
+++ b/bib-cite.el
@@ -1,7 +1,7 @@
 ;;; bib-cite.el --- test
 ;; bib-cite.el - Display \cite, \ref or \label / Extract refs from BiBTeX file.
 
-;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2003, 2004, 2005
+;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2003, 2004, 2005, 
2014
 ;; Free Software Foundation
 
 ;; Author:    Peter S. Galbraith <address@hidden>
@@ -724,9 +724,6 @@ These are usually month abbreviations (or journals) defined 
in a style file."
   "*Regular expression for \\ref LaTeX commands that have a matching \\label.
 A opening curly bracket is appended to the regexp.")
 
-(defvar bib-cite-is-XEmacs
-  (not (null (save-match-data (string-match "XEmacs\\|Lucid" emacs-version)))))
-
 (defvar bib-cite-minor-mode nil)
 
 (defvar bib-highlight-mouse-keymap (make-sparse-keymap)
@@ -762,11 +759,11 @@ runs bib-find, and [mouse-3] runs bib-display."
        (progn
          (bib-cite-setup-highlight-mouse-keymap)
          (bib-highlight-mouse)
-         (when bib-cite-is-XEmacs
+         (when (featurep 'xemacs)
            (make-local-hook 'after-change-functions))
          (add-hook 'after-change-functions
                    'bib-cite-setup-mouse-function nil t)))
-    (if bib-cite-is-XEmacs
+    (if (featurep 'xemacs)
        (progn
          (or (local-variable-p 'current-menubar (current-buffer))
              (set-buffer-menubar current-menubar))
@@ -775,7 +772,7 @@ runs bib-find, and [mouse-3] runs bib-display."
    ;;;Undo the minor-mode
     ;; mouse overlay
     (cond
-     (bib-cite-is-XEmacs
+     ((featurep 'xemacs)
       (while bib-ext-list
        (delete-extent (car bib-ext-list))
        (setq bib-ext-list (cdr bib-ext-list))))
@@ -786,7 +783,7 @@ runs bib-find, and [mouse-3] runs bib-display."
        ;; FIXME Hope no other package is using them in this buffer!
        (remove-text-properties (point-min) (point-max)
                                '(mouse-face t local-map t)))))
-    (if bib-cite-is-XEmacs
+    (if (featurep 'xemacs)
        (delete-menu-item '("BCite"))))))
 
 ;;This must be eval'ed when the LaTeX mode is in use.
@@ -803,7 +800,7 @@ runs bib-find, and [mouse-3] runs bib-display."
    ;;;        display the bib-cite stuff (or a subset of it).
        (let ((m (copy-keymap (current-local-map))))
          (cond
-          (bib-cite-is-XEmacs
+          ((featurep 'xemacs)
            (set-keymap-name m 'bib-highlight-mouse-keymap)
            (cond
             ;;action-key stuff from Vladimir Alexiev <address@hidden>
@@ -849,7 +846,7 @@ runs bib-find, and [mouse-3] runs bib-display."
   "Unconditionally turn on Bib Cite mode."
   (bib-cite-minor-mode 1))
 
-(defun bib-cite-setup-mouse-function (beg end old-len)
+(defun bib-cite-setup-mouse-function (beg end _old-len)
   (save-excursion
     (save-match-data
       (save-restriction
@@ -893,7 +890,7 @@ runs bib-find, and [mouse-3] runs bib-display."
 
 ;;; Add a menu entry to bibtex.el (Perhaps I should not do this).
 (cond
- ((and (string-match "XEmacs\\|Lucid" emacs-version)
+ ((and (featurep 'xemacs)
        (or window-system
           (fboundp 'smart-menu)))      ;text menus by Bob Weiner
   ;;
@@ -927,7 +924,7 @@ runs bib-find, and [mouse-3] runs bib-display."
     (add-hook 'bibtex-mode-hook 'bib-cite-bibtex-mode-hook))
   )
 
- ((and (not (string-match "XEmacs\\|Lucid" emacs-version))
+ ((and (not (featurep 'xemacs))
        (string-equal "19" (substring emacs-version 0 2))
        (or window-system
           (fboundp 'tmm-menubar)))     ; 19.30 - Will autoload if necessary
@@ -1160,7 +1157,7 @@ by using bib-apropos sequentially."
       (if (not the-text)
          (message "Sorry, no matches found.")
        (with-output-to-temp-buffer "*Help*"
-         (mapcar 'princ (nreverse the-text)))
+         (mapc #'princ (nreverse the-text)))
        (bib-cite-fontify-help-as-bibtex)
        (if bib-novice
            (message
@@ -1236,18 +1233,19 @@ to create a bibtex file containing only the references 
used in the document."
       (put-text-property (point-min)(or limit (point-max))
                         'face 'red-bold))))
 
-(defun bib-cite-fontify-help-xemacs (defaults)
-  (if (fboundp 'font-lock-set-defaults-1) ; >= XEmcas 19.14
-      (progn
-       (set-buffer "*Help*")
-       (setq font-lock-defaults-computed nil
-             font-lock-keywords nil)
-       (font-lock-set-defaults-1
-        (and defaults (font-lock-find-font-lock-defaults defaults)))
-       (font-lock-fontify-buffer)
-       (setq font-lock-defaults-computed nil
-             font-lock-keywords nil)
-       (font-lock-set-defaults-1))))
+(when (featurep 'xemacs)
+  (defun bib-cite-fontify-help-xemacs (defaults)
+    (if (fboundp 'font-lock-set-defaults-1) ; >= XEmacs 19.14
+        (progn
+          (set-buffer "*Help*")
+          (setq font-lock-defaults-computed nil
+                font-lock-keywords nil)
+          (font-lock-set-defaults-1
+           (and defaults (font-lock-find-font-lock-defaults defaults)))
+          (font-lock-fontify-buffer)
+          (setq font-lock-defaults-computed nil
+                font-lock-keywords nil)
+          (font-lock-set-defaults-1)))))
 
 (defun bib-cite-fontify-help-as-bibtex ()
   (save-excursion
@@ -1255,7 +1253,7 @@ to create a bibtex file containing only the references 
used in the document."
      ((not (featurep 'font-lock))
       nil)                              ;No font-lock! Stop here.
      ;; font-lock under Emacs and XEmacs
-     ((string-match "XEmacs\\|Lucid" emacs-version)
+     ((featurep 'xemacs)
       ;; XEmacs
       (bib-cite-fontify-help-xemacs 'bibtex-mode))
      (t
@@ -1264,9 +1262,10 @@ to create a bibtex file containing only the references 
used in the document."
       (let ((font-lock-defaults
             '(bib-cite-bibtex-font-lock-keywords
               nil t ((?$ . "\"")(?\" . ".")))))
-       (if font-lock-mode
-           (font-lock-mode)
-         (if (fboundp 'font-lock-unset-defaults) (font-lock-unset-defaults))
+       (if (not font-lock-mode)
+           (font-lock-mode 1)
+         (if (fboundp 'font-lock-unset-defaults)
+             (font-lock-unset-defaults))
          (font-lock-unfontify-buffer))
        (font-lock-fontify-buffer))))))
 
@@ -1276,7 +1275,7 @@ to create a bibtex file containing only the references 
used in the document."
      ((not (featurep 'font-lock))
       nil)                              ;No font-lock! Stop here.
      ;; font-lock under Emacs and XEmacs
-     ((string-match "XEmacs\\|Lucid" emacs-version)
+     ((featurep 'xemacs)
       ;; XEmacs, not necessary to do s.th. special for font-latex, we do *not*
       ;; want the buffer-local faces!
       (bib-cite-fontify-help-xemacs 'latex-mode))
@@ -1298,9 +1297,10 @@ to create a bibtex file containing only the references 
used in the document."
                   (font-lock-comment-start-regexp . "%")
                   (font-lock-mark-block-function . mark-paragraph))
               '(tex-font-lock-keywords nil nil ((?$ . "\""))))))
-       (if font-lock-mode
-           (font-lock-mode)
-         (if (fboundp 'font-lock-unset-defaults) (font-lock-unset-defaults))
+       (if (not font-lock-mode)
+           (font-lock-mode 1)
+         (if (fboundp 'font-lock-unset-defaults)
+             (font-lock-unset-defaults))
          (font-lock-unfontify-buffer))
        (font-lock-fontify-buffer))))))
 
@@ -1347,7 +1347,7 @@ See variables bib-etags-command and bib-etags-filename"
     ;;  tags-file-name set.
     ;;  To get around this.  I'm setting this variable in the TAGS buffer.
     ;; Skip this in XEmacs (Changed by Anders Stenman)
-    (if (and (not (string-match "XEmacs\\|Lucid" emacs-version))
+    (if (and (not (featurep 'xemacs))
             (get-file-buffer the-tags-file))
        (with-current-buffer (get-file-buffer the-tags-file)
          (set (make-local-variable 'tags-file-name) the-tags-file))))
@@ -1390,7 +1390,7 @@ See variables bib-etags-command and bib-etags-filename"
       ;; * peta Wed Nov  8 16:27:29 1995 -- better remove the mouse face
       ;;   properties first.
       (setq bib-ext-list nil)          ;Reconstructed below...
-      (if (string-match "XEmacs\\|Lucid" emacs-version)
+      (if (featurep 'xemacs)
          (while local-extent-list
            (setq extent (car local-extent-list))
            (if (or (extent-detached-p extent)
@@ -1415,7 +1415,7 @@ See variables bib-etags-command and bib-etags-filename"
        (setq s (match-beginning 0))
        (setq e (match-end 0))
        (cond
-        ((string-match "XEmacs\\|Lucid" emacs-version)
+        ((featurep 'xemacs)
          (setq extent (make-extent s e))
          (setq bib-ext-list (cons extent bib-ext-list))
          (set-extent-property extent 'highlight t)
@@ -1448,7 +1448,7 @@ See variables bib-etags-command and bib-etags-filename"
     (let ((modified (buffer-modified-p))
          (inhibit-read-only t))
       (cond
-       ((string-match "XEmacs\\|Lucid" emacs-version)
+       ((featurep 'xemacs)
        (while bib-ext-list
          (delete-extent (car bib-ext-list))
          (setq bib-ext-list (cdr bib-ext-list))))
@@ -1726,7 +1726,7 @@ If within a multi-file document (in auctex only)
     (if (looking-at "\n")  ;Remove first empty line...
        (delete-char 1))
     (with-output-to-temp-buffer "*Help*"
-      (princ (buffer-substring 1 (point-max))))
+      (princ (buffer-substring (point-min) (point-max))))
     (bib-cite-fontify-help-as-latex)
     (kill-buffer "*BiBTemp*"))
    (t
@@ -2307,7 +2307,7 @@ Makes sure TAGS file exists, etc."
     ;; find-tag-noselect should set the TAGS file for the new buffer
     ;; that's what C-h f visit-tags-table says...
     (cond
-     ((string-match "XEmacs\\|Lucid" emacs-version)
+     ((featurep 'xemacs)
       (find-tag tag)
       (setq new-buffer (current-buffer))
       (set-buffer the-buffer))
@@ -2420,6 +2420,10 @@ although BiBTeX doesn't allow it!"
            (setq doNext nil)))
        (mapcar 'list the-list)))))
 
+(defvar TeX-auto-save)
+(defvar TeX-auto-update)
+(defvar TeX-auto-regexp-list)
+
 ;; BibTeX-mode key def to create AUCTeX's parsing file.
 (defun bib-create-auto-file ()
   "Force the creation of the AUCTeX auto file for a bibtex buffer."
@@ -2427,8 +2431,8 @@ although BiBTeX doesn't allow it!"
   (if (not (require 'latex))
       (error "Sorry, This is only useful if you have AUCTeX"))
   (let ((TeX-auto-save t)
-       (TeX-auto-update t)
-       (TeX-auto-regexp-list BibTeX-auto-regexp-list))
+        (TeX-auto-update t)
+        (TeX-auto-regexp-list BibTeX-auto-regexp-list))
     ;; TeX-auto-write
     ;; -> calls TeX-auto-store
     ;;    -> calls TeX-auto-parse
diff --git a/context.el b/context.el
index b9ce2c0..f871c6b 100644
--- a/context.el
+++ b/context.el
@@ -64,16 +64,19 @@
 
 ;;; variables
 
-;; globals used in certain macro's.
-(defvar done-mark nil
-  "Position of point afterwards, default nil (meaning end).")
+;; Dynamically scoped vars used in certain macro's.
+;; BEWARE: We used to give them a global nil value, but this can mess up poor
+;; unrelated packages using those same vars but expecting them to be
+;; lexically scoped.
+;; So don't give them a global value, which makes sure the effect of `defvar'
+;; localized to this file!
+(defvar done-mark)     ;Position of point afterwards, default nil (meaning end)
 
-(defvar reference nil
-  "Set by `ConTeXt-section-ref', used by `ConTeXt-section-section'.")
-
-(defvar title nil
-  "Set by `ConTeXt-section-title', used by `ConTeXt-section-section'.")
+(defvar reference);Used by `ConTeXt-section-ref' and `ConTeXt-section-section'.
 
+(defvar title); Used by `ConTeXt-section-title' and `ConTeXt-section-section'.
+(defvar name)
+(defvar level)
 
 ;; others
 
@@ -302,8 +305,8 @@ The following variables can be set to customize:
                       (ConTeXt-up-section (- val)))
                      (t val)))
         (name (ConTeXt-numbered-section-name level))
-        (toc nil)
         (title "")
+         (reference nil)
         (done-mark (make-marker)))
     (newline)
     (run-hooks 'ConTeXt-numbered-section-hook)
@@ -410,9 +413,9 @@ section."
 
 The following variables are set before the hooks are run
 
-level - numeric section level, see the documentation of `ConTeXt-section'.
-name - name of the sectioning command, derived from `level'.
-title - The title of the section, default to an empty string.
+`level' - numeric section level, see the documentation of `ConTeXt-section'.
+`name' - name of the sectioning command, derived from `level'.
+`title' - The title of the section, default to an empty string.
 `done-mark' - Position of point afterwards, default nil (meaning end).
 
 The following standard hook exist -
@@ -451,13 +454,14 @@ in your .emacs file."
     ConTeXt-section-title
     ConTeXt-section-ref
     ConTeXt-section-section)
+  ;; FIXME: I can't see where this variable is used!
   "List of hooks to run when a new section is inserted.
 
 The following variables are set before the hooks are run
 
-level - numeric section level, see the documentation of `ConTeXt-section'.
-name - name of the sectioning command, derived from `level'.
-title - The title of the section, default to an empty string.
+`level' - numeric section level, see the documentation of `ConTeXt-section'.
+`name' - name of the sectioning command, derived from `level'.
+`title' - The title of the section, default to an empty string.
 `done-mark' - Position of point afterwards, default nil (meaning end).
 
 The following standard hook exist -
@@ -856,8 +860,7 @@ If INNER is non-nil, go to the point just past before
                        (ConTeXt-environment-stop-name)
                        "\\)"
                        ))
-       (level 1)
-       (pos))
+       (level 1))
     ;;jump over the \start... when at the beginning of it.
     (when (looking-at (concat (regexp-quote TeX-esc)
                              (ConTeXt-environment-start-name)))
@@ -935,13 +938,13 @@ If INNER is non-nil, go to the point just past the 
\\start... macro."
 
 ;;; Macro Argument Hooks
 
-(defun ConTeXt-optional-argument-insert (arg &optional prefix)
+(defun ConTeXt-optional-argument-insert (arg &optional _prefix)
   "Insert ARG surrounded by square brackets."
   (insert ConTeXt-optop)
   (insert arg)
   (insert ConTeXt-optcl))
 
-(defun ConTeXt-required-argument-insert (arg &optional prefix)
+(defun ConTeXt-required-argument-insert (arg &optional _prefix)
   "Insert ARG surrounded by curly braces."
   (insert TeX-grop)
   (insert arg)
@@ -1150,7 +1153,7 @@ An optional fourth (or sixth) element means always 
replace if t."
   (modify-syntax-entry ?\( "." ConTeXt-indent-syntax-table)
   (modify-syntax-entry ?\) "." ConTeXt-indent-syntax-table))
 
-(defun ConTeXt-indent-line (&optional arg)
+(defun ConTeXt-indent-line (&optional _arg)
   (with-syntax-table ConTeXt-indent-syntax-table
     ;; TODO: Rather than ignore $, we should try to be more clever about it.
     (let ((indent
@@ -1696,7 +1699,7 @@ i.e. you do _not_ have to cater for this yourself by 
adding \\\\' or $."
   (easy-menu-add ConTeXt-mode-command-menu ConTeXt-mode-map)
   (setq ConTeXt-menu-changed t)
 
-  (if (= emacs-major-version 20)
+  (if (fboundp 'make-local-hook)
       (make-local-hook 'activate-menubar-hook))
   (add-hook 'activate-menubar-hook 'ConTeXt-menu-update nil t)
 
diff --git a/latex.el b/latex.el
index af1c676..d89c793 100644
--- a/latex.el
+++ b/latex.el
@@ -28,6 +28,7 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'cl))       ;FIXME: Use cl-lib.
 (require 'tex)
 (require 'tex-style)
 
@@ -106,6 +107,13 @@ This depends on `LaTeX-insert-into-comments'."
 
 ;;; Sections
 
+;; Declare dynamically scoped vars.
+(defvar title)
+(defvar name)
+(defvar level)
+(defvar done-mark)
+(defvar toc)
+
 (defun LaTeX-section (arg)
   "Insert a template for a LaTeX section.
 Determine the type of section to be inserted, by the argument ARG.
@@ -791,7 +799,7 @@ work analogously."
 
 To insert a hook here, you must insert it in the appropiate style file.")
 
-(defun LaTeX-env-document (&optional ignore)
+(defun LaTeX-env-document (&optional _ignore)
   "Create new LaTeX document.
 Also inserts a \\documentclass macro if there's none already and
 prompts for the insertion of \\usepackage macros.
@@ -1169,6 +1177,8 @@ You may use `LaTeX-item-list' to change the routines used 
to insert the item."
       (TeX-insert-macro "item"))
     (indent-according-to-mode)))
 
+(defvar TeX-arg-item-label-p)
+
 (defun LaTeX-item-argument ()
   "Insert a new item with an optional argument."
   (let ((TeX-arg-item-label-p t))
@@ -1478,8 +1488,10 @@ The input string may include LaTeX comments and 
newlines."
                           (point))))
         ;; Add entry to output.
         ((or (string= match ",") (= (point) (point-max)))
-         (add-to-list 'opts (buffer-substring-no-properties
-                             start (1- (point))) t)
+          (let ((entry (buffer-substring-no-properties
+                        start (1- (point)))))
+            (unless (member entry opts)
+              (setq opts (append opts (list entry)))))
          (setq start (point)))
         ;; Get rid of comments.
         ((string= match "%")
@@ -1710,6 +1722,8 @@ list of defined labels."
        (LaTeX-add-labels label))
     (TeX-argument-insert label optional optional)))
 
+(defvar reftex-ref-macro-prompt)
+
 (defun TeX-arg-ref (optional &optional prompt definition)
   "Let-bind `reftex-ref-macro-prompt' to nil and pass arguments
 to `TeX-arg-label'.
@@ -1719,7 +1733,7 @@ arguments: OPTIONAL, PROMPT, and DEFINITION."
   (let ((reftex-ref-macro-prompt nil))
     (TeX-arg-label optional prompt definition)))
 
-(defun TeX-arg-index-tag (optional &optional prompt &rest args)
+(defun TeX-arg-index-tag (optional &optional prompt &rest _args)
   "Prompt for an index tag.
 This is the name of an index, not the entry.
 
@@ -1951,7 +1965,7 @@ May be reset with `\\[universal-argument] 
\\[TeX-normal-mode]'.")
 
 To insert a hook here, you must insert it in the appropiate style file.")
 
-(defun TeX-arg-document (optional &optional ignore)
+(defun TeX-arg-document (optional &optional _ignore)
   "Insert arguments to documentclass.
 OPTIONAL and IGNORE are ignored."
   (let* ((TeX-file-extensions '("cls"))
@@ -2066,7 +2080,7 @@ of the options, nil otherwise."
   (insert TeX-grop (mapconcat 'identity packages ",") TeX-grcl)
   (run-hooks 'LaTeX-after-usepackage-hook))
 
-(defun LaTeX-arg-usepackage (optional)
+(defun LaTeX-arg-usepackage (_optional)
   "Insert arguments to usepackage.
 OPTIONAL is ignored."
   (let* ((packages-options (LaTeX-arg-usepackage-read-packages-with-options))
@@ -2313,7 +2327,7 @@ the list of defined pagestyles."
   :group 'LaTeX-macro
   :type 'character)
 
-(defun TeX-arg-verb (optional &optional ignore)
+(defun TeX-arg-verb (optional &optional _ignore)
   "Prompt for delimiter and text.
 If OPTIONAL is non-nil, insert the resulting value as an optional
 argument, otherwise as a mandatory one.  IGNORE is ignored."
@@ -2461,6 +2475,8 @@ OPTIONAL is ignored."
        (LaTeX-insert-corresponding-right-macro-and-brace
         left-macro left-brace optional)))))
 
+(defvar TeX-arg-right-insert-p)
+
 (defun LaTeX-insert-left-brace (arg)
   "Insert typed left brace ARG times and possibly a correspondig right brace.
 Automatic right brace insertion is done only if no prefix ARG is given and
@@ -2940,7 +2956,8 @@ Lines starting with an item is given an extra indentation 
of
     ;; the 'invisible property.
     (dolist (ol overlays)
       (when (extent-property ol 'invisible)
-       (add-to-list 'ol-specs (list ol (extent-property ol 'invisible)))
+        (pushnew (list ol (extent-property ol 'invisible))
+                 ol-specs :test #'equal)
        (set-extent-property ol 'invisible nil)))
     (save-excursion
       (cond ((and fill-prefix
@@ -3716,8 +3733,7 @@ space does not end a sentence, so don't break a line 
there."
   (when LaTeX-fill-break-at-separators
     (let ((orig-breakpoint (point))
          (final-breakpoint (point))
-         start-point
-         math-sep)
+         start-point)
       (save-excursion
        (beginning-of-line)
        (LaTeX-back-to-indentation)
@@ -5262,9 +5278,9 @@ environmens."
   "Create an entry for the change environment menu."
   (vector (car entry) (list 'LaTeX-modify-environment (car entry)) t))
 
-(defun LaTeX-section-enable-symbol (LEVEL)
+(defun LaTeX-section-enable-symbol (level)
   "Symbol used to enable section LEVEL in the menu bar."
-  (intern (concat "LaTeX-section-" (int-to-string (nth 1 entry)) "-enable")))
+  (intern (concat "LaTeX-section-" (int-to-string level) "-enable")))
 
 (defun LaTeX-section-enable (entry)
   "Enable or disable section ENTRY from `LaTeX-section-list'."
@@ -6298,10 +6314,10 @@ i.e. you do _not_ have to cater for this yourself by 
adding \\\\' or $."
          (format "\\\\end{%s}"
                  (regexp-opt
                   (let (out)
-                    (mapcar (lambda (x)
-                              (when (eq (cadr x) 'LaTeX-indent-tabular)
-                                (push (car x) out)))
-                            LaTeX-indent-environment-list)
+                    (mapc (lambda (x)
+                             (when (eq (cadr x) 'LaTeX-indent-tabular)
+                               (push (car x) out)))
+                           LaTeX-indent-environment-list)
                     out)))))
      (cond ((looking-at tabular-like-end-regex)
            beg-col)
diff --git a/multi-prompt.el b/multi-prompt.el
index 25ba4c9..ed88d15 100644
--- a/multi-prompt.el
+++ b/multi-prompt.el
@@ -1,6 +1,6 @@
 ;;; multi-prompt.el --- Completing read of multiple strings
 
-;; Copyright (C) 1996, 1997, 2000, 2009 Free Software Foundation
+;; Copyright (C) 1996, 1997, 2000, 2009, 2014 Free Software Foundation
 
 ;; Author: Per Abrahamsen <address@hidden>
 ;; Maintainer: address@hidden
@@ -62,7 +62,6 @@ are the arguments to `completing-read'.  See that."
     (let* ((minibuffer-local-completion-map new-map)
           (minibuffer-local-must-match-map new-map)
           (multi-prompt-found nil)
-          (done nil)
           (filter (cond (unique
                          (lambda (x)
                            (and (not (member (car x) multi-prompt-found))
@@ -119,8 +118,8 @@ are the arguments to `completing-read'.  See that."
   (interactive)
   (when  (call-interactively 'minibuffer-complete)
     (let ((content (buffer-substring-no-properties (point-min) (point-max))))
-      (when (or (not require-match)
-               (assoc content table))
+      (when (or ;; (not require-match)
+                (assoc content minibuffer-completion-table))
        (throw 'multi-prompt-next content)))))
 
 
diff --git a/tex-buf.el b/tex-buf.el
index a3538ba..b6a3a31 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -1383,6 +1383,10 @@ The hooks are run in the region buffer, you may use the 
variable
            pos (+ pos 8))))
   file)
 
+(defvar font-lock-mode-enable-list)
+(defvar font-lock-auto-fontify)
+(defvar font-lock-defaults-alist)
+
 (defun TeX-region-create (file region original offset)
   "Create a new file named FILE with the string REGION.
 The region is taken from ORIGINAL starting at line OFFSET.
diff --git a/tex-fold.el b/tex-fold.el
index 05bd61a..af1191f 100644
--- a/tex-fold.el
+++ b/tex-fold.el
@@ -1,6 +1,6 @@
 ;;; tex-fold.el --- Fold TeX macros.
 
-;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011-2012
+;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011-2012, 2014
 ;;   Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <address@hidden>
@@ -44,6 +44,8 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'cl))
+
 (when (featurep 'xemacs)
   (require 'overlay))
 (require 'tex)
@@ -334,8 +336,8 @@ for macros and 'math for math macros."
                          ((eq type 'math) TeX-fold-math-spec-list-internal)
                          (t TeX-fold-macro-spec-list-internal)))
        (dolist (i (cadr item))
-         (add-to-list 'fold-list (list i (car item)))
-         (add-to-list 'item-list i)))
+          (pushnew (list i (car item)) fold-list :test #'equal)
+         (pushnew i item-list :test #'equal)))
       (when item-list
        (setq regexp (cond ((and (eq type 'env)
                                 (eq major-mode 'context-mode))
@@ -708,7 +710,7 @@ breaks will be replaced by spaces."
     (dolist (ov (overlays-at (point)))
       (when (and (eq (overlay-get ov 'category) 'TeX-fold)
                 (numberp (overlay-get ov 'TeX-fold-display-string-spec)))
-       (add-to-list 'overlays ov)))
+       (pushnew ov overlays)))
     (when overlays
       ;; Sort list according to descending starts.
       (setq overlays (sort (copy-sequence overlays)
@@ -808,7 +810,8 @@ That means, put respective properties onto overlay OV."
                           (n 1))
                       (while (setq arg (TeX-fold-macro-nth-arg
                                         n ov-start ov-end))
-                        (add-to-list 'arg-list (car arg) t)
+                         (unless (member (car arg) arg-list)
+                           (setq arg-list (append arg-list (list (car arg)))))
                         (setq n (1+ n)))
                       (or (condition-case nil
                               (apply spec arg-list)
diff --git a/tex-info.el b/tex-info.el
index 83e0081..5027800 100644
--- a/tex-info.el
+++ b/tex-info.el
@@ -25,6 +25,8 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'cl))
+
 (require 'tex)
 
 (require 'texinfo)
@@ -305,10 +307,10 @@ for @node."
       (goto-char (point-min))
       (while (re-search-forward "address@hidden" nil t)
        (skip-chars-forward " \t")
-       (add-to-list 'nodes
-                    (list (buffer-substring-no-properties
+       (pushnew (list (buffer-substring-no-properties
                            (point) (progn (skip-chars-forward "^,")
-                                          (point)))))))
+                                          (point))))
+                 nodes :test #'equal)))
     (unless active-mark
       (setq node-name (read-string "Node name: ")))
     ;; FIXME: What if key binding for `minibuffer-complete' was changed?
@@ -344,12 +346,12 @@ for @node."
 
 ;; Silence the byte-compiler from warnings for variables and functions declared
 ;; in reftex.
-(eval-when-compile
-  (defvar reftex-section-levels-all)
-  (defvar reftex-level-indent)
-  (defvar reftex-label-menu-flags)
-  (defvar reftex-tables-dirty)
+(defvar reftex-section-levels-all)
+(defvar reftex-level-indent)
+(defvar reftex-label-menu-flags)
+(defvar reftex-tables-dirty)
 
+(eval-when-compile
   (when (fboundp 'declare-function)
     (declare-function reftex-match-string "reftex" (n))
     (declare-function reftex-section-number "reftex-parse" (&optional level 
star))
@@ -604,9 +606,10 @@ value of `Texinfo-mode-hook'."
   (set (make-local-variable 'TeX-font-replace-function) 
'TeX-font-replace-macro)
   (set (make-local-variable 'TeX-style-hook-dialect) :texinfo)
 
-  (add-hook 'find-file-hooks (lambda ()
-                              (unless (file-exists-p (buffer-file-name))
-                                (TeX-master-file nil nil t))) nil t)
+  (add-hook 'find-file-hook (lambda ()
+                              (unless (file-exists-p (buffer-file-name))
+                                (TeX-master-file nil nil t)))
+            nil t)
 
   (when (and (boundp 'add-log-current-defun-function)
             (fboundp 'texinfo-current-defun-name))
diff --git a/tex.el b/tex.el
index a675ab0..cd764eb 100644
--- a/tex.el
+++ b/tex.el
@@ -1092,6 +1092,8 @@ search are checked, too."
                                               (cdr (caar (cdr elem)))))
                                           spec))))))))
 
+(defvar url-unreserved-chars)
+
 (defun TeX-evince-sync-view ()
   "Focus the focused page/paragraph in Evince with the position
 of point in emacs by using Evince's DBUS API.  Used by default
@@ -2274,6 +2276,9 @@ This is done calling `kpsewhich --expand-path' for each 
variable.
 PROGRAM is passed as the parameter for --progname.  SUBDIRS are
 subdirectories which are appended to the directories of the TeX
 trees.  Only existing directories are returned."
+  ;; FIXME: The GNU convention only uses "path" to mean "list of directories"
+  ;; and uses "filename" for the name of a file even if it contains possibly
+  ;; several elements separated by "/".
   (let (path-list path exit-status input-dir-list)
     (condition-case nil
        (dolist (var vars)
@@ -2284,9 +2289,9 @@ trees.  Only existing directories are returned."
                                          "--progname" program
                                          "--expand-path" var))))
          (when (zerop exit-status)
-           (add-to-list 'path-list path t)))
+            (pushnew path path-list :test #'equal)))
       (error nil))
-    (dolist (elt path-list)
+    (dolist (elt (nreverse path-list))
       (let ((separators (if (string-match "^[A-Za-z]:" elt)
                            "[\n\r;]"
                          "[\n\r:]")))
@@ -2298,11 +2303,11 @@ trees.  Only existing directories are returned."
              (dolist (subdir subdirs)
                (setq path (file-name-as-directory (concat item subdir)))
                (when (file-exists-p path)
-                 (add-to-list 'input-dir-list path t)))
+                  (pushnew path input-dir-list :test #'equal)))
            (setq path (file-name-as-directory item))
            (when (file-exists-p path)
-             (add-to-list 'input-dir-list path t))))))
-    input-dir-list))
+             (pushnew path input-dir-list :test #'equal))))))
+    (nreverse input-dir-list)))
 
 (defun TeX-macro-global ()
   "Return directories containing the site's TeX macro and style files."
@@ -2358,10 +2363,10 @@ These correspond to the personal TeX macros."
   (let ((path))
     ;; Put directories in an order where the more local files can
     ;; override the more global ones.
-    (mapcar (lambda (file) (when file (add-to-list 'path file t)))
-           (append (list TeX-auto-global TeX-style-global)
-                   TeX-auto-private TeX-style-private
-                   (list TeX-auto-local TeX-style-local)))
+    (mapc (lambda (file) (when file (add-to-list 'path file t)))
+          (append (list TeX-auto-global TeX-style-global)
+                  TeX-auto-private TeX-style-private
+                  (list TeX-auto-local TeX-style-local)))
     path)
   "List of directories to search for AUCTeX style files.
 Per default the list is built from the values of the variables
@@ -2614,7 +2619,7 @@ See variable `TeX-style-hook-dialect' for supported 
dialects."
                                            (TeX-master-directory))
                        style (substring style
                                         (match-beginning 2) (match-end 2))))
-               (condition-case err
+               (condition-case nil
                    (mapcar (lambda (hook)
                              (cond
                               ((functionp hook)
@@ -3557,6 +3562,10 @@ directory hierarchy, t means recurse indefinitely."
                 (const :tag "Off" nil)
                 (integer :tag "Depth" :value 1)))
 
+(defvar TeX-file-extensions)
+(defvar BibTeX-file-extensions)
+(defvar TeX-Biber-file-extensions)
+
 ;;;###autoload
 (defun TeX-auto-generate (tex auto)
   "Generate style file for TEX and store it in AUTO.
@@ -4008,10 +4017,11 @@ EXTENSIONS defaults to `TeX-file-extensions'."
   "Return a list of available TeX tree roots."
   (let (list)
     (dolist (dir (TeX-tree-expand '("$TEXMFHOME" "$TEXMFMAIN" "$TEXMFLOCAL"
-                                   "$TEXMFDIST") "latex"))
+                                   "$TEXMFDIST")
+                                  "latex"))
       (when (file-readable-p dir)
-       (add-to-list 'list dir t)))
-    list))
+        (pushnew dir list :test #'equal)))
+    (nreverse list)))
 
 (defcustom TeX-tree-roots (TeX-tree-roots)
   "List of all available TeX tree root directories."
@@ -4173,19 +4183,23 @@ If optional argument STRIP is non-nil, remove file 
extension."
            (if (null TeX-tree-roots)
                (error "No TeX trees available; configure `TeX-tree-roots'")
              ;; Expand variables.
-             (dolist (rawdir rawdirs)
-               (if (symbolp rawdir)
-                   (setq expdirs (append expdirs (eval rawdir)))
-                 (add-to-list 'expdirs rawdir t)))
-             (delete-dups expdirs)
+              (setq expdirs
+                    (delete-dups
+                     (apply #'append
+                            (mapcar (lambda (rawdir)
+                                      (if (symbolp rawdir)
+                                          (symbol-value rawdir)
+                                        (list rawdir)))
+                                    rawdirs))))
              ;; Assumption: Either all paths are absolute or all are relative.
              (if (file-name-absolute-p (car expdirs))
                  (setq dirs expdirs)
                ;; Append relative TDS subdirs to all TeX tree roots.
                (dolist (root TeX-tree-roots)
                  (dolist (dir expdirs)
-                   (add-to-list 'dirs (concat (file-name-as-directory root)
-                                              dir) t)))))
+                    (let ((dir (expand-file-name dir root)))
+                      (unless (member dir dirs)
+                        (setq dirs (append dirs (list dir)))))))))
            (append local-files (TeX-search-files dirs exts nodir strip)))))))
 
 ;;; Narrowing
@@ -5900,7 +5914,7 @@ NAME may be a package, a command, or a document."
       (when (memq major-mode (nth 1 elt))
        (let ((completions (funcall (nth 2 elt))))
          (unless (null completions)
-           (add-to-list 'docs (cons completions (nth 0 elt)))))))
+            (pushnew (cons completions (nth 0 elt)) docs :test #'equal)))))
     (if (null docs)
        (progn
          (if (executable-find "texdoc")
diff --git a/toolbar-x.el b/toolbar-x.el
index ef4edc8..8f50656 100644
--- a/toolbar-x.el
+++ b/toolbar-x.el
@@ -1,6 +1,6 @@
 ;;; toolbar-x.el --- fancy toolbar handling in Emacs and XEmacs
 
-;; Copyright (C) 2004, 2005, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2005, 2008, 2014 Free Software Foundation, Inc.
 
 ;; This program is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU General Public License as
@@ -106,6 +106,8 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'cl))
+
 ;; Note that this just gives a useful default.  Icons are expected to
 ;; be in subdirectory "images" or "toolbar" relative to the load-path.
 ;; Packages loading toolbarx are advised to explicitly add their own
@@ -177,8 +179,7 @@ different.  OPTION-LIST equal to nil is a good option list."
     (dotimes (i n)
       (when (> i 0)
        (setq temp-opt-list (cddr temp-opt-list)))
-      (add-to-list 'list-diff
-                  (car temp-opt-list))
+      (pushnew (car temp-opt-list) list-diff :test #'equal)
       (setq elt-in-valid (and elt-in-valid
                              (memq (car temp-opt-list)
                                    valid-options))))



reply via email to

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