Skip to content

Instantly share code, notes, and snippets.

@mrc
Created February 2, 2014 03:37
Show Gist options
  • Save mrc/8762699 to your computer and use it in GitHub Desktop.
Save mrc/8762699 to your computer and use it in GitHub Desktop.
Context-sensitive info index lookup with helm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; helm info
(defvar mrc-helm-context-info-alist
'(((emacs-lisp-mode lisp-interaction-mode inferior-emacs-lisp-mode)
. (helm-source-info-elisp helm-source-info-cl helm-source-info-emacs))
((org-mode) . (helm-source-info-org))
((lisp-mode) . ((name . "Hyperspec") (info-index . "ansicl")
((name . "Iterate") (info-index . "iterate")))))
"Alist of modes to Helm sources.
Each element looks like (MODES . SOURCES). MODES is a list of
major modes. SOURCES is a list of helm sources.")
(defun mrc-helm-context-info ()
(interactive)
(let ((context (cdar (cl-remove-if-not (lambda (alist) (memq major-mode (car alist)))
mrc-helm-context-info-alist))))
(message "context: %S" context)
(when context
(helm :sources context :buffer "*helm-info-context*"))))
(global-set-key (kbd "C-h C-i") #'mrc-helm-context-info)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment