]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
added helm-descbinds and bound it to C-h b
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Tue, 10 Nov 2015 13:07:31 +0000 (14:07 +0100)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Tue, 10 Nov 2015 13:07:31 +0000 (14:07 +0100)
bba.org
elpa/helm-descbinds-20151019.230/helm-descbinds-autoloads.el [new file with mode: 0644]
elpa/helm-descbinds-20151019.230/helm-descbinds-pkg.el [new file with mode: 0644]
elpa/helm-descbinds-20151019.230/helm-descbinds.el [new file with mode: 0644]
elpa/helm-descbinds-readme.txt [new file with mode: 0644]

diff --git a/bba.org b/bba.org
index 74988acc1437a64db6c07a937142e765a52bfdbb..b967ffea17e2a2e30a8a9508350776225384cb8d 100644 (file)
--- a/bba.org
+++ b/bba.org
@@ -1839,6 +1839,18 @@ Some links you might check out:
 
 #+END_SRC
 
+* helm-descbinds
+
+#+BEGIN_SRC emacs-lisp
+  (if (>= emacs-major-version 25)
+      (progn
+        (add-to-list 'load-path "~/.emacs.d/elpa/helm-descbinds-20151019.230")
+        (require 'helm-descbinds)
+        (define-key global-map (kbd "\C-h b") 'helm-descbinds)
+        )
+  )
+#+END_SRC
+
 * browser switch
 
 switch default browser between eww and default.
diff --git a/elpa/helm-descbinds-20151019.230/helm-descbinds-autoloads.el b/elpa/helm-descbinds-20151019.230/helm-descbinds-autoloads.el
new file mode 100644 (file)
index 0000000..5f906d0
--- /dev/null
@@ -0,0 +1,46 @@
+;;; helm-descbinds-autoloads.el --- automatically extracted autoloads
+;;
+;;; Code:
+(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))
+\f
+;;;### (autoloads nil "helm-descbinds" "helm-descbinds.el" (22081
+;;;;;;  57649 0 0))
+;;; Generated autoloads from helm-descbinds.el
+
+(defvar helm-descbinds-mode nil "\
+Non-nil if Helm-Descbinds mode is enabled.
+See the command `helm-descbinds-mode' for a description of this minor mode.
+Setting this variable directly does not take effect;
+either customize it (see the info node `Easy Customization')
+or call the function `helm-descbinds-mode'.")
+
+(custom-autoload 'helm-descbinds-mode "helm-descbinds" nil)
+
+(autoload 'helm-descbinds-mode "helm-descbinds" "\
+Use `helm' for `describe-bindings'
+
+\(fn &optional ARG)" t nil)
+
+(autoload 'helm-descbinds-install "helm-descbinds" "\
+Use `helm-descbinds' as a replacement of `describe-bindings'.
+
+\(fn)" t nil)
+
+(autoload 'helm-descbinds-uninstall "helm-descbinds" "\
+Restore original `describe-bindings'.
+
+\(fn)" t nil)
+
+(autoload 'helm-descbinds "helm-descbinds" "\
+Yet Another `describe-bindings' with `helm'.
+
+\(fn &optional PREFIX BUFFER)" t nil)
+
+;;;***
+\f
+;; Local Variables:
+;; version-control: never
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; End:
+;;; helm-descbinds-autoloads.el ends here
diff --git a/elpa/helm-descbinds-20151019.230/helm-descbinds-pkg.el b/elpa/helm-descbinds-20151019.230/helm-descbinds-pkg.el
new file mode 100644 (file)
index 0000000..b8225d9
--- /dev/null
@@ -0,0 +1 @@
+(define-package "helm-descbinds" "20151019.230" "Yet Another `describe-bindings' with `helm'." '((helm "1.5")) :url "https://github.com/emacs-helm/helm-descbinds" :keywords '("helm" "help"))
diff --git a/elpa/helm-descbinds-20151019.230/helm-descbinds.el b/elpa/helm-descbinds-20151019.230/helm-descbinds.el
new file mode 100644 (file)
index 0000000..2096031
--- /dev/null
@@ -0,0 +1,297 @@
+;;; helm-descbinds.el --- Yet Another `describe-bindings' with `helm'.
+
+;; Copyright (C) 2008, 2009, 2010  Taiki SUGAWARA <buzz.taikiNOSPAMgmail.com>
+;; Copyright (C) 2012, 2013  Michael Markert <markert.michaelNOSPAMgooglemail.com>
+;; Copyright (C) 2013 Daniel Hackney <danNOSPAMhaxney.org>
+
+;; Author: Taiki SUGAWARA <buzz.taikiNOSPAMgmail.com>
+;; URL: https://github.com/emacs-helm/helm-descbinds
+;; Package-Version: 20151019.230
+;; Keywords: helm, help
+;; Version: 1.08
+;; Package-Requires: ((helm "1.5"))
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+;; This package is a replacement of `describe-bindings'.
+
+;;; Usage:
+;; Add followings on your .emacs.
+;;
+;;   (require 'helm-descbinds)
+;;   (helm-descbinds-mode)
+;;
+;; or use customize to set `helm-descbinds-mode' to t.
+;;
+;; Now, `describe-bindings' is replaced to `helm-descbinds'. Type
+;; `C-h b', `C-x C-h' these run `helm-descbinds'.
+;;
+;; In the Helm buffer, you can select key-binds with helm interface.
+;;
+;;  - When type RET, selected candidate command is executed.
+;;
+;;  - When type TAB, You can "Execute", "Describe Function" or "Find
+;;    Function" by the menu.
+;;
+;;  - When type C-z, selected command is described without quiting.
+
+;;; History:
+;; 2013-02-23 Michael Markert <markert.michaelNOSPAMgooglemail.com>
+;;   * helm-descbinds.el: Version 1.08
+;;   Merge Daniel Hackney's helm-descbinds minor mode.
+;;   Several bugfixes.
+;;
+;; 2012-03-18 Michael Markert <markert.michaelNOSPAMgooglemail.com>
+;;   * helm-descbinds.el: Version 1.07
+;;   make strings bound to keys insertable
+;;
+;; 2012-03-18 Michael Markert <markert.michaelNOSPAMgooglemail.com>
+;;   * helm-descbinds.el: Version 1.06
+;;   port to helm
+;;
+;; 2010-02-05   Taiki SUGAWARA  <sugawara_tNOSPAMariel-networks.com>
+;;
+;;   * descbinds-anything.el: Version 1.05
+;;   bug fix.
+;;
+;; 2010-02-02 UTC  Taiki SUGAWARA  <buzz.taikiNOSPAMgmail.com>
+;;
+;;   * descbinds-anything.el: Version 1.04
+;;   add sorting feature.
+;;   separete sorce creation function.
+;;   add persistent action.
+;;
+;; 2009-03-29 UTC  Taiki SUGAWARA  <buzz.taikiNOSPAMgmail.com>
+;;
+;;   * descbinds-anything.el: Version 1.03
+;;   fix typo.
+;;
+;; 2008-11-16 UTC  Taiki SUGAWARA  <buzz.taikiNOSPAMgmail.com>
+;;
+;;   * descbinds-anything.el: Version 1.02
+;;   bound `indent-tabs-mode` to t for nil environment.
+;;
+;; 2008-11-16 UTC  Taiki SUGAWARA  <buzz.taikiNOSPAMgmail.com>
+;;
+;;   * descbinds-anything.el: fix infinitive-loop when binding-line
+;;   has not tab.
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'helm)
+
+(defgroup helm-descbinds nil
+  "Yet Another `describe-bindings' with `helm'."
+  :prefix "helm-descbinds-"
+  :group 'helm)
+
+(defcustom helm-descbinds-actions
+  '(("Execute" . helm-descbinds-action:execute)
+    ("Describe Function" . helm-descbinds-action:describe)
+    ("Find Function" . helm-descbinds-action:find-func))
+  "Actions of selected candidate."
+  :type '(repeat
+         (cons
+          :tag "Action"
+          (string :tag "Name")
+          (function :tag "Function")))
+  :group 'helm-descbinds)
+
+(defcustom helm-descbinds-strings-to-ignore
+  '("Keyboard Macro" "Prefix Command")
+  "Strings to ignore as a possible string candidate."
+  :type '(repeat string))
+
+(defcustom helm-descbinds-candidate-formatter
+  'helm-descbinds-default-candidate-formatter
+  "Candidate formatter function.
+This function called two argument KEY and BINDING."
+  :type 'function
+  :group 'helm-descbinds)
+
+(defcustom helm-descbinds-window-style 'one-window
+  "Window splitting style."
+  :type '(choice
+         (const :tag "One Window" one-window)
+         (const :tag "Same Window" same-window)
+         (const :tag "Split Window" split-window))
+  :group 'helm-descbinds)
+
+(defcustom helm-descbinds-section-order
+  '("Major Mode Bindings" "Minor Mode Bindings" "Global Bindings")
+  "A list of section order by name regexp."
+  :type '(repeat (regexp :tag "Regexp"))
+  :group 'helm-descbinds)
+
+(defcustom helm-descbinds-source-template
+  `((candidate-transformer . helm-descbinds-transform-candidates)
+    (filtered-candidate-transformer . helm-fuzzy-highlight-matches)
+    (persistent-action . helm-descbinds-action:describe)
+    (action . ,helm-descbinds-actions))
+  "A template of `helm-descbinds' source."
+  :type 'sexp
+  :group 'helm-descbinds)
+
+(defvar helm-descbinds-Orig-describe-bindings (symbol-function 'describe-bindings))
+(defvar helm-descbind--initial-full-frame helm-full-frame)
+
+;;;###autoload
+(define-minor-mode helm-descbinds-mode
+  "Use `helm' for `describe-bindings'"
+  :group 'helm-descbinds
+  :global t
+  (if helm-descbinds-mode
+      (fset 'describe-bindings #'helm-descbinds)
+    (fset 'describe-bindings helm-descbinds-Orig-describe-bindings)))
+
+;;;###autoload
+(defun helm-descbinds-install ()
+  "Use `helm-descbinds' as a replacement of `describe-bindings'."
+  (interactive)
+  (helm-descbinds-mode 1))
+(make-obsolete 'helm-descbinds-install 'helm-descbinds-mode "1.08")
+
+;;;###autoload
+(defun helm-descbinds-uninstall ()
+  "Restore original `describe-bindings'."
+  (interactive)
+  (helm-descbinds-mode -1))
+(make-obsolete 'helm-descbinds-uninstall 'helm-descbinds-mode "1.08")
+
+(defun helm-descbinds-all-sections (buffer &optional prefix menus)
+  (with-temp-buffer
+    (let ((indent-tabs-mode t))
+      (describe-buffer-bindings buffer prefix menus))
+    (goto-char (point-min))
+    (let ((header-p (not (= (char-after) ?\f)))
+         sections header section)
+      (while (not (eobp))
+       (cond
+        (header-p
+         (setq header (buffer-substring-no-properties
+                       (point)
+                       (line-end-position)))
+         (setq header-p nil)
+         (forward-line 3))
+        ((= (char-after) ?\f)
+         (push (cons header (nreverse section)) sections)
+         (setq section nil)
+         (setq header-p t))
+        ((looking-at "^[ \t]*$")
+         ;; ignore
+         )
+        (t
+         (let ((binding-start (save-excursion
+                                (and (re-search-forward "\t+" nil t)
+                                     (match-end 0))))
+               key binding)
+           (when binding-start
+             (setq key (buffer-substring-no-properties (point) binding-start)
+                   key (replace-regexp-in-string"^[ \t\n]+" "" key)
+                   key (replace-regexp-in-string"[ \t\n]+$" "" key))
+             (goto-char binding-start)
+             (setq binding (buffer-substring-no-properties
+                            binding-start
+                            (line-end-position)))
+             (unless (member binding '("self-insert-command"))
+               (push (cons key binding) section))))))
+       (forward-line))
+      (push (cons header (nreverse section)) sections)
+      (nreverse sections))))
+
+(defun helm-descbinds-action:execute (candidate)
+  "An action that execute selected CANDIDATE command."
+  (let ((x (cdr candidate))
+        (helm-full-frame helm-descbind--initial-full-frame))
+    (cond
+     ((stringp x)
+      (insert x))
+     ((commandp x)
+      (run-at-time 0.01 nil (lambda (command) (call-interactively command)) x)))))
+
+(defun helm-descbinds-action:describe (candidate)
+  "An action that describe selected CANDIDATE function."
+  (describe-function (cdr candidate)))
+
+(defun helm-descbinds-action:find-func (candidate)
+  "An action that find selected CANDIDATE function."
+  (find-function (cdr candidate)))
+
+(defun helm-descbinds-default-candidate-formatter (key binding)
+  "Default candidate formatter."
+  (format "%-10s\t%s" key binding))
+
+(defun helm-descbinds-order-section (section)
+  (cl-loop for n = 0 then (1+ n)
+           for regexp in helm-descbinds-section-order
+           if (and (car section) (string-match regexp (car section)))
+           return n
+           finally
+           return n))
+
+(defun helm-descbinds-transform-candidates (candidates)
+  (mapcar
+   (lambda (pair)
+     (let ((key (car pair))
+           (command (cdr pair)))
+       (cons (funcall helm-descbinds-candidate-formatter key command)
+             (cons key (or (intern-soft command)
+                           (unless (member command helm-descbinds-strings-to-ignore)
+                             command))))))
+   candidates))
+
+(defun helm-descbinds-sources (buffer &optional prefix menus)
+  (mapcar
+   (lambda (section)
+     (helm-descbinds-source (car section) (cdr section)))
+   (sort
+    (helm-descbinds-all-sections buffer prefix menus)
+    (lambda (a b)
+      (< (helm-descbinds-order-section a)
+         (helm-descbinds-order-section b))))))
+
+(defun helm-descbinds-source (name candidates)
+  `((name . ,name)
+    (candidates . ,candidates)
+    ,@helm-descbinds-source-template))
+
+;;;###autoload
+(defun helm-descbinds (&optional prefix buffer)
+  "Yet Another `describe-bindings' with `helm'."
+  (interactive)
+  (let ((old-helm-full-frame helm-full-frame)
+        (helm-full-frame (and (not (minibufferp))
+                              (memq helm-descbinds-window-style
+                                    '(same-window one-window))))
+        (helm-before-initialize-hook (if (and (not (minibufferp))
+                                              (eq helm-descbinds-window-style
+                                                  'one-window))
+                                         (cons 'delete-other-windows
+                                               helm-before-initialize-hook)
+                                       helm-before-initialize-hook))
+        (enable-recursive-minibuffers t))
+    (setq helm-descbind--initial-full-frame old-helm-full-frame)
+    (helm :sources (helm-descbinds-sources
+                    (or buffer (current-buffer)) prefix)
+          :buffer "*helm-descbinds*"
+          :resume 'noresume
+          :allow-nest t)))
+
+(provide 'helm-descbinds)
+
+;;; helm-descbinds.el ends here
diff --git a/elpa/helm-descbinds-readme.txt b/elpa/helm-descbinds-readme.txt
new file mode 100644 (file)
index 0000000..2c489fa
--- /dev/null
@@ -0,0 +1 @@
+This package is a replacement of `describe-bindings'.