|
@@ -1,6 +1,6 @@
|
|
|
;;; imenus.el --- Imenu for multiple buffers and without subgroups
|
|
|
|
|
|
-;; Copyright © 2014–2018 Alex Kost
|
|
|
+;; Copyright © 2014–2018, 2020 Alex Kost
|
|
|
|
|
|
;; Author: Alex Kost <alezost@gmail.com>
|
|
|
;; Created: 19 Dec 2014
|
|
@@ -57,6 +57,16 @@
|
|
|
"Easy jumping to buffers places."
|
|
|
:group 'convenience)
|
|
|
|
|
|
+(defgroup imenus-faces nil
|
|
|
+ "Imenus faces."
|
|
|
+ :group 'imenus
|
|
|
+ :group 'faces)
|
|
|
+
|
|
|
+(defface imenus-section-face
|
|
|
+ '((t :inherit font-lock-comment-face))
|
|
|
+ "Face used for titles of sections."
|
|
|
+ :group 'imenus-faces)
|
|
|
+
|
|
|
(defcustom imenus-sort-function nil
|
|
|
"Function used to sort imenus items.
|
|
|
The function should take 2 arguments and return t if the first
|
|
@@ -82,6 +92,14 @@ subsection name and a buffer where the item come from."
|
|
|
:type 'string
|
|
|
:group 'imenus)
|
|
|
|
|
|
+(defcustom imenus-inherit-input-method t
|
|
|
+ "If non-nil, inherit the input method from the current buffer.
|
|
|
+This value is passed as the last argument to
|
|
|
+`imenus-completing-read-function'. See `completing-read' for
|
|
|
+details."
|
|
|
+ :type 'boolean
|
|
|
+ :group 'imenus)
|
|
|
+
|
|
|
(defvar imenus-completing-read-function completing-read-function
|
|
|
"Function used to read a string from minibuffer with completions.
|
|
|
It should accept the same arguments as `completing-read'.")
|
|
@@ -164,7 +182,8 @@ Make this command return the current user input."
|
|
|
(defun imenus-item-name-default (item-name &optional section _buffer)
|
|
|
"Concatenate SECTION and ITEM-NAME with `imenus-delimiter'."
|
|
|
(if section
|
|
|
- (concat section imenus-delimiter item-name)
|
|
|
+ (concat (propertize section 'face 'imenus-section-face)
|
|
|
+ imenus-delimiter item-name)
|
|
|
item-name))
|
|
|
|
|
|
(defun imenus-item-name-full (item-name section buffer)
|
|
@@ -289,7 +308,8 @@ if this string does not match any item."
|
|
|
(add-hook 'minibuffer-setup-hook 'imenus-minibuffer-setup)
|
|
|
(let* ((input (funcall imenus-completing-read-function
|
|
|
prompt index nil nil initial-input
|
|
|
- 'imenu--history-list name))
|
|
|
+ 'imenu--history-list name
|
|
|
+ imenus-inherit-input-method))
|
|
|
(item (assoc input index)))
|
|
|
(if (or imenus-exit-status (null item))
|
|
|
input
|