[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/forth-mode ee0781f0a8 066/153: Add more functions for eval
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/forth-mode ee0781f0a8 066/153: Add more functions for evaluating Forth expressions. |
Date: |
Sat, 29 Jan 2022 08:02:17 -0500 (EST) |
branch: elpa/forth-mode
commit ee0781f0a8efe6861e84beddad6622ec5144fd26
Author: Lars Brinkhoff <lars.brinkhoff@delphi.com>
Commit: Lars Brinkhoff <lars.brinkhoff@delphi.com>
Add more functions for evaluating Forth expressions.
---
forth-interaction-mode.el | 36 +++++++++++++++++++++++++++++++++++-
forth-mode.el | 7 ++++---
2 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/forth-interaction-mode.el b/forth-interaction-mode.el
index 42f86a9373..784ce45959 100644
--- a/forth-interaction-mode.el
+++ b/forth-interaction-mode.el
@@ -103,10 +103,15 @@
(setq forth-words-cache
(split-string (forth-interaction-send "words"))))))
+;;;###autoload
+(defun forth-eval (string)
+ (interactive "sForth expression: ")
+ (message "%s" (forth-interaction-send string)))
+
;;;###autoload
(defun forth-eval-region (start end)
(interactive "r")
- (message "%s" (forth-interaction-send (buffer-substring start end))))
+ (forth-eval (buffer-substring start end)))
;;;###autoload
(defun forth-eval-defun ()
@@ -130,4 +135,33 @@
(insert (forth-interaction-send "see " word)))
(special-mode)))
+;;;###autoload
+(defun forth-switch-to-output-buffer ()
+ (interactive)
+ (if forth-interaction-buffer
+ (switch-to-buffer forth-interaction-buffer)
+ (message "Forth not started.")))
+
+;;;###autoload
+(defun forth-eval-last-expression ()
+ (interactive)
+ (save-excursion
+ (backward-sexp)
+ (let ((start (point)))
+ (forward-sexp)
+ (forth-eval-region start (point)))))
+
+;;;###autoload
+(defun forth-eval-last-expression-display-output ()
+ (interactive)
+ (if forth-interaction-buffer
+ (save-excursion
+ (backward-sexp)
+ (let ((start (point)))
+ (forward-sexp)
+ (let ((string (buffer-substring start (point))))
+ (forth-switch-to-output-buffer)
+ (insert (forth-interaction-send string)))))
+ (message "Forth not started.")))
+
(provide 'forth-interaction-mode)
diff --git a/forth-mode.el b/forth-mode.el
index 5bc1430d81..2d618670da 100644
--- a/forth-mode.el
+++ b/forth-mode.el
@@ -20,14 +20,15 @@
(define-key map (kbd "C-c C-s") 'forth-see)
(define-key map (kbd "C-M-x") 'forth-eval-defun)
(define-key map (kbd "C-c C-k") 'forth-kill)
+ (define-key map (kbd "C-c C-e") 'forth-eval-last-expression)
+ (define-key map (kbd "C-x M-e") 'forth-eval-last-expression-display-output)
+ (define-key map (kbd "C-c C-z") 'forth-switch-to-output-buffer)
+ (define-key map (kbd "C-c :") 'forth-eval)
;; (define-key map (kbd "C-c C-c") 'eval-buffer)
- ;; (define-key map (kbd "C-x C-e") #'forth-eval-last-sexp)
- ;; (define-key map (kbd "C-c :") #'forth-eval-expression)
;; (define-key map (kbd "C-x `") #'forth-next-error)
;; (define-key map (kbd "M-n") #'forth-next-note)
;; (define-key map (kbd "M-p") #'forth-previous-note)
;; (define-key map (kbd "M-.") #'forth-find-definition)
- ;; (define-key map (kbd "C-c C-z") #'forth-switch-to-output-buffer)
map))
(defvar forth-mode-syntax-table
- [nongnu] elpa/forth-mode 2e75fb156f 081/153: Fix warning about defvar ignored., (continued)
- [nongnu] elpa/forth-mode 2e75fb156f 081/153: Fix warning about defvar ignored., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 96c20f03f5 128/153: Make completion-at-point test work with Emacs23, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 867922d61e 112/153: Handle string literals more correctly, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 16f359442e 109/153: Add tests for word movement commands, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 45650c28a2 140/153: Check if forth interactive buffer is live, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode ab790fdac8 091/153: Don't kill *forth* buffer when there's a fatal error., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode be0272be3a 076/153: Inhibut Gforth terminal attribute output., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 312f3860aa 124/153: Try to indent (foo), ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 952995d95e 098/153: Add tests for indentation, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 0bbf7992d6 135/153: Workaround pcase bug in Emacs-24.3, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode ee0781f0a8 066/153: Add more functions for evaluating Forth expressions.,
ELPA Syncer <=
- [nongnu] elpa/forth-mode 1ffc174c13 127/153: Pass Makefile variable FORTH as environment variable to build.el, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 9b0982e169 149/153: Fix CI, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 52d84393c0 141/153: Remove newlines to fix markdown formatting., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 2d30ca8eaa 142/153: Use add-to-list in installation instructions instead of pushnew., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 8c0e519c57 148/153: Add restart-forth to source window menu, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 5e99586c1e 065/153: Remove prompt from Forth output., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 6bc035fd90 040/153: Fix missing argument to define-key., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode fbd2c51cea 070/153: Initialize pseudo terminal window size, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 38f0ccbfc8 027/153: Rename to run-forth, forth-ensure, and forth-parse.el., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode ccb14b4a47 136/153: Indentation rule for :noname, ELPA Syncer, 2022/01/29