[literate] move desktop and mail config to init.org

This commit is contained in:
contrapunctus 2021-03-16 12:39:27 +05:30
parent 463db6d685
commit b64cfeef64
3 changed files with 93 additions and 94 deletions

View File

@ -1,51 +0,0 @@
(use-package desktop
:init
(desktop-save-mode t)
(desktop-auto-save-enable)
:config
(setq desktop-dirname "~/.emacs.d/desktop-save/"
desktop-save 'ask-if-new
;; don't save buffers, just the history
desktop-files-not-to-save ""
desktop-buffers-not-to-save "")
(cl-loop for var in
'(grep-history
grep-find-history
find-args-history
extended-command-history
read-expression-history
default-input-method
input-method-history
query-replace-history
compile-history
string-rectangle-history
regexp-history
dired-shell-command-history
dired-regexp-history
shell-command-history
org-tags-history
minibuffer-history
erc-server-history-list
cp/activity-history
LaTeX-environment-history
swiper-history)
do (add-to-list 'desktop-globals-to-save var)))
;; (add-to-list 'desktop-locals-to-save 'comint-input-ring)
(defun cp/backup-desktop-file ()
(let ((new-filename (->> (shell-command-to-string "date -Is")
(replace-regexp-in-string "\n" "")
(concat "~/.emacs.d/.emacs.desktop."))))
(copy-file "~/.emacs.d/.emacs.desktop" new-filename)))
(defun cp/cleanup-desktop-backups ()
(let ((desktop-file-backups (-> (concat "find ~/.emacs.d/ -maxdepth 1 -type f |"
" grep -E \"\.emacs\.desktop\.[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}[-+]?[0-9]{2}:?[0-9]{2}\"")
(shell-command-to-string )) )))
(if (> 10 )))
;; ;; this one created loads and loads of backups
;; (add-hook 'desktop-save-hook 'cp/backup-desktop-file)
;; ;; not enough space for this - wasteful
;; (add-hook 'kill-emacs-hook 'cp/backup-desktop-file)
(provide 'cp-desktop)

View File

@ -1,40 +0,0 @@
(use-package wl
:disabled
:config
(setq wl-icon-directory "~/.emacs.d/wl/icons"
wl-smtp-posting-server "disroot.org"))
(use-package mew
:disabled
:config
(setq mew-user "contrapunctus"
mew-name mew-user
mew-mail-domain "disroot.org"
mew-proto "%"
mew-smtp-server mew-mail-domain
mew-imap-server mew-mail-domain))
(use-package gnus
:init ;; I composed an email without loading Gnus, and it wasn't
;; saved in my sent folder; here's hoping that changing :config to
;; :init will do it.
(setq gnus-select-method '(nnnil "")
gnus-secondary-select-methods '((nnml "")
(nnimap "disroot.org")
;; (nnimap "imap.gmail.com"
;; (nnimap-stream starttls))
)
user-mail-address "contrapunctus@disroot.org"
user-full-name "contrapunctus"
gnus-mime-display-multipart-related-as-mixed t
smiley-style 'medium
message-send-mail-function 'smtpmail-send-it
;; gnus-message-archive-method '(nnimap "disroot.org")
gnus-message-archive-group "nnimap+disroot.org:Sent"))
(use-package message
:hook
(message-mode . (lambda () (auto-fill-mode -1)))
(message-mode . visual-fill-column-mode))
(provide 'cp-mail)

View File

@ -985,6 +985,48 @@ PR ideas
:hook
(dired-mode . peep-dired))
#+END_SRC
*** mail
#+BEGIN_SRC emacs-lisp
(use-package wl
:disabled
:config
(setq wl-icon-directory "~/.emacs.d/wl/icons"
wl-smtp-posting-server "disroot.org"))
(use-package mew
:disabled
:config
(setq mew-user "contrapunctus"
mew-name mew-user
mew-mail-domain "disroot.org"
mew-proto "%"
mew-smtp-server mew-mail-domain
mew-imap-server mew-mail-domain))
(use-package gnus
:init ;; I composed an email without loading Gnus, and it wasn't
;; saved in my sent folder; here's hoping that changing :config to
;; :init will do it.
(setq gnus-select-method '(nnnil "")
gnus-secondary-select-methods '((nnml "")
(nnimap "disroot.org")
;; (nnimap "imap.gmail.com"
;; (nnimap-stream starttls))
)
user-mail-address "contrapunctus@disroot.org"
user-full-name "contrapunctus"
gnus-mime-display-multipart-related-as-mixed t
smiley-style 'medium
message-send-mail-function 'smtpmail-send-it
;; gnus-message-archive-method '(nnimap "disroot.org")
gnus-message-archive-group "nnimap+disroot.org:Sent"))
(use-package message
:hook
(message-mode . (lambda () (auto-fill-mode -1)))
(message-mode . visual-fill-column-mode))
#+END_SRC
** comint
#+BEGIN_SRC emacs-lisp
@ -2747,10 +2789,58 @@ Must put this after loading the custom file, or I get prompted about the theme e
erc-remove-text-properties-region))
#+END_SRC
**
** desktop - session management
#+BEGIN_SRC emacs-lisp
(require 'cp-desktop)
(require 'cp-mail)
(use-package desktop
:init
(desktop-save-mode t)
(desktop-auto-save-enable)
:config
(setq desktop-dirname "~/.emacs.d/desktop-save/"
desktop-save 'ask-if-new
;; don't save buffers, just the history
desktop-files-not-to-save ""
desktop-buffers-not-to-save "")
(cl-loop for var in
'(grep-history
grep-find-history
find-args-history
extended-command-history
read-expression-history
default-input-method
input-method-history
query-replace-history
compile-history
string-rectangle-history
regexp-history
dired-shell-command-history
dired-regexp-history
shell-command-history
org-tags-history
minibuffer-history
erc-server-history-list
cp/activity-history
LaTeX-environment-history
swiper-history)
do (add-to-list 'desktop-globals-to-save var)))
;; (add-to-list 'desktop-locals-to-save 'comint-input-ring)
(defun cp/backup-desktop-file ()
(let ((new-filename (->> (shell-command-to-string "date -Is")
(replace-regexp-in-string "\n" "")
(concat "~/.emacs.d/.emacs.desktop."))))
(copy-file "~/.emacs.d/.emacs.desktop" new-filename)))
(defun cp/cleanup-desktop-backups ()
(let ((desktop-file-backups (-> (concat "find ~/.emacs.d/ -maxdepth 1 -type f |"
" grep -E \"\.emacs\.desktop\.[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}[-+]?[0-9]{2}:?[0-9]{2}\"")
(shell-command-to-string )) )))
(if (> 10 )))
;; ;; this one created loads and loads of backups
;; (add-hook 'desktop-save-hook 'cp/backup-desktop-file)
;; ;; not enough space for this - wasteful
;; (add-hook 'kill-emacs-hook 'cp/backup-desktop-file)
#+END_SRC
**