From 6b7f64016c8189d03d91dbc5c9441290678f9b22 Mon Sep 17 00:00:00 2001
From: Vedang Manerikar <ved.manerikar@gmail.com>
Date: Mon, 18 Nov 2024 20:09:01 +0530
Subject: [PATCH] Set imenu-max-item-length to unlimited

This fixes consult-imenu behaviour -- entries which were longer than
this length were being dropped because of the way consult-imenu
implements collection.
---
 unravel-emacs.org                 | 22 +++++++++++++++++++---
 unravel-modules/unravel-search.el |  7 +++++++
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/unravel-emacs.org b/unravel-emacs.org
index 1e4755b..1ddde81 100644
--- a/unravel-emacs.org
+++ b/unravel-emacs.org
@@ -2209,7 +2209,23 @@ For starters, just learn:
 Now on to the configurations.
 #+end_quote
 
-** The =unravel-search.el= on isearch lax space
+** The =unravel-search.el= section on imenu
+:PROPERTIES:
+:CUSTOM_ID: h:7151F001-75DB-4808-95CB-3BC6BEC6A8CA
+:END:
+
+~imenu~ is amazing and I use it as my primary tool for navigating any file. Here, we make a small tweak to ensure that ~consult-imenu~ returns good ~imenu~ results to us.
+
+#+begin_src emacs-lisp :tangle "unravel-modules/unravel-search.el" :mkdirp yes
+  (use-package imenu
+    :ensure nil
+    :config
+    ;; Don't limit item length, this makes imenu less useful in
+    ;; consult-imenu
+    (setq imenu-max-item-length 'unlimited))
+#+end_src
+
+** The =unravel-search.el= section on isearch lax space
 :PROPERTIES:
 :CUSTOM_ID: h:95947b37-2071-4ee7-a201-8e19bf3322e9
 :END:
@@ -2226,7 +2242,7 @@ do exactly this for regular =C-s= (~isearch-forward~) and =C-r=
 (~isearch-backward~).
 #+end_quote
 
-#+begin_src emacs-lisp :tangle "unravel-modules/unravel-search.el" :mkdirp yes
+#+begin_src emacs-lisp :tangle "unravel-modules/unravel-search.el"
   ;;; Isearch, occur, grep
   (use-package isearch
     :ensure nil
@@ -2260,7 +2276,7 @@ longer in character count than ~lazy-highlight-no-delay-length~.
   (setq lazy-highlight-no-delay-length 4))
 #+end_src
 
-** The =unravel-search.el= on isearch match counter
+** The =unravel-search.el= section on isearch match counter
 :PROPERTIES:
 :CUSTOM_ID: h:acfdc17f-7ffb-48d3-90ff-49bd00463934
 :END:
diff --git a/unravel-modules/unravel-search.el b/unravel-modules/unravel-search.el
index b4186e4..65db02a 100644
--- a/unravel-modules/unravel-search.el
+++ b/unravel-modules/unravel-search.el
@@ -1,3 +1,10 @@
+(use-package imenu
+  :ensure nil
+  :config
+  ;; Don't limit item length, this makes imenu less useful in
+  ;; consult-imenu
+  (setq imenu-max-item-length 'unlimited))
+
 ;;; Isearch, occur, grep
 (use-package isearch
   :ensure nil