Refill some long/short copyright headers.
[bpt/emacs.git] / lisp / progmodes / asm-mode.el
index 8f4dfcf..9d79d22 100644 (file)
@@ -1,7 +1,6 @@
 ;;; asm-mode.el --- mode for editing assembler code
 
-;; Copyright (C) 1991, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-;; Free Software Foundation, Inc.
+;; Copyright (C) 1991, 2001-2011  Free Software Foundation, Inc.
 
 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
 ;; Maintainer: FSF
@@ -9,10 +8,10 @@
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -20,9 +19,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
     (define-key map "\C-c;"    'comment-region)
     (define-key map "\C-j"     'newline-and-indent)
     (define-key map "\C-m"     'newline-and-indent)
-    (define-key map [menu-bar] (make-sparse-keymap))
-    (define-key map [menu-bar asm-mode] (cons "Asm" map))
-    (define-key map [asm-colon]
-      '("Insert Colon" . asm-colon))
-    (define-key map [comment-region]
-      '("Comment Region" . comment-region))
-    (define-key map [newline-and-indent]
-      '("Insert Newline and Indent" . newline-and-indent))
+    (define-key map [menu-bar asm-mode] (cons "Asm" (make-sparse-keymap)))
+    (define-key map [menu-bar asm-mode comment-region]
+      '(menu-item "Comment Region" comment-region
+                 :help "Comment or uncomment each line in the region"))
+    (define-key map [menu-bar asm-mode newline-and-indent]
+      '(menu-item "Insert Newline and Indent" newline-and-indent
+                 :help "Insert a newline, then indent according to major mode"))
+    (define-key map [menu-bar asm-mode asm-colon]
+      '(menu-item "Insert Colon" asm-colon
+                 :help "Insert a colon; if it follows a label, delete the label's indentation"))
     map)
   "Keymap for Asm mode.")
 
   "Additional expressions to highlight in Assembler mode.")
 
 ;;;###autoload
-(defun asm-mode ()
+(define-derived-mode asm-mode prog-mode "Assembler"
   "Major mode for editing typical assembler code.
 Features a private abbrev table and the following bindings:
 
@@ -127,13 +126,8 @@ Turning on Asm mode runs the hook `asm-mode-hook' at the end of initialization.
 
 Special commands:
 \\{asm-mode-map}"
-  (interactive)
-  (kill-all-local-variables)
-  (setq mode-name "Assembler")
-  (setq major-mode 'asm-mode)
   (setq local-abbrev-table asm-mode-abbrev-table)
-  (make-local-variable 'font-lock-defaults)
-  (setq font-lock-defaults '(asm-font-lock-keywords))
+  (set (make-local-variable 'font-lock-defaults) '(asm-font-lock-keywords))
   (set (make-local-variable 'indent-line-function) 'asm-indent-line)
   ;; Stay closer to the old TAB behavior (was tab-to-tab-stop).
   (set (make-local-variable 'tab-always-indent) nil)
@@ -146,18 +140,13 @@ Special commands:
   (set-syntax-table (make-syntax-table asm-mode-syntax-table))
   (modify-syntax-entry asm-comment-char "< b")
 
-  (make-local-variable 'comment-start)
-  (setq comment-start (string asm-comment-char))
-  (make-local-variable 'comment-add)
-  (setq comment-add 1)
-  (make-local-variable 'comment-start-skip)
-  (setq comment-start-skip "\\(?:\\s<+\\|/[/*]+\\)[ \t]*")
-  (make-local-variable 'comment-end-skip)
-  (setq comment-end-skip "[ \t]*\\(\\s>\\|\\*+/\\)")
-  (make-local-variable 'comment-end)
-  (setq comment-end "")
-  (setq fill-prefix "\t")
-  (run-mode-hooks 'asm-mode-hook))
+  (set (make-local-variable 'comment-start) (string asm-comment-char))
+  (set (make-local-variable 'comment-add) 1)
+  (set (make-local-variable 'comment-start-skip)
+       "\\(?:\\s<+\\|/[/*]+\\)[ \t]*")
+  (set (make-local-variable 'comment-end-skip) "[ \t]*\\(\\s>\\|\\*+/\\)")
+  (set (make-local-variable 'comment-end) "")
+  (setq fill-prefix "\t"))
 
 (defun asm-indent-line ()
   "Auto-indent the current line."
@@ -253,5 +242,4 @@ repeatedly until you are satisfied with the kind of comment."
 
 (provide 'asm-mode)
 
-;; arch-tag: 210e695f-f338-4376-8913-a4c5c72ac848
 ;;; asm-mode.el ends here