From 158a232cfe8b3f8362a28f1e9caef7427b08d46b Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sat, 11 Jan 2020 12:35:53 +0100 Subject: [PATCH] Move some personal customization variables to dedicated package --- init.el | 40 +++++------------------------ site-lisp/db-customize.el | 54 +++++++++++++++++++++++++++++++++++++++ site-lisp/db-utils.el | 11 -------- 3 files changed, 60 insertions(+), 45 deletions(-) create mode 100644 site-lisp/db-customize.el diff --git a/init.el b/init.el index 446e82c..a79cdd0 100644 --- a/init.el +++ b/init.el @@ -286,17 +286,12 @@ ;; * Personal customization -(defgroup personal-settings nil - "A bunch of functions and variables for personalizing emacs." - :prefix "db/" - :group 'convenience - :group 'help - :tag "Personal settings") - -(defcustom db/jabber-id "" - "Personal XMPP ID." - :group 'personal-settings - :type 'string) +(use-package db-customize + :defines (db/jabber-id + db/important-documents-path + db/path-to-onenote + db/path-to-outlook + db/cert-file-directory)) (defcustom db/after-init-load-files nil "A list of files to be loaded by `db/run-init' as the last step." @@ -561,7 +556,6 @@ conditionally-enable-lispy turn-on-lispy-when-available db/sort-nsm-permanent-settings - db/update-cert-file-directory endless/colorize-compilation db/add-use-package-to-imenu db/turn-off-local-electric-pair-mode @@ -657,12 +651,6 @@ call." (set symbol value) (db/define-hydra-from-frequently-used-features))) -(defcustom db/important-documents-path "~/Documents/library/" - "Path to look for documents that can be listed in extended -search commands like `db/helm-shortcuts’." - :group 'personal-settings - :type 'string) - (defun db/helm-shortcuts (arg) "Open helm completion on common locations. With given ARG, display files in `db/important-document-path’." @@ -722,16 +710,6 @@ With given ARG, display files in `db/important-document-path’." hydra-org-clock/body db/make-org-capture-frame)) -(defcustom db/path-to-onenote "c:/Program Files (x86)/Microsoft Office/Office15/ONENOTE.EXE" - "Path to OneNote executable, for opening corresponding org-mode links." - :group 'personal-settings - :type 'file) - -(defcustom db/path-to-outlook "c:/Program Files (x86)/Microsoft Office/Office15/OUTLOOK.EXE" - "Path to Outlook executable, for opening corresponding org-mode links." - :group 'personal-settings - :type 'file) - (use-package org :commands (org-store-link) :bind (:map org-mode-map @@ -1736,12 +1714,6 @@ in the main agenda view." gnutls-min-prime-bits 1024 gnutls-verify-error t)) -(defcustom db/cert-file-directory "~/.local/etc/certs/" - "Local directory with additional certificates." - :group 'personal-settings - :type 'string - :set #'db/update-cert-file-directory) - (use-package epg :defer t :init (setq epg-debug t diff --git a/site-lisp/db-customize.el b/site-lisp/db-customize.el new file mode 100644 index 0000000..cca17de --- /dev/null +++ b/site-lisp/db-customize.el @@ -0,0 +1,54 @@ +;;; db-customize.el --- Custom variables -*- lexical-binding: t -*- + +;;; Commentary: + +;;; Code: + +(defgroup personal-settings nil + "A bunch of functions and variables for personalizing emacs." + :prefix "db/" + :group 'convenience + :group 'help + :tag "Personal settings") + +(defcustom db/jabber-id "" + "Personal XMPP ID." + :group 'personal-settings + :type 'string) + +(defcustom db/important-documents-path "~/Documents/library/" + "Path to look for documents that can be listed in extended +search commands like `db/helm-shortcuts’." + :group 'personal-settings + :type 'string) + +(defcustom db/path-to-onenote "c:/Program Files (x86)/Microsoft Office/Office15/ONENOTE.EXE" + "Path to OneNote executable, for opening corresponding org-mode links." + :group 'personal-settings + :type 'file) + +(defcustom db/path-to-outlook "c:/Program Files (x86)/Microsoft Office/Office15/OUTLOOK.EXE" + "Path to Outlook executable, for opening corresponding org-mode links." + :group 'personal-settings + :type 'file) + +(defun db/update-cert-file-directory (symbol new-value) + "Set SYMBOL to NEW-VALUE and add all certificate in it to `gnutls-trustfiles’. + +Assumes that NEW-VALUE points to a directory, and certificates +are assumed to be of the form *.crt." + (set symbol new-value) + (require 'gnutls) + (when (file-directory-p new-value) + (dolist (cert-file (directory-files new-value t ".crt$")) + (add-to-list 'gnutls-trustfiles cert-file)))) + +(defcustom db/cert-file-directory "~/.local/etc/certs/" + "Local directory with additional certificates." + :group 'personal-settings + :type 'string + :set #'db/update-cert-file-directory) + +(provide 'db-customize) + +;;; db-customize ends here diff --git a/site-lisp/db-utils.el b/site-lisp/db-utils.el index 5e271dd..cab694c 100644 --- a/site-lisp/db-utils.el +++ b/site-lisp/db-utils.el @@ -252,17 +252,6 @@ Will print a warning in case of failure." #'string< :key #'cl-second))) -(defun db/update-cert-file-directory (symbol new-value) - "Set SYMBOL to NEW-VALUE and add all certificate in it to `gnutls-trustfiles’. - -Assumes that NEW-VALUE points to a directory, and certificates -are assumed to be of the form *.crt." - (set symbol new-value) - (require 'gnutls) - (when (file-directory-p new-value) - (dolist (cert-file (directory-files new-value t ".crt$")) - (add-to-list 'gnutls-trustfiles cert-file)))) - (defun endless/colorize-compilation () "Colorize from `compilation-filter-start' to `point'." ;; http://endlessparentheses.com/ansi-colors-in-the-compilation-buffer-output.html