Move some personal customization variables to dedicated package

This commit is contained in:
Daniel - 2020-01-11 12:35:53 +01:00
parent f4b55ad777
commit 158a232cfe
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
3 changed files with 60 additions and 45 deletions

40
init.el
View File

@ -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

54
site-lisp/db-customize.el Normal file
View File

@ -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

View File

@ -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