phobos.el: init
This commit is contained in:
parent
fd4fc67121
commit
7d64c06589
1 changed files with 41 additions and 0 deletions
41
phobos.el
Normal file
41
phobos.el
Normal file
|
@ -0,0 +1,41 @@
|
|||
;;; 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 Phobos documentation.")
|
||||
(defvar phobos-root "https://dlang.org/library"
|
||||
"Root URL to use when viewing Phobos documentation.")
|
||||
|
||||
(defun phobos (symbol-name)
|
||||
"View the documentation on SYMBOL-NAME from the Phobos documentation.
|
||||
|
||||
SYMBOL-NAME can be a module (e.g. std.algorithm), a submodule (e.g.
|
||||
std.algorithm.searching), a function (e.g. std.algorithm.searching.findSplit)
|
||||
or any other symbol part of a standard module, such as object.Exception."
|
||||
(interactive "MModule or symbol: ")
|
||||
(shell-command (concat phobos-browser " " phobos-root "/"
|
||||
(string-replace "." "/" symbol-name) ".html")))
|
||||
|
||||
(provide 'phobos)
|
Loading…
Add table
Add a link
Reference in a new issue