[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/forth-mode cc267b4b85 043/153: Symbol completion. Candidat
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/forth-mode cc267b4b85 043/153: Symbol completion. Candidates come from a running Forth. |
Date: |
Sat, 29 Jan 2022 08:02:15 -0500 (EST) |
branch: elpa/forth-mode
commit cc267b4b85e89aabbfaf8835c1ea44d7653376b4
Author: Lars Brinkhoff <lars.brinkhoff@delphi.com>
Commit: Lars Brinkhoff <lars.brinkhoff@delphi.com>
Symbol completion. Candidates come from a running Forth.
---
README.md | 4 +---
forth-mode.el | 15 +++++++++++++++
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 6e014b220f..086635f40a 100644
--- a/README.md
+++ b/README.md
@@ -10,9 +10,6 @@ Features in progress:
expressions.
- Display stack comment when moving the cursor over a word.
- Edit block files.
-
-Planned:
-
- Tab completion.
- Query a running Forth about words, search order, etc.
@@ -48,3 +45,4 @@ Key bindings:
- `C-c C-l` - load file.
- `C-c C-r` - evaluate region.
- `C-c C-k` - kill interactive Forth.
+- `M-TAB`, `C-M-i` - complete-symbol.
diff --git a/forth-mode.el b/forth-mode.el
index e37d134a5b..222d9b8c7d 100644
--- a/forth-mode.el
+++ b/forth-mode.el
@@ -58,6 +58,20 @@
(defvar forth-font-lock-keywords
'((forth-match-definition 3 font-lock-function-name-face)))
+(defun forth-symbol-start ()
+ (save-excursion
+ (re-search-backward "[^[:graph:]]")
+ (1+ (point))))
+
+(defun forth-symbol-end ()
+ (save-excursion
+ (re-search-forward "[^[:graph:]]")
+ (1- (point))))
+
+(defun forth-expand-symbol ()
+ ;; Append result from (imenu--make-index-alist t)?
+ (list (forth-symbol-start) (forth-symbol-end) (forth-words)))
+
(defun forth-block-p ()
"Guess whether the current buffer is a Forth block file."
(and (> (point-max) 1)
@@ -76,6 +90,7 @@
(if (forth-block-p)
(forth-block-mode))
(setq font-lock-defaults '(forth-font-lock-keywords))
+ (setq-local completion-at-point-functions '(forth-expand-symbol))
(setq ;; font-lock-defaults
comment-start-skip "\\((\\*?\\|\\\\\\) *"
comment-start "("
- [nongnu] elpa/forth-mode 695bb04ebc 002/153: A humble beginning., (continued)
- [nongnu] elpa/forth-mode 695bb04ebc 002/153: A humble beginning., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 24d3d052fe 003/153: More work. Font lock and navigation somewhat usable., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 93756ec224 005/153: Some basic and flawed support for block files., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode bca8f01218 004/153: Make it work in older Emacsen without prog-mode., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode effb52b8e0 009/153: Load files from load-path., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 3047dfa37a 008/153: Run a subprocess Forth for interaction., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 6ab334684b 010/153: Send a string to an interactive Forth session., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode b6b1f049b0 017/153: Restart an interactive Forth session., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 7c75c452e9 022/153: Correct autoload cookie format, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode e4ed4a8acf 050/153: Test with both Emacs 23 and 24., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode cc267b4b85 043/153: Symbol completion. Candidates come from a running Forth.,
ELPA Syncer <=
- [nongnu] elpa/forth-mode 50adf0d552 024/153: Remove byte-compile warnings., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 85ce58e93e 020/153: Correct package header format, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode d972e9fc7a 019/153: Escape some character constants., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode d09313f19c 035/153: Add forth-eval-region., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 89b9904ceb 119/153: Add some tests for font-lock faces, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode d47662b187 037/153: Add some installation and usage instrutions., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 1cb3071930 117/153: Move the font-locking for defining words to forth-syntax.el, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 21033fc700 031/153: Improve sending commands to an interactive Forth session., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 1c05a009a3 080/153: Fix warning about speedbar-add-supported-extension., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode ef60dcd180 036/153: If forth-executable is nil, query user for file name., ELPA Syncer, 2022/01/29