[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode 0cf2bc3 255/486: Merge pull request #157 from fm
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode 0cf2bc3 255/486: Merge pull request #157 from fmdkdd/master |
Date: |
Sat, 7 Aug 2021 09:25:30 -0400 (EDT) |
branch: elpa/rust-mode
commit 0cf2bc30ec29ad215242b617748c9fa1aa91c407
Merge: 4fce178 c69adaf
Author: Niko Matsakis <niko@alum.mit.edu>
Commit: Niko Matsakis <niko@alum.mit.edu>
Merge pull request #157 from fmdkdd/master
Improve imenu support
---
rust-mode.el | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/rust-mode.el b/rust-mode.el
index b0f8379..16aaa6d 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,16 +1195,15 @@ 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))
- '("enum" "struct" "type" "mod" "fn" "trait"))
- `(("Impl" ,(rust-re-item-def "impl") 1)))
+ (list (capitalize x) (rust-re-item-def-imenu x) 1))
+ '("enum" "struct" "type" "mod" "fn" "trait" "impl"))
+ `(("Macro" ,(rust-re-item-def-imenu "macro_rules!") 1)))
"Value for `imenu-generic-expression' in Rust mode.
-Create a flat index of the item definitions in a Rust file.
+Create a hierarchical index of the item definitions in a Rust file.
-Imenu will show all the enums, structs, etc. at the same level.
-Implementations will be shown under the `Impl` subheading. Use
-idomenu (imenu with `ido-mode') for best mileage.")
+Imenu will show all the enums, structs, etc. in their own subheading.
+Use idomenu (imenu with `ido-mode') for best mileage.")
;;; Defun Motions
@@ -1334,6 +1339,7 @@ This is written mainly to be used as
`end-of-defun-function' for Rust."
(setq-local comment-multi-line t)
(setq-local comment-line-break-function 'rust-comment-indent-new-line)
(setq-local imenu-generic-expression rust-imenu-generic-expression)
+ (setq-local imenu-syntax-alist '((?! . "w"))) ; For macro_rules!
(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)
- [nongnu] elpa/rust-mode 5937589 169/486: set :safe on two defcustoms, (continued)
- [nongnu] elpa/rust-mode 5937589 169/486: set :safe on two defcustoms, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 102ad5f 181/486: Merge pull request #67 from tromey/fix-two-docstrings, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 88ff62a 182/486: Remove unnecessary code with call to undefined function, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode c49bb12 184/486: Cache (regexp-opt rust-special-types 'symbols) in rust-is-lt-char-operator, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ec3855f 188/486: Recognize runaway raw strings, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 99c5571 190/486: Merge pull request #68 from tromey/fix-issue-53, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 5f5a428 192/486: Merge pull request #88 from kw-udon/nested-comment, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 1ff1d75 193/486: Merge pull request #90 from Wilfred/fix_type_word_boundaries, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 30d1dac 198/486: Recognize compiler help and notes as "info" messages, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 61a35f6 202/486: Merge pull request #97 from syohex/update-url, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 0cf2bc3 255/486: Merge pull request #157 from fmdkdd/master,
ELPA Syncer <=
- [nongnu] elpa/rust-mode c2a0c13 269/486: Add info to enable rustfmt, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode cd09a54 280/486: Merge pull request #189 from froydnj/minor-cleanups, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 19e6f60 291/486: Merge pull request #199 from tromey/open-paren-in-column-0, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 7f7b2ac 293/486: mention keybinding for rustfmt, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 758ab8c 303/486: Add support for "default" keyword, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode a73e9ee 004/486: Update reserved words for syntax highlighters (vim is still behind, though), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 7724813 306/486: Merge pull request #206 from cjhowe7/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ac6a45e 308/486: Merge pull request #213 from KeenS/restore-points, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode d38bfb8 309/486: Set `compile-command' in `rust-mode'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode c00c8a9 312/486: Require `json'., ELPA Syncer, 2021/08/07