diff options
author | Piotr Szarmanski | 2023-01-03 18:39:57 +0100 |
---|---|---|
committer | Piotr Szarmanski | 2023-01-03 18:39:57 +0100 |
commit | 8ee57ceceef058d89f6e44a0f5fdbb99e676f262 (patch) | |
tree | f5474650ab1b28175bf5c3bfe353c84302b74026 | |
parent | 55091f3d0a8ce3539d2212c63fdd9abce36c6284 (diff) |
Gnus config change + org-publish stuff
-rw-r--r-- | config.org | 194 | ||||
-rw-r--r-- | init.el | 5 |
2 files changed, 178 insertions, 21 deletions
@@ -499,9 +499,15 @@ be refiled into a different tree. Really useful for TODOs. "* %?\n:PROPERTIES:\n:rating: %^{Rating}\n:main: %^{Main characters}\n:END:\n") ("A" "Anime upcoming" entry (file+headline ,(concat org-directory "agenda/anime.org") "Upcoming anime") "* %?\n %^t\n") - ("s" "School" entry (file+headline ,(concat org-directory "agenda/school.org") "School") + ("s" "Wydarzenie dt. studiów" entry (file+headline ,(concat org-directory "agenda/mimuw.org") + "Wydarzenia") + "* %^t " + :refile-targets `(((,(concat org-directory "agenda/mimuw.org")) . (:tag . "cat")))) + ("S" "Praca do wykonania" entry (file+headline ,(concat org-directory "agenda/mimuw.org") + "Praca do wykonania") "* TODO %?\nDEADLINE: %^t\n" - :refile-targets `(((,(concat org-directory "agenda/school.org")) . (:tag . "cat")))) + :refile-targets `(((,(concat org-directory "agenda/mimuw.org")) . (:tag . "cat")))) + ("l" "Link" item (file+headline ,(concat org-directory "links.org") "Links") "+ %(call-interactively #'webarch-capture) :: %?" :refile-targets `(((,(concat org-directory "links.org")) . (:level . 1)))) @@ -522,6 +528,63 @@ Set up org exports. (setq org-startup-with-inline-images t) (setq org-html-validation-link nil) #+end_src +** Org-publish +#+begin_src emacs-lisp + (require 'ox-publish) + (setq org-export-with-statistics-cookies nil + org-html-head-include-default-style t) + + (setq org-export-with-toc 2 + org-export-with-date nil + org-export-with-author nil + org-export-with-creator nil) + + (setq http-dir + "/ssh:root@ykonai.net:/srv/http/ykonai/") + + (defun yk/org-sitemap (title list) + (concat "#+TITLE: " title "\n\n" + "Mail: mail [AT] ykonai [DOT] net + + Public key: [[https://ykonai.net/key.asc][[11B2 E4AF 4833 D7A5 BEAF 3566 CC6D 0555 B66F 03AC]]] + + [[https://git.ykonai.net][Some projects]]\n" + (org-list-to-org list))) + + (setq org-publish-project-alist + `(("er" + :base-directory "~/org/fun/er" + :publishing-directory ,(concat http-dir "er/") + :auto-sitemap t + + :sitemap-style tree + :sitemap-filename "index.org" + :sitemap-sort-files anti-chronologically + :sitemap-title "Index" + + :html-postamble nil + :html-head "<link rel=\"stylesheet\" href=\"../style.css\">") + ("css" + :base-directory "~/org/website" + :base-extension "css" + :publishing-function org-publish-attachment + :publishing-directory ,http-dir) + ("blog" + :base-directory "~/org/website/" + :base-extension "org" + :publishing-directory ,http-dir + :auto-sitemap t + + :sitemap-style tree + :sitemap-filename "index.org" + :sitemap-sort-files anti-chronologically + :sitemap-title "Index" + :sitemap-function yk/org-sitemap + + :html-postamble nil + :html-head "<link rel=\"stylesheet\" href=\"style.css\">") + ("website" :components ("blog" "css" "er")))) +#+end_src ** Org-babel Literate programming settings. #+begin_src emacs-lisp @@ -568,6 +631,13 @@ heavier tasks #+END_SRC ** Modules #+begin_src emacs-lisp + + (require 'tramp) + (eval-when-compile + (require 'cl-lib) + (require 'esh-mode) + (require 'eshell)) + (require 'esh-util) (add-to-list 'eshell-modules-list 'eshell-tramp) #+end_src ** Custom functions @@ -1029,9 +1099,15 @@ theme seems very pretty on the other hand. #+end_src * Major modes section ** Gnus +*** Set C-x g to open Gnus #+begin_src emacs-lisp (require 'gnus) (global-set-key (kbd "C-x g") #'gnus) + +#+end_src +*** Put everything in ~/news +This should essentially put everything under ~/news. +#+begin_src emacs-lisp (setq gnus-home-directory (expand-file-name "~/news/")) (setq gnus-directory (expand-file-name "data/" gnus-home-directory) @@ -1041,6 +1117,18 @@ theme seems very pretty on the other hand. gnus-startup-file (expand-file-name "newsrc" gnus-home-directory) gnus-kill-files-directory (expand-file-name "data/" gnus-home-directory) gnus-cache-directory (expand-file-name "data/cache/" gnus-home-directory)) +#+end_src +*** Set select methods and mail sources +**** Primary select method +The primary select method is nnmail from a maildir so that I can use +nnmail-split. I fetch it via imap using mbsync. The disadvantage is that I can't +really use the same mail account on other devices, but I don't really use +anything but Gnus anyways. +#+begin_src emacs-lisp + (setq gnus-select-method + '(nnmaildir "mail" + (directory "~/news/mail/maildir") + (get-new-mail t))) (setq mail-source-directory (expand-file-name "mail/incoming" gnus-home-directory)) @@ -1049,7 +1137,72 @@ theme seems very pretty on the other hand. (setq mail-sources `((maildir :path ,(expand-file-name "~/news/mail/imap/INBOX")))) +#+end_src +**** Secondary select methods +These are two maildirs, one is from my RSS-to-mail system and the other is a +university server. I sync both using imap via mbsync but preserve the maildir so +that I can see them on other devices. +#+begin_src emacs-lisp + (setq gnus-secondary-select-methods + (list + '(nnmaildir "feeds" + (directory "~/news/mail/feeds/feeds") + (get-new-mail nil)) + '(nnmaildir "mimuw" + (directory "~/news/mail/mimuw/") + (get-new-mail nil)))) +#+end_src +*** gnus-posting-styles +Posting styles make it possible to manage different mail accounts from one Gnus. +**** gnus/is-within-topic +This is a simple function that returns non-nil if the current ~gnus-newsgroup-name~ is +contained within the (top-level) topic according to ~gnus-topic-alist~. +#+begin_src emacs-lisp + (defun gnus/is-within-topic (topic) + "Return t if the current gnus-newsgroup-name is within a + top-level topic TOPIC according to gnus-topic-alist" + (member gnus-newsgroup-name (assoc-string topic gnus-topic-alist))) +#+end_src +**** compose-mail-with-account +On =C-u C-x m=, first prompt for the account and then only call compose-message. +#+begin_src emacs-lisp + (defun compose-mail-with-account (account) + (interactive + (list + (completing-read "Account: " '("MIMUW" "ykonai")))) + (pcase account + ("ykonai" (compose-mail + nil nil + '(("From" . "mail@ykonai.net") + ("X-Message-SMTP-Method" . "smtp mail.ykonai.net 587 yk")) )) + ("MIMUW" (compose-mail + nil nil + '(("From" . "Piotr Szarmański <ps448543@students.mimuw.edu.pl>") + ("X-Message-SMTP-Method" . "smtp students.mimuw.edu.pl 587 ps448543")))))) + + (defun extended-compose-mail (prefix) + (interactive "P") + (if prefix + (call-interactively #'compose-mail-with-account) + (call-interactively #'compose-mail))) + + (global-set-key (kbd "C-x m") #'extended-compose-mail) +#+end_src +**** posting-styles +#+begin_src emacs-lisp + (setq gnus-posting-styles + `((".*" ;; default + (address ,user-mail-address)) + ((gnus/is-within-topic "mimuw") + (name "Piotr Szarmański") + (address "Piotr Szarmański <ps448543@students.mimuw.edu.pl>") + ("X-Message-SMTP-Method" "smtp students.mimuw.edu.pl 587 ps448543")))) + +#+end_src + +*** Split mail via nnmail-split-fancy +#+begin_src emacs-lisp (setq nnmail-split-fancy `(| (any ".*@debbugs.gnu.org" "debbugs.gnu") (from "help-debbugs@gnu.org" "debbugs.gnu") @@ -1060,34 +1213,29 @@ theme seems very pretty on the other hand. (setq nnmail-split-methods nnmail-split-fancy) - (setq gnus-select-method - '(nnmaildir "mail" - (directory "~/news/mail/maildir") - (get-new-mail t))) - - (setq gnus-secondary-select-methods - (list - '(nnmaildir "feeds" - (directory "~/news/mail/feeds/feeds") - (get-new-mail nil)) - '(nnmaildir "mimuw" - (directory "~/news/mail/mimuw/") - (get-new-mail nil)))) - +#+end_src +*** Options +**** Add Archived-At to visible headers +#+begin_src emacs-lisp (setq gnus-visible-headers "^From:\\|^Newsgroups:\\|^Subject:\\|^Date:\\|^Followup-To:\\|^Reply-To:\\|^Organization:\\|^Summary:\\|^Keywords:\\|^To:\\|^[BGF]?Cc:\\|^Posted-To:\\|^Mail-Copies-To:\\|^Mail-Followup-To:\\|^Apparently-To:\\|^Gnus-Warning:\\|^Resent-From:\\|^Archived-At:") - +#+end_src +**** Add group mode behavior +#+begin_src emacs-lisp (add-hook 'gnus-group-mode-hook 'gnus-topic-mode) (setq gnus-default-article-saver 'gnus-summary-write-to-file gnus-large-newsgroup 100 gnus-message-archive-group nil) - +#+end_src +**** Silence backends +#+begin_src emacs-lisp (setq gnus-verbose-backends 0) - +#+end_src +**** Don't use the full window +#+begin_src emacs-lisp (setq gnus-use-full-window nil) #+end_src *** Article mode -Add visual fill mode to the article buffer for the sake of readability. #+begin_src emacs-lisp ;; (add-hook 'gnus-article-mode-hook (lambda () ;; (setq line-spacing 2) @@ -1097,6 +1245,12 @@ Add visual fill mode to the article buffer for the sake of readability. (define-key gnus-article-mode-map (kbd "C-c C-c") #'do-right-thing-at-point) #+end_src +*** Disable TAB indentation in topic-mode. +#+begin_src emacs-lisp + (require 'gnus-topic) + (put 'gnus-topic-indent 'disabled t) + (define-key gnus-topic-mode-map (kbd "TAB") nil) +#+end_src ** Eww #+begin_src emacs-lisp (require 'shr) @@ -56,7 +56,10 @@ (seek . emms-player-mpd-seek) (seek-to . emms-player-mpd-seek-to))) '(safe-local-variable-values - '((eval progn + '((Package . CL-USER) + (Syntax . ANSI-Common-Lisp) + (Base . 10) + (eval progn (require 'lisp-mode) (defun emacs27-lisp-fill-paragraph (&optional justify) |