From: Amin Bandali Date: Sat, 31 Aug 2019 14:40:55 +0000 (-0400) Subject: emacs: use no-littering X-Git-Url: https://git.shemshak.org/~bandali/configs/commitdiff_plain/1060413bf79aaa20273c785976cf9c2b2b34fac2?ds=inline emacs: use no-littering --- diff --git a/.emacs.d/init.el b/.emacs.d/init.el index ab634c8..d08c84a 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -180,27 +180,11 @@ ;;; Initial setup ;; keep ~/.emacs.d clean -(defvar b/etc-dir - (expand-file-name - (convert-standard-filename "etc/") user-emacs-directory) - "The directory where packages place their configuration files.") - -(defvar b/var-dir - (expand-file-name - (convert-standard-filename "var/") user-emacs-directory) - "The directory where packages place their persistent data files.") - -(defun b/etc (file) - "Expand filename FILE relative to `b/etc-dir'." - (expand-file-name (convert-standard-filename file) b/etc-dir)) - -(defun b/var (file) - "Expand filename FILE relative to `b/var-dir'." - (expand-file-name (convert-standard-filename file) b/var-dir)) - -(setq - auto-save-list-file-prefix (b/var "auto-save/sessions/") - nsm-settings-file (b/var "nsm-settings.el")) +(use-package no-littering + :demand + :config + (defalias 'b/etc 'no-littering-expand-etc-file-name) + (defalias 'b/var 'no-littering-expand-var-file-name)) ;; separate custom file (don't want it mixing with init.el) (use-feature custom @@ -403,7 +387,6 @@ For disabling the behaviour for certain buffers and/or modes." ;; backups (C-h v make-backup-files RET) (setq backup-by-copying t - backup-directory-alist (list (cons "." (b/var "backup/"))) version-control t delete-old-versions t) @@ -664,9 +647,6 @@ For disabling the behaviour for certain buffers and/or modes." (nconc magit-section-initial-visibility-alist '(([unpulled status] . show) ([unpushed status] . show))) - (setq transient-history-file (b/var "transient/history.el") - transient-levels-file (b/etc "transient/levels.el") - transient-values-file (b/etc "transient/values.el")) :custom (magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1) :custom-face (magit-diff-file-heading ((t (:weight normal))))) @@ -676,13 +656,10 @@ For disabling the behaviour for certain buffers and/or modes." ;; :config ;; (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:") :custom - (recentf-max-saved-items 2000) - (recentf-save-file (b/var "recentf-save.el"))) + (recentf-max-saved-items 2000)) ;; smart M-x enhancement (needed by counsel for history) -(use-package smex - :config - (setq smex-save-file (b/var "smex-save.el"))) +(use-package smex) (use-package ivy :defer 0.3 @@ -787,7 +764,6 @@ This function is intended for use with `ivy-ignore-buffers'." :hook (eshell-mode . b/eshell-setup) :custom - (eshell-directory-name (b/var "eshell/")) (eshell-hist-ignoredups t) (eshell-input-filter 'eshell-input-filter-initial-space)) @@ -987,17 +963,15 @@ This function is intended for use with `ivy-ignore-buffers'." ;; save minibuffer history (use-feature savehist + :demand :config (savehist-mode) - :custom - (savehist-file (b/var "savehist.el"))) + (add-to-list 'savehist-additional-variables 'kill-ring)) ;; automatically save place in files (use-feature saveplace :when (version< "25" emacs-version) - :config (save-place-mode) - :custom - (save-place-file (b/var "save-place.el"))) + :config (save-place-mode)) (use-feature prog-mode :config (global-prettify-symbols-mode) @@ -1077,9 +1051,7 @@ This function is intended for use with `ivy-ignore-buffers'." (use-feature abbrev :delight " abbr" - :hook (text-mode . abbrev-mode) - :custom - (abbrev-file-name (b/var "abbrev.el"))) + :hook (text-mode . abbrev-mode)) ;;; Programming modes @@ -1244,10 +1216,7 @@ This function is intended for use with `ivy-ignore-buffers'." (eclim-executable "~/.p2/pool/plugins/org.eclim_2.8.0/bin/eclim") (eclim-eclipse-dirs '("~/usr/eclipse/dsl-2018-09/eclipse")))) -(use-package geiser - :config - (make-directory (b/var "geiser/") t) - (setq geiser-repl-history-filename (b/var "geiser/repl-history"))) +(use-package geiser) (use-feature geiser-guile :config @@ -1401,7 +1370,6 @@ This function is intended for use with `ivy-ignore-buffers'." :defer 0.5 :bind-keymap ("C-c P" . projectile-command-map) :config - (make-directory (b/var "projectile/") t) (projectile-mode) (defun b/projectile-mode-line-fun () @@ -1426,9 +1394,7 @@ This function is intended for use with `ivy-ignore-buffers'." (advice-add 'magit-branch-and-checkout :after #'my-projectile-invalidate-cache))) :custom - (projectile-cache-file (b/var "projectile/cache.el")) (projectile-completion-system 'ivy) - (projectile-known-projects-file (b/var "projectile/known-projects.el")) (projectile-mode-line-prefix " proj")) (use-package helpful @@ -1588,9 +1554,7 @@ This function is intended for use with `ivy-ignore-buffers'." ("c" . mc/edit-lines) ("n" . mc/mark-next-like-this) ("p" . mc/mark-previous-like-this) - ("a" . mc/mark-all-like-this))) - :config - (setq mc/list-file (b/var "mc-list.el"))) + ("a" . mc/mark-all-like-this)))) (comment ;; TODO @@ -1603,7 +1567,6 @@ This function is intended for use with `ivy-ignore-buffers'." :config (defconst yas-verbosity-cur yas-verbosity) (setq yas-verbosity 2) - (setq yas-snippet-dirs (list (b/etc "yasnippet/snippets/"))) (add-to-list 'yas-snippet-dirs "~/src/git/guix/etc/snippets" t) (yas-reload-all) (setq yas-verbosity yas-verbosity-cur) @@ -1641,9 +1604,6 @@ This function is intended for use with `ivy-ignore-buffers'." ;; (use-package fill-column-indicator) (use-package emojify - :config - (make-directory (b/var "emojify/") t) - (setq emojify-emojis-dir (b/var "emojify/")) :hook (erc-mode . emojify-mode)) (use-feature window @@ -1701,6 +1661,10 @@ This function is intended for use with `ivy-ignore-buffers'." (goto-char (cdr macro))) (reftex-this-word))))) +(use-feature files + :custom (auto-save-file-name-transforms + `((".*" ,(b/var "auto-save/") t)))) + ;;; Email (with Gnus)