emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/bluetooth 2560749 15/57: adds Imenu integration


From: Stefan Monnier
Subject: [elpa] externals/bluetooth 2560749 15/57: adds Imenu integration
Date: Thu, 7 Nov 2019 23:28:50 -0500 (EST)

branch: externals/bluetooth
commit 25607496a057b231857d18bd02e6aff2df3f2afc
Author: Raffael Stocker <address@hidden>
Commit: Raffael Stocker <address@hidden>

    adds Imenu integration
---
 bluetooth.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/bluetooth.el b/bluetooth.el
index 383b2f4..4a93569 100644
--- a/bluetooth.el
+++ b/bluetooth.el
@@ -270,6 +270,16 @@ devices, as well as setting properties."
                            (mapcar #'car bluetooth--list-format))))
          device-info))
 
+;;; Build up the index for Imenu.  This function is used as
+;;; `imenu-create-index-function'.
+(defun bluetooth--create-imenu-index ()
+  "Create the index for Imenu."
+  (goto-char (point-min))
+  (cl-loop for (pos entry) = (list (point) (tabulated-list-get-entry))
+          while entry
+          do (forward-line 1)
+          collect (cons (elt entry 0) pos)))
+
 ;;; This function calls FUNCTION with ARGS given the device-id DEV-ID and
 ;;; Bluez API.  This is used on D-Bus functions.
 (defun bluetooth--call-method (dev-id api function &rest args)
@@ -375,7 +385,8 @@ This function only uses the first adapter reported by 
Bluez."
        (bluetooth--register-agent)
        (add-hook 'kill-buffer-hook #'bluetooth--cleanup nil t)
        (setq-local mode-line-misc-info
-                  (cl-pushnew bluetooth--mode-info mode-line-misc-info)))
+                  (cl-pushnew bluetooth--mode-info mode-line-misc-info))
+       (setq imenu-create-index-function #'bluetooth--create-imenu-index))
      (tabulated-list-print))))
 
 ;;; Bluetooth pairing agent code



reply via email to

[Prev in Thread] Current Thread [Next in Thread]