aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2024-05-29 21:43:57 +0300
committerEli Zaretskii2024-05-29 21:43:57 +0300
commit98149ad31ea2cfd5a82f95443affd665c9da667b (patch)
tree597cb187b4b5c447ee32f6c46e0658edfc88eb54
parentf469ab73a777c9930582af8b4fd22967f07808aa (diff)
downloademacs-98149ad31ea2cfd5a82f95443affd665c9da667b.tar.gz
emacs-98149ad31ea2cfd5a82f95443affd665c9da667b.zip
; Improve documentation of new Imenu features
* doc/emacs/programs.texi (Imenu): Update documentation of 'imenu-flatten'. * etc/NEWS: Fix wording of 'imenu-flatten's entry. * lisp/imenu.el (imenu-flatten): Fix doc string and value descriptions. (Bug#70846)
-rw-r--r--doc/emacs/programs.texi41
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/imenu.el28
3 files changed, 50 insertions, 23 deletions
diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi
index 8ab5033795d..b944d24d91f 100644
--- a/doc/emacs/programs.texi
+++ b/doc/emacs/programs.texi
@@ -331,20 +331,43 @@ a negative argument moves back to the start of a sentence.
331@cindex index of buffer definitions 331@cindex index of buffer definitions
332@cindex buffer definitions index 332@cindex buffer definitions index
333 333
334 The Imenu facility offers a way to find the major definitions in 334 The Imenu facility offers a way to find the major definitions in a
335a file by name. It is also useful in text formatter major modes, 335file by name. It is useful both in programming-language major modes,
336where it treats each chapter, section, etc., as a definition. 336where the definitions are variables, functions, etc., and in text
337(@xref{Xref}, for a more powerful feature that handles multiple files 337formatter major modes, where it treats each chapter, section, etc., as a
338together.) 338definition. (@xref{Xref}, for a more powerful feature that handles
339multiple files together.)
339 340
340@findex imenu 341@findex imenu
341@vindex imenu-flatten 342@vindex imenu-flatten
342 If you type @kbd{M-g i} (@code{imenu}), it reads the name of a 343 If you type @kbd{M-g i} (@code{imenu}), it reads the name of a
343definition using the minibuffer, then moves point to that definition. 344definition using the minibuffer, then moves point to that definition.
344You can use completion to specify the name; the command always 345You can use completion to specify the name; the command displays the
345displays the whole list of valid names. If you set @code{imenu-flatten} 346list of matching valid names in the completions buffer. If the index is
346to a non-@code{nil} value, then instead of the nested menu 347hierarchical, then by default the completion candidates are also shown
347you can select a completion candidate from the flat list. 348hierarchically, as a nested list: first you need to choose a section,
349then a subsection, etc., and finally the name of the definition.
350However, if you set @code{imenu-flatten} to a non-@code{nil} value, then
351instead of the nested menu you can select a completion candidate from a
352flattened list of definitions. How the sections and subsections are
353shown in the flattened list of completion candidates depends on the
354value of @code{imenu-flatten}, which can be one of the following:
355
356@table @code
357@vindex imenu-level-separator
358@item prefix
359This shows each candidate prefixed by names of its section, subsection,
360subsubsection, etc., with each level separated from the next by the
361string that is the value of @code{imenu-level-separator}, by default
362@samp{:}.
363
364@item annotation
365This shows the section names as annotations, following each definition
366name.
367
368@item group
369This shows the completion candidates grouped by their sections.
370@end table
348 371
349@findex imenu-add-menubar-index 372@findex imenu-add-menubar-index
350 Alternatively, you can bind the command @code{imenu} to a mouse 373 Alternatively, you can bind the command @code{imenu} to a mouse
diff --git a/etc/NEWS b/etc/NEWS
index d8d55494128..9416ced5a0d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1059,8 +1059,8 @@ point is not in a comment or a string. It is by default bound to
1059 1059
1060+++ 1060+++
1061*** New user option 'imenu-flatten'. 1061*** New user option 'imenu-flatten'.
1062It defines whether to flatten the list of sections in an imenu 1062It controls whether to flatten the list of sections in an imenu, and
1063or show it nested. 1063how to display the sections in the flattened list.
1064 1064
1065+++ 1065+++
1066*** The sort order of Imenu completions can now be customized. 1066*** The sort order of Imenu completions can now be customized.
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 3aec32fa708..708a39a0f71 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -151,18 +151,22 @@ Used for flattening nested indexes with name concatenation."
151(defcustom imenu-flatten nil 151(defcustom imenu-flatten nil
152 "Whether to flatten the list of sections in an imenu or show it nested. 152 "Whether to flatten the list of sections in an imenu or show it nested.
153If nil, use nested indexes. 153If nil, use nested indexes.
154If `prefix', pop up the completion buffer with a flattened menu 154If the value is `prefix', pop up the completion buffer with a
155where section names are used as a prefix. 155flattened menu where section names are prepended to completion
156If `annotation', use completion annotation as a suffix 156candidates as prefixes.
157to append section names after the index names. 157If the value is `annotation', annotate each completion candidate
158If `group', split completions into groups. 158with a suffix that is the section name to which it belongs.
159 159If the value is `group', split completion candidates into groups
160The string from `imenu-level-separator' is used to separate names of 160according to the sections.
161nested levels while flattening nested indexes with name concatenation." 161Any other value is treated as `prefix'.
162 :type '(choice (const :tag "Nested" nil) 162
163 (const :tag "By prefix" prefix) 163The value of `imenu-level-separator', a string, is used to separate
164 (const :tag "By annotation" annotation) 164names from different flattened levels, such as section names, from the
165 (const :tag "By group" group)) 165names of completion candidates."
166 :type '(choice (const :tag "Show nested list" nil)
167 (const :tag "Flat list with sections as prefix" prefix)
168 (const :tag "Flat list annotated with sections" annotation)
169 (const :tag "Flat list grouped by sections" group))
166 :version "30.1") 170 :version "30.1")
167 171
168(defcustom imenu-generic-skip-comments-and-strings t 172(defcustom imenu-generic-skip-comments-and-strings t