Back to dash-at-point! (and zeal-at-point)
This commit is contained in:
parent
7963c48600
commit
9e7749cf1d
28 changed files with 58 additions and 120 deletions
24
core/core-docs.el
Normal file
24
core/core-docs.el
Normal file
|
@ -0,0 +1,24 @@
|
|||
;;; core-docs.el
|
||||
|
||||
(use-package dash-at-point
|
||||
:when IS-MAC
|
||||
:commands (dash-at-point dash-at-point-with-docset dash-at-point-run-search
|
||||
dash-at-point-guess-docset)
|
||||
:init
|
||||
(defmacro def-docset! (mode docset)
|
||||
`(add-hook! ,mode (setq-local dash-at-point-docset ,docset)))
|
||||
(defun doom-docs-lookup (&optional search docset)
|
||||
(dash-at-point-run-search search docset)))
|
||||
|
||||
(use-package zeal-at-point
|
||||
:when (not IS-MAC)
|
||||
:commands (zeal-at-point zeal-at-point-set-docset)
|
||||
:init
|
||||
(defmacro def-docset! (mode docset)
|
||||
`(add-hook! ,mode (setq-local zeal-at-point-docset ,docset)))
|
||||
(defun doom-docs-lookup (&optional search docset)
|
||||
(let ((zeal-at-point-docset (or docset zeal-at-point-docset)))
|
||||
(zeal-at-point search))))
|
||||
|
||||
(provide 'core-docs)
|
||||
;;; core-docs.el ends here
|
|
@ -73,13 +73,6 @@
|
|||
(defun helm*buffer-list (&rest _) (doom/get-buffer-names doom-helm-force-project-buffers))
|
||||
(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)
|
||||
:config
|
||||
(setq helm-dash-browser-func 'doom/dash-open
|
||||
helm-dash-candidate-format "%d → %n (%t)"))
|
||||
|
||||
(use-package helm-tags
|
||||
:commands (helm-tags-get-tag-file helm-etags-select))
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
(use-package applescript-mode
|
||||
:mode "\\.applescript$"
|
||||
:config (def-docset! applescript-mode ("AppleScript")))
|
||||
:config (def-docset! applescript-mode "applescript"))
|
||||
|
||||
(def-project-type! lb6 "lb6"
|
||||
:match "\\.lb\\(action\\|ext\\)/.+$"
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
;;; defuns-dash.el --- helm-dash integration
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/dash-at-pt ()
|
||||
(interactive)
|
||||
(let (helm-dash-common-docsets)
|
||||
(call-interactively 'helm-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)
|
||||
(evil-define-command doom:dash (&optional bang input)
|
||||
""
|
||||
(interactive "<!><a>")
|
||||
(let ((helm-dash-common-docsets (when bang (helm-dash-installed-docsets))))
|
||||
(helm-dash-initialize-debugging-buffer)
|
||||
(helm-dash-create-common-connections)
|
||||
(helm-dash-create-buffer-connections)
|
||||
(helm :sources (helm-dash-sources--narrowed-docsets)
|
||||
:buffer "*helm-dash*"
|
||||
:prompt "Doc for: "
|
||||
: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)
|
||||
;;; defuns-dash.el ends here
|
17
core/defuns/defuns-docs.el
Normal file
17
core/defuns/defuns-docs.el
Normal file
|
@ -0,0 +1,17 @@
|
|||
;;; defuns-docs.el
|
||||
|
||||
;;;###autoload (autoload 'doom:docs-lookup "defuns-docs" nil t)
|
||||
(evil-define-command doom:docs-lookup (&optional bang input)
|
||||
"Look up INPUT (otherwise the current selection) in Dash or Zeal."
|
||||
(interactive "<!><a>")
|
||||
(let ((docset (unless bang (dash-at-point-guess-docset)))
|
||||
(query input))
|
||||
(when (evil-visual-state-p)
|
||||
(setq query (concat (buffer-substring-no-properties (region-beginning) (region-end))
|
||||
" " query)))
|
||||
(when (or (not query) (zerop (length query)))
|
||||
(setq query (thing-at-point 'symbol)))
|
||||
(doom-docs-lookup query docset)))
|
||||
|
||||
(provide 'defuns-docs)
|
||||
;;; defuns-docs.el ends here
|
|
@ -1,8 +0,0 @@
|
|||
;;; macros-dash.el
|
||||
|
||||
;;;###autoload
|
||||
(defmacro def-docset! (mode docsets)
|
||||
`(add-hook! ,mode (setq-local helm-dash-docsets ',docsets)))
|
||||
|
||||
(provide 'macros-dash)
|
||||
;;; macros-dash.el ends here
|
Loading…
Add table
Add a link
Reference in a new issue