[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/d-mode 1908f59 236/346: Speed up imenu a bit
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/d-mode 1908f59 236/346: Speed up imenu a bit |
Date: |
Sun, 29 Aug 2021 11:00:37 -0400 (EDT) |
branch: elpa/d-mode
commit 1908f59c0e5f9523f65c5738708a5c2348cec924
Author: Vladimir Panteleev <git@thecybershadow.net>
Commit: Vladimir Panteleev <git@thecybershadow.net>
Speed up imenu a bit
Don't bother with non-toplev callbacks.
---
d-mode.el | 129 +++++++++++++++++++++++++++++++-------------------------------
1 file changed, 65 insertions(+), 64 deletions(-)
diff --git a/d-mode.el b/d-mode.el
index 3dc6016..d6bae36 100644
--- a/d-mode.el
+++ b/d-mode.el
@@ -7,7 +7,7 @@
;; Maintainer: Russel Winder <russel@winder.org.uk>
;; Vladimir Panteleev <vladimir@thecybershadow.net>
;; Created: March 2007
-;; Version: 201909092055
+;; Version: 201909092103
;; Keywords: D programming language emacs cc-mode
;; Package-Requires: ((emacs "25.1"))
@@ -567,74 +567,75 @@ Each list item should be a regexp matching a single
identifier."
c-decl-start-re
(eval c-maybe-decl-faces)
(lambda (match-pos inside-macro toplev)
- (let* ((got-context
- (c-get-fontification-context
- match-pos nil toplev))
- (context (car got-context))
- (decl-or-cast
- (when (eq context 'top)
- (c-forward-decl-or-cast-1
- match-pos
- context
- nil ; last-cast-end
- ))))
- (when (and decl-or-cast (not (eq (car decl-or-cast) last-spot)))
- (let* ((id-start (progn
- (goto-char (car decl-or-cast))
- (when (eq (char-after) ?=)
- (c-backward-syntactic-ws)
- (c-simple-skip-symbol-backward))
+ (when toplev
+ (let* ((got-context
+ (c-get-fontification-context
+ match-pos nil toplev))
+ (context (car got-context))
+ (decl-or-cast
+ (when (eq context 'top)
+ (c-forward-decl-or-cast-1
+ match-pos
+ context
+ nil ; last-cast-end
+ ))))
+ (when (and decl-or-cast (not (eq (car decl-or-cast) last-spot)))
+ (let* ((id-start (progn
+ (goto-char (car decl-or-cast))
+ (when (eq (char-after) ?=)
+ (c-backward-syntactic-ws)
+ (c-simple-skip-symbol-backward))
+ (point)))
+ (id-end (progn
+ (goto-char id-start)
+ (forward-char)
+ (c-end-of-current-token)
(point)))
- (id-end (progn
- (goto-char id-start)
- (forward-char)
- (c-end-of-current-token)
- (point)))
- (name (buffer-substring-no-properties id-start id-end))
- (id-prev-token (progn
- (goto-char id-start)
- (c-backward-syntactic-ws)
- (let ((end (point)))
- (when (c-simple-skip-symbol-backward)
- (buffer-substring-no-properties (point)
end)))))
- (type-start (cadddr decl-or-cast))
- (type-prev-token (when type-start
- (goto-char type-start)
+ (name (buffer-substring-no-properties id-start id-end))
+ (id-prev-token (progn
+ (goto-char id-start)
(c-backward-syntactic-ws)
(let ((end (point)))
(when (c-simple-skip-symbol-backward)
(buffer-substring-no-properties
(point) end)))))
- (next-char (progn
- (goto-char id-end)
- (c-forward-syntactic-ws)
- (char-after)))
- (kind (cond
- ((equal id-prev-token "enum")
- "Enums")
- ((equal id-prev-token "class")
- "Classes")
- ((equal id-prev-token "struct")
- "Structs")
- ((equal id-prev-token "template")
- "Templates")
- ((equal id-prev-token "alias")
- "Aliases")
- ((equal type-prev-token "alias")
- "Aliases") ; old-style alias
- ((memq next-char '(?\; ?= ?,))
- "Variables")
- ((memq next-char '(?\())
- nil) ; function
- (t ; unknown
- id-prev-token))))
-
- (setq last-spot (car decl-or-cast)
- d-spots
- (cons
- (if kind
- (list kind (cons name (car decl-or-cast)))
- (cons name (car decl-or-cast)))
- d-spots)))))))
+ (type-start (cadddr decl-or-cast))
+ (type-prev-token (when type-start
+ (goto-char type-start)
+ (c-backward-syntactic-ws)
+ (let ((end (point)))
+ (when (c-simple-skip-symbol-backward)
+ (buffer-substring-no-properties
(point) end)))))
+ (next-char (progn
+ (goto-char id-end)
+ (c-forward-syntactic-ws)
+ (char-after)))
+ (kind (cond
+ ((equal id-prev-token "enum")
+ "Enums")
+ ((equal id-prev-token "class")
+ "Classes")
+ ((equal id-prev-token "struct")
+ "Structs")
+ ((equal id-prev-token "template")
+ "Templates")
+ ((equal id-prev-token "alias")
+ "Aliases")
+ ((equal type-prev-token "alias")
+ "Aliases") ; old-style alias
+ ((memq next-char '(?\; ?= ?,))
+ "Variables")
+ ((memq next-char '(?\())
+ nil) ; function
+ (t ; unknown
+ id-prev-token))))
+
+ (setq last-spot (car decl-or-cast)
+ d-spots
+ (cons
+ (if kind
+ (list kind (cons name (car decl-or-cast)))
+ (cons name (car decl-or-cast)))
+ d-spots))))))))
(nreverse d-spots)))
;;----------------------------------------------------------------------------
- [nongnu] elpa/d-mode 86a86dd 110/346: Merge pull request #68 from sdilts/master, (continued)
- [nongnu] elpa/d-mode 86a86dd 110/346: Merge pull request #68 from sdilts/master, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode facf01a 187/346: Fix imenu with inout types, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 951ca5c 212/346: Remove code incompatible with older Emacs versions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 4dce323 229/346: README.md: Add note about compatibility, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode b1d752a 233/346: Fix buffer modification when invoking imenu, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 441761c 237/346: Delete old keyword lists for imenu, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode f7ac740 235/346: Fix imenu classification of some variables, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 29940d7 226/346: Makefile: Add some utility commands, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode d14a001 239/346: Fix imenu false positive for static imports, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 8606775 240/346: Fix imenu jump position for new-style aliases, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 1908f59 236/346: Speed up imenu a bit,
ELPA Syncer <=
- [nongnu] elpa/d-mode 627a6f8 273/346: Move c-forward-decl-or-cast-1 into d-mode.el, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode e9278a9 114/346: Reimplement compilation-mode error message detection for DMD, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode aff84c6 115/346: update support for Emacs 25, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode a564656 116/346: Merge pull request #71 from brdjns/patch-1, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 23a3661 119/346: Merge pull request #72 from nordlow/fix-d-exceptions-regexp, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode e5d21be 121/346: README: Update shield images and links to use official project repository, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 576dd29 123/346: tests: Actually test compilation-mode error list correctness, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 7817dbc 122/346: d-mode-test: Announce mismatched values of inline tests, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 8ccad32 136/346: Simplify cascaded call indentation setup, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 0b8ed61 152/346: Fix highlighting of const variable declarations, ELPA Syncer, 2021/08/29