[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/forth-mode b9586a57a5 147/153: Add menu
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/forth-mode b9586a57a5 147/153: Add menu |
Date: |
Sat, 29 Jan 2022 08:02:28 -0500 (EST) |
branch: elpa/forth-mode
commit b9586a57a5b82117810880fb5d55cc840cdcfb3b
Author: Jeronimo Pellegrini <j_p@aleph0.info>
Commit: Lars Brinkhoff <lars@nocrew.org>
Add menu
Adds menu to Emacs menu bar, with entries for all commands
except forth-switch-to-output-buffer.
---
forth-mode.el | 48 +++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 47 insertions(+), 1 deletion(-)
diff --git a/forth-mode.el b/forth-mode.el
index f672cf76ae..2c18798931 100644
--- a/forth-mode.el
+++ b/forth-mode.el
@@ -61,6 +61,49 @@
(modify-syntax-entry ?\" "\"" table)
table))
+;; forth-menu-entries:
+;; In the list, the three elements are
+;; 1. menu name (internal)
+;; 2. menu string (shown to the user)
+;; 3. function name (to be called whe this menu entry iss
+;; clicked on
+(defvar forth-menu-entries
+ (reverse (list
+ '(see "See" forth-see)
+ '(eval "Eval" forth-eval)
+ '(eval-defun "Eval defun" forth-eval-defun)
+ '(eval-region "Eval region" forth-eval-region)
+ '(eval-last "Eval last" forth-eval-last-expression)
+ '(eval-display "Eval last and display"
forth-eval-last-expression-display-output)
+ '(separator1 "--")
+ '(lookup-1994 "Lookup 1994 spec" forth-spec-lookup-1994)
+ '(lookup-2012 "Lookup-2012 spec" forth-spec-lookup-2012)
+ '(separator2 "--")
+ '(load-file "Load file" forth-load-file)
+ '(run "Run Forth" run-forth)
+ '(kill "Kill" forth-kill))))
+
+;; forth-create-menu will actually call define-key to
+;; add meu entries. The format is that of the variable
+;; forth-menu-entries.
+(defun forth-create-menu (entries)
+ (mapcar (lambda (entry)
+ (let ((menu-name (first entry))
+ (menu-string (second entry))
+ (menu-function (third entry)))
+ (define-key forth-mode-map
+ (vector 'menu-bar 'forth menu-name)
+ (cons menu-string menu-function))))
+ entries))
+
+(defun forth-mode-init-menu ()
+ (define-key-after
+ forth-mode-map
+ [menu-bar forth]
+ (cons "Forth" (make-sparse-keymap "Forth"))
+ 'tools)
+ (forth-create-menu forth-menu-entries))
+
(defvar forth-mode-hook)
(defun forth-symbol-start ()
@@ -161,7 +204,8 @@
("Variables"
"^\\s-*2?\\(variable\\|create\\|value\\)\\s-+\\(\\(\\sw\\|\\s_\\)+\\)" 2)
("Constants"
- "\\s-2?constant\\s-+\\(\\(\\sw\\|\\s_\\)+\\)" 1))))
+ "\\s-2?constant\\s-+\\(\\(\\sw\\|\\s_\\)+\\)" 1)))
+ (forth-mode-init-menu))
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.\\(f\\|fs\\|fth\\|4th\\)\\'" . forth-mode))
@@ -180,5 +224,7 @@
(defun forth-beginning ()
(goto-char (point-min)))
+(add-hook 'forth-mode-hook 'forth-mode-init-menu)
+
(provide 'forth-mode)
;;; forth-mode.el ends here
- [nongnu] elpa/forth-mode 9cf3d777ec 064/153: Fix for C-c C-s forth-see., (continued)
- [nongnu] elpa/forth-mode 9cf3d777ec 064/153: Fix for C-c C-s forth-see., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode d90c4a46e0 118/153: Use funny characters (→, ¹ and ²) to mark positions in test strings., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode c99ed046df 074/153: Remove debug message., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 64209f501c 108/153: Merge pull request #35 from ellerh/forward-sexp-tests, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode e6ee5ddf99 069/153: Handle ( ...) comments with syntax-propertize-function, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode e966275c2e 100/153: Add tests for indentation, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode dc3f7fabed 131/153: Use -y with apt-get., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode f531a1bcd7 096/153: Print test name in ERT shim., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 38d5152011 153/153: Version 0.2., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 9f885433e1 048/153: Use ERT for some light testing as part of build., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode b9586a57a5 147/153: Add menu,
ELPA Syncer <=
- [nongnu] elpa/forth-mode fdc218c6f2 052/153: Don't get Makefile variable EMACS from environment; it may be set to 't'., ELPA Syncer, 2022/01/29