44 lines
1.7 KiB
EmacsLisp
44 lines
1.7 KiB
EmacsLisp
;;; phobos.el --- view Phobos documentation from within Emacs -*- lexical-binding:t -*-
|
|
|
|
;; Copyright (C) 2024 Jeremy Baxter
|
|
|
|
;; Author: Jeremy Baxter <jeremy@baxters.nz>
|
|
;; Created: July 2024
|
|
;; Keywords: d
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;; phobos.el is free software: you can redistribute it and/or modify
|
|
;; it under the terms of the GNU General Public License as published by
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
;; (at your option) any later version.
|
|
;;
|
|
;; phobos.el is distributed in the hope that it will be useful,
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;; GNU General Public License for more details.
|
|
;;
|
|
;; You should have received a copy of the GNU General Public License
|
|
;; along with phobos.el. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
;;; Code:
|
|
|
|
(defvar phobos-browser "xdg-open"
|
|
"Web browser to use when opening documentation with `phobos'.")
|
|
(defvar phobos-root "https://dlang.org/library"
|
|
"Root URL to use when viewing documentation with `phobos'.")
|
|
|
|
(defun phobos (symbol)
|
|
"View the documentation on SYMBOL from the Phobos documentation.
|
|
|
|
SYMBOL can be a module (e.g. std.sumtype), a submodule (e.g.
|
|
std.algorithm.searching), a function or type (e.g. std.stdio.File)
|
|
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 <https://dlang.org>."
|
|
(interactive "MModule or symbol: ")
|
|
(shell-command (concat phobos-browser " " phobos-root "/"
|
|
(string-replace "." "/" symbol) ".html")))
|
|
|
|
(provide 'phobos)
|