3 Commits 149cfa579e ... 90200f5f22

Auteur SHA1 Bericht Datum
  Alex Kost 90200f5f22 Add 'imenus-section-face' 4 jaren geleden
  Alex Kost 41bcfaf2a7 README: Use https everywhere 4 jaren geleden
  Alex Kost e9982cbe73 Add 'imenus-inherit-input-method' variable 4 jaren geleden
2 gewijzigde bestanden met toevoegingen van 30 en 10 verwijderingen
  1. 7 7
      README.org
  2. 23 3
      imenus.el

+ 7 - 7
README.org

@@ -1,6 +1,6 @@
-[[http://www.gnu.org/licenses/gpl-3.0.txt][file:https://img.shields.io/badge/license-GPL_3-orange.svg]]
-[[http://melpa.org/#/imenus][file:http://melpa.org/packages/imenus-badge.svg]]
-[[http://stable.melpa.org/#/imenus][file:http://stable.melpa.org/packages/imenus-badge.svg]]
+[[https://www.gnu.org/licenses/gpl-3.0.txt][file:https://img.shields.io/badge/license-GPL_3-orange.svg]]
+[[https://melpa.org/#/imenus][file:https://melpa.org/packages/imenus-badge.svg]]
+[[https://stable.melpa.org/#/imenus][file:https://stable.melpa.org/packages/imenus-badge.svg]]
 
 ** About
 
@@ -14,7 +14,7 @@ specified buffers by pressing an according key binding.
 
 *** Automatic
 
-This package can be installed from [[http://melpa.org/][MELPA]] (with =M-x package-install= or
+This package can be installed from [[https://melpa.org/][MELPA]] (with =M-x package-install= or
 =M-x list-packages=).
 
 *** Manual
@@ -51,9 +51,9 @@ For the manual installation, clone the repo, add the directory to
     a group prefix (i.e., "Variables ⇨ imenus-delimiter").  The
     difference is shown in the following screenshots:
 
-    | Imenu                               | Imenus                              |
-    |-------------------------------------+-------------------------------------|
-    | [[http://i.imgur.com/mVG7uOI.png][file:http://i.imgur.com/mVG7uOI.png]] | [[http://i.imgur.com/3fAZetY.png][file:http://i.imgur.com/3fAZetY.png]] |
+    | Imenu                                | Imenus                               |
+    |--------------------------------------+--------------------------------------|
+    | [[https://i.imgur.com/mVG7uOI.png][file:https://i.imgur.com/mVG7uOI.png]] | [[https://i.imgur.com/3fAZetY.png][file:https://i.imgur.com/3fAZetY.png]] |
 
 - =M-x imenus-mode-buffers=
 

+ 23 - 3
imenus.el

@@ -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