changeset 44942:972dc81abf82

(f90-xemacs-flag): New variable to put the test for Emacs flavor in one place.
author Glenn Morris <rgm@gnu.org>
date Sun, 28 Apr 2002 22:09:55 +0000
parents 857c2abe3324
children c5a1b54e283e
files lisp/progmodes/f90.el
diffstat 1 files changed, 23 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/f90.el	Sun Apr 28 22:06:38 2002 +0000
+++ b/lisp/progmodes/f90.el	Sun Apr 28 22:09:55 2002 +0000
@@ -242,6 +242,9 @@
   :type 'boolean
   :group 'f90)
 
+(defconst f90-xemacs-flag (string-match "XEmacs\\|Lucid" emacs-version)
+  "Non-nil means f90-mode thinks it is running under XEmacs.")
+
 (defconst f90-keywords-re
   (regexp-opt '("allocatable" "allocate" "assign" "assignment" "backspace"
 		"block" "call" "case" "character" "close" "common" "complex"
@@ -441,7 +444,7 @@
 
  
 ;; menus
-(if (string-match "XEmacs" emacs-version)
+(if f90-xemacs-flag
     (defvar f90-xemacs-menu
       '("F90"
 	["Indent Subprogram"       f90-indent-subprogram t]
@@ -672,11 +675,8 @@
 
 ;; When compiling under GNU Emacs, load imenu during compilation.  If
 ;; you have 19.22 or earlier, comment this out, or get imenu.
-(and (fboundp 'eval-when-compile)
-     (eval-when-compile
-       (if (not (string-match "XEmacs" emacs-version))
-	   (require 'imenu))
-       ()))
+(or f90-xemacs-flag (eval-when-compile (require 'imenu)))
+
 
 ;; abbrevs have generally two letters, except standard types `c, `i, `r, `t
 (defvar f90-mode-abbrev-table nil)
@@ -829,15 +829,13 @@
   (setq normal-auto-fill-function 'f90-do-auto-fill)
   (setq indent-tabs-mode nil)
   ;; Setting up things for font-lock
-  (if (string-match "XEmacs" emacs-version)
-      (progn
-	(put 'f90-mode 'font-lock-keywords-case-fold-search t)
-	(if (and (featurep 'menubar)
-		 current-menubar
-		 (not (assoc "F90" current-menubar)))
-	    (progn
-	      (set-buffer-menubar (copy-sequence current-menubar))
-	      (add-submenu nil f90-xemacs-menu)))))
+  (when f90-xemacs-flag
+    (put 'f90-mode 'font-lock-keywords-case-fold-search t)
+    (when (and (featurep 'menubar)
+             current-menubar
+             (not (assoc "F90" current-menubar)))
+          (set-buffer-menubar (copy-sequence current-menubar))
+          (add-submenu nil f90-xemacs-menu)))
   ;; XEmacs: (Don't need a special case, since both emacsen work alike -sb)
   (make-local-variable 'font-lock-defaults)
   (setq font-lock-defaults 
@@ -1227,10 +1225,10 @@
     (goto-char pos)
     (setq program (f90-beginning-of-subprogram))
     ;; The keywords in the preceding lists assume case-insensitivity.
-    (if (string-match "XEmacs" emacs-version)
+    (if f90-xemacs-flag
 	(zmacs-activate-region)
-      (setq mark-active t)
-      (setq deactivate-mark nil))
+      (setq mark-active t
+            deactivate-mark nil))
     program))
 
 (defun f90-comment-region (beg-region end-region)
@@ -1399,7 +1397,7 @@
     (goto-char save-point)
     (set-marker end-region-mark nil)
     (set-marker save-point nil)
-    (if (string-match "XEmacs" emacs-version)
+    (if f90-xemacs-flag
 	(zmacs-deactivate-region)
       (deactivate-mark))))
 
@@ -1512,7 +1510,7 @@
 			(zerop (forward-line 1))))
       (setq f90-cache-position (point)))
     (setq f90-cache-position nil)
-    (if (string-match "XEmacs" emacs-version)
+    (if f90-xemacs-flag
 	(zmacs-deactivate-region)
       (deactivate-mark))))
 
@@ -1615,15 +1613,14 @@
   (interactive)
   (let (e c)
     (insert last-command-char)
-    (if (string-match "XEmacs" emacs-version)
-	(progn
-	  (setq e (next-command-event))
-	  (setq c (event-to-character e)))
-      (setq c (read-event)))
+    (if (not f90-xemacs-flag)
+        (setq c (read-event))
+      (setq e (next-command-event)
+            c (event-to-character e)))
     ;; insert char if not equal to `?'
     (if (or (eq c ??) (eq c help-char))
 	(f90-abbrev-help)
-      (if (string-match "XEmacs" emacs-version)
+      (if f90-xemacs-flag
 	  (setq unread-command-event e)
 	(setq unread-command-events (list c))))))