From a6629469f304b8d485a32df222be1e39a6db3e46 Mon Sep 17 00:00:00 2001 From: Jakob L. Kreuze Date: Thu, 28 Jan 2021 20:03:44 -0500 Subject: Add initial configuration for Dash (and EWW). --- lisp/appearance/modeline.el | 9 +++++++-- lisp/programming.el | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/lisp/appearance/modeline.el b/lisp/appearance/modeline.el index eefd80c..53ee967 100644 --- a/lisp/appearance/modeline.el +++ b/lisp/appearance/modeline.el @@ -80,8 +80,13 @@ RIGHT aligned respectively." (concat "%b [%m: " shell-title "] [%*] Ln: %l/" - (number-to-string (1+ (count-lines 1 (point-max)))) - " Col: %c")) + (number-to-string (1+ (count-lines 1 (point-max)))) + " Col: %c")) + ((and (eq major-mode 'eww-mode) (boundp 'eww-data)) + (concat (plist-get eww-data :title) + " [%m] [%*] Ln: %l/" + (number-to-string (1+ (count-lines 1 (point-max)))) + " Col: %c")) (t (concat "%b [%m] [%*] Ln: %l/" (number-to-string (1+ (count-lines 1 (point-max)))) diff --git a/lisp/programming.el b/lisp/programming.el index 592551e..5f8d743 100644 --- a/lisp/programming.el +++ b/lisp/programming.el @@ -123,3 +123,37 @@ (:map smartparens-mode-map ("C-M-o" . sp-up-sexp) ("C-M-i" . sp-backward-down-sexp))) + +;; Dash [1] is an alright system for managing documentation offline. We're in +;; Emacs, though, so why not make full use of it and use EWW to browse docs? +;; +;; [1]: https://kapeli.com/dash + +(defun maybe-install-docset (name) + "Install NAME if it is not already installed." + (let ((file-name (concat name ".docset"))) + (unless (file-exists-p (expand-file-name file-name dash-docs-docsets-path)) + (dash-docs-install-docset name)))) + +(use-package dash-docs + :init + (setq dash-docs-browser-func 'w3m-goto-url) + :config + (maybe-install-docset "Rust") + :hook + (rust-mode . (lambda () (setq-local dash-docs-docsets '("Rust")))) + :bind + (("C-c C-M-d" . counsel-dash))) + +(use-package counsel-dash) + +;; I configure EWW here because I mostly use it for Dash. Thanks to the +;; Javascript curse, Firefox is my daily driver for recreational browsing. + +(use-package eww + :straight nil + :init + (setq shr-max-width 80) + (setq shr-use-colors nil) + (setq shr-use-fonts nil) + (setq eww-header-line-format nil) -- cgit v1.3