changeset 78600:4f60c94dc647

Fix up comment style in header. (ada-check-emacs-version): Remove. (ada-mode): Set parse-sexp-* even if they don't exist: can't hurt. (ada-region-selected): Use (featurep 'xemacs) rather than contortions to try and quieten the byte-compiler. (ada-create-keymap): Use [(..)] keys, which work on both (X)Emacs.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 21 Aug 2007 16:24:43 +0000
parents 3ec4d1da6eeb
children 047d1fc93812
files lisp/ChangeLog lisp/progmodes/ada-mode.el
diffstat 2 files changed, 132 insertions(+), 144 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Aug 21 16:24:21 2007 +0000
+++ b/lisp/ChangeLog	Tue Aug 21 16:24:43 2007 +0000
@@ -1,3 +1,14 @@
+2007-08-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* progmodes/ada-mode.el: Fix up comment style in header.
+	(ada-check-emacs-version): Remove.
+	(ada-mode): Set parse-sexp-* even if they don't exist: can't hurt.
+	(ada-region-selected): Use (featurep 'xemacs) rather than contortions
+	to try and quieten the byte-compiler.
+	(ada-create-keymap): Use [(..)] keys, which work on both (X)Emacs.
+
+	* vc.el (vc-annotate-warp-version): Don't use previous-line.
+
 2007-08-20  Johannes Weiner  <hannes@saeurebad.de>  (tiny change)
 
 	* emacs-lisp/lisp-mode.el (preceding-sexp): New fun, the code was
@@ -13,27 +24,24 @@
 
 2007-08-18  Glenn Morris  <rgm@gnu.org>
 
-	* progmodes/scheme.el (scheme-mode-variables): Set
-	font-lock-comment-start-skip.
+	* progmodes/scheme.el (scheme-mode-variables):
+	Set font-lock-comment-start-skip.
 
 2007-08-18  Martin Rudalics  <rudalics@gmx.at>
 
-	* progmodes/ada-mode.el (ada-create-syntax-table): Move
-	set-syntax-table from here to ...
-	(ada-mode): ... here.  Do not change global value of
-	comment-multi-line.  Call new function
-	ada-initialize-syntax-table-properties and add new function
-	ada-handle-syntax-table-properties to font-lock-mode-hook.
-	(ada-deactivate-properties, ada-initialize-properties): Replace
-	by new functions ...
-	(ada-handle-syntax-table-properties)
-	(ada-initialize-syntax-table-properties)
-	(ada-set-syntax-table-properties): ... to set up syntax-table
+	* progmodes/ada-mode.el (ada-create-syntax-table):
+	Move set-syntax-table from here to ...
+	(ada-mode): ... here.  Don't change global value of comment-multi-line.
+	Call new function ada-initialize-syntax-table-properties.
+	Add ada-handle-syntax-table-properties to font-lock-mode-hook.
+	(ada-deactivate-properties, ada-initialize-properties):
+	Replace by new functions ...
+	(ada-handle-syntax-table-properties, ada-set-syntax-table-properties)
+	(ada-initialize-syntax-table-properties): ... to set up syntax-table
 	properties uniformly, independently from whether font-lock-mode
 	is enabled or not.  Handle read-only buffers and do not change
 	undo-list when setting syntax-table properties.
-	(ada-after-change-function): Use
-	ada-set-syntax-table-properties.
+	(ada-after-change-function): Use ada-set-syntax-table-properties.
 
 2007-08-17  Bob Rogers  <rogers-emacs@rgrjr.dyndns.org>  (tiny change)
 
@@ -132,8 +140,8 @@
 	* pcvs-util.el (cvs-qtypedesc-strings): Use new names
 	combine-and-quote-strings and split-string-and-unquote.
 
-	* subr.el (combine-and-quote-strings): Renamed from strings->string.
-	(split-string-and-unquote): Renamed from string->strings.
+	* subr.el (combine-and-quote-strings): Rename from strings->string.
+	(split-string-and-unquote): Rename from string->strings.
 
 2007-08-10  Stefan Monnier  <monnier@iro.umontreal.ca>
 
--- a/lisp/progmodes/ada-mode.el	Tue Aug 21 16:24:21 2007 +0000
+++ b/lisp/progmodes/ada-mode.el	Tue Aug 21 16:24:43 2007 +0000
@@ -27,103 +27,103 @@
 ;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
-;;; This mode is a major mode for editing Ada code.  This is a major
-;;; rewrite of the file packaged with Emacs-20.  The Ada mode is
-;;; composed of four Lisp files: ada-mode.el, ada-xref.el, ada-prj.el
-;;; and ada-stmt.el.  Only this file (ada-mode.el) is completely
-;;; independent from the GNU Ada compiler GNAT, distributed by Ada
-;;; Core Technologies.  All the other files rely heavily on features
-;;; provided only by GNAT.
-;;;
-;;; Note: this mode will not work with Emacs 19. If you are on a VMS
-;;; system, where the latest version of Emacs is 19.28, you will need
-;;; another file, called ada-vms.el, that provides some required
-;;; functions.
+;; This mode is a major mode for editing Ada code.  This is a major
+;; rewrite of the file packaged with Emacs-20.  The Ada mode is
+;; composed of four Lisp files: ada-mode.el, ada-xref.el, ada-prj.el
+;; and ada-stmt.el.  Only this file (ada-mode.el) is completely
+;; independent from the GNU Ada compiler GNAT, distributed by Ada
+;; Core Technologies.  All the other files rely heavily on features
+;; provided only by GNAT.
+;;
+;; Note: this mode will not work with Emacs 19. If you are on a VMS
+;; system, where the latest version of Emacs is 19.28, you will need
+;; another file, called ada-vms.el, that provides some required
+;; functions.
 
 ;;; Usage:
-;;; Emacs should enter Ada mode automatically when you load an Ada file.
-;;; By default, the valid extensions for Ada files are .ads, .adb or .ada
-;;; If the ada-mode does not start automatically, then simply type the
-;;; following command :
-;;;     M-x ada-mode
-;;;
-;;; By default, ada-mode is configured to take full advantage of the GNAT
-;;; compiler (the menus will include the cross-referencing features,...).
-;;; If you are using another compiler, you might want to set the following
-;;; variable in your .emacs (Note: do not set this in the ada-mode-hook, it
-;;; won't work) :
-;;;    (setq ada-which-compiler 'generic)
-;;;
-;;; This mode requires find-file.el to be present on your system.
+;; Emacs should enter Ada mode automatically when you load an Ada file.
+;; By default, the valid extensions for Ada files are .ads, .adb or .ada
+;; If the ada-mode does not start automatically, then simply type the
+;; following command :
+;;     M-x ada-mode
+;;
+;; By default, ada-mode is configured to take full advantage of the GNAT
+;; compiler (the menus will include the cross-referencing features,...).
+;; If you are using another compiler, you might want to set the following
+;; variable in your .emacs (Note: do not set this in the ada-mode-hook, it
+;; won't work) :
+;;    (setq ada-which-compiler 'generic)
+;;
+;; This mode requires find-file.el to be present on your system.
 
 ;;; History:
-;;; The first Ada mode for GNU Emacs was written by V. Broman in
-;;; 1985. He based his work on the already existing Modula-2 mode.
-;;; This was distributed as ada.el in versions of Emacs prior to 19.29.
-;;;
-;;; Lynn Slater wrote an extensive Ada mode in 1989. It consisted of
-;;; several files with support for dired commands and other nice
-;;; things. It is currently available from the PAL
-;;; (wuarchive.wustl.edu:/languages/ada) as ada-mode-1.06a.tar.Z.
-;;;
-;;; The probably very first Ada mode (called electric-ada.el) was
-;;; written by Steven D. Litvintchouk and Steven M. Rosen for the
-;;; Gosling Emacs. L. Slater based his development on ada.el and
-;;; electric-ada.el.
-;;;
-;;; A complete rewrite by M. Heritsch and R. Ebert has been done.
-;;; Some ideas from the Ada mode mailing list have been
-;;; added.  Some of the functionality of L. Slater's mode has not
-;;; (yet) been recoded in this new mode.  Perhaps you prefer sticking
-;;; to his version.
-;;;
-;;; A complete rewrite for Emacs-20 / GNAT-3.11 has been done by Ada Core
-;;; Technologies.
+;; The first Ada mode for GNU Emacs was written by V. Broman in
+;; 1985. He based his work on the already existing Modula-2 mode.
+;; This was distributed as ada.el in versions of Emacs prior to 19.29.
+;;
+;; Lynn Slater wrote an extensive Ada mode in 1989. It consisted of
+;; several files with support for dired commands and other nice
+;; things. It is currently available from the PAL
+;; (wuarchive.wustl.edu:/languages/ada) as ada-mode-1.06a.tar.Z.
+;;
+;; The probably very first Ada mode (called electric-ada.el) was
+;; written by Steven D. Litvintchouk and Steven M. Rosen for the
+;; Gosling Emacs. L. Slater based his development on ada.el and
+;; electric-ada.el.
+;;
+;; A complete rewrite by M. Heritsch and R. Ebert has been done.
+;; Some ideas from the Ada mode mailing list have been
+;; added.  Some of the functionality of L. Slater's mode has not
+;; (yet) been recoded in this new mode.  Perhaps you prefer sticking
+;; to his version.
+;;
+;; A complete rewrite for Emacs-20 / GNAT-3.11 has been done by Ada Core
+;; Technologies.
 
 ;;; Credits:
-;;;   Many thanks to John McCabe <john@assen.demon.co.uk> for sending so
-;;;     many patches included in this package.
-;;;   Christian Egli <Christian.Egli@hcsd.hac.com>:
-;;;     ada-imenu-generic-expression
-;;;   Many thanks also to the following persons that have contributed
-;;;   to the ada-mode
-;;;     Philippe Waroquiers (PW) <philippe@cfmu.eurocontrol.be> in particular,
-;;;     woodruff@stc.llnl.gov (John Woodruff)
-;;;     jj@ddci.dk (Jesper Joergensen)
-;;;     gse@ocsystems.com (Scott Evans)
-;;;     comar@gnat.com (Cyrille Comar)
-;;;     stephen.leake@gsfc.nasa.gov (Stephen Leake)
-;;;     robin-reply@reagans.org
-;;;    and others for their valuable hints.
+;;   Many thanks to John McCabe <john@assen.demon.co.uk> for sending so
+;;     many patches included in this package.
+;;   Christian Egli <Christian.Egli@hcsd.hac.com>:
+;;     ada-imenu-generic-expression
+;;   Many thanks also to the following persons that have contributed
+;;   to the ada-mode
+;;     Philippe Waroquiers (PW) <philippe@cfmu.eurocontrol.be> in particular,
+;;     woodruff@stc.llnl.gov (John Woodruff)
+;;     jj@ddci.dk (Jesper Joergensen)
+;;     gse@ocsystems.com (Scott Evans)
+;;     comar@gnat.com (Cyrille Comar)
+;;     stephen.leake@gsfc.nasa.gov (Stephen Leake)
+;;     robin-reply@reagans.org
+;;    and others for their valuable hints.
 
 ;;; Code:
-;;; Note: Every function in this package is compiler-independent.
-;;; The names start with  ada-
-;;; The variables that the user can edit can all be modified through
-;;;   the customize mode. They are sorted in alphabetical order in this
-;;;   file.
-
-;;; Supported packages.
-;;; This package supports a number of other Emacs modes. These other modes
-;;; should be loaded before the ada-mode, which will then setup some variables
-;;; to improve the support for Ada code.
-;;; Here is the list of these modes:
-;;;   `which-function-mode': Display the name of the subprogram the cursor is
-;;;      in in the mode line.
-;;;   `outline-mode': Provides the capability to collapse or expand the code
-;;;      for specific language constructs, for instance if you want to hide the
-;;;      code corresponding to a subprogram
-;;;   `align': This mode is now provided with Emacs 21, but can also be
-;;;      installed manually for older versions of Emacs. It provides the
-;;;      capability to automatically realign the selected region (for instance
-;;;      all ':=', ':' and '--' will be aligned on top of each other.
-;;;   `imenu': Provides a menu with the list of entities defined in the current
-;;;      buffer, and an easy way to jump to any of them
-;;;   `speedbar': Provides a separate file browser, and the capability for each
-;;;      file to see the list of entities defined in it and to jump to them
-;;;      easily
-;;;   `abbrev-mode': Provides the capability to define abbreviations, which
-;;;      are automatically expanded when you type them. See the Emacs manual.
+;; Note: Every function in this package is compiler-independent.
+;; The names start with  ada-
+;; The variables that the user can edit can all be modified through
+;;   the customize mode. They are sorted in alphabetical order in this
+;;   file.
+
+;; Supported packages.
+;; This package supports a number of other Emacs modes. These other modes
+;; should be loaded before the ada-mode, which will then setup some variables
+;; to improve the support for Ada code.
+;; Here is the list of these modes:
+;;   `which-function-mode': Display the name of the subprogram the cursor is
+;;      in in the mode line.
+;;   `outline-mode': Provides the capability to collapse or expand the code
+;;      for specific language constructs, for instance if you want to hide the
+;;      code corresponding to a subprogram
+;;   `align': This mode is now provided with Emacs 21, but can also be
+;;      installed manually for older versions of Emacs. It provides the
+;;      capability to automatically realign the selected region (for instance
+;;      all ':=', ':' and '--' will be aligned on top of each other.
+;;   `imenu': Provides a menu with the list of entities defined in the current
+;;      buffer, and an easy way to jump to any of them
+;;   `speedbar': Provides a separate file browser, and the capability for each
+;;      file to see the list of entities defined in it and to jump to them
+;;      easily
+;;   `abbrev-mode': Provides the capability to define abbreviations, which
+;;      are automatically expanded when you type them. See the Emacs manual.
 
 (require 'find-file nil t)
 (require 'align nil t)
@@ -134,18 +134,6 @@
 (defvar ispell-check-comments)
 (defvar skeleton-further-elements)
 
-(eval-and-compile
-  (defun ada-check-emacs-version (major minor &optional is-xemacs)
-    "Return t if Emacs's version is greater or equal to MAJOR.MINOR.
-If IS-XEMACS is non-nil, check for XEmacs instead of Emacs."
-    (let ((xemacs-running (or (string-match "Lucid"  emacs-version)
-			      (string-match "XEmacs" emacs-version))))
-      (and (or (and is-xemacs xemacs-running)
-	       (not (or is-xemacs xemacs-running)))
-	   (or (> emacs-major-version major)
-	       (and (= emacs-major-version major)
-		    (>= emacs-minor-version minor)))))))
-
 (defun ada-mode-version ()
   "Return Ada mode version."
   (interactive)
@@ -612,7 +600,7 @@
    "\\(\\(\\sw\\|[_.]\\)+\\)"
    "\\)")
   "Regexp matching Ada subprogram start.
-The actual start is at (match-beginning 4). The name is in (match-string 5).")
+The actual start is at (match-beginning 4).  The name is in (match-string 5).")
 
 (defconst ada-name-regexp
   "\\([a-zA-Z][a-zA-Z0-9_.']*[a-zA-Z0-9]\\)"
@@ -1192,13 +1180,9 @@
   ;;  the comment and the text. We do not want any, this is already
   ;;  included in comment-start
   (unless (featurep 'xemacs)
-    (progn
-      (if (ada-check-emacs-version 20 3)
-	  (progn
-	    (set (make-local-variable 'parse-sexp-ignore-comments) t)
-	    (set (make-local-variable 'comment-padding) 0)))
-      (set (make-local-variable 'parse-sexp-lookup-properties) t)
-      ))
+    (set (make-local-variable 'parse-sexp-ignore-comments) t)
+    (set (make-local-variable 'comment-padding) 0)
+    (set (make-local-variable 'parse-sexp-lookup-properties) t))
 
   (set 'case-fold-search t)
   (if (boundp 'imenu-case-fold-search)
@@ -1227,6 +1211,7 @@
   ;;  We need to set some properties for XEmacs, and define some variables
   ;;  for Emacs
 
+  ;; FIXME: The Emacs code should work just fine under XEmacs AFAIK.  --Stef
   (if (featurep 'xemacs)
       ;;  XEmacs
       (put 'ada-mode 'font-lock-defaults
@@ -1414,10 +1399,9 @@
 ;;  transient-mark-mode and mark-active are not defined in XEmacs
 (defun ada-region-selected ()
   "Return t if a region has been selected by the user and is still active."
-  (or (and (featurep 'xemacs) (funcall (symbol-function 'region-active-p)))
-      (and (not (featurep 'xemacs))
-	   (symbol-value 'transient-mark-mode)
-	   (symbol-value 'mark-active))))
+  (if (featurep 'xemacs)
+      (region-active-p)
+    (and transient-mark-mode mark-active)))
 
 
 ;;-----------------------------------------------------------------
@@ -4041,7 +4025,7 @@
 If BACKWARD is non-nil, search backward; search forward otherwise.
 The search stops at pos LIMIT.
 If PARAMLISTS is nil, ignore parameter lists.
-The search is done using SEARCH-FUNC. SEARCH-FUNC can be optimized
+The search is done using SEARCH-FUNC.  SEARCH-FUNC can be optimized
 in case we are searching for a constant string.
 Point is moved at the beginning of the SEARCH-RE."
   (let (found
@@ -4562,9 +4546,7 @@
   (define-key ada-mode-map "\t"       'ada-tab)
   (define-key ada-mode-map "\C-c\t"   'ada-justified-indent-current)
   (define-key ada-mode-map "\C-c\C-l" 'ada-indent-region)
-  (if (featurep 'xemacs)
-      (define-key ada-mode-map '(shift tab)    'ada-untab)
-    (define-key ada-mode-map [(shift tab)]    'ada-untab))
+  (define-key ada-mode-map [(shift tab)]    'ada-untab)
   (define-key ada-mode-map "\C-c\C-f" 'ada-format-paramlist)
   ;; We don't want to make meta-characters case-specific.
 
@@ -4587,9 +4569,9 @@
   ;; On XEmacs, you can easily specify whether DEL should deletes
   ;; one character forward or one character backward. Take this into
   ;; account
-  (if (boundp 'delete-key-deletes-forward)
-      (define-key ada-mode-map [backspace] 'backward-delete-char-untabify)
-    (define-key ada-mode-map "\177" 'backward-delete-char-untabify))
+  (define-key ada-mode-map
+    (if (boundp 'delete-key-deletes-forward) [backspace] "\177")
+    'backward-delete-char-untabify))
 
   ;; Make body
   (define-key ada-mode-map "\C-c\C-n" 'ada-make-subprogram-body)
@@ -4601,12 +4583,10 @@
   ;; The following keys are bound to functions defined in ada-xref.el or
   ;; ada-prj,el., However, RMS rightly thinks that the code should be shared,
   ;; and activated only if the right compiler is used
-  (if (featurep 'xemacs)
-      (progn
-	(define-key ada-mode-map '(shift button3) 'ada-point-and-xref)
-	(define-key ada-mode-map '(control tab) 'ada-complete-identifier))
-    (define-key ada-mode-map [C-tab] 'ada-complete-identifier)
-    (define-key ada-mode-map [S-mouse-3] 'ada-point-and-xref))
+  
+  (define-key ada-mode-map (if (featurep 'xemacs) '(shift button3) [S-mouse-3])
+    'ada-point-and-xref)
+  (define-key ada-mode-map [(control tab)] 'ada-complete-identifier)
 
   (define-key ada-mode-map "\C-co"     'ff-find-other-file)
   (define-key ada-mode-map "\C-c5\C-d" 'ada-goto-declaration-other-frame)
@@ -5570,5 +5550,5 @@
 ;;; provide ourselves
 (provide 'ada-mode)
 
-;;; arch-tag: 1b7d45ec-1698-43b5-8d4a-e479ea023270
+;; arch-tag: 1b7d45ec-1698-43b5-8d4a-e479ea023270
 ;;; ada-mode.el ends here