Replace dash-at-point with helm-dash + async defuns
This commit is contained in:
parent
7befcc50fa
commit
b763888b54
5 changed files with 70 additions and 22 deletions
|
@ -53,6 +53,7 @@
|
||||||
(debugger-mode . normal)
|
(debugger-mode . normal)
|
||||||
(image-mode . normal)
|
(image-mode . normal)
|
||||||
(doc-view-mode . normal)
|
(doc-view-mode . normal)
|
||||||
|
(eww-mode . normal)
|
||||||
(tabulated-list-mode . emacs)
|
(tabulated-list-mode . emacs)
|
||||||
(profile-report-mode . emacs)
|
(profile-report-mode . emacs)
|
||||||
(Info-mode . emacs)
|
(Info-mode . emacs)
|
||||||
|
|
|
@ -73,6 +73,15 @@
|
||||||
(defun helm*buffer-list (&rest _) (doom/get-buffer-names doom-helm-force-project-buffers))
|
(defun helm*buffer-list (&rest _) (doom/get-buffer-names doom-helm-force-project-buffers))
|
||||||
(advice-add 'helm-buffer-list :override 'helm*buffer-list))
|
(advice-add 'helm-buffer-list :override 'helm*buffer-list))
|
||||||
|
|
||||||
|
(use-package helm-dash
|
||||||
|
:when (not IS-WINDOWS)
|
||||||
|
:commands (helm-dash helm-dash-at-point helm-dash-install-docset def-docset!)
|
||||||
|
:config
|
||||||
|
(setq helm-dash-browser-func 'doom/dash-open
|
||||||
|
helm-dash-candidate-format "%d → %n (%t)")
|
||||||
|
(defmacro def-docset! (mode docsets)
|
||||||
|
`(add-hook! ,mode (setq-local helm-dash-docsets ',docsets))))
|
||||||
|
|
||||||
(use-package helm-tags
|
(use-package helm-tags
|
||||||
:commands (helm-tags-get-tag-file helm-etags-select))
|
:commands (helm-tags-get-tag-file helm-etags-select))
|
||||||
|
|
||||||
|
|
|
@ -46,14 +46,9 @@
|
||||||
;; OSX-related plugins + hacks
|
;; OSX-related plugins + hacks
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(use-package dash-at-point
|
(use-package applescript-mode
|
||||||
:commands (dash-at-point dash-at-point-with-docset dash-at-point-run-search
|
:mode "\\.applescript$"
|
||||||
dash-at-point-guess-docset)
|
:config (def-docset! applescript-mode ("AppleScript")))
|
||||||
:init
|
|
||||||
(defmacro def-docset! (mode docset)
|
|
||||||
`(add-hook! ,mode (setq-local dash-at-point-docset ,docset))))
|
|
||||||
|
|
||||||
(use-package applescript-mode :mode "\\.applescript$")
|
|
||||||
|
|
||||||
(def-project-type! lb6 "lb6"
|
(def-project-type! lb6 "lb6"
|
||||||
:match "\\.lb\\(action\\|ext\\)/.+$"
|
:match "\\.lb\\(action\\|ext\\)/.+$"
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
("*nosetests*" :align below :size 0.4 :noselect t)
|
("*nosetests*" :align below :size 0.4 :noselect t)
|
||||||
("*esup*" :align below :size 30 :noselect t)
|
("*esup*" :align below :size 30 :noselect t)
|
||||||
("*ert*" :align below :size 20 :noselect t)
|
("*ert*" :align below :size 20 :noselect t)
|
||||||
|
(eww-mode :align below :size 30 :select t)
|
||||||
;; vcs
|
;; vcs
|
||||||
("*git-messenger*" :align left :size 55 :select t)
|
("*git-messenger*" :align left :size 55 :select t)
|
||||||
("^\\*git-gutter.+\\*$" :align below :size 15 :noselect t :regexp t)
|
("^\\*git-gutter.+\\*$" :align below :size 15 :noselect t :regexp t)
|
||||||
|
|
|
@ -1,24 +1,66 @@
|
||||||
;;; defuns-dash.el --- Dash.app integration
|
;;; defuns-dash.el --- helm-dash integration
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/dash-at-pt ()
|
(defun doom/dash-at-pt ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(if (evil-visual-state-p)
|
(let (helm-dash-common-docsets)
|
||||||
(dash-at-point-run-search (buffer-substring-no-properties (region-beginning) (region-end))
|
(call-interactively 'helm-dash-at-point)))
|
||||||
(dash-at-point-guess-docset))
|
|
||||||
(dash-at-point)))
|
;;;###autoload
|
||||||
|
(defun doom/dash-open (url)
|
||||||
|
"Open url in an *eww* popup."
|
||||||
|
(interactive)
|
||||||
|
(save-window-excursion (eww url))
|
||||||
|
(doom/popup-buffer "*eww*"))
|
||||||
|
|
||||||
;;;###autoload (autoload 'doom:dash "defuns-dash" nil t)
|
;;;###autoload (autoload 'doom:dash "defuns-dash" nil t)
|
||||||
(evil-define-command doom:dash (bang input)
|
(evil-define-command doom:dash (&optional bang input)
|
||||||
|
""
|
||||||
(interactive "<!><a>")
|
(interactive "<!><a>")
|
||||||
(let ((docset (unless bang (dash-at-point-guess-docset)))
|
(let ((helm-dash-common-docsets (when bang (helm-dash-installed-docsets))))
|
||||||
(query input))
|
(helm-dash-initialize-debugging-buffer)
|
||||||
(when (evil-visual-state-p)
|
(helm-dash-create-common-connections)
|
||||||
(setq query (concat (buffer-substring-no-properties (region-beginning) (region-end))
|
(helm-dash-create-buffer-connections)
|
||||||
" " query)))
|
(helm :sources (helm-dash-sources--narrowed-docsets)
|
||||||
(when (or (not query) (zerop (length query)))
|
:buffer "*helm-dash*"
|
||||||
(setq query (thing-at-point 'symbol)))
|
:prompt "Doc for: "
|
||||||
(dash-at-point-run-search query docset)))
|
:history 'helm-dash-history-input
|
||||||
|
:input (or input "")
|
||||||
|
:helm-candidate-number-limit 500)))
|
||||||
|
|
||||||
|
(defvar doom--dash-docsets nil)
|
||||||
|
(defvar doom--dash-user-docsets nil)
|
||||||
|
;;;###autoload (autoload 'doom:dash-install "defuns-dash" nil t)
|
||||||
|
(evil-define-command doom:dash-install (&optional docset)
|
||||||
|
"Async docset install."
|
||||||
|
(interactive "<a>")
|
||||||
|
(let ((docsets (or doom--dash-docsets
|
||||||
|
(setq doom--dash-docsets (helm-dash-available-docsets))))
|
||||||
|
(user-docsets (or doom--dash-user-docsets
|
||||||
|
(setq doom--dash-user-docsets (helm-dash-search-all-user-docsets)))))
|
||||||
|
(unless docset
|
||||||
|
(setq docset (helm-dash-read-docset
|
||||||
|
"Install docset"
|
||||||
|
(append docsets (mapcar 'car user-docsets)))))
|
||||||
|
(message "Installing ...")
|
||||||
|
(async-start `(lambda ()
|
||||||
|
,(async-inject-variables "\\`\\(load-path\\|helm-dash-*\\)$")
|
||||||
|
(require 'f)
|
||||||
|
(require 'helm)
|
||||||
|
(require 'helm-dash)
|
||||||
|
(cond ((member ,docset ',docsets)
|
||||||
|
(helm-dash-install-docset ,docset)
|
||||||
|
,docset)
|
||||||
|
((assoc ,docset ',user-docsets)
|
||||||
|
(helm-dash-install-user-docset ,docset)
|
||||||
|
(f-no-ext (f-base (car-safe (cdr-safe (assoc ,docset ',user-docsets))))))))
|
||||||
|
(lambda (doc)
|
||||||
|
(unless doc
|
||||||
|
(error "Invalid docset id" doc))
|
||||||
|
(message "Installing docset %s ..." doc)
|
||||||
|
(helm-dash-activate-docset doc)
|
||||||
|
(setq helm-dash-common-docsets nil)
|
||||||
|
(message "Docset %s installed" doc)))))
|
||||||
|
|
||||||
(provide 'defuns-dash)
|
(provide 'defuns-dash)
|
||||||
;;; defuns-dash.el ends here
|
;;; defuns-dash.el ends here
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue