emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master ae70443 060/184: counsel.el (counsel-major): Add


From: Oleh Krehel
Subject: [elpa] master ae70443 060/184: counsel.el (counsel-major): Add
Date: Wed, 16 Oct 2019 13:14:49 -0400 (EDT)

branch: master
commit ae70443692509534e64fea8e66a24daa2587d1ec
Author: Marat Safin <address@hidden>
Commit: Oleh Krehel <address@hidden>

    counsel.el (counsel-major): Add
    
    Fixes #378
---
 counsel.el | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/counsel.el b/counsel.el
index 87d3636..8586c28 100644
--- a/counsel.el
+++ b/counsel.el
@@ -5824,6 +5824,20 @@ Additional actions:\\<ivy-minibuffer-map>
  `(("d" ,(lambda (x) (find-function (cdr x))) "definition")
    ("h" ,(lambda (x) (describe-function (cdr x))) "help")))
 
+;;;###autoload
+(defun counsel-major ()
+  (interactive)
+  (ivy-read "Major modes: " obarray
+            :predicate (lambda (f)
+                         (and (commandp f) (string-match "-mode$" (symbol-name 
f))
+                              (or (and (autoloadp (symbol-function f))
+                                       (let ((doc-split (help-split-fundoc 
(documentation f) f)))
+                                         ;; major mode starters have no 
arguments
+                                         (and doc-split (null (cdr (read (car 
doc-split)))))))
+                                  (null (help-function-arglist f)))))
+            :action (lambda (mode) (funcall (intern mode)))
+            :caller 'counsel-major))
+
 ;;* `counsel-mode'
 (defvar counsel-mode-map
   (let ((map (make-sparse-keymap)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]