changeset 80172:7d8f87158250

(eval-when-compile): Don't define add-submenu. (verilog-xemacs-menu): Add :keys for C-M-a, C-M-e and C-M-h. Remove. Move contents to the only use ... (verilog-menu): ... here. (verilog-statement-menu): Remove. Move contents to the only use ... (verilog-stmt-menu): ... here. (verilog-mark-defun): Simply call mark-defun for emacs. (occur-pos-list): Declare for byte compiler. (mode-popup-menu): Don't defvar. (verilog-add-statement-menu): Remove. (verilog-mode-hook): Don't add verilog-add-statement-menu. (verilog-mode): Call easy-menu-add and set mode-popup-menu for XEmacs.
author Dan Nicolaescu <dann@ics.uci.edu>
date Thu, 21 Feb 2008 07:41:21 +0000
parents 97019d686b43
children 0fade0cf2913
files lisp/ChangeLog lisp/progmodes/verilog-mode.el
diffstat 2 files changed, 43 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Feb 21 05:15:31 2008 +0000
+++ b/lisp/ChangeLog	Thu Feb 21 07:41:21 2008 +0000
@@ -1,3 +1,20 @@
+2008-02-21  Dan Nicolaescu  <dann@ics.uci.edu>
+
+	* progmodes/verilog-mode.el (eval-when-compile): Don't define
+	add-submenu.
+	(verilog-xemacs-menu): Add :keys for C-M-a, C-M-e and C-M-h.
+	Remove.  Move contents to the only use ...
+	(verilog-menu): ... here.
+	(verilog-statement-menu): Remove.  Move contents to the only use ...
+	(verilog-stmt-menu): ... here.
+	(verilog-mark-defun): Simply call mark-defun for emacs.
+	(occur-pos-list): Declare for byte compiler.
+	(mode-popup-menu): Don't defvar.
+	(verilog-add-statement-menu): Remove.
+	(verilog-mode-hook): Don't add verilog-add-statement-menu.
+	(verilog-mode): Call easy-menu-add and set mode-popup-menu for
+	XEmacs.
+
 2008-02-21  Michael McNamara  <mac@mail.brushroad.com>
 
 	* progmodes/verilog-mode.el (verilog-xemacs-menu): Remove XEmacs
--- a/lisp/progmodes/verilog-mode.el	Thu Feb 21 05:15:31 2008 +0000
+++ b/lisp/progmodes/verilog-mode.el	Thu Feb 21 07:41:21 2008 +0000
@@ -161,13 +161,6 @@
           (defmacro store-match-data (&rest args) nil))
       (error nil))
     (condition-case nil
-        (if (boundp 'current-menubar)
-            nil ;; great
-          (progn
-            (defmacro add-submenu (&rest args) nil))
-          )
-      (error nil))
-    (condition-case nil
         (if (fboundp 'char-before)
             nil ;; great
           (defmacro char-before (&rest body)
@@ -957,7 +950,8 @@
   "Keymap used in Verilog mode.")
 
 ;; menus
-(defvar verilog-xemacs-menu
+(easy-menu-define
+  verilog-menu verilog-mode-map "Menu for Verilog mode"
   `("Verilog"
     ("Choose Compilation Action"
      ["None"
@@ -992,9 +986,12 @@
       :selected (equal verilog-tool `verilog-compiler)]
      )
     ("Move"
-     ["Beginning of function"           verilog-beg-of-defun t]
-     ["End of function"                 verilog-end-of-defun t]
-     ["Mark function"                   verilog-mark-defun t]
+     ["Beginning of function"           verilog-beg-of-defun
+      :keys "C-M-a"]
+     ["End of function"                 verilog-end-of-defun
+      :keys "C-M-e"]
+     ["Mark function"                   verilog-mark-defun
+      :keys "C-M-h"]
      ["Goto function/module"		verilog-goto-defun t]
      ["Move to beginning of block"	electric-verilog-backward-sexp t]
      ["Move to end of block"		electric-verilog-forward-sexp t]
@@ -1051,11 +1048,10 @@
     ["Submit bug report"		verilog-submit-bug-report t]
     ["Version and FAQ"			verilog-faq t]
     ["Customize Verilog Mode..."	verilog-customize t]
-    ["Customize Verilog Fonts & Colors"	verilog-font-customize t]
-    )
-  "Emacs menu for Verilog mode."
-  )
-(defvar verilog-statement-menu
+    ["Customize Verilog Fonts & Colors"	verilog-font-customize t]))
+
+(easy-menu-define
+  verilog-stmt-menu verilog-mode-map "Menu for statement templates in Verilog."
   '("Statements"
     ["Header"		verilog-sk-header  t]
     ["Comment"		verilog-sk-comment t]
@@ -1086,14 +1082,7 @@
     ["Repeat"		verilog-sk-repeat t]
     ["Case"		verilog-sk-case t]
     ["Casex"		verilog-sk-casex t]
-    ["Casez"		verilog-sk-casez t]
-    )
-  "Menu for statement templates in Verilog.")
-
-(easy-menu-define verilog-menu verilog-mode-map "Menu for Verilog mode"
-		  verilog-xemacs-menu)
-(easy-menu-define verilog-stmt-menu verilog-mode-map "Menu for statement templates in Verilog."
-		  verilog-statement-menu)
+    ["Casez"		verilog-sk-casez t]))
 
 (defvar verilog-mode-abbrev-table nil
   "Abbrev table in use in Verilog-mode buffers.")
@@ -2375,11 +2364,9 @@
 
   ;; Setting up menus
   (when (featurep 'xemacs)
-    (when (and current-menubar
-	       (not (assoc "Verilog" current-menubar)))
-      ;; (set-buffer-menubar (copy-sequence current-menubar))
-      (add-submenu nil verilog-xemacs-menu)
-      (add-submenu nil verilog-stmt-menu)))
+    (easy-menu-add verilog-stmt-menu)
+    (easy-menu-add verilog-menu)
+    (setq mode-popup-menu (cons "Verilog Mode" verilog-stmt-menu)))
 
   ;; Stuff for GNU emacs
   (set (make-local-variable 'font-lock-defaults)
@@ -2673,13 +2660,15 @@
   "Mark the current Verilog function (or procedure).
 This puts the mark at the end, and point at the beginning."
   (interactive)
-  (when (featurep 'xemacs)
-    (push-mark (point))
-    (verilog-end-of-defun)
-    (push-mark (point))
-    (verilog-beg-of-defun)
-    (if (fboundp 'zmacs-activate-region)
-	(zmacs-activate-region))))
+  (if (featurep 'xemacs)
+      (progn
+	(push-mark (point))
+	(verilog-end-of-defun)
+	(push-mark (point))
+	(verilog-beg-of-defun)
+	(if (fboundp 'zmacs-activate-region)
+	    (zmacs-activate-region)))
+    (mark-defun)))
 
 (defun verilog-comment-region (start end)
   ; checkdoc-params: (start end)
@@ -5510,9 +5499,7 @@
 	(verilog-goto-defun-file label))))
 
 ;; Eliminate compile warning
-(eval-when-compile
-  (if (not (boundp 'occur-pos-list))
-      (defvar occur-pos-list nil "Backward compatibility occur positions.")))
+(defvar occur-pos-list)
 
 (defun verilog-showscopes ()
   "List all scopes in this module."
@@ -9869,23 +9856,6 @@
   > ("case selector: " str ": begin" \n > "next_" verilog-sk-state " = " _ ";" \n > (- verilog-indent-level-behavioral) "end" \n )
   resume: >  (- verilog-case-indent) "endcase" (progn (electric-verilog-terminate-line) nil)
   > (- verilog-indent-level-behavioral) "end" (progn (electric-verilog-terminate-line) nil))
-
-;; Eliminate compile warning
-(eval-when-compile
-  (if (not (boundp 'mode-popup-menu))
-      (defvar mode-popup-menu nil "Compatibility with XEmacs.")))
-
-;; ---- add menu 'Statements' in Verilog mode (MH)
-(defun verilog-add-statement-menu ()
-  "Add the menu 'Statements' to the menu bar in Verilog mode."
-  (if (featurep 'xemacs)
-      (progn
-	(easy-menu-add verilog-stmt-menu)
-	(easy-menu-add verilog-menu)
-	(setq mode-popup-menu (cons "Verilog Mode" verilog-stmt-menu)))))
-
-(add-hook 'verilog-mode-hook 'verilog-add-statement-menu)
-
 
 
 ;;