[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sweeprolog c6066eabb9 144/166: ADDED: support imenu in swe
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/sweeprolog c6066eabb9 144/166: ADDED: support imenu in sweep-mode buffers |
Date: |
Fri, 30 Sep 2022 04:59:33 -0400 (EDT) |
branch: elpa/sweeprolog
commit c6066eabb9cea47581b76da7b9d3418e83cc7361
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>
ADDED: support imenu in sweep-mode buffers
---
sweep.el | 17 +++++++++++++++++
sweep.pl | 11 +++++++++++
2 files changed, 28 insertions(+)
diff --git a/sweep.el b/sweep.el
index 8297f5262b..7ba846beb1 100644
--- a/sweep.el
+++ b/sweep.el
@@ -2000,6 +2000,22 @@ Interactively, POINT is set to the current point."
(xref-make-file-location path line 0))))
matches)))
+(defun sweep-create-index-function ()
+ (sweep-open-query "user"
+ "sweep"
+ "sweep_imenu_index"
+ (buffer-file-name))
+ (let ((sol (sweep-next-solution)))
+ (sweep-close-query)
+ (when (sweep-true-p sol)
+ (seq-map (lambda (entry)
+ (let ((car (car entry))
+ (line (cdr entry)))
+ (goto-char (point-min))
+ (forward-line (1- line))
+ (cons car (line-beginning-position))))
+ (cdr sol)))))
+
(defvar-local sweep--timer nil)
(defvar-local sweep--colourise-buffer-duration 0.2)
@@ -2010,6 +2026,7 @@ Interactively, POINT is set to the current point."
(setq-local comment-start "%")
(setq-local comment-start-skip "\\(?:/\\*+ *\\|%+ *\\)")
(setq-local parens-require-spaces nil)
+ (setq-local imenu-create-index-function #'sweep-create-index-function)
(setq-local beginning-of-defun-function #'sweep-beginning-of-top-term)
(setq-local end-of-defun-function #'sweep-end-of-top-term)
(setq-local forward-sexp-function #'sweep-forward-sexp-function)
diff --git a/sweep.pl b/sweep.pl
index a161694a6b..de9be3e20e 100644
--- a/sweep.pl
+++ b/sweep.pl
@@ -53,6 +53,7 @@
sweep_pack_install/2,
sweep_prefix_ops/2,
sweep_op_info/2,
+ sweep_imenu_index/2,
sweep_module_path/2
]).
@@ -727,3 +728,13 @@ with_buffer_stream(Stream, String, Goal) :-
( close(Stream),
free_memory_file(H)
)).
+
+sweep_imenu_index(Path, Index) :-
+ atom_string(Atom, Path),
+ findall([String|L],
+ ( xref_defined(Atom, D, H),
+ xref_definition_line(H, L),
+ pi_head(PI, D),
+ term_string(PI, String)
+ ),
+ Index).
- [nongnu] elpa/sweeprolog c60df8e7e3 101/166: DOC: Loading buffers: new section, (continued)
- [nongnu] elpa/sweeprolog c60df8e7e3 101/166: DOC: Loading buffers: new section, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 4c1e510bbf 125/166: FIXED: handle some more color terms, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 588cfb0f63 130/166: BUILD: Inline sweep.h in sweep.c, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 12bddb3f75 117/166: ENHANCED: don't record one-character inputs in the top level history, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog f82827fdb0 093/166: ENHANCED: Display message if unable to find predicate location, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 0f1119fb75 118/166: FIXED: indentation after with inline comments, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog f9218dc461 123/166: PORT: use (eql sweep) instead of (eql 'sweep) in cl-defmethods..., ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 0db900634f 120/166: DOC: update commentary section in sweep.el, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 6f7aa88050 100/166: ENHANCED: (sweep-load-buffer): report results, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 12fbadf13b 137/166: sweep.el: remove outdated sweep--compile-module function, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog c6066eabb9 144/166: ADDED: support imenu in sweep-mode buffers,
ELPA Syncer <=
- [nongnu] elpa/sweeprolog 8179cb4204 135/166: FIXED: qualify calls to sweep_funcall/2, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 7085c2e830 142/166: ADDED: sweep-mode: make sexp-based commands work on Prolog terms, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 6434715829 149/166: FIXED: use a more robust mechanism for finding sweep-module, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 69be982c41 150/166: FIXED: don't rely on string-lines added in Emacs 28.1, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 3e6fae1244 146/166: DOC: fix typos in README.org, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 6517af47b3 134/166: FIXED: sweep-init-args separate arguments, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 24a1e14ee9 151/166: MODIFIED: Breaking change: rename sweep.el to sweeprolog.el..., ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 13c7551015 156/166: ENHANCED: only fontify visible sweeprolog-mode buffers on idle, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog cada0d3871 166/166: DOC: document quasi-quotation highlighting in the manual, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 85af4010e8 158/166: Use a public mailing list in the Maintainer package header, ELPA Syncer, 2022/09/30