diff --git a/phobos.el b/phobos.el index 73c7dfa..3e65f1c 100644 --- a/phobos.el +++ b/phobos.el @@ -32,6 +32,11 @@ (defvar phobos-registry-root "https://code.dlang.org" "Root URL of the D package registry used with `describe-dub-package'.") +(defun phobos--visit (&rest format-args) + (let ((url (apply #'format format-args))) + (shell-command (concat phobos-browser " " url)) + (message url))) + (defun phobos (symbol) "View the documentation on SYMBOL from the Phobos documentation. @@ -42,9 +47,7 @@ or any other symbol part of a standard module, such as object.Exception. Phobos is the standard library for the D programming language. For more information on Phobos and the D programming language, see ." (interactive "MModule or symbol: ") - (shell-command (format "%s %s/%s.html" - phobos-browser phobos-root - (string-replace "." "/" symbol)))) + (phobos--visit "%s/%s.html" phobos-root (string-replace "." "/" symbol))) (defun dub-doc (package &optional symbol) "View the documentation on SYMBOL from the dub package PACKAGE. @@ -57,8 +60,8 @@ Support for dub package documentation is provided by Adam Ruppe's site hosted at ." (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))) + (phobos--visit "https://%s.%s/%s.html" + package phobos-dpldocs-domain symbol)) (defalias 'view-dub-documentation 'dub-doc) @@ -68,7 +71,7 @@ site hosted at ." PACKAGE is the name of a package listed on the code.dlang.org registry. Also see `dub-doc' for retrieving documentation for a specific symbol." (interactive "MPackage name: ") - (shell-command (format "%s %s/packages/%s" - phobos-browser phobos-registry-root package))) + (phobos--visit "%s/packages/%s" + phobos-registry-root package)) (provide 'phobos)