[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/forth-mode 74c0e17c45 122/153: Improve beginning-of-defun
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/forth-mode 74c0e17c45 122/153: Improve beginning-of-defun |
Date: |
Sat, 29 Jan 2022 08:02:25 -0500 (EST) |
branch: elpa/forth-mode
commit 74c0e17c4568ddba1dd77bf1bf8a3fccb6cfc5e8
Author: Helmut Eller <eller.helmut@gmail.com>
Commit: Helmut Eller <eller.helmut@gmail.com>
Improve beginning-of-defun
* forth-mode.el (forth-beginning-of-defun): New.
(forth-mode): Set beginning-of-defun-function.
* test/tests.el (forth-beginning-of-defun): New test.
---
forth-mode.el | 5 +++++
test/tests.el | 10 ++++++++++
2 files changed, 15 insertions(+)
diff --git a/forth-mode.el b/forth-mode.el
index e46326f9fb..82e98f2035 100644
--- a/forth-mode.el
+++ b/forth-mode.el
@@ -116,6 +116,10 @@
(comment-end ""))
(apply #'fill-paragraph args)))
+(defun forth-beginning-of-defun (arg)
+ (and (re-search-backward "^\\s *: \\_<" nil t (or arg 1))
+ (beginning-of-line)))
+
(unless (fboundp 'prog-mode)
(defalias 'prog-mode 'fundamental-mode))
@@ -136,6 +140,7 @@
(setq-local parse-sexp-lookup-properties t)
(forth-smie-setup)
(setq-local fill-paragraph-function #'forth-fill-paragraph)
+ (setq-local beginning-of-defun-function #'forth-beginning-of-defun)
(setq-local comment-start-skip "\\(?:(\\*\\|\\\\\\) *")
(setq-local comment-start "(")
(setq-local comment-end ")")
diff --git a/test/tests.el b/test/tests.el
index 555c9b6e6c..0b6015e7da 100644
--- a/test/tests.el
+++ b/test/tests.el
@@ -258,6 +258,16 @@ The whitespace before and including \"|\" on each line is
removed."
|: frob ( x y -- z ) ;"
#'fill-paragraph))
+(ert-deftest forth-beginning-of-defun ()
+ (forth-should-before/after
+ ": foo bar ;
+ |: baz ( x -- )
+ | if foo→ then ;"
+ ": foo bar ;
+ |→: baz ( x -- )
+ | if foo then ;"
+ #'beginning-of-defun))
+
;; FIXME: maybe insert "( )" instead of "()".
(ert-deftest forth-comment-dwim ()
(forth-should-before/after
- [nongnu] elpa/forth-mode 9f9b5cdf86 089/153: Don't send output as input, (continued)
- [nongnu] elpa/forth-mode 9f9b5cdf86 089/153: Don't send output as input, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 2e65a80a3b 110/153: Fontify buffer before testing word movement commands., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode f44fa6481f 152/153: Forth 200x core.html is no longer there., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 5502816e37 134/153: Make it easier to emulate Open Firmware indentation style, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 5076a08abc 057/153: Make C-c C-k work in all Forth modes., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 7cbb60f1d7 143/153: Highlight +field and friends, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 5c1c928490 132/153: Make completion case insensitive, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 37da497572 144/153: Switch back from interaction mode to source buffer., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 05e8a02796 139/153: Highlight LEAVE, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 1f922f41f4 138/153: Declare forth-smie-basic-indent as safe local-variable., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 74c0e17c45 122/153: Improve beginning-of-defun,
ELPA Syncer <=
- [nongnu] elpa/forth-mode b40ffb3127 078/153: Fix building with Emacs 23., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 1d85344467 113/153: Add commands to browse description in Forth standards, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode c5e63e29f1 072/153: Basic indentation of control structures, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 0d22cedbaf 133/153: Improve indentation of BEGIN-STRUCTURE/END-STRUCTURE, ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 47f33ea62a 063/153: Move interaction functions to forth-interactive-mode., ELPA Syncer, 2022/01/29
- [nongnu] elpa/forth-mode 6fac263222 068/153: Automatic build with Wercker., ELPA Syncer, 2022/01/29
- [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