[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode 6b57bbf 117/486: Make features (and their tests)
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode 6b57bbf 117/486: Make features (and their tests) work on emacs 23 |
Date: |
Sat, 7 Aug 2021 09:25:01 -0400 (EDT) |
branch: elpa/rust-mode
commit 6b57bbf52530acdfdd9cc4b6c2ec198d0ac57e22
Author: Micah Chalmer <micah@micahchalmer.net>
Commit: Micah Chalmer <micah@micahchalmer.net>
Make features (and their tests) work on emacs 23
---
rust-mode-tests.el | 6 +++++-
rust-mode.el | 41 ++++++++++++-----------------------------
2 files changed, 17 insertions(+), 30 deletions(-)
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index a0e27b0..347dcd2 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -289,7 +289,11 @@ very very very long string
(rust-test-manip-code
deindented
1
- (lambda () (indent-region 1 (buffer-size)))
+ (lambda ()
+ ;; The indentation will fial in some cases if the syntax properties are
+ ;; not set. This only happens when font-lock fontifies the buffer.
+ (font-lock-fontify-buffer)
+ (indent-region 1 (buffer-size)))
indented)))
diff --git a/rust-mode.el b/rust-mode.el
index b2e0d5d..3413592 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -116,7 +116,7 @@
;; be undone via tab.
(when (looking-at (concat "\s*\." rust-re-ident))
- (previous-line)
+ (previous-logical-line)
(end-of-line)
(let
@@ -311,6 +311,14 @@
("fn" . font-lock-function-name-face)
("static" . font-lock-constant-face)))))
+(defvar rust-mode-font-lock-syntactic-keywords
+ (mapcar (lambda (re) (list re '(1 "\"") '(2 "\"")))
+ '("\\('\\)[^']\\('\\)"
+ "\\('\\)\\\\['nrt]\\('\\)"
+ "\\('\\)\\\\x[[:xdigit:]]\\{2\\}\\('\\)"
+ "\\('\\)\\\\u[[:xdigit:]]\\{4\\}\\('\\)"
+ "\\('\\)\\\\U[[:xdigit:]]\\{8\\}\\('\\)")))
+
(defun rust-fill-prefix-for-comment-start (line-start)
"Determine what to use for `fill-prefix' based on what is at the beginning
of a line."
(let ((result
@@ -569,7 +577,7 @@ This is written mainly to be used as
`end-of-defun-function' for Rust."
(setq-local indent-line-function 'rust-mode-indent-line)
;; Fonts
- (setq-local font-lock-defaults '(rust-mode-font-lock-keywords nil nil nil
nil))
+ (setq-local font-lock-defaults '(rust-mode-font-lock-keywords nil nil nil
nil (font-lock-syntactic-keywords . rust-mode-font-lock-syntactic-keywords)))
;; Misc
(setq-local comment-start "// ")
@@ -591,33 +599,8 @@ This is written mainly to be used as
`end-of-defun-function' for Rust."
(setq-local beginning-of-defun-function 'rust-beginning-of-defun)
(setq-local end-of-defun-function 'rust-end-of-defun)
(setq-local parse-sexp-lookup-properties t)
- (add-hook 'syntax-propertize-extend-region-functions
'rust-syntax-propertize-extend-region)
- (add-hook 'post-self-insert-hook 'rust-match-angle-bracket-hook)
- (setq-local syntax-propertize-function 'rust-syntax-propertize))
-
-(defun rust-syntax-propertize-extend-region (start end)
- (save-excursion
- (goto-char start)
- (beginning-of-defun)
- (cons
- (point)
- (progn
- (goto-char end)
- (end-of-defun)
- (point)))))
-
-(defun rust-syntax-propertize (start end)
- ;; Find character literals and make the syntax table recognize the single
quote as the string delimiter
- (dolist (char-lit-re
- '("'[^']'"
- "'\\\\['nrt]'"
- "'\\\\x[[:xdigit:]]\\{2\\}'"
- "'\\\\u[[:xdigit:]]\\{4\\}'"
- "'\\\\U[[:xdigit:]]\\{8\\}'"))
- (save-excursion
- (goto-char start)
- (while (re-search-forward char-lit-re end t)
- (put-text-property (match-beginning 0) (match-end 0) 'syntax-table
rust-mode-character-literal-syntax-table)))))
+ (setq-local syntax-begin-function 'beginning-of-defun)
+ (add-hook 'post-self-insert-hook 'rust-match-angle-bracket-hook))
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))
- [nongnu] elpa/rust-mode 0e25008 043/486: rust-mode: Default rust-indent-offset to 4, not default-tab-width, (continued)
- [nongnu] elpa/rust-mode 0e25008 043/486: rust-mode: Default rust-indent-offset to 4, not default-tab-width, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 679501e 056/486: Cover all cases for padding in paragraph fills as intended, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode bee96e8 067/486: Fix emacs indentation of multi-line match patterns, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 9d8dff8 077/486: Use defvar for rust-top-item-beg-re instead, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode e2cd79b 084/486: auto merge of #14818 : tomjakubowski/rust/emacs-attributes-key-value, r=pnkfelix, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 9672625 066/486: Added more scripts to tidy check, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 7cb68f7 088/486: Add new keywords (particularly `where` & `virtual`) to editor modes., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode efbc810 089/486: Replaced some TODO by FIXME, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 13c7e25 105/486: Ignore byte-compiled files, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 3878cc6 107/486: Allow user to override which emacs is used in run_rust_emacs_tests.sh, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 6b57bbf 117/486: Make features (and their tests) work on emacs 23,
ELPA Syncer <=
- [nongnu] elpa/rust-mode 4d633fc 125/486: Merge pull request #32 from MicahChalmer/raw-string-handling, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 8d99bf8 126/486: Merge pull request #31 from pnkfelix/more-robust-test-driver, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode e16c37c 161/486: Remove Marmalade from the README, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ee171df 172/486: test $EMACS directly rather than using "which", ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode d1ed015 173/486: Distinguish face for doc-comments, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode c9c7871 179/486: Merge pull request #79 from MicahChalmer/angle-bracket-madness, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ee564d5 185/486: Merge pull request #85 from talchas/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 99b128c 187/486: Fix slowness in angle bracket matching, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 5e77aed 191/486: Correcting highlighting of capitals in function names., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 5e51aaa 194/486: Merge pull request #69 from tromey/safe-local-variables, ELPA Syncer, 2021/08/07