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

commit 04927d01a3dfd8b0886d1070abe8e11e925f0e4e
Author: Mosè Giordano <giordano.m...@libero.it>
Date:   Sat Jun 29 11:59:43 2013 +0200

    Silence some compilation warnings.
    
    * bib-cite.el: Replace `save-excursion'+`set-buffer' with
    `with-current-buffer'.
    
    * tex-bar.el: Ditto.
    
    * tex-buf.el: Ditto.
    
    * tex.el: Replace `save-excursion'+`set-buffer' with
    `with-current-buffer'.  Delete trailing whitespaces.
---
 ChangeLog   |   10 ++++++++++
 bib-cite.el |   35 +++++++++++++----------------------
 tex-bar.el  |    6 ++----
 tex-buf.el  |   23 ++++++++---------------
 tex.el      |   28 +++++++++++++---------------
 5 files changed, 46 insertions(+), 56 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1c4befa..7a52e8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2013-06-29  Mos� Giordano  <giordano.m...@libero.it>
 
+       * bib-cite.el: Replace `save-excursion'+`set-buffer' with
+       `with-current-buffer'.
+
+       * tex-bar.el: Ditto.
+
+       * tex-buf.el: Ditto.
+
+       * tex.el: Replace `save-excursion'+`set-buffer' with
+       `with-current-buffer'.  Delete trailing whitespaces.
+
        * tex-buf.el (TeX-error-file): Fix spelling error.
        (TeX-error): Ditto.
 
diff --git a/bib-cite.el b/bib-cite.el
index afd7aa2..ad6f166 100644
--- a/bib-cite.el
+++ b/bib-cite.el
@@ -1144,8 +1144,7 @@ by using bib-apropos sequentially."
                            (not (string-equal "*Help*" (buffer-name)))))
         (bib-buffer (or (and new-buffer-f (bib-get-bibliography nil))
                         (current-buffer))))
-    (save-excursion
-      (set-buffer bib-buffer)
+    (with-current-buffer bib-buffer
       (goto-char (point-min))
       (while (and (re-search-forward "^[ \t]*@" nil t)
                  (re-search-forward keyword nil t))
@@ -1232,8 +1231,7 @@ to create a bibtex file containing only the references 
used in the document."
       (progn
        (copy-face 'bold 'red-bold)
        (set-face-foreground 'red-bold "red")))
-  (save-excursion
-    (set-buffer "*Help*")
+  (with-current-buffer "*Help*"
     (let ((before-change-functions) (after-change-functions))
       (put-text-property (point-min)(or limit (point-max))
                         'face 'red-bold))))
@@ -1332,8 +1330,7 @@ See variables bib-etags-command and bib-etags-filename"
        (concat bib-etags-append-command the-tags-file " " the-file))
       (setq the-file-list (cdr the-file-list)))
     (if the-tags-buffer                 ;buffer existed; we must refresh it.
-       (save-excursion
-         (set-buffer the-tags-buffer)
+       (with-current-buffer the-tags-buffer
          (revert-buffer t t)))
 
     ;; Check value of tags-file-name against the-tags-file
@@ -1352,8 +1349,7 @@ See variables bib-etags-command and bib-etags-filename"
     ;; Skip this in XEmacs (Changed by Anders Stenman)
     (if (and (not (string-match "XEmacs\\|Lucid" emacs-version))
             (get-file-buffer the-tags-file))
-       (save-excursion
-         (set-buffer (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))))
 
 
@@ -2186,8 +2182,7 @@ Sets global variable bib-document-TeX-files-warnings."
          (kill-buffer tex-buffer)
          (error
           "Sorry, but this is not a multi-file document (Try C-u C-c C-n if 
using auctex)")))
-    (save-excursion
-      (set-buffer tex-buffer)
+    (with-current-buffer tex-buffer
       ;; set its directory so relative includes work without expanding
       (setq default-directory dir)
       (insert-file-contents masterfile)
@@ -2237,8 +2232,7 @@ Sets global variable 
bib-document-citekeys-obarray-warnings."
                         master-aux master-tex)))
       (let ((work-buffer (get-buffer-create "*bib-cite-work*"))
            (keys-obarray (make-vector 201 0)))
-       (save-excursion
-         (set-buffer work-buffer)
+       (with-current-buffer work-buffer
          (insert-file-contents master-aux)
          ;; Because we will be looking for \input statements, we need to set
          ;; the default directory to that of the master file.
@@ -2353,10 +2347,9 @@ accents embeded in bibtex entries."
        ;; Path is relative to the master directory
        (default-directory (bib-master-directory))
        (the-name)(the-warnings)(the-file))
-    (save-excursion
+    (with-current-buffer bib-buffer
       ;; such that forward-sexp works with embeeded \" in german,
       ;; and unbalanced ()
-      (set-buffer bib-buffer)
       (erase-buffer)
       (set-syntax-table text-mode-syntax-table)
 ;;      (if (boundp 'bibtex-mode-syntax-table)
@@ -2385,14 +2378,12 @@ accents embeded in bibtex entries."
                (and (boundp 'TeX-check-path)
                     (psg-checkfor-file-list the-name TeX-check-path))))
       (if the-file
-         (progn
-           (save-excursion
-             (set-buffer bib-buffer)
-             (goto-char (point-max))
-             (if include-filenames-f
-                 (insert "%%%Filename: " the-file "\n"))
-             (insert-file-contents the-file nil)
-             (goto-char 1)))
+         (with-current-buffer bib-buffer
+           (goto-char (point-max))
+           (if include-filenames-f
+               (insert "%%%Filename: " the-file "\n"))
+           (insert-file-contents the-file nil)
+           (goto-char 1))
        (setq the-warnings
              (concat the-warnings "Could not read file: " the-name "\n"))))
     (if the-warnings
diff --git a/tex-bar.el b/tex-bar.el
index 28fafda..aaa9301 100644
--- a/tex-bar.el
+++ b/tex-bar.el
@@ -137,8 +137,7 @@ alists, see variable `TeX-bar-TeX-all-button-alists'."
                                       assqs-button-alists)))
     (setq assqs-button-alists (nreverse assqs-button-alists))
     ;; displaying results
-    (save-excursion
-      (set-buffer (get-buffer-create "*TeX tool bar buttons*"))
+    (with-current-buffer (get-buffer-create "*TeX tool bar buttons*")
       (erase-buffer)
       (insert "Available buttons for TeX mode
 ================================")
@@ -284,8 +283,7 @@ alists, see variable `TeX-bar-LaTeX-all-button-alists'."
                                       assqs-button-alists)))
     (setq assqs-button-alists (nreverse assqs-button-alists))
     ;; displaying results
-    (save-excursion
-      (set-buffer (get-buffer-create "*TeX tool bar buttons*"))
+    (with-current-buffer (get-buffer-create "*TeX tool bar buttons*")
       (erase-buffer)
       (insert "Available buttons for LaTeX mode
 ================================")
diff --git a/tex-buf.el b/tex-buf.el
index fa65a00..e277d77 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -393,7 +393,7 @@ ORIGINALS which are modified but not saved yet."
                        (y-or-n-p (concat "Save file "
                                          (buffer-file-name buffer)
                                          "? ")))
-                   (save-excursion (set-buffer buffer) (save-buffer)))))))
+                   (with-current-buffer buffer (save-buffer)))))))
     (dolist (eo existingoriginals)
       (if (file-newer-than-file-p eo derived)
           (setq found t)))
@@ -503,8 +503,7 @@ QUEUE is non-nil when we are checking for the printer 
queue."
 (defun TeX-view-mouse (event)
   "Start `TeX-view' at mouse position."
   (interactive "e")
-  (save-excursion
-    (set-buffer (window-buffer (posn-window (event-start event))))
+  (with-current-buffer (window-buffer (posn-window (event-start event)))
     (goto-char (posn-point (event-start event)))
     (TeX-view)))
 
@@ -616,8 +615,7 @@ Return the new process."
   (let ((buffer (TeX-process-buffer-name file))
        (process (TeX-run-command name command file)))
     ;; Hook to TeX debuger.
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (TeX-parse-reset)
       (setq TeX-parse-function 'TeX-parse-TeX)
       (setq TeX-sentinel-function 'TeX-TeX-sentinel)
@@ -811,8 +809,7 @@ reasons.  Use `TeX-run-function' instead."
 (defun TeX-synchronous-sentinel (name file result)
   "Process TeX command output buffer after the process dies."
   (let ((buffer (TeX-process-buffer (file-name-nondirectory file))))
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
 
       ;; Append post-mortem information to the buffer
       (goto-char (point-max))
@@ -843,8 +840,7 @@ reasons.  Use `TeX-run-function' instead."
           (set-process-buffer process nil)
           (set-process-sentinel process nil))
          ((memq (process-status process) '(signal exit))
-          (save-excursion
-            (set-buffer buffer)
+          (with-current-buffer buffer
 
             ;; Append post-mortem information to the buffer
             (goto-char (point-max))
@@ -1091,8 +1087,7 @@ defined."
   (let ((buffer (TeX-process-buffer name)))
     (if (and buffer
             (local-variable-p symbol buffer))
-       (save-excursion
-         (set-buffer buffer)
+       (with-current-buffer buffer
          (symbol-value symbol))
       default)))
 
@@ -1101,8 +1096,7 @@ defined."
 Return nil iff no process buffer exist."
   (let ((buffer (TeX-process-buffer name)))
     (if buffer
-       (save-excursion
-         (set-buffer buffer)
+       (with-current-buffer buffer
          (set symbol value)
          t)
       nil)))
@@ -1374,8 +1368,7 @@ original file."
     (setq original (TeX-quote-filename (file-relative-name
                                        original (TeX-master-directory)))
          master-name (TeX-quote-filename master-name))
-    (save-excursion
-      (set-buffer file-buffer)
+    (with-current-buffer file-buffer
       (setq buffer-undo-list t)
       (setq original-content (buffer-string))
       (erase-buffer)
diff --git a/tex.el b/tex.el
index 19da9bf..7e717b7 100644
--- a/tex.el
+++ b/tex.el
@@ -144,7 +144,7 @@ If nil, none is specified."
     ("File" "%(o?)dvips %d -o %f " TeX-run-command t t
      :help "Generate PostScript file")
     ("Index" "makeindex %s" TeX-run-command nil t :help "Create index file")
-    ("Xindy" "texindy %s" TeX-run-command nil t 
+    ("Xindy" "texindy %s" TeX-run-command nil t
      :help "Run xindy to create index file")
     ("Check" "lacheck %s" TeX-run-compile nil (latex-mode)
      :help "Check LaTeX file for correctness")
@@ -712,7 +712,7 @@ If POS is nil, use current buffer location."
 
   (defun TeX-read-string (prompt &optional initial-input history default-value)
     (read-string prompt initial-input history default-value t))
-  
+
   (defun TeX-mark-active ()
     ;; In FSF 19 mark-active indicates if mark is active.
     mark-active)
@@ -1758,7 +1758,7 @@ already established, don't do anything."
     (unless (local-variable-p 'TeX-PDF-mode (current-buffer))
       (TeX-PDF-mode (if arg 1 0))
       (setq TeX-PDF-mode-parsed t))))
-  
+
 (defun TeX-PDF-mode-on ()
   "Use only from parsing routines."
   (TeX-PDF-mode-parsed t))
@@ -1882,7 +1882,7 @@ output files."
        (when (or (not TeX-clean-confirm)
                  (condition-case nil
                      (dired-mark-pop-up " *Deletions*" 'delete
-                                        (if (> (length files) 1) 
+                                        (if (> (length files) 1)
                                             files
                                           (cons t files))
                                         'y-or-n-p "Delete files? ")
@@ -3001,7 +3001,7 @@ The algorithm is as follows:
   (setq ispell-parser 'tex)
   (make-local-variable 'ispell-tex-p)
   (setq ispell-tex-p t)
-  
+
   ;; Redefine some standard variables
   (make-local-variable 'paragraph-start)
   (make-local-variable 'paragraph-separate)
@@ -3322,9 +3322,8 @@ If TEX is a directory, generate style files for all files 
in the directory."
                                   (append TeX-file-extensions
                                           BibTeX-file-extensions
                                           TeX-Biber-file-extensions)))
-        (save-excursion
-          (set-buffer (let (enable-local-eval)
-                        (find-file-noselect tex)))
+        (with-current-buffer (let (enable-local-eval)
+                               (find-file-noselect tex))
           (message "Parsing %s..." tex)
           (TeX-auto-store (concat (file-name-as-directory auto)
                                   (TeX-strip-extension tex
@@ -3358,8 +3357,7 @@ If TEX is a directory, generate style files for all files 
in the directory."
            (pkg-opts (if (boundp 'LaTeX-provided-package-options)
                          LaTeX-provided-package-options)))
        (TeX-unload-style style)
-       (save-excursion
-         (set-buffer (generate-new-buffer file))
+       (with-current-buffer (generate-new-buffer file)
          (erase-buffer)
          (insert "(TeX-add-style-hook\n \""
                  style "\"\n (lambda ()")
@@ -4192,7 +4190,7 @@ Brace insertion is only done if point is in a math 
construct and
     (define-key map "\C-c?"    'TeX-doc)
     (define-key map "\C-c\C-i" 'TeX-goto-info-page)
     (define-key map "\r"       'TeX-newline)
-    
+
     ;; From tex.el
     (define-key map "\""       'TeX-insert-quote)
     (define-key map "$"        'TeX-insert-dollar)
@@ -4206,14 +4204,14 @@ Brace insertion is only done if point is in a math 
construct and
     (define-key map "^"        'TeX-insert-sub-or-superscript)
     (define-key map "_"        'TeX-insert-sub-or-superscript)
     (define-key map "\e\t"     'TeX-complete-symbol) ;*** Emacs 19 way
-    
+
     (define-key map "\C-c'"    'TeX-comment-or-uncomment-paragraph) ;*** Old 
way
     (define-key map "\C-c:"    'TeX-comment-or-uncomment-region) ;*** Old way
     (define-key map "\C-c\""   'TeX-uncomment) ;*** Old way
-    
+
     (define-key map "\C-c;"    'TeX-comment-or-uncomment-region)
     (define-key map "\C-c%"    'TeX-comment-or-uncomment-paragraph)
-    
+
     (define-key map "\C-c\C-t\C-p"   'TeX-PDF-mode)
     (define-key map "\C-c\C-t\C-i"   'TeX-interactive-mode)
     (define-key map "\C-c\C-t\C-s"   'TeX-source-correlate-mode)
@@ -5686,7 +5684,7 @@ NAME may be a package, a command, or a document."
        (regexp (concat "\\`\\("
                        (mapconcat (lambda (dir)
                                     (regexp-quote
-                                     (expand-file-name 
+                                     (expand-file-name
                                       (file-name-as-directory dir))))
                                   (append (when (file-name-directory name)
                                             (list (file-name-directory name)))

Reply via email to