Skip to content

Commit

Permalink
Use user-emacs-directory instead of hard-coding "~/.emacs.d"
Browse files Browse the repository at this point in the history
  • Loading branch information
ubolonton committed Mar 28, 2021
1 parent 9b3e8d7 commit 1f2fd52
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion config/ublt-editing.el
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ See `http://ergoemacs.org/emacs/modernization_upcase-word.html'
;; Don't, use a dedicate key binding for yas
;; (add-to-list 'hippie-expand-try-functions-list 'yas-hippie-try-expand)
:config
(add-to-list 'yas-snippet-dirs "~/.emacs.d/data/yasnippet/snippets")
(add-to-list 'yas-snippet-dirs (ublt/init-rel-path "data/yasnippet/snippets"))
(yas-global-mode +1))

(use-package yasnippet-snippets))
Expand Down
9 changes: 6 additions & 3 deletions config/ublt-git.el
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@
(magit-ediff-dwim-show-on-hunks t)

;; Git directories
(magit-repository-directories '(("~/dotfiles". 0)
("~/.emacs.d". 0)
(magit-repository-directories `(("~/dotfiles". 0)
(,user-emacs-directory . 0)
("~/Programming/projects" . 1)
("~/Programming/lib" . 1)
("~/Programming/Tools" . 1)
("~/.emacs.d/straight/repos" . 1)))
("~/Programming/projects/emacs-tree-sitter/langs/repos" . 1)
("~/Programming/pp/parcel-perform" . 1)
("~/Programming/pp/ml-team" . 1)
(,(ublt/init-rel-path "straight/repos") . 1)))

(magit-status-margin '(t age magit-log-margin-width t 10))

Expand Down
4 changes: 2 additions & 2 deletions config/ublt-lisp.el
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
:custom (highlight-function-calls-not t))

(use-package ielm
:hook (ielm-mode . (lambda () (setq comint-input-ring-file-name "~/.emacs.d/.ielm-input.hist"))))
:hook (ielm-mode . (lambda () (setq comint-input-ring-file-name (ublt/init-rel-path ".ielm-input.hist")))))

(use-package flycheck-package
:config (flycheck-package-setup))
Expand Down Expand Up @@ -96,7 +96,7 @@
(cider-repl-popup-stacktraces t)
(cider-repl-wrap-history t)

(cider-repl-history-file "~/.emacs.d/.nrepl.hist")
(cider-repl-history-file (ublt/init-rel-path ".nrepl.hist"))
(cider-repl-history-highlight-current-entry t)
(cider-repl-history-highlight-inserted-item 'pulse)
(cider-repl-history-current-entry-face 'secondary-selection)
Expand Down
8 changes: 4 additions & 4 deletions config/ublt-misc.el
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@

;; Save positions in visited files
(use-package saveplace
:custom ((save-place-file "~/.emacs.d/.saveplace")
:custom ((save-place-file (ublt/init-rel-path ".saveplace"))
(save-place-limit 3000))
:config (save-place-mode +1))

;; Save history
(use-package savehist
:custom (savehist-file "~/.emacs.d/.savehist")
:custom (savehist-file (ublt/init-rel-path ".savehist"))
:config
(dolist (var '(log-edit-comment-ring
regexp-search-ring
Expand All @@ -86,12 +86,12 @@
(savehist-mode +1))

(use-package bookmark
:custom ((bookmark-default-file "~/.emacs.d/.bookmarks")
:custom ((bookmark-default-file (ublt/init-rel-path ".bookmarks"))
(bookmark-version-control t)
(bookmark-sort-flag nil)))

(use-package recentf
:custom (recentf-save-file "~/.emacs.d/.recentf" ))
:custom (recentf-save-file (ublt/init-rel-path ".recentf")))

(setq ring-bell-function 'ignore)

Expand Down
2 changes: 1 addition & 1 deletion config/ublt-organization.el
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ end tell")))

(add-to-list 'org-latex-classes
`("ublt-org-article"
,(ublt/get-string-from-file "~/.emacs.d/config/ublt-org-article.tex")
,(ublt/get-string-from-file (ublt/init-rel-path "config/ublt-org-article.tex"))
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
Expand Down
9 changes: 6 additions & 3 deletions init.el
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
;;; Make package downloading a bit more secure.
(setq tls-checktrust 'ask)

(setq custom-file "~/.emacs.d/custom.el")
(defun ublt/init-rel-path (path)
(expand-file-name path user-emacs-directory))

(setq custom-file (ublt/init-rel-path "custom.el"))
(add-hook 'after-init-hook (lambda ()
(with-demoted-errors "Error loading custom-file: %S"
(load custom-file))))

(add-to-list 'load-path "~/.emacs.d/lib")
(add-to-list 'load-path "~/.emacs.d/config")
(add-to-list 'load-path (ublt/init-rel-path "lib"))
(add-to-list 'load-path (ublt/init-rel-path "config"))

(defvar ublt/packages
'(use-package))
Expand Down

0 comments on commit 1f2fd52

Please sign in to comment.