2019-10-14 17:38:14 +02:00
|
|
|
;;; web.el --- Settings for web stuff. -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2020-03-18 15:00:17 +01:00
|
|
|
(require 'basics/package-management)
|
2020-12-08 14:10:01 +01:00
|
|
|
(require 'misc/completion)
|
2020-03-18 15:00:17 +01:00
|
|
|
|
2019-10-14 17:38:14 +02:00
|
|
|
;; Use company auto-completion for (X)HTML.
|
|
|
|
(use-package company-web
|
2020-05-24 22:59:31 +02:00
|
|
|
:demand t
|
2019-10-14 17:38:14 +02:00
|
|
|
:after (company)
|
2020-03-27 18:12:41 +01:00
|
|
|
:config (add-to-list 'company-backends 'company-web-html))
|
2019-10-14 17:38:14 +02:00
|
|
|
|
|
|
|
(use-package web-mode
|
2019-12-31 12:58:36 +01:00
|
|
|
:custom
|
|
|
|
(web-mode-markup-indent-offset 2) ; Default indentation level.
|
2021-03-14 19:36:16 +01:00
|
|
|
:config ((defun my/html-surround-with-tag (beg end)
|
2021-03-10 14:22:40 +01:00
|
|
|
"Surround region with HTML tag."
|
|
|
|
(interactive "*r")
|
|
|
|
(if (region-active-p)
|
2021-03-11 18:40:34 +01:00
|
|
|
(let ((tag (completing-read "Tag: "
|
|
|
|
'("em" "strong" "blockquote"))))
|
2021-03-10 14:22:40 +01:00
|
|
|
(insert (concat "<" tag ">"
|
|
|
|
(delete-and-extract-region beg end)
|
|
|
|
"</" tag ">")))
|
|
|
|
(message "No active region")))
|
2021-03-14 19:36:16 +01:00
|
|
|
|
|
|
|
(defun my/html-paragraphify-buffer ()
|
|
|
|
(interactive)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (re-search-forward "^\\([^<$
|
|
|
|
].+\\)$" nil t)
|
|
|
|
(replace-match "<p>\\1</p>"))))
|
2020-03-27 18:12:41 +01:00
|
|
|
:mode (("\\.[ps]?html?$" . web-mode)
|
|
|
|
("\\.tmpl$" . web-mode) ; Gitea templates.
|
|
|
|
("\\.php$" . web-mode))
|
2021-03-10 14:22:40 +01:00
|
|
|
:hook (web-mode . (lambda () (set-fill-column 120)))
|
|
|
|
:bind ("C-c C-M-h" . my/html-surround-with-tag))
|
2019-10-14 17:38:14 +02:00
|
|
|
|
|
|
|
;; Read EPUB ebooks.
|
|
|
|
(use-package nov
|
2020-03-27 18:12:41 +01:00
|
|
|
:custom (nov-text-width fill-column)
|
|
|
|
:custom-face (variable-pitch ((t (:inherit variable-pitch
|
|
|
|
:family "Source Serif Pro"
|
|
|
|
:height 1.4))))
|
|
|
|
:mode ("\\.epub$" . nov-mode))
|
2019-10-14 17:38:14 +02:00
|
|
|
|
2020-03-27 21:26:25 +01:00
|
|
|
;; Mode for writing blog posts with hugo.
|
|
|
|
(when (string= (system-name) "ventiloplattform")
|
|
|
|
(use-package easy-hugo
|
2020-12-29 18:31:17 +01:00
|
|
|
:custom ((easy-hugo-basedir "~/Projekte/www/computering.tastytea.de/")
|
|
|
|
(easy-hugo-url "https://computering.tastytea.de")
|
2020-03-27 21:26:25 +01:00
|
|
|
(easy-hugo-postdir "content/posts")
|
|
|
|
(easy-hugo-previewtime (* 60 60 2))
|
|
|
|
(easy-hugo-default-ext ".adoc")
|
|
|
|
(easy-hugo-asciidoc-extension "adoc")
|
|
|
|
(easy-hugo-server-flags "-D")
|
|
|
|
(easy-hugo-bloglist ; Additional blogs.
|
2020-12-26 00:45:41 +01:00
|
|
|
'(((easy-hugo-basedir . "~/Projekte/www/thoughtpile.tastytea.de/")
|
|
|
|
(easy-hugo-url . "https://thoughtpile.tastytea.de")
|
2020-03-27 21:26:25 +01:00
|
|
|
(easy-hugo-postdir . "content/posts")
|
|
|
|
(easy-hugo-previewtime . (* 60 60 2)))
|
|
|
|
((easy-hugo-basedir . "~/Projekte/www/text-de.tastytea.de/")
|
|
|
|
(easy-hugo-url . "https://text-de.tastytea.de")
|
|
|
|
(easy-hugo-postdir . "content/posts")
|
|
|
|
(easy-hugo-previewtime . (* 60 60 2))))))
|
|
|
|
:bind ("C-c h" . easy-hugo)))
|
|
|
|
|
2019-10-14 17:38:14 +02:00
|
|
|
(provide 'text/web)
|
|
|
|
;;; web.el ends here
|