diff options
Diffstat (limited to '.emacs.d')
-rw-r--r-- | .emacs.d/init.org | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/.emacs.d/init.org b/.emacs.d/init.org index b025d77..f14f931 100644 --- a/.emacs.d/init.org +++ b/.emacs.d/init.org @@ -790,6 +790,36 @@ (add-hook 'js2-init-hook #'oni:js2-add-conkeror-symbols) #+END_SRC +* Teach eww about <code> tags + + Strangely enough, ~eww~ doesn't seem to be aware of =<code>= HTML tags. + Luckily it's trivial to teach it. It does know about =<pre>= HTML + tags, and basically I just want =<code>= tags to be treated almost as + =<pre>= tags, so to do that we just have to define a =shr-tag-code= + function. I've copied the =shr-tag-pre= function and removed the calls + to =ensure-newline=, because =<code>= tags are inline tags. + + In order to remain a little future-proof, it should only be done if + it doesn't already exist. + + *Note:* See my [[Vacuous defvar][note]] on vacuous defvar for this use of =defvar=. + + *Note:* See my [[Function declarations][note]] on function declarations about the use of + =declare-function=. + + #+BEGIN_SRC emacs-lisp + (defvar shr-folding-mode) + (declare-function shr-indent "shr") + (declare-function shr-generic "shr") + + (with-eval-after-load 'shr + (unless (fboundp 'shr-tag-code) + (defun shr-tag-code (cont) + (let ((shr-folding-mode 'none)) + (shr-indent) + (shr-generic cont))))) + #+END_SRC + * Load custom file I don't really use the Emacs customization interface much, but I |