diff options
author | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2017-04-06 16:32:56 +0200 |
---|---|---|
committer | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2017-04-06 16:32:56 +0200 |
commit | 52fce0ef161663a085e8b9c5d35dd0d621157510 (patch) | |
tree | 8fde04731ad1add899f23d20564b53c084366191 /helm-misc.el | |
parent | 31ffa92266db82b8b74687d6fa35ec18304f5cae (diff) |
Move helm-lacarte to emacs-helm (#1740).
Diffstat (limited to 'helm-misc.el')
-rw-r--r-- | helm-misc.el | 57 |
1 files changed, 1 insertions, 56 deletions
diff --git a/helm-misc.el b/helm-misc.el index f7233ea5..f867db9a 100644 --- a/helm-misc.el +++ b/helm-misc.el @@ -127,63 +127,8 @@ :action 'helm-timezone-actions :filtered-candidate-transformer 'helm-time-zone-transformer)) -;;; LaCarte +;;; Commands ;; -;; -(declare-function lacarte-get-overall-menu-item-alist "ext:lacarte.el" (&optional MAPS)) - -(defun helm-lacarte-candidate-transformer (cands) - (mapcar (lambda (cand) - (let* ((item (car cand)) - (match (string-match "[^>] \\((.*)\\)$" item))) - (when match - (put-text-property (match-beginning 1) (match-end 1) - 'face 'helm-M-x-key item)) - cand)) - cands)) - -(defclass helm-lacarte (helm-source-sync helm-type-command) - ((init :initform (lambda () (require 'lacarte))) - (candidates :initform 'helm-lacarte-get-candidates) - (candidate-transformer :initform 'helm-lacarte-candidate-transformer) - (candidate-number-limit :initform 9999))) - -(defun helm-lacarte-get-candidates (&optional maps) - "Extract candidates for menubar using lacarte.el. -See http://www.emacswiki.org/cgi-bin/wiki/download/lacarte.el. -Optional argument MAPS is a list specifying which keymaps to use: it -can contain the symbols `local', `global', and `minor', mean the -current local map, current global map, and all current minor maps." - (with-helm-current-buffer - ;; When a keymap doesn't have a [menu-bar] entry - ;; the filtered map returned and passed to - ;; `lacarte-get-a-menu-item-alist-22+' is nil, which - ;; fails because this code is not protected for such case. - (condition-case nil - (lacarte-get-overall-menu-item-alist maps) - (error nil)))) - -;;;###autoload -(defun helm-browse-menubar () - "Preconfigured helm to the menubar using lacarte.el." - (interactive) - (if (require 'lacarte nil t) - (helm :sources (mapcar - (lambda (spec) (helm-make-source (car spec) 'helm-lacarte - :candidates - (lambda () - (helm-lacarte-get-candidates (cdr spec))))) - '(("Major Mode" . (local)) - ("Minor Modes" . (minor)) - ("Global Map" . (global)))) - :buffer "*helm lacarte*") - (when (yes-or-no-p "lacarte.el is not installed. Install? ") - (condition-case nil - (progn - (package-install 'lacarte) - (helm-browse-menubar)) - (error (error "lacarte.el is not available. Is MELPA in your `package-archives'?")))))) - (defun helm-call-interactively (cmd-or-name) "Execute CMD-OR-NAME as Emacs command. It is added to `extended-command-history'. |