.emacs.d/init.d/basics/global-variables.el

69 lines
3.1 KiB
EmacsLisp

;;; global-variables.el --- Set some global variables. -*- lexical-binding: t; -*-
;;; Commentary:
;; * Banish customizations.
;; * Fewer startup messages.
;; * Configure backup settings.
;; * Set username and email-address.
;; * Set up authentication sources
;; * Set `LC_MESSAGES'.
;; * Set `slow-computer'.
;;; Code:
(require 'basics/package-management)
(use-package emacs
:straight (:type built-in)
:demand t
:diminish abbrev-mode
:diminish auto-fill-function
;; Banish customizations to another file.
:init (setq custom-file (concat user-emacs-directory "custom.el"))
:custom ((inhibit-startup-screen t)
(inhibit-startup-echo-area-message t)
(backup-directory-alist ; Save backups in ~/.emacs.d/backups/.
`(("." . ,(concat user-emacs-directory "backups"))))
(delete-old-versions t) ; Delete old backups.
(kept-new-versions 6) ; Keep 6 newest backups.
(backup-by-copying t) ; Copy to backup folder.
(version-control t) ; Append version numbers to file names.
(auto-save-file-name-transforms ; Save auto-saves in backup dir.
`((".*" ,(concat user-emacs-directory "backups/") t)))
(create-lockfiles nil) ; Don't create lockfiles (.#<file>).
(user-full-name "tastytea")
(user-mail-address "tastytea@tastytea.de")
(recentf-max-saved-items 200) ; Number of buffers to keep in history.
(auth-sources ; Preference of authentication sources.
'("~/.authinfo.gpg" "~/.authinfo" "~/.netrc"))
(auth-source-gpg-encrypt-to ; Encrypt to these users.
(cons (symbol-value 'user-mail-address) '()))
(what-cursor-show-names t)
(read-process-output-max (* 1024 1024))) ; LSP needs this.
:config (progn
(defalias 'yes-or-no-p 'y-or-n-p) ; Just type y/n instead of yes/no.
(savehist-mode t) ; Save minibuffer history.
(global-auto-revert-mode t) ; Auto-revert file if changed on disk.
;; Show manpages and error messages from compilers in English.
(setenv "LC_MESSAGES" "en_US.utf8")
(defvar slow-computer nil) ; Slow computers load fewer packages.
(if (member (system-name) '("steuerbeamter" "azimuth" "localhost"))
(setq slow-computer t)) ; localhost is schnibble.
(defcustom my/reformat-save t
"Make changes to the buffer on save.
If t, run `whitespace-cleanup', `clang-format-buffer' and so on."
:type 'boolean
:safe #'booleanp
:group 'my)
(defun my/set-garbage-collection-threshold ()
"Set garbage collection threshold to final value."
(let ((multiplier 2))
(customize-set-variable
'gc-cons-threshold
(* (car (get 'gc-cons-threshold 'standard-value))
multiplier)))))
:hook (after-init . my/set-garbage-collection-threshold))
(provide 'basics/global-variables)
;;; global-variables.el ends here