General tidy-up

This commit is contained in:
dctrud 2022-12-31 22:38:15 +00:00
parent 9688420ce7
commit 78cf455a8b
15 changed files with 171 additions and 230 deletions

View File

@ -0,0 +1,17 @@
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-safe-themes
'("6bd4fbfd827d3e278f3d95f584e18ec384a3f529a8c7d69e3af9bbeca4beecd8" "1d0af613d28d5719bccfd5e59b8af77b68253bd7a3fde33f69678167af9c2d30" default))
'(js2-strict-inconsistent-return-warning nil)
'(js2-strict-missing-semi-warning nil)
'(package-selected-packages
'(org-download org-web-tools elpher edit-indirect markdown-mode company-c-headers ggtags impatient-mode web-mode js2-refactor js-comint tern js2-mode gotest eglot go-mode pyenv-mode py-autopep8 pip-requirements elpy flycheck bufler restart-emacs dumb-jump yasnippet which-key undo-tree smartparens projectile page-break-lines ox-twbs org-journal org-bullets neotree multiple-cursors magit-popup magit counsel ivy smex expand-region dashboard company ace-jump-mode modus-themes mood-line all-the-icons use-package)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:height 110 :family "Consolas")))))

View File

@ -1,4 +1,13 @@
;;; app-elpher.el --- Elpher Gopher / Gemini Config
;;; Commentary:
;; Configuration for Elpher, used to browse gopher and gemini sites.
;;; Code:
(use-package elpher
:ensure t)
(provide 'app-elpher)
;;; app-elpher.el ends here

View File

@ -1,37 +1,47 @@
(require 'mu4e)
;;; app-mu4e.el --- mu4e Email client configuration
;;; Commentary:
(setq
mue4e-headers-skip-duplicates t
mu4e-view-show-images t
mu4e-view-show-addresses t
mu4e-compose-format-flowed nil
mu4e-date-format "%y/%m/%d"
mu4e-headers-date-format "%Y/%m/%d"
mu4e-change-filenames-when-moving t
mu4e-attachments-dir "~/Downloads"
;; Mu4e email client configuration for my personal Emacs config.
;; Talks to Fastmail. Requires Mu4e installed from distro packages.
mu4e-maildir "~/Maildir" ;; top-level Maildir
;; note that these folders below must start with /
;; the paths are relative to maildir root
mu4e-refile-folder "/Archive"
mu4e-sent-folder "/Sent"
mu4e-drafts-folder "/Drafts"
mu4e-trash-folder "/Trash")
;;; Code:
;; this setting allows to re-sync and re-index mail
;; by pressing U
(setq mu4e-get-mail-command "mbsync -a")
(when (require 'mu4e nil t)
(fset 'my-move-to-trash "mTrash")
(define-key mu4e-headers-mode-map (kbd "d") 'my-move-to-trash)
(define-key mu4e-view-mode-map (kbd "d") 'my-move-to-trash)
(setq
mue4e-headers-skip-duplicates t
mu4e-view-show-images t
mu4e-view-show-addresses t
mu4e-compose-format-flowed nil
mu4e-date-format "%y/%m/%d"
mu4e-headers-date-format "%Y/%m/%d"
mu4e-change-filenames-when-moving t
mu4e-attachments-dir "~/Downloads"
(setq
mu4e-maildir "~/Maildir" ;; top-level Maildir
;; note that these folders below must start with /
;; the paths are relative to maildir root
mu4e-refile-folder "/Archive"
mu4e-sent-folder "/Sent"
mu4e-drafts-folder "/Drafts"
mu4e-trash-folder "/Trash")
;; this setting allows to re-sync and re-index mail
;; by pressing U
(setq mu4e-get-mail-command "mbsync -a")
(fset 'my-move-to-trash "mTrash")
(define-key mu4e-headers-mode-map (kbd "d") 'my-move-to-trash)
(define-key mu4e-view-mode-map (kbd "d") 'my-move-to-trash)
(setq
message-send-mail-function 'smtpmail-send-it
smtpmail-default-smtp-server "smtp.fastmail.com"
smtpmail-smtp-server "smtp.fastmail.com"
smtpmail-smtp-service 587
user-full-name "David Trudgian"
user-mail-address "dave@trudgian.net")
user-mail-address "dave@trudgian.net"))
(provide 'app-mu4e)
;;; app-mu4e.el ends here

View File

@ -1,3 +1,11 @@
;;; base-extensions.el --- Grab bag of packages extending base config
;;; Commentary:
;; Extensions to basic functionality, via a grab bag of packages.
;; Should probably be split up some more.
;;; Code:
(use-package ace-jump-mode
:bind
("C-c SPC" . ace-jump-mode))
@ -95,182 +103,6 @@
(if (display-graphic-p)
(add-hook 'neotree-mode-hook '(lambda () (text-scale-decrease 1)))))
(defun dctrud/org-html-preamble (plist)
(concat
"<div class=\"org-center\">"
"<p>[ "
"<a href=\"/index.html\">Home</a> | "
"<a href=\"/cv.html\">About Me</a> | "
"<a href=\"/blog/index.html\">Blog</a> ]</p></div>"))
(defun dctrud/org-html-postamble (plist)
(concat
"<hr />"
"<div class=\"figure\"><p><img src=\"https://sfconservancy.org/img/supporter-badge.png\" alt=\"SFC Supporter\" height=\"45\" /></p></div>"))
(defun dctrud/blog-sitemap-function (title list)
(concat "#+TITLE: dctrud's Random Road :: Blog\n"
"[[/blog/rss.xml][RSS Feed]]\n\n"
"* Posts\n"
(org-list-to-org list)))
(defun dctrud/org-rss-publish-to-rss (plist filename pub-dir)
"Publish RSS with PLIST, only when FILENAME is 'rss.org'.
PUB-DIR is when the output will be placed."
(if (equal "rss.org" (file-name-nondirectory filename))
(org-rss-publish-to-rss plist filename pub-dir)))
(defun dctrud/format-rss-feed (title list)
"Generate RSS feed, as a string.
TITLE is the title of the RSS feed. LIST is an internal
representation for the files to include, as returned by
`org-list-to-lisp'. PROJECT is the current project."
(concat "#+TITLE: " title "\n\n"
(org-list-to-subtree list)))
0
(defun dctrud/format-rss-feed-entry (entry style project)
"Format ENTRY for the RSS feed.
ENTRY is a file name. STYLE is either 'list' or 'tree'.
PROJECT is the current project."
(cond ((not (directory-name-p entry))
(let* ((file (org-publish--expand-file-name entry project))
(title (org-publish-find-title entry project))
(date (format-time-string "%Y-%m-%d" (org-publish-find-date entry project)))
(link (concat (file-name-sans-extension entry) ".html")))
(with-temp-buffer
(insert (format "* [[file:%s][%s]]\n" file title))
(org-set-property "RSS_PERMALINK" link)
(org-set-property "PUBDATE" date)
(insert-file-contents file)
(buffer-string))))
((eq style 'tree)
;; Return only last subdir.
(file-name-nondirectory (directory-file-name entry)))
(t entry)))
(use-package org
:bind
("C-c l" . org-store-link)
("C-c a" . org-agenda)
:config
(require 'ox-rss)
;; Org directories
(setq org-directory "~/Dropbox/Org"
org-default-notes-file (concat org-directory "/todo.org"))
(setq org-agenda-files '("~/Dropbox/Org/"))
;; Default show all of the things
(setq org-startup-folded nil)
;; Exports don't have TOC or numbering by default
(setq org-export-with-toc nil)
(setq org-export-with-creator nil)
(setq org-export-with-section-numbers nil)
(setq org-export-with-sub-superscripts nil)
;; Indent by default
(setq org-startup-indented t)
;; Split right if window is wide enough
(defadvice org-agenda (around split-vertically activate)
(let ((split-width-threshold 80)) ; or whatever width makes sense for you
ad-do-it))
;;warn me of any deadlines in next 7 days
(setq org-deadline-warning-days 7)
;;show me tasks scheduled or due in next fortnight
(setq org-agenda-span (quote fortnight))
;; Agenda Settings
(setq org-agenda-custom-commands
'(("c" "Simple agenda view"
((tags "PRIORITY=\"A\""
((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
(org-agenda-overriding-header "High-priority unfinished tasks:")))
(agenda "")
(alltodo ""
((org-agenda-skip-function
'(or (dctrud/org-skip-subtree-if-priority ?A)
(org-agenda-skip-if nil '(scheduled deadline))))))))))
(setq org-publish-project-alist
'(("site"
:components ("content" "static" "blog" "blog-rss"))
("content"
:base-directory "~/Dropbox/Org/Web/pages/"
:base-extension "org"
:publishing-directory "~/Dropbox/Org/WebPub/"
:publishing-function org-html-publish-to-html
:recursive t
:timestamp t
:with-sub-superscript nil
:section-numbers: nil
:with-headline-numbers nil
:html-doctype "html5"
:html-html5-fancy t
:html-head "<link rel=\"stylesheet\" type=\"text/css\" href=\"/static/org-css/stylesheet.css\" />"
:html-preamble dctrud/org-html-preamble
:html-postamble dctrud/org-html-postamble)
("static"
:base-directory "~/Dropbox/Org/Web/static/"
:base-extension "css\\|js\\|png\\|jpg\\|jpeg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|otf"
:publishing-directory "~/Dropbox/Org/WebPub/static/"
:recursive t
:publishing-function org-publish-attachment)
("blog"
:base-directory "~/Dropbox/Org/Web/blog/"
:base-extension "org"
:publishing-directory "~/Dropbox/Org/WebPub/blog/"
:publishing-function org-html-publish-to-html
:makeindex nil
:auto-sitemap t
:sitemap-filename "index.org"
:sitemap-title "dctrud's Random Road :: Blog"
:sitemap-function dctrud/blog-sitemap-function
:sitemap-sort-files anti-chronologically
:recursive t
:timestamp t
:with-sub-superscript nil
:section-numbers: nil
:with-headline-numbers nil
:exclude "index.org\\|rss.org"
:html-doctype "html5"
:html-html5-fancy t
:html-head "<link rel=\"stylesheet\" type=\"text/css\" href=\"/static/org-css/stylesheet.css\" />"
:html-preamble dctrud/org-html-preamble
:html-postamble dctrud/org-html-postamble)
("blog-rss"
:base-directory "~/Dropbox/Org/Web/blog/"
:base-extension "org"
:publishing-directory "~/Dropbox/Org/WebPub/blog/"
:publishing-function dctrud/org-rss-publish-to-rss
:makeindex nil
:auto-sitemap t
:sitemap-filename "rss.org"
:sitemap-title "dctrud's Blog"
:sitemap-sort-files anti-chronologically
:sitemap-function dctrud/format-rss-feed
:sitemap-format-entry dctrud/format-rss-feed-entry
:rss-extension "xml"
:exclude "index.org\\|rss.org"
:html-link-home "https://randomroad.net/blog"
:html-link-use-abs-url t))))
(use-package org-bullets
:config
(setq org-hide-leading-stars t)
(add-hook 'org-mode-hook
(lambda ()
(org-bullets-mode t))))
(use-package org-journal
:ensure t
:config
(setq org-journal-dir "~/Org/Journal/")
(setq org-journal-file-type 'weekly))
(use-package ox-twbs
:ensure t)
(use-package org-web-tools
:ensure t)
(use-package org-download
:ensure t)
(use-package page-break-lines)
(use-package projectile
@ -327,3 +159,5 @@ PROJECT is the current project."
:init (global-flycheck-mode))
(provide 'base-extensions)
;;; base-extensions.el ends here

View File

@ -1,4 +1,12 @@
;; Add your custom functions here
;;; base-functions.el --- Custom functions
;;; Commentary:
;; Custom functions for my personal Emacs config.
;;; Code:
(require 'projectile)
(require 'neotree)
(defun dct/neotree-project-dir ()
"Open NeoTree at the git root."
@ -15,3 +23,5 @@
(provide 'base-functions)
;;; base-functions.el ends here

View File

@ -1,11 +1,15 @@
;; Add your keys here, as such
;;; base-global-keys.el --- Global key mappings
;;; Commentary:
;; Global key mappings for my personal Emacs config.
;;; Code:
;; On Mac, make the meta/super in same position as on PC
(when (eq system-type 'darwin)
(setq mac-command-modifier 'meta)
(setq mac-option-modifier nil))
;; Use super in emacs as much as possible on Windows
(if (eq system-type 'windows-nt)
(progn
@ -24,5 +28,6 @@
(global-set-key [f8] 'dct/neotree-project-dir)
(global-set-key (kbd "C-x p /") 'projectile-grep)
(provide 'base-global-keys)
;;; base-global-keys.el ends here

View File

@ -1,4 +1,12 @@
(load-theme 'adwaita t)
;;; base-theme.el --- Theming / appearance settings
;;; Commentary:
;; This package contains any theming and appearance related settings
;; for my Emacs config.
;;; Code:
(load-theme 'modus-operandi)
(use-package all-the-icons
:ensure t)
@ -7,10 +15,6 @@
:ensure t
:init (mood-line-mode 1))
(use-package modus-themes
:ensure t
:config
(load-theme 'modus-operandi t)
:bind ("<f5>" . modus-themes-toggle))
(provide 'base-theme)
;;; base-theme.el ends here

View File

@ -1,3 +1,10 @@
;;; base.el --- Base cofiguration / customizations
;;; Commentary:
;; Base customizations, package management setup, etc.
;;; Code:
(package-initialize)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
@ -11,7 +18,7 @@
(defconst private-dir (expand-file-name "private" user-emacs-directory))
(defconst temp-dir (format "%s/cache" private-dir)
"Hostname-based elisp temp directories")
"Hostname-based elisp temp directories.")
;; Core settings
;; UTF-8 please
@ -35,7 +42,6 @@
;; http://ergoemacs.org/emacs/emacs_stop_cursor_enter_prompt.html
minibuffer-prompt-properties
'(read-only t point-entered minibuffer-avoid-prompt face minibuffer-prompt)
;; Disable non selected window highlight
cursor-in-non-selected-windows nil
highlight-nonselected-windows nil
@ -44,15 +50,9 @@
indent-tabs-mode nil
inhibit-startup-message t
fringes-outside-margins t
x-select-enable-clipboard t
select-enable-clipboard t
use-package-always-ensure t)
;; Bookmarks
(setq
;; persistent bookmarks
bookmark-save-flag t
bookmark-default-file (concat temp-dir "/bookmarks"))
;; Backups enabled, use nil to disable
(setq
history-length 1000
@ -87,4 +87,5 @@
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(provide 'base)
;;; base ends here
;;; base.el ends here

View File

@ -1,4 +1,10 @@
;;; lang-c.el --- C language configuration
;;; Commentary:
;; C-IDE based on https://github.com/tuhdo/emacs-c-ide-demo
;;; Code:
(use-package cc-mode
:config
;; Available C style:
@ -83,3 +89,5 @@
(add-hook 'c++-mode-hook 'alexott/cedet-hook)
(provide 'lang-c)
;;; lang-c.el ends here

View File

@ -1,3 +1,10 @@
;;; lang-go.el --- Go language configuration
;;; Commentary:
;; Packages and configuration for Go programming.
;;; Code:
(use-package go-mode
:ensure t
:config
@ -13,3 +20,5 @@
:ensure t)
(provide 'lang-go)
;;; lang-go.el ends here

View File

@ -1,3 +1,10 @@
;;; lang-javascript.el --- Javascript language configuration
;;; Commentary:
;; Packages and config for Javascript programming.
;;; Code:
;; js2-mode
;; https://github.com/mooz/js2-mode
(use-package js2-mode
@ -45,3 +52,5 @@
(add-hook 'js2-mode-hook 'js2-refactor-mode))
(provide 'lang-javascript)
;;; lang-javascript.el ends here

View File

@ -1,3 +1,10 @@
;;; lang-markdown.el --- Markdown editing configuration
;;; Commentary:
;; Packages and configuration for markdown editing.
;;; Code:
(use-package markdown-mode
:ensure t
:commands (markdown-mode gfm-mode)
@ -9,3 +16,5 @@
:ensure t)
(provide 'lang-markdown)
;;; lang-markdown.el ends here

View File

@ -1,9 +1,12 @@
;;; package --- python configs
;;; lang-python.el --- Python language configuration
;;; Commentary:
;;; Contains my python configs
;; Packages and configuration for Python programming.
;;; Code:
(require 'f)
(use-package python
:mode ("\\.py" . python-mode)
:config
@ -25,7 +28,6 @@
(use-package py-autopep8)
(use-package pyenv-mode
:if
(executable-find "pyenv")
@ -61,4 +63,5 @@
(add-hook 'projectile-after-switch-project-hook 'pyenv-activate-current-project)
(provide 'lang-python)
;;; base-python.el ends here
;;; lang-python.el ends here

View File

@ -1,3 +1,11 @@
;;; lang-web.el --- Web languages configuration
;;; Commentary:
;; Packages and configuration for web related files, HTML and
;; derivatives.
;;; Code:
(use-package web-mode
:bind (("C-c ]" . emmet-next-edit-point)
("C-c [" . emmet-prev-edit-point))
@ -79,3 +87,5 @@
:commands (impatient-mode))
(provide 'lang-web)
;;; lang-web.el ends here

11
init.el
View File

@ -1,11 +1,11 @@
;;; package --- Main init file
;;; init.el --- Personal Emacs config initialization
;;; Commentary:
;;; This is my init file
;; Basic initialization for my personal Emacs config.
;;; Code:
;;; For performance
;; For performance
(setq gc-cons-threshold 100000000)
(setq read-process-output-max (* 1024 1024)) ;; 1mb
@ -35,5 +35,8 @@
(require 'app-elpher)
;(require 'app-mu4e)
(require 'app-org)
(require 'ssh-agency)
;;; init.el ends here