From bab53707b6fdf4fc8e27efa52de02f093f3cf218 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Wed, 27 Feb 2019 23:43:16 -0800 Subject: Add oni-data-dir --- oni-clojure.el | 10 +++++----- oni-data-dir.el | 37 +++++++++++++++++++++++++++++++++++++ oni-gnus.el | 8 +++++--- oni-jabber.el | 10 +++++----- oni-projectile.el | 10 +++++----- 5 files changed, 57 insertions(+), 18 deletions(-) create mode 100644 oni-data-dir.el diff --git a/oni-clojure.el b/oni-clojure.el index 2b00b8c..87785e1 100644 --- a/oni-clojure.el +++ b/oni-clojure.el @@ -4,8 +4,8 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 20190218165405 -;; Package-Requires: (clojure-mode cider clojure-mode-extra-font-locking paredit rainbow-delimiters) +;; Version: 20190227232633 +;; Package-Requires: (clojure-mode cider clojure-mode-extra-font-locking paredit rainbow-delimiters oni-data-dir) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -26,10 +26,11 @@ ;;; Code: +(require 'cider) (require 'clojure-mode) (require 'clojure-mode-extra-font-locking) (require 'inf-lisp) -(require 'cider) +(require 'oni-data-dir) (defun oni-clojure-set-inferior-lisp () "Set `inferior-lisp-program' to use Lein." @@ -54,8 +55,7 @@ (setq cider-show-error-buffer t cider-auto-select-error-buffer t) -(setq cider-repl-history-file - (concat user-emacs-directory "data/cider-history")) +(setq cider-repl-history-file (oni-data-dir-locate "cider-history")) (setq cider-repl-wrap-history t) diff --git a/oni-data-dir.el b/oni-data-dir.el new file mode 100644 index 0000000..15af240 --- /dev/null +++ b/oni-data-dir.el @@ -0,0 +1,37 @@ +;;; oni-data-dir.el --- Data dir configuration -*- lexical-binding: t; -*- + +;; Copyright (C) 2019 Tom Willemse + +;; Author: Tom Willemse +;; Keywords: local +;; Version: 20190227232656 + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Utilities for placing all state files in "data/" inside my +;; `user-emacs-directory'. + +;;; Code: + +(defconst oni-data-dir--name "data" + "The name of the directory all data should live in.") + +(defun oni-data-dir-locate (filename) + "Return the location of FILENAME inside the data directory." + (concat user-emacs-directory oni-data-dir--name "/" filename)) + +(provide 'oni-data-dir) +;;; oni-data-dir.el ends here diff --git a/oni-gnus.el b/oni-gnus.el index 186eef2..d53cf7d 100644 --- a/oni-gnus.el +++ b/oni-gnus.el @@ -4,7 +4,8 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 20190226022941 +;; Version: 20190227233916 +;; Package-Requires: (oni-data-dir) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -30,14 +31,15 @@ (require 'mail-source) (require 'message) (require 'nnfolder) +(require 'oni-data-dir) (require 'sendmail) -(setq gnus-directory (locate-user-emacs-file "data/News") +(setq gnus-directory (oni-data-dir-locate "News") gnus-article-save-directory gnus-directory gnus-cache-directory gnus-directory gnus-kill-files-directory gnus-directory) -(setq mail-source-directory (locate-user-emacs-file "data/Mail") +(setq mail-source-directory (oni-data-dir-locate "Mail") message-directory mail-source-directory nnfolder-directory mail-source-directory) diff --git a/oni-jabber.el b/oni-jabber.el index 076e307..5a13033 100644 --- a/oni-jabber.el +++ b/oni-jabber.el @@ -4,8 +4,8 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 20190221004411 -;; Package-Requires: (jabber) +;; Version: 20190227233209 +;; Package-Requires: (jabber oni-data-dir) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -27,6 +27,7 @@ ;;; Code: (require 'jabber) +(require 'oni-data-dir) (defun oni-jabber-set-default-directory () "Set the default directory to my home directory." @@ -55,10 +56,9 @@ Insert PROPOSED-ALERT in the buffer if it is non-nil." (:connection-type . starttls)))) (setq jabber-avatar-cache-directory - (concat user-emacs-directory "data/jabber/avatars/")) + (oni-data-dir-locate "jabber/avatars/")) -(setq jabber-history-dir - (concat user-emacs-directory "data/jabber/hist/")) +(setq jabber-history-dir (oni-data-dir-locate "jabber/hist/")) (setq jabber-chat-buffer-format "+%n" jabber-chat-foreign-prompt-format "%t %n " diff --git a/oni-projectile.el b/oni-projectile.el index 9c5d491..602e59e 100644 --- a/oni-projectile.el +++ b/oni-projectile.el @@ -4,8 +4,8 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 20190219003930 -;; Package-Requires: (projectile ivy) +;; Version: 20190227233727 +;; Package-Requires: (projectile ivy oni-data-dir) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -26,15 +26,15 @@ ;;; Code: +(require 'oni-data-dir) (require 'projectile) (setq projectile-known-projects-file - (concat user-emacs-directory "data/projectile-bookmarks.eld")) + (oni-data-dir-locate "projectile-bookmarks.eld")) (setq projectile-mode-line-prefix " P") -(setq projectile-cache-file - (concat user-emacs-directory "data/projectile.cache")) +(setq projectile-cache-file (oni-data-dir-locate "projectile.cache")) (setq projectile-completion-system 'ivy) -- cgit v1.2.3-54-g00ecf