[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/forth-mode e6ee5ddf99 069/153: Handle ( ...) comments with
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/forth-mode e6ee5ddf99 069/153: Handle ( ...) comments with syntax-propertize-function |
Date: |
Sat, 29 Jan 2022 08:02:17 -0500 (EST) |
branch: elpa/forth-mode
commit e6ee5ddf99df2f24a0b426dbfc41d25863563ec3
Author: Helmut Eller <eller.helmut@gmail.com>
Commit: Lars Brinkhoff <lars@nocrew.org>
Handle ( ...) comments with syntax-propertize-function
---
forth-mode.el | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/forth-mode.el b/forth-mode.el
index 2d618670da..190ea925fd 100644
--- a/forth-mode.el
+++ b/forth-mode.el
@@ -35,8 +35,8 @@
(let ((table (make-syntax-table)))
(modify-syntax-entry ?\\ "<" table)
(modify-syntax-entry ?\n ">" table)
- (modify-syntax-entry ?\( "<1" table)
- (modify-syntax-entry ?\) ">4" table)
+ (modify-syntax-entry ?\( "!" table)
+ (modify-syntax-entry ?\) "_" table)
(modify-syntax-entry ?* "_23n" table)
(modify-syntax-entry ?\{ "<" table)
(modify-syntax-entry ?\} ">" table)
@@ -73,6 +73,27 @@
(defun forth-word-at-point ()
(buffer-substring (forth-symbol-start) (forth-symbol-end)))
+(defun forth--ppss-in-comment-p (pos)
+ (not (null (elt (syntax-ppss pos) 4))))
+
+(defun forth--syntax-propertize (start end)
+ (save-excursion
+ (goto-char start)
+ ;; Fix some cases of comment syntax
+ (while (re-search-forward "(\\|\\\\" end t)
+ (when (and (forth--ppss-in-comment-p (point))
+ (not (forth--ppss-in-comment-p (1- (point)))))
+ (cond ((save-excursion
+ (goto-char (1- (point)))
+ (not (looking-at "\\([ \n]\\|\\\`\\)\\((\\|\\\\\\)[ \n]")))
+ (put-text-property (point) (forth-symbol-end)
+ 'syntax-table (string-to-syntax "_")))
+ ((and (looking-at "(")
+ (re-search-forward ")" nil t))
+ (put-text-property (point) (1+ (point))
+ 'syntax-table (string-to-syntax "!")))))
+ (forward-char))))
+
(defun forth-expand-symbol ()
(let ((list (forth-words)))
(when (fboundp 'imenu--make-index-alist)
@@ -119,6 +140,8 @@
(forth-block-mode))
(setq font-lock-defaults '(forth-font-lock-keywords))
(setq-local completion-at-point-functions '(forth-expand-symbol))
+ (setq-local syntax-propertize-function #'forth--syntax-propertize)
+ (setq-local parse-sexp-lookup-properties t)
(setq ;; font-lock-defaults
comment-start-skip "\\((\\*?\\|\\\\\\) *"
comment-start "("
- [nongnu] elpa/forth-mode b40ffb3127 078/153: Fix building with Emacs 23., (continued)
- [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
- [nongnu] elpa/forth-mode e6ee5ddf99 069/153: Handle ( ...) comments with syntax-propertize-function,
ELPA Syncer <=
- [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, 2022/01/29
- [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