Add 2012 to FSF copyright years for Emacs files
[bpt/emacs.git] / lisp / progmodes / antlr-mode.el
index d9b036b..634570c 100644 (file)
@@ -1,7 +1,6 @@
 ;;; antlr-mode.el --- major mode for ANTLR grammar files
 
-;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-;;   2008, 2009, 2010, 2011  Free Software Foundation, Inc.
+;; Copyright (C) 1999-2012  Free Software Foundation, Inc.
 
 ;; Author: Christoph.Wedler@sap.com
 ;; Keywords: languages, ANTLR, code generator
@@ -83,7 +82,7 @@
 
 ;;; Code:
 
-(eval-when-compile 
+(eval-when-compile
   (require 'cl))
 
 (require 'easymenu)
@@ -94,7 +93,7 @@
 (declare-function cond-emacs-xemacs-macfn "antlr-mode" (args &optional msg))
 
 ;; General Emacs/XEmacs-compatibility compile-time macros
-(eval-when-compile 
+(eval-when-compile
   (defmacro cond-emacs-xemacs (&rest args)
     (cond-emacs-xemacs-macfn
      args "`cond-emacs-xemacs' must return exactly one element"))
@@ -1074,7 +1073,7 @@ Used for `antlr-slow-syntactic-context'.")
   (read-from-minibuffer prompt initial-input nil nil
                        (or history 'shell-command-history)))
 
-(defunx antlr-with-displaying-help-buffer (thunk &optional name)
+(defunx antlr-with-displaying-help-buffer (thunk &optional _name)
   :xemacs-and-try with-displaying-help-buffer
   "Make a help buffer and call `thunk' there."
   (with-output-to-temp-buffer "*Help*"
@@ -1093,7 +1092,7 @@ Used for `antlr-slow-syntactic-context'.")
 ;;;(defvar antlr-statistics-cache 0)
 ;;;(defvar antlr-statistics-inval 0)
 
-(defunx antlr-invalidate-context-cache (&rest dummies)
+(defunx antlr-invalidate-context-cache (&rest _dummies)
 ;; checkdoc-params: (dummies)
   "Invalidate context cache for syntactical context information."
   :XEMACS                              ; XEmacs bug workaround
@@ -1671,7 +1670,7 @@ Return \(LEVEL OPTION LOCATION)."
                                     table)))
        (list level input (cdr kind))))))
 
-(defun antlr-options-menu-filter (level menu-items)
+(defun antlr-options-menu-filter (level _menu-items)
   "Return items for options submenu of level LEVEL."
   ;; checkdoc-params: (menu-items)
   (let ((active (if buffer-read-only
@@ -2073,7 +2072,7 @@ Used inside `antlr-options-alists'."
                    nil
                    table '(("false") ("true"))))
 
-(defun antlr-language-option-extra (phase &rest dummies)
+(defun antlr-language-option-extra (phase &rest _dummies)
 ;; checkdoc-params: (dummies)
   "Change language according to the new value of the \"language\" option.
 Call `antlr-mode' if the new language would be different from the value
@@ -2089,7 +2088,7 @@ Called in PHASE `after-insertion', see `antlr-options-alists'."
            (antlr-mode)
            (and font-lock (null font-lock-mode) (font-lock-mode 1)))))))
 
-(defun antlr-c++-mode-extra (phase option &rest dummies)
+(defun antlr-c++-mode-extra (phase option &rest _dummies)
 ;; checkdoc-params: (option dummies)
   "Warn if C++ option is used with the wrong language.
 Ask user \(\"y or n\"), if a C++ only option is going to be inserted but
@@ -2182,36 +2181,32 @@ grammar file in which CLASS is defined and EVOCAB is the name of the
 export vocabulary specified in that file."
   (let ((grammar (directory-files dirname t "\\.g\\'")))
     (when grammar
-      (let ((temp-buffer (get-buffer-create
-                         (generate-new-buffer-name " *temp*")))
-           (antlr-imenu-name nil)              ; dynamic-let: no imenu
-           (expanded-regexp (concat (format (regexp-quote
-                                             (cadr antlr-special-file-formats))
-                                            ".+")
-                                    "\\'"))
+      (let ((antlr-imenu-name nil)             ; dynamic-let: no imenu
+           (expanded-regexp
+             (concat (format (regexp-quote
+                              (cadr antlr-special-file-formats))
+                             ".+")
+                     "\\'"))
            classes dependencies)
-       (unwind-protect
-           (with-current-buffer temp-buffer
-             (widen)                   ; just in case...
-             (dolist (file grammar)
-               (when (and (file-regular-p file)
-                          (null (string-match expanded-regexp file)))
-                 (insert-file-contents file t nil nil t)
-                 (normal-mode t)       ; necessary for major-mode, syntax
+        (with-temp-buffer
+          (dolist (file grammar)
+            (when (and (file-regular-p file)
+                       (null (string-match expanded-regexp file)))
+              (insert-file-contents file t nil nil t)
+              (normal-mode t)           ; necessary for major-mode, syntax
                                        ; table and `antlr-language'
-                 (when (derived-mode-p 'antlr-mode)
-                   (let* ((file-deps (antlr-file-dependencies))
-                          (file (car file-deps)))
-                     (when file-deps
-                       (dolist (class-def (caadr file-deps))
-                         (let ((file-evocab (cons file (cdr class-def)))
-                               (class-spec (assoc (car class-def) classes)))
-                           (if class-spec
-                               (nconc (cdr class-spec) (list file-evocab))
-                             (push (list (car class-def) file-evocab)
-                                   classes))))
-                       (push file-deps dependencies)))))))
-         (kill-buffer temp-buffer))
+              (when (derived-mode-p 'antlr-mode)
+                (let* ((file-deps (antlr-file-dependencies))
+                       (file (car file-deps)))
+                  (when file-deps
+                    (dolist (class-def (caadr file-deps))
+                      (let ((file-evocab (cons file (cdr class-def)))
+                            (class-spec (assoc (car class-def) classes)))
+                        (if class-spec
+                            (nconc (cdr class-spec) (list file-evocab))
+                          (push (list (car class-def) file-evocab)
+                                classes))))
+                    (push file-deps dependencies)))))))
        (cons (nreverse classes) (nreverse dependencies))))))
 
 
@@ -2265,7 +2260,7 @@ called interactively, the buffers are always saved, see also variable
   (or saved (save-some-buffers (not antlr-ask-about-save)))
   (let ((default-directory (file-name-directory file)))
     (compilation-start (concat command " " (file-name-nondirectory file))
-                      nil #'(lambda (mode-name) "*Antlr-Run*"))))
+                      nil (lambda (_mode-name) "*Antlr-Run*"))))
 
 (defun antlr-run-tool-interactive ()
   ;; code in `interactive' is not compiled
@@ -2597,7 +2592,7 @@ the default language."
   ;; FIXME: Since it uses cc-mode, it bumps into c-update-modeline's
   ;; limitation to mode-name being a string.
   ;; '("Antlr." (:eval (cadr (assq antlr-language antlr-language-alist))))
-  "Antlr" 
+  "Antlr"
   "Major mode for editing ANTLR grammar files."
   :abbrev-table antlr-mode-abbrev-table
   (c-initialize-cc-mode)               ; cc-mode is required