[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 5a6217a 161/167: counsel.el (counsel-tmm): New command
From: |
Oleh Krehel |
Subject: |
[elpa] master 5a6217a 161/167: counsel.el (counsel-tmm): New command |
Date: |
Tue, 08 Dec 2015 10:50:43 +0000 |
branch: master
commit 5a6217a742b7928a94187c774c8d4e98edc0cb8b
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel.el (counsel-tmm): New command
* counsel.el (counsel-tmm-prompt): New defun.
(tmm-km-list): Define this variable here, since `tmm-get-keymap'
modifies a global variable (yuck!).
Re #316
---
counsel.el | 34 +++++++++++++++++++++++++++++++++-
1 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/counsel.el b/counsel.el
index e2dc27c..9c86ec0 100644
--- a/counsel.el
+++ b/counsel.el
@@ -966,7 +966,7 @@ Usable with `ivy-resume', `ivy-next-line-and-call' and
(defvar org-indent-indentation-per-level)
(defvar org-tags-column)
(declare-function org-get-tags-string "org")
-(declare-function org-move-to-column "org")
+(declare-function org-move-to-column "org-compat")
(defun counsel-org-change-tags (tags)
(let ((current (org-get-tags-string))
@@ -1216,6 +1216,38 @@ INITIAL-INPUT can be given as the initial minibuffer
input."
(unless (string-match "pdf$" x)
(swiper ivy-text)))))))
+(defvar tmm-km-list nil)
+(declare-function tmm-get-keymap "tmm")
+(declare-function tmm--completion-table "tmm")
+(declare-function tmm-get-keybind "tmm")
+
+(defun counsel-tmm-prompt (menu)
+ "Select and call an item from the MENU keymap."
+ (let (out
+ choice
+ chosen-string)
+ (setq tmm-km-list nil)
+ (map-keymap (lambda (k v) (tmm-get-keymap (cons k v))) menu)
+ (setq tmm-km-list (nreverse tmm-km-list))
+ (setq out (ivy-read "Menu bar: " (tmm--completion-table tmm-km-list)
+ :require-match t
+ :sort nil))
+ (setq choice (cdr (assoc out tmm-km-list)))
+ (setq chosen-string (car choice))
+ (setq choice (cdr choice))
+ (cond ((keymapp choice)
+ (counsel-tmm-prompt choice))
+ ((and choice chosen-string)
+ (setq last-command-event chosen-string)
+ (call-interactively choice)))))
+
+(defun counsel-tmm ()
+ "Text-mode emulation of looking and choosing from a menubar."
+ (interactive)
+ (require 'tmm)
+ (run-hooks 'menu-bar-update-hook)
+ (counsel-tmm-prompt (tmm-get-keybind [menu-bar])))
+
(defcustom counsel-yank-pop-truncate nil
"When non-nil, truncate the display of long strings."
:group 'ivy)
- [elpa] master ed9169d 158/167: swiper.el (swiper--update-input-ivy): Add a work-around for "M-j", (continued)
- [elpa] master ed9169d 158/167: swiper.el (swiper--update-input-ivy): Add a work-around for "M-j", Oleh Krehel, 2015/12/08
- [elpa] master 0332b3e 151/167: Remove 'field text property for twittering-mode, Oleh Krehel, 2015/12/08
- [elpa] master 5cfe6e6 148/167: Fixes on the previous docstring edits, Oleh Krehel, 2015/12/08
- [elpa] master 435e9d4 159/167: Use :caller for ivy-re-builders-alist, Oleh Krehel, 2015/12/08
- [elpa] master 8dd88e4 149/167: doc/Changelog.org: Update up to 2bec99d, Oleh Krehel, 2015/12/08
- [elpa] master 706349f 160/167: swiper.el (swiper-font-lock-ensure): Add vc-dir-mode, Oleh Krehel, 2015/12/08
- [elpa] master 2a55ada 163/167: doc/Changelog.org: Update up to 706349f, Oleh Krehel, 2015/12/08
- [elpa] master 98a4548 164/167: swiper.el: Bump version to 0.7.0, Oleh Krehel, 2015/12/08
- [elpa] master 84533bb 139/167: Minor fixes to ivy.org and export to ivy.texi, Oleh Krehel, 2015/12/08
- [elpa] master 17872ba 157/167: ivy.el: Structure all faces into ivy-faces custom group, Oleh Krehel, 2015/12/08
- [elpa] master 5a6217a 161/167: counsel.el (counsel-tmm): New command,
Oleh Krehel <=
- [elpa] master e264139 166/167: doc/ivy.org: Add "Variable Index" node, Oleh Krehel, 2015/12/08
- [elpa] master c5661c0 162/167: ivy.el (ivy-completing-read): Use completing-read-default for tmm, Oleh Krehel, 2015/12/08
- [elpa] master 1992f44 165/167: doc/ivy.texi: Re-export using adjusted texinfo exporter, Oleh Krehel, 2015/12/08
- [elpa] master 1f3fa31 167/167: Merge commit 'e264139e7fafbd1bbb68f9cef6d1c50b8e6cf1f3' from swiper, Oleh Krehel, 2015/12/08