Emacs: Refactor text/misc.el.

This commit is contained in:
tastytea 2020-03-27 18:05:15 +01:00
parent 910035067c
commit b724d880e4

View File

@ -1,6 +1,6 @@
;;; misc.el --- Miscellaneous file formats. -*- lexical-binding: t; -*- ;;; misc.el --- Miscellaneous file formats. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-03-23T13:48:44+0100> ;; Time-stamp: <2020-03-27T18:05:06+0100>
;;; Commentary: ;;; Commentary:
@ -10,54 +10,35 @@
(require 'text/common) (require 'text/common)
(use-package conf-mode (use-package conf-mode
:mode :mode (("^/etc/conf\\.d/" . conf-mode) ; openrc config.
("^/etc/conf\\.d/" . conf-mode) ; openrc config files. ("^/etc/portage/package\\.use/" . conf-space-mode) ; Portage config.
("^/etc/portage/package\\.use/" . conf-space-mode) ; Portage config. ("^/etc/portage/package\\.accept_keywords/" . conf-space-mode)
("^/etc/portage/package\\.accept_keywords/" . conf-space-mode) ("\\.pc\\(\\.in\\)?$" . conf-mode) ; pkg-config files.
("\\.pc\\(\\.in\\)?$" . conf-mode) ; pkg-config files. ("conanfile\\.txt$" . conf-mode))) ; Conan recipes.
("conanfile\\.txt$" . conf-mode) ; Conan recipes.
)
(use-package crontab-mode (use-package crontab-mode
:custom-face ;; Shrink minutes to normal size.
(outline-1 ((t (:inherit outline-1 ; Shrink minutes to normal size. :custom-face (outline-1 ((t (:inherit outline-1 :height 1.0))))
:height 1.0)))) :mode (("/cron\\.d/" . crontab-mode)
("^'/etc/crontab$" . crontab-mode))
:mode :hook (crontab-mode . (lambda () (auto-fill-mode -1)))) ; No word-wrapping.
("/cron\\.d/" . crontab-mode)
("^'/etc/crontab$" . crontab-mode)
:hook
(crontab-mode . (lambda () (auto-fill-mode -1))) ; No word-wrapping.
)
(use-package nginx-mode (use-package nginx-mode
:defer t :defer t) ; Why defer?
)
(use-package company-nginx (use-package company-nginx
:after (nginx-mode company) :after (nginx-mode company)
:hook (nginx-mode . company-nginx-keywords))
:hook
(nginx-mode . company-nginx-keywords)
)
(use-package yaml-mode (use-package yaml-mode
:mode :mode ("\\.yml$" . yaml-mode)
("\\.yml$" . yaml-mode) :hook (yaml-mode . my/truncate-lines))
:hook
(yaml-mode . my/truncate-lines)
)
(use-package mediawiki (use-package mediawiki
:commands (mediawiki-mode) :commands (mediawiki-mode))
)
(use-package csv-mode (use-package csv-mode
:mode :mode ("\\.[Cc][Ss][Vv]$" . csv-mode))
("\\.[Cc][Ss][Vv]$" . csv-mode)
)
(use-package adoc-mode (use-package adoc-mode
:custom-face :custom-face
@ -84,23 +65,15 @@
;; Style code snippets (``) ;; Style code snippets (``)
(markup-verbatim-face ((t (:background "gray5")))) (markup-verbatim-face ((t (:background "gray5"))))
:mode :mode ("\\.adoc$" . adoc-mode)
("\\.adoc$" . adoc-mode) :hook ((adoc-mode . auto-fill-mode) ; Wrap at fill-column.
(adoc-mode . (lambda () ; Automatically update date.
:hook (setq-local time-stamp-pattern
(adoc-mode . auto-fill-mode) ; Wrap at fill-column. "8/:[dD[aA][tT][eE]: +%Y-%02m-%02d\n")))
(adoc-mode . (lambda () ; Automatically update date. (adoc-mode . yas-minor-mode))) ; Enable yasnippets.
(setq-local time-stamp-pattern
"8/:[dD[aA][tT][eE]: +%Y-%02m-%02d\n")
;; (setq-local time-stamp-time-zone nil) ; Set to local TZ.
))
(adoc-mode . yas-minor-mode) ; Enable yasnippets.
)
(use-package markdown-mode (use-package markdown-mode
:custom :custom (markdown-command "cmark")
(markdown-command "cmark")
:custom-face :custom-face
;; Style headers. ;; Style headers.
(markdown-header-face-1 ((t (:inherit markdown-header-face :height 1.4 (markdown-header-face-1 ((t (:inherit markdown-header-face :height 1.4
@ -118,56 +91,35 @@
(markdown-header-face-7 ((t (:inherit markdown-header-face :height 1.0 (markdown-header-face-7 ((t (:inherit markdown-header-face :height 1.0
:weight bold)))) :weight bold))))
:mode :mode (("README\\.md$" . gfm-mode)
(("README\\.md$" . gfm-mode) ("\\.md$" . gfm-mode)
("\\.md$" . gfm-mode) ("\\.markdown$" . gfm-mode))
("\\.markdown$" . gfm-mode)) :hook (markdown-mode . auto-fill-mode)) ; Wrap at fill-column.
:hook ;; Insert pseudo latin text.
(markdown-mode . auto-fill-mode) ; Wrap at fill-column.
)
;; Insert pseudo Latin text.
(use-package lorem-ipsum) (use-package lorem-ipsum)
;; Document editing, formatting, and organizing mode. ;; Document editing, formatting, and organizing mode.
(use-package org (use-package org
:commands (org-mode) :commands (org-mode)
:custom (org-support-shift-select t) ; Make shift behave normally on text.
:custom :bind (:map org-mode-map ; Remove some annoying keybindings.
(org-support-shift-select t) ; Make shift behave normally on text. ("M-<left>" . nil)
("M-<right>" . nil)
:bind ("M-<up>" . nil)
(:map org-mode-map ; Remove some annoying keybindings. ("M-<down>" . nil)
("M-<left>" . nil) ("M-S-<left>" . nil)
("M-<right>" . nil) ("M-S-<right>" . nil)
("M-<up>" . nil) ("M-S-<up>" . nil)
("M-<down>" . nil) ("M-S-<down>" . nil)))
("M-S-<left>" . nil)
("M-S-<right>" . nil)
("M-S-<up>" . nil)
("M-S-<down>" . nil)
;; ("S-<left>" . nil)
;; ("S-<right>" . nil)
;; ("C-S-<left>" . nil)
;; ("C-S-<right>" . nil)
;; ("S-<up>" . nil)
;; ("S-<down>" . nil)
)
)
(use-package sendmail (use-package sendmail
:mode :mode ("/.claws-mail/tmp/tmpmsg\\." . mail-mode) ; claws-mail messages.
("/.claws-mail/tmp/tmpmsg\\." . mail-mode) ; claws-mail messages. :hook (mail-mode . (lambda () (set-fill-column 72))))
:hook
(mail-mode . (lambda () (set-fill-column 72))) ; Leave space for quoting.
)
;; Open more file extensions in nxml-mode. ;; Open more file extensions in nxml-mode.
(use-package nxml (use-package nxml
:mode ("\\.qrc" . nxml-mode) :mode ("\\.qrc" . nxml-mode))
)
(provide 'text/misc) (provide 'text/misc)
;;; misc.el ends here ;;; misc.el ends here