auctex-devel
[Top][All Lists]
Advanced

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

[AUCTeX-devel] Another patch to silence some warnings


From: Stefan Monnier
Subject: [AUCTeX-devel] Another patch to silence some warnings
Date: Wed, 25 May 2016 20:51:14 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Here's another one.  There's still lots of warnings, and some of the
warnings left in the files I touched below seem serious (e.g. use of
custom-buffer-done-function which seems to be a variable that doesn't
exist).


        Stefan


diff --git a/context.el b/context.el
index b962e0d..25151e5 100644
--- a/context.el
+++ b/context.el
@@ -495,6 +495,14 @@ in your .emacs file."
     ConTeXt-section-ref
     ConTeXt-section-section))
 
+;; Define before first use.
+(defcustom ConTeXt-Mark-version "II"
+  "ConTeXt Mark version used for running ConTeXt."
+  :type "string"
+  :group 'TeX-command)
+(make-variable-buffer-local 'ConTeXt-Mark-version)
+(put 'ConTeXt-Mark-version 'safe-local-variable 'stringp)
+
 (defun ConTeXt-numbered-section-heading ()
   "Hook to prompt for ConTeXt section name.
 Insert this hook into `ConTeXt-numbered-section-hook' to allow the user to 
change
@@ -1004,11 +1012,11 @@ If OPTIONAL, only insert it if not empty, and then use 
square brackets."
    "[][]\\|"  ; display math delimitors (is this applicable to ConTeXt??)
    (ConTeXt-environment-start-name) "\\|"
    (ConTeXt-environment-stop-name) "\\|"
-   (mapconcat 'car ConTeXt-numbered-section-list "\\b\\|") "\\b\\|"
-   (mapconcat 'car ConTeXt-unnumbered-section-list "\\b\\|") "\\b\\|"
-   (mapconcat 'identity ConTeXt-extra-paragraph-commands "\\b\\|")
+   (mapconcat #'car ConTeXt-numbered-section-list "\\b\\|") "\\b\\|"
+   (mapconcat #'car ConTeXt-unnumbered-section-list "\\b\\|") "\\b\\|"
+   (mapconcat #'identity ConTeXt-extra-paragraph-commands "\\b\\|")
    "\\b\\|"
-   (mapconcat 'identity ConTeXt-item-list "\\b\\|") "\\b\\)"))
+   (mapconcat #'identity ConTeXt-item-list "\\b\\|") "\\b\\)"))
 
 
 ;; Outline support
@@ -1028,14 +1036,14 @@ header is at the start of a line."
    "[ \t]*"
    (regexp-quote TeX-esc)
    "\\("
-   (mapconcat 'ConTeXt-environment-full-start-name ConTeXt-section-block-list 
"\\|") "\\|"
-   (mapconcat 'car ConTeXt-numbered-section-list "\\|")
-   (mapconcat 'car ConTeXt-unnumbered-section-list "\\|")
+   (mapconcat #'ConTeXt-environment-full-start-name ConTeXt-section-block-list 
"\\|") "\\|"
+   (mapconcat #'car ConTeXt-numbered-section-list "\\|")
+   (mapconcat #'car ConTeXt-unnumbered-section-list "\\|")
    "\\)\\b"
    (if TeX-outline-extra
        "\\|"
      "")
-   (mapconcat 'car TeX-outline-extra "\\|")
+   (mapconcat #'car TeX-outline-extra "\\|")
    "\\|" (ConTeXt-header-end) "\\b"
    "\\|" (ConTeXt-trailer-start) "\\b"))
 
@@ -1063,7 +1071,7 @@ header is at the start of a line."
   "Regular expression that matches a start of all environments mentioned in 
LIST."
   (concat
    "start\\("
-   (mapconcat 'identity list "\\|")
+   (mapconcat #'identity list "\\|")
    "\\)\\b"))
 
 ;; The top headings are \starttext, \startfrontmatter, \startbodymatter etc.
@@ -1533,55 +1541,55 @@ else.  There might be text before point."
        (TeX-update-style)
        (setq ConTeXt-menu-changed nil)
        (message "Updating section menu...")
-       (mapc 'ConTeXt-section-enable ConTeXt-section-list)
+       (mapc #'ConTeXt-section-enable ConTeXt-section-list)
        (message "Updating environment menu...")
        (easy-menu-change '("ConTeXt") ConTeXt-environment-menu-name
                          (LaTeX-split-long-menu
-                          (mapcar 'ConTeXt-environment-menu-entry
+                          (mapcar #'ConTeXt-environment-menu-entry
                                   (ConTeXt-environment-list))))
        (message "Updating modify environment menu...")
        (easy-menu-change '("ConTeXt") ConTeXt-environment-modify-menu-name
                          (LaTeX-split-long-menu
-                          (mapcar 'ConTeXt-environment-modify-menu-entry
+                          (mapcar #'ConTeXt-environment-modify-menu-entry
                                   (ConTeXt-environment-list))))
        (message "Updating define menu...")
        (easy-menu-change '("ConTeXt") ConTeXt-define-menu-name
                          (LaTeX-split-long-menu
-                          (mapcar 'ConTeXt-define-menu-entry
+                          (mapcar #'ConTeXt-define-menu-entry
                                   ConTeXt-define-list)))
        (message "Updating setup menu...")
        (easy-menu-change '("ConTeXt") ConTeXt-setup-menu-name
                          (LaTeX-split-long-menu
-                          (mapcar 'ConTeXt-setup-menu-entry
+                          (mapcar #'ConTeXt-setup-menu-entry
                                   ConTeXt-setup-list)))
        (message "Updating referencing menu...")
        (easy-menu-change '("ConTeXt") ConTeXt-referencing-menu-name
                          (LaTeX-split-long-menu
-                          (mapcar 'ConTeXt-referencing-menu-entry
+                          (mapcar #'ConTeXt-referencing-menu-entry
                                   ConTeXt-referencing-list)))
        (message "Updating other macro's menu...")
        (easy-menu-change '("ConTeXt") ConTeXt-other-macro-menu-name
                          (LaTeX-split-long-menu
-                          (mapcar 'ConTeXt-other-macro-menu-entry
+                          (mapcar #'ConTeXt-other-macro-menu-entry
                                   ConTeXt-other-macro-list)))
        (message "Updating project structure menu...")
        (easy-menu-change '("ConTeXt") ConTeXt-project-structure-menu-name
                          (LaTeX-split-long-menu
-                          (mapcar 'ConTeXt-project-structure-menu-entry
+                          (mapcar #'ConTeXt-project-structure-menu-entry
                                   ConTeXt-project-structure-list)))
        (message "Updating section block menu...")
        (easy-menu-change '("ConTeXt") ConTeXt-section-block-menu-name
                          (LaTeX-split-long-menu
-                          (mapcar 'ConTeXt-section-block-menu-entry
+                          (mapcar #'ConTeXt-section-block-menu-entry
                                   ConTeXt-section-block-list)))
        (message "Updating section menu...")
        (easy-menu-change '("ConTeXt") ConTeXt-numbered-section-menu-name
                          (LaTeX-split-long-menu
-                          (mapcar 'ConTeXt-numbered-section-menu-entry
+                          (mapcar #'ConTeXt-numbered-section-menu-entry
                                   ConTeXt-numbered-section-list)))
        (easy-menu-change '("ConTeXt") ConTeXt-unnumbered-section-menu-name
                          (LaTeX-split-long-menu
-                          (mapcar 'ConTeXt-unnumbered-section-menu-entry
+                          (mapcar #'ConTeXt-unnumbered-section-menu-entry
                                   ConTeXt-unnumbered-section-list)))
        (message "Updating...done")
        (and menu (easy-menu-return-item ConTeXt-mode-menu menu))
@@ -1589,13 +1597,6 @@ else.  There might be text before point."
 
 ;;; Option expander
 
-(defcustom ConTeXt-Mark-version "II"
-  "ConTeXt Mark version used for running ConTeXt."
-  :type "string"
-  :group 'TeX-command)
-(make-variable-buffer-local 'ConTeXt-Mark-version)
-(put 'ConTeXt-Mark-version 'safe-local-variable 'stringp)
-
 (defvar ConTeXt-texexec-option-nonstop "--nonstop "
   "Command line option for texexec to use nonstopmode.")
 
@@ -1708,7 +1709,7 @@ i.e. you do _not_ have to cater for this yourself by 
adding \\\\' or $."
                                              ConTeXt-current-interface)))))
 
   ;; Create certain regular expressions based on language
-  (setq ConTeXt-indent-item-re (concat "\\\\\\(" (mapconcat 'identity 
ConTeXt-item-list "\\|") "\\)\\>"))
+  (setq ConTeXt-indent-item-re (concat "\\\\\\(" (mapconcat #'identity 
ConTeXt-item-list "\\|") "\\)\\>"))
 
   ;; What's the deepest level at we can collapse a document?
   ;; set only if user has not set it. Need to be set before menu is created.
diff --git a/tex-buf.el b/tex-buf.el
index 0fe7b9d..db3c959 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -30,6 +30,7 @@
 
 (require 'tex)
 (require 'latex)
+(require 'comint)
 
 ;;; Customization:
 
@@ -907,7 +908,7 @@ region."
        (with-current-buffer region-buf
          (goto-char (point-min))
          (when (re-search-forward "!offset(\\(-?[0-9]+\\)")
-           (let ((offset (string-to-int (match-string 1))))
+           (let ((offset (string-to-number (match-string 1))))
              (goto-char (point-min))
              (forward-line (- current-line (1+ offset))))))))))
 
@@ -2096,7 +2097,8 @@ original file."
        (let ((line-col (with-current-buffer orig-buffer
                          (cons (line-number-at-pos)
                                (current-column)))))
-         (goto-line (abs (- header-offset (car line-col))))
+          (goto-char (point-min))
+          (forward-line (1- (abs (- header-offset (car line-col)))))
          (forward-char (cdr line-col)))
        (run-hooks 'TeX-region-hook)
        (if (string-equal (buffer-string) original-content)
@@ -3672,34 +3674,35 @@ forward, if negative)."
 
 ;;; Output mode
 
-(if (fboundp 'special-mode)
-    (progn
-      (defalias 'TeX-special-mode 'special-mode)
-      (defvaralias 'TeX-special-mode-map 'special-mode-map))
-  (defun TeX-special-mode ()
-    "Placeholder mode for Emacsen which don't have `special-mode'.")
-  (defvar TeX-special-mode-map
-    (let ((map (make-sparse-keymap)))
-      (suppress-keymap map)
-      (define-key map "q" (if (fboundp 'quit-window)
-                              'quit-window
-                            'bury-buffer))
-      (define-key map " " (if (fboundp 'scroll-up-command)
-                              'scroll-up-command
-                            'scroll-up))
-      (define-key map [backspace] (if (fboundp 'scroll-down-command)
-                                      'scroll-down-command
-                                    'scroll-down))
-      (define-key map "\C-?" (if (fboundp 'scroll-down-command)
-                                 'scroll-down-command
-                               'scroll-down))
-      (define-key map "?" 'describe-mode)
-      (define-key map "h" 'describe-mode)
-      (define-key map ">" 'end-of-buffer)
-      (define-key map "<" 'beginning-of-buffer)
-      (define-key map "g" 'revert-buffer)
-      map)
-    "Keymap for `TeX-special-mode-map'."))
+(defalias 'TeX-special-mode
+  (if (fboundp 'special-mode)
+      (progn
+        (defvaralias 'TeX-special-mode-map 'special-mode-map)
+        #'special-mode)
+    (defvar TeX-special-mode-map
+      (let ((map (make-sparse-keymap)))
+        (suppress-keymap map)
+        (define-key map "q" (if (fboundp 'quit-window)
+                                'quit-window
+                              'bury-buffer))
+        (define-key map " " (if (fboundp 'scroll-up-command)
+                                'scroll-up-command
+                              'scroll-up))
+        (define-key map [backspace] (if (fboundp 'scroll-down-command)
+                                        'scroll-down-command
+                                      'scroll-down))
+        (define-key map "\C-?" (if (fboundp 'scroll-down-command)
+                                   'scroll-down-command
+                                 'scroll-down))
+        (define-key map "?" 'describe-mode)
+        (define-key map "h" 'describe-mode)
+        (define-key map ">" 'end-of-buffer)
+        (define-key map "<" 'beginning-of-buffer)
+        (define-key map "g" 'revert-buffer)
+        map)
+      "Keymap for `TeX-special-mode-map'.")
+    (lambda ()
+      "Placeholder mode for Emacsen which don't have `special-mode'.")))
 
 (defvar TeX-output-mode-map
   (let ((map (make-sparse-keymap)))
diff --git a/tex-jp.el b/tex-jp.el
index 3771f44..53ebe47 100644
--- a/tex-jp.el
+++ b/tex-jp.el
@@ -33,6 +33,7 @@
 ;;; Code:
 
 (require 'latex)
+(require 'tex-buf)
 
 ;;; Customization
 
@@ -102,6 +103,13 @@ For detail, see `TeX-command-list', to which this list is 
appended."
                                     (const :tag "AmSTeX" ams-tex-mode)))
                        (repeat :tag "Menu elements" :inline t sexp))))
 
+
+;; Define before first use.
+(defvar japanese-TeX-mode nil
+  "Non-nil means the current buffer handles Japanese TeX/LaTeX.")
+(make-variable-buffer-local 'japanese-TeX-mode)
+(put 'japanese-TeX-mode 'permanent-local t)
+
 ;; $B=gD4$K9T$1$PITMW$K$J$k!#(B
 (setq TeX-command-list
       (append japanese-TeX-command-list
@@ -251,8 +259,6 @@ For detail, see `TeX-command-list', to which this list is 
appended."
   :group 'AUCTeX-jp
   :type 'boolean)
 
-(when (featurep 'mule)
-
 ;; FIX-ME (2007-02-09) The default coding system in recent Unix (like Fedora 
and
 ;; Ubuntu) is utf-8.  But Japanese TeX system does not support utf-8 yet
 ;; (platex-utf is under development, may be alpha phase).  So,
@@ -276,8 +282,6 @@ For detail, see `TeX-command-list', to which this list is 
appended."
   :group 'AUCTeX-jp
   :type 'coding-system)
 
-)
-
 ;; $B=gD4$K9T$1$PITMW$K$J$k!#(B
 (defcustom japanese-TeX-command-default "pTeX"
   "*The default command for `TeX-command' in the japanese-TeX mode."
@@ -322,16 +326,15 @@ For detail, see `TeX-command-list', to which this list is 
appended."
 
 ;;; Coding system
 
-(when (featurep 'mule)
-
 (defun japanese-TeX-set-process-coding-system (process)
   "Set proper coding system for japanese TeX PROCESS."
   (if (with-current-buffer TeX-command-buffer japanese-TeX-mode)
       (set-process-coding-system process
                                 TeX-japanese-process-output-coding-system
                                 TeX-japanese-process-input-coding-system)))
-(setq TeX-after-start-process-function
-      'japanese-TeX-set-process-coding-system)
+(when (featurep 'mule)
+  (setq TeX-after-start-process-function
+        #'japanese-TeX-set-process-coding-system))
 
 (defcustom japanese-TeX-use-kanji-opt-flag t
   "Add kanji option to Japanese pTeX family if non-nil."
@@ -381,15 +384,8 @@ For inappropriate encoding, nil instead."
       (japanese-TeX-coding-ejsu
        (default-value 'buffer-file-coding-system))))
 
-)
-
 ;;; Japanese TeX modes
 
-(defvar japanese-TeX-mode nil
-  "Non-nil means the current buffer handles Japanese TeX/LaTeX.")
-(make-variable-buffer-local 'japanese-TeX-mode)
-(put 'japanese-TeX-mode 'permanent-local t)
-
 ;;;###autoload
 (defun japanese-plain-tex-mode ()
   "Major mode in AUCTeX for editing Japanese plain TeX files.
@@ -482,13 +478,13 @@ Set `japanese-TeX-mode' to t, and enter `TeX-latex-mode'."
 
 (fset 'japanese-TeX-self-insert-command
       (cond ((fboundp 'can-n-egg-self-insert-command)
-            'can-n-egg-self-insert-command)
+            #'can-n-egg-self-insert-command)
            ((fboundp 'egg-self-insert-command)
-            'egg-self-insert-command)
+            #'egg-self-insert-command)
            ((fboundp 'canna-self-insert-command)
-            'canna-self-insert-command)
+            #'canna-self-insert-command)
            (t
-            'self-insert-command)))
+            #'self-insert-command)))
 
 (defun TeX-insert-punctuation ()
   "Insert point or comma, cleaning up preceding space."
diff --git a/tex-mik.el b/tex-mik.el
index 4197df5..9323406 100644
--- a/tex-mik.el
+++ b/tex-mik.el
@@ -1,6 +1,6 @@
 ;;; tex-mik.el --- MiKTeX support for AUCTeX.
 
-;; Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2001, 2004, 2016 Free Software Foundation, Inc.
 
 ;; Author: Per Abrahamsen <address@hidden>
 ;; Maintainer: address@hidden
@@ -29,6 +29,8 @@
 
 ;;; Code:
 
+(require 'tex)
+
   ;; Remove the Queue entry from the default, and make a non-Unix
   ;; specific print entry, assuming that we'll print via gsview32.
 (unless (get 'TeX-queue-command 'saved-value)
diff --git a/toolbar-x.el b/toolbar-x.el
index 8f50656..bac32c8 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, 2014 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2005, 2008, 2014, 2016 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
@@ -275,6 +275,11 @@ command, COMM is returned."
 ;; handle `menu titles' differently) meanwhile in XEmacs, menus are lists of
 ;; vectors
 
+(defmacro toolbarx--if-when-compile (test then else)
+  (declare (indent 1) (debug t))
+  (if (eval test) then else))
+
+(toolbarx--if-when-compile (not (featurep 'xemacs))
 (defun toolbarx-emacs-mount-popup-menu
   (strings var type &optional title save)
   "Return an interactive `lambda'-expression that shows a popup menu.
@@ -362,7 +367,8 @@ inside XEmacs. See documentation of that function for more."
     ;; warn if type is not `radio' ot `toggle'; use `radio' if incorrect.
     (unless (eq type real-type)
       (warn (concat "TYPE should be symbols `radio' or `toggle', "
-                   "but %s found; using `radio'") type))
+                   "but %s found; using `radio'")
+            type))
     ;; warn if save is not `nil', `offer' or `always'; use nil when incorrect
     (unless (eq save real-save)
       (setq real-save nil)
@@ -401,7 +407,7 @@ inside XEmacs. See documentation of that function for more."
     ;; returnung the lambda-expression
     `(lambda nil (interactive)
        (let ((popup-menu-titles ,(if title t nil)))
-        (popup-menu (quote ,menu))))))
+        (popup-menu (quote ,menu)))))))
 
 (defun toolbarx-mount-popup-menu (strings var type &optional title save)
   "Return a command that show a popup menu.
@@ -1138,9 +1144,10 @@ an extension.  If the extension is omitted, `xpm', `xbm' 
and
 This variable can store different values for the different buffers.")
 
 
+(toolbarx--if-when-compile (not (featurep 'xemacs))
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Second engine: display parsed buttons in Emacs
-
+(progn
 (defun toolbarx-emacs-add-button (button used-keys keymap)
   "Insert a button where BUTTON is its description.
 USED-KEYS should be a list of symbols, where the first element is
@@ -1298,12 +1305,12 @@ is used and the default value of `toolbarx-map' is 
changed."
                                                          tool-bar-map-temp)
     (if global-flag
        (setq-default tool-bar-map tool-bar-map-temp)
-      (setq tool-bar-map tool-bar-map-temp))))
+      (setq tool-bar-map tool-bar-map-temp)))))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Third engine: display parsed buttons in XEmacs
-
+(progn
 (defun toolbarx-xemacs-image-properties (image)
   "Return a list of properties of IMAGE.
 IMAGE should be a string or a list of one to six strings or
@@ -1669,7 +1676,7 @@ the lists are built reversed."
          (set-specifier left-toolbar left locale))
       (remove-specifier left-toolbar locale)
       (remove-specifier left-toolbar-visible-p locale)
-      (remove-specifier left-toolbar-width locale))))
+      (remove-specifier left-toolbar-width locale))))))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;



reply via email to

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