[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode e3c545e 252/486: imenu: don't add item defs in s
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode e3c545e 252/486: imenu: don't add item defs in single-line comments |
Date: |
Sat, 7 Aug 2021 09:25:30 -0400 (EDT) |
branch: elpa/rust-mode
commit e3c545ec266721075e6d6e136759d95f4bb798da
Author: fmdkdd <fmdkdd@gmail.com>
Commit: fmdkdd <fmdkdd@gmail.com>
imenu: don't add item defs in single-line comments
Fixes #94.
This commit changes the regexp used to build
`rust-imenu-generic-expression` to strictly match item definitions
on lines that are not single-line comments.
---
rust-mode.el | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/rust-mode.el b/rust-mode.el
index b0f8379..2e783a0 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -31,6 +31,7 @@
(defconst rust-re-ident
"[[:word:][:multibyte:]_][[:word:][:multibyte:]_[:digit:]]*")
(defconst rust-re-lc-ident
"[[:lower:][:multibyte:]_][[:word:][:multibyte:]_[:digit:]]*")
(defconst rust-re-uc-ident "[[:upper:]][[:word:][:multibyte:]_[:digit:]]*")
+(defconst rust-re-vis "pub")
(defconst rust-re-non-standard-string
(rx
@@ -543,8 +544,13 @@ buffer."
(defconst rust-re-pre-expression-operators "[-=!%&*/:<>[{(|.^;}]")
(defun rust-re-word (inner) (concat "\\<" inner "\\>"))
(defun rust-re-grab (inner) (concat "\\(" inner "\\)"))
+(defun rust-re-shy (inner) (concat "\\(?:" inner "\\)"))
(defun rust-re-item-def (itype)
(concat (rust-re-word itype) "[[:space:]]+" (rust-re-grab rust-re-ident)))
+(defun rust-re-item-def-imenu (itype)
+ (concat "^[[:space:]]*"
+ (rust-re-shy (concat (rust-re-word rust-re-vis) "[[:space:]]+")) "?"
+ (rust-re-item-def itype)))
(defconst rust-re-special-types (regexp-opt rust-special-types 'symbols))
@@ -1189,9 +1195,9 @@ the desired identifiers), but does not match type
annotations \"foo::<\"."
;;; Imenu support
(defvar rust-imenu-generic-expression
(append (mapcar #'(lambda (x)
- (list nil (rust-re-item-def x) 1))
+ (list nil (rust-re-item-def-imenu x) 1))
'("enum" "struct" "type" "mod" "fn" "trait"))
- `(("Impl" ,(rust-re-item-def "impl") 1)))
+ `(("Impl" ,(rust-re-item-def-imenu "impl") 1)))
"Value for `imenu-generic-expression' in Rust mode.
Create a flat index of the item definitions in a Rust file.
- [nongnu] elpa/rust-mode 917503b 244/486: Fix failing tests, and add a test for the fix., (continued)
- [nongnu] elpa/rust-mode 917503b 244/486: Fix failing tests, and add a test for the fix., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode a8a5e14 245/486: Fix for emacs24, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ed0b390 246/486: Merge pull request #148 from bmastenbrook/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode b971c6d 247/486: Fix #151, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode abadab0 009/486: Update rust-mode.el with new keywords., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 6275e8e 010/486: Add trait to emacs keyword table., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 9f21b28 024/486: change to 4-space indents everywhere, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode f1b6007 174/486: Merge pull request #71 from birkenfeld/doc-comments, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 07943f0 178/486: Perform syntactic angle bracket matching, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 54e24e6 200/486: Add basic license information, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode e3c545e 252/486: imenu: don't add item defs in single-line comments,
ELPA Syncer <=
- [nongnu] elpa/rust-mode 6886300 256/486: [master] Copy buffer only when format changes., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode e452995 261/486: rust--after-revert-hook should preserve point position., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode d2e57a9 263/486: fix regex to account for `[E123]`, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode bec3d0c 267/486: Test #169, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 7fb78d4 273/486: Bump version, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode f6cf013 275/486: Add instructions for version tag update requests, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 4935090 279/486: convert http links into https links, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode b8126e4 284/486: Recognize "extern" imenu items, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode a436945 294/486: Merge pull request #172 from nokaa/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 954221f 316/486: Define `rust-test-project-located' conditionally instead of using `skip-unless'., ELPA Syncer, 2021/08/07