phobos.el: add support for viewing dub package documentation
This commit is contained in:
parent
98bc3c6095
commit
134d726321
1 changed files with 18 additions and 0 deletions
18
phobos.el
18
phobos.el
|
@ -27,6 +27,8 @@
|
||||||
"Web browser to use when opening documentation with `phobos'.")
|
"Web browser to use when opening documentation with `phobos'.")
|
||||||
(defvar phobos-root "https://dlang.org/library"
|
(defvar phobos-root "https://dlang.org/library"
|
||||||
"Root URL to use when viewing documentation with `phobos'.")
|
"Root URL to use when viewing documentation with `phobos'.")
|
||||||
|
(defvar phobos-dpldocs-domain "dpldocs.info"
|
||||||
|
"Root domain to use when viewing documentation on dub packages with `dub-doc'.")
|
||||||
|
|
||||||
(defun phobos (symbol)
|
(defun phobos (symbol)
|
||||||
"View the documentation on SYMBOL from the Phobos documentation.
|
"View the documentation on SYMBOL from the Phobos documentation.
|
||||||
|
@ -42,4 +44,20 @@ information on Phobos and the D programming language, see <https://dlang.org>."
|
||||||
phobos-browser phobos-root
|
phobos-browser phobos-root
|
||||||
(string-replace "." "/" symbol))))
|
(string-replace "." "/" symbol))))
|
||||||
|
|
||||||
|
(defun dub-doc (package &optional symbol)
|
||||||
|
"View the documentation on SYMBOL from the dub package PACKAGE.
|
||||||
|
|
||||||
|
PACKAGE is the name of a package listed on the code.dlang.org registry.
|
||||||
|
For more information on SYMBOL, see the documentation for `phobos'. If
|
||||||
|
SYMBOL is not provided, the contents of PACKAGE is displayed instead.
|
||||||
|
|
||||||
|
Support for dub package documentation is provided by Adam Ruppe's
|
||||||
|
site hosted at <https://dpldocs.info>."
|
||||||
|
(interactive "MPackage name: \nMModule or symbol: ")
|
||||||
|
(or symbol (setq symbol "index")) ; index.html
|
||||||
|
(shell-command (format "%s https://%s.%s/%s.html"
|
||||||
|
phobos-browser package phobos-dpldocs-domain symbol)))
|
||||||
|
|
||||||
|
(defalias 'view-dub-documentation 'dub-doc)
|
||||||
|
|
||||||
(provide 'phobos)
|
(provide 'phobos)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue