add config-dir variable and change load-path to use it

This commit is contained in:
2021-05-13 20:43:07 +02:00
parent 9723323a29
commit e13e08068b
22 changed files with 52 additions and 50 deletions

3
init
View File

@@ -7,7 +7,8 @@
;; Requirements: git gnuplot ledger
;;; Code:
(require 'pre-settings "~/.config/emacs/settings/pre-settings.el") ;; use-package delight functions variables
(setq config-dir (file-name-directory (file-truename user-init-file))) ;; user-init-file: ~/.config/emacs/init, file-truename: /opt/emacs-conf/init
(require 'pre-settings (concat config-dir "settings/pre-settings.el")) ;; use-package delight functions variables
(require 'which-key-settings) ;; https://melpa.org/#/which-key
(require 'general-settings) ;; requires which-key
(require 'my-settings)

View File

@@ -16,15 +16,15 @@
;;; Code:
(use-package pdf-tools
:load-path "lisp/pdf-tools"
:load-path (lambda() (concat config-dir "lisp/pdf-tools"))
:defer t) ;; used by org-ref
(use-package biblio
:load-path "lisp/biblio"
:load-path (lambda() (concat config-dir "lisp/biblio"))
:defer t) ;; used by org-ref
(use-package org-ref ;; used with some preamble defs and \printbibliography (biblatex/biber, no html export), see also ox-bibtex
:load-path "lisp/org-ref"
:load-path (lambda() (concat config-dir "lisp/org-ref"))
:after (org)
:defer 1
:init

View File

@@ -51,7 +51,7 @@
(setq srecode-map-save-file (concat user-cache-directory "cedet/srecode-map.el")))
(use-package srefactor ;; https://melpa.org/#/srefactor
:load-path "lisp/srefactor"
:load-path (lambda() (concat config-dir "lisp/srefactor"))
:defer 2) ;; Loads after 2 seconds of idle time.
(use-package srefactor-lisp

View File

@@ -33,7 +33,7 @@
;; in an ivy action minibuffer use M-o `ivy-dispatching-done' to see
;; valid actions.
(use-package ivy
:load-path "lisp/ivy"
:load-path (lambda() (concat config-dir "lisp/ivy"))
:delight (ivy-mode "") ;; Ⓘ i
:defer 0.1
;; Ivy-based interface to standard commands
@@ -108,7 +108,7 @@
;;(setq tab-always-indent 'complete) ;; use 'complete when auto-complete is disabled
(use-package company
:load-path "lisp/company"
:load-path (lambda() (concat config-dir "lisp/company"))
:delight (company-mode "") ;; Ⓒ c
;;:bind (("C-M-i" . company-complete))
:bind (([remap completion-at-point] . company-complete)
@@ -212,7 +212,7 @@ Possible PACKAGE values are `company'."
'(yas-popup-isearch-prompt yas-maybe-ido-prompt yas-completing-prompt yas-no-prompt)))
(use-package yasnippet-snippets
:load-path "lisp/yasnippet-snippets"
:load-path (lambda() (concat config-dir "lisp/yasnippet-snippets"))
:after (yasnippet)
:defer 1)

View File

@@ -7,11 +7,11 @@
;;; Code:
;; required by eaf
(use-package epc
:load-path "lisp/epc"
:load-path (lambda() (concat config-dir "lisp/epc"))
:defer t)
(use-package eaf
:load-path "lisp/emacs-application-framework"
:load-path (lambda() (concat config-dir "lisp/emacs-application-framework"))
;;:after (org) ;; eaf requires eaf-interleave requires org
;;:defer 2
:commands (eaf-open

View File

@@ -18,7 +18,7 @@
;;; Code:
(use-package ess-site ;; all ESS features
:load-path "lisp/ess"
:load-path (lambda() (concat config-dir "lisp/ess"))
:commands ess-r-mode) ;; only R related features
(use-package ess-R-data-view

View File

@@ -15,11 +15,11 @@
:mode "\\.md\\'")
(use-package sql-indent
:load-path "lisp/sql-indent"
:load-path (lambda() (concat config-dir "lisp/sql-indent"))
:commands sqlind-minor-mode)
(use-package systemd
:load-path "lisp/systemd"
:load-path (lambda() (concat config-dir "lisp/systemd"))
:commands systemd-mode
:mode (("\\.service\\'" . systemd-mode) ("\\.mount\\'" . systemd-mode)))

View File

@@ -295,7 +295,7 @@ Version 2016-07-13"
(setq bookmark-default-file (concat user-cache-directory "bookmarks"))
(use-package transient
:load-path (lambda() (concat user-emacs-directory "lisp/transient"))
:load-path (lambda() (concat config-dir "lisp/transient"))
:defer t
:config
(setq transient-levels-file (concat user-cache-directory "transient/levels.el"))

View File

@@ -171,7 +171,7 @@ DISPLAY-START: `integer', e.g. 3820"
:defer t)
(use-package all-the-icons
:load-path "lisp/all-the-icons"
:load-path (lambda() (concat config-dir "lisp/all-the-icons"))
:defer t
:config
(when (and (not (my-font-installed-p "all-the-icons"))
@@ -181,7 +181,7 @@ DISPLAY-START: `integer', e.g. 3820"
))
(use-package dashboard
:load-path "lisp/dashboard"
:load-path (lambda() (concat config-dir "lisp/dashboard"))
:delight (dashboard-mode "🅓")
:config
;; because we use `use-package' include `use-package-statistics' if computed

View File

@@ -14,7 +14,7 @@
;;; Code:
(use-package ledger-mode
:load-path "lisp/ledger-mode"
:load-path (lambda() (concat config-dir "lisp/ledger-mode"))
:delight
(ledger-mode "🅛d") ; "Le "
(ledger-report-mode "🅛dr") ; "LeR 🅖⒭"

View File

@@ -7,7 +7,7 @@
;;; Code:
(use-package multiple-cursors
:load-path "lisp/multiple-cursors"
:load-path (lambda() (concat config-dir "lisp/multiple-cursors"))
:bind (;; see kbd prefix description in which-key-settings
("M-m s m a" . mc/mark-all-dwim)
("M-m s m b" . mc/mark-all-like-this)

View File

@@ -2,18 +2,18 @@
;;; Commentary:
;;; Code:
(use-package my
:load-path "lisp/my"
:load-path (lambda() (concat config-dir "lisp/my"))
:config
(with-eval-after-load 'org
(add-hook 'org-mode-hook 'my-org-link-color-hook)
(add-hook 'org-ctrl-c-ctrl-c-hook 'my-org-table-cell-color-attr)))
(use-package my-org-article
:load-path "lisp/my"
:load-path (lambda() (concat config-dir "lisp/my"))
:after (org))
(use-package my-org-letter
:load-path "lisp/my"
:load-path (lambda() (concat config-dir "lisp/my"))
:after (org))
(provide 'my-settings)

View File

@@ -236,7 +236,8 @@ Example defines
;; be loaded before, otherwise both versions will be loaded and will
;; conflict.
(use-package org
:load-path ("lisp/org/lisp" "lisp/org/contrib/lisp")
:load-path (lambda () (list (concat config-dir "lisp/org/lisp")
(concat config-dir "lisp/org/contrib/lisp")))
:delight (org-mode "🅞") ;; "Org "
:defer t
:init
@@ -425,7 +426,7 @@ Example defines
(use-package org-cliplink
:after (org)
:load-path "lisp/org-cliplink"
:load-path (lambda() (concat config-dir "lisp/org-cliplink"))
:config
(defun my-org-link-description-update ()
"."
@@ -1134,10 +1135,10 @@ used as a communication channel."
:defer t ;; will be loaded via `org-export-backends' see above inside `org'
:config
;; #+REVEAL_EXTRA_CSS:
(setq org-reveal-extra-css (concat "file://" (expand-file-name user-emacs-directory) "scripts/flipcard/flipcard.css")) ;; multiple files seperated with \n
(setq org-reveal-extra-css (concat "file://" (expand-file-name config-dir) "scripts/flipcard/flipcard.css")) ;; multiple files seperated with \n
;; #+REVEAL_POSTAMBLE:
(setq org-reveal-postamble (replace-regexp-in-string "\n" "" (concat "<script>" (org-reveal--read-file (concat (expand-file-name user-emacs-directory) "scripts/flipcard/flipcard.js")) "\n</script>"))) ;; only one line!
(setq org-reveal-root (concat "file://" (expand-file-name user-emacs-directory) "scripts/reveal.js"))
(setq org-reveal-postamble (replace-regexp-in-string "\n" "" (concat "<script>" (org-reveal--read-file (concat (expand-file-name config-dir) "scripts/flipcard/flipcard.js")) "\n</script>"))) ;; only one line!
(setq org-reveal-root (concat "file://" (expand-file-name config-dir) "scripts/reveal.js"))
(setq org-reveal-single-file t)
;; overwrite to implement `org-reveal-single-file' (:reveal-single-file)
;; used in `org-reveal-scripts' as reveal-4-plugin

View File

@@ -11,7 +11,7 @@
;;; Code:
(use-package gnuplot-mode
:load-path "lisp/gnuplot"
:load-path (lambda() (concat config-dir "lisp/gnuplot"))
:commands gnuplot-mode
:mode "\\.gp\\'")

View File

@@ -2,7 +2,7 @@
;;; Commentary:
;;; Code:
(use-package polymode
:load-path "lisp/polymode"
:load-path (lambda() (concat config-dir "lisp/polymode"))
:commands poly-python-web-mode
:config

View File

@@ -2,15 +2,15 @@
;;; Commentary:
;;; Code:
(mapc (lambda (item) (add-to-list 'load-path item))
'(
"~/.config/emacs/settings" ;; path where settings files are kept
"~/.config/emacs/lisp" ;; personal elisp lib dir, for manually installed packages
"~/.config/emacs/lisp/dash"
"~/.config/emacs/lisp/with-editor"
"~/.config/emacs/lisp/hydra" ;; required by treemacs org-ref
"~/.config/emacs/lisp/async" ;; https://melpa.org/#/async required by ob-async
"~/.config/emacs/lisp/persist" ;; https://elpa.gnu.org/packages/persist.html required by org-drill
"~/.config/emacs/lisp/use-package" ;; https://melpa.org/#/use-package
(list
(concat config-dir "settings") ;; path where settings files are kept
(concat config-dir "lisp") ;; personal elisp lib dir, for manually installed packages
(concat config-dir "lisp/dash")
(concat config-dir "lisp/with-editor")
(concat config-dir "lisp/hydra") ;; required by treemacs org-ref
(concat config-dir "lisp/async") ;; https://melpa.org/#/async required by ob-async
(concat config-dir "lisp/persist") ;; https://elpa.gnu.org/packages/persist.html required by org-drill
(concat config-dir "lisp/use-package") ;; https://melpa.org/#/use-package
))
(setq gc-cons-threshold (* 50 1000 1000)) ;; Make startup faster by reducing the frequency of garbage collection. The default is 800 kilobytes. Measured in bytes. Will be decreased again at the end.
@@ -49,7 +49,7 @@ Both Win32 and Cygwin count.")
(shell-command-to-string
"uname -a | sed -n 's/.*\\( *Microsoft *\\).*/\\1/ip'"))
"Microsoft"))
(setq user-emacs-directory "~/.config/emacs/")
(setq user-emacs-directory "~/.config/emacs/") ;; for cache etc.
(defconst user-cache-directory
(file-name-as-directory (concat user-emacs-directory ".cache"))
"My Emacs storage area for persistent files.")

View File

@@ -18,9 +18,9 @@
;; do not load directly with e.g. (global-flycheck-mode) or via
;; after-init-hook while loading the init because flycheck will freeze
;; for a short while. Therefore better defer loading.
;;(require 'flycheck (concat user-emacs-directory "lisp/flycheck/flycheck.el"))
;;(require 'flycheck (concat config-dir "lisp/flycheck/flycheck.el"))
(use-package flycheck
:load-path "lisp/flycheck"
:load-path (lambda() (concat config-dir "lisp/flycheck"))
:defer 2
:init
(setq flycheck-mode-line-prefix "𝓕") ;; Ⓕ 𝓕 ✈ f ;; other flycheck settings see syntax-checking-settings.el

View File

@@ -12,7 +12,7 @@
;;; Code:
(use-package spacemacs-common
:after (cl-lib) ;; spacemacs-common misses to load cl-lib
:load-path "lisp/spacemacs-theme"
:load-path (lambda() (concat config-dir "lisp/spacemacs-theme"))
:config
(load-theme 'spacemacs-dark t))
@@ -54,7 +54,7 @@
(use-package emojify
:commands emojify-mode
:load-path "lisp/emojify"
:load-path (lambda() (concat config-dir "lisp/emojify"))
:hook (after-init . global-emojify-mode)
:init
(setq emojify-emojis-dir (concat user-emacs-directory ".cache/emojify")))

View File

@@ -124,7 +124,7 @@
:defer t
:config
;; add local icon folder to the image-load-path
(add-to-list 'image-load-path (concat user-emacs-directory "icon/"))
(add-to-list 'image-load-path (concat config-dir "icon/"))
;; TODO: revert after close?
;; TODO: add redo?

View File

@@ -11,7 +11,7 @@
;; hydra.el https://elpa.gnu.org/packages/hydra.html
;; treemacs-magit ;; http://melpa.org/#/treemacs-magit
(use-package treemacs
:load-path "lisp/treemacs"
:load-path (lambda() (concat config-dir "lisp/treemacs"))
:commands treemacs
:init
;; get rid of the message:

View File

@@ -21,7 +21,7 @@
;;; Code:
;; see also Diff-Hl (diff-hl-mode) to see VC diff highlighting in fringes.
(use-package magit
:load-path "lisp/magit"
:load-path (lambda() (concat config-dir "lisp/magit"))
:bind (("C-c M-g" . magit-file-dispatch))
:config
;; (setq magit-completing-read-function 'magit-builtin-completing-read) ;; if ivy-mode is on then it uses it otherwise set to 'ivy-completing-read
@@ -50,7 +50,7 @@
:after (magit org))
(use-package diff-hl
:load-path "lisp/diff-hl"
:load-path (lambda() (concat config-dir "lisp/diff-hl"))
:hook (((prog-mode vc-dir-mode org-mode) . turn-on-diff-hl-mode)
(magit-pre-refresh . diff-hl-magit-pre-refresh)
(magit-post-refresh . diff-hl-magit-post-refresh))

View File

@@ -18,23 +18,23 @@
(setq css-indent-offset 2))
(use-package js2-mode
:load-path "lisp/js2-mode"
:load-path (lambda() (concat config-dir "lisp/js2-mode"))
:commands js2-mode)
(use-package php-mode
:load-path "lisp/php-mode"
:load-path (lambda() (concat config-dir "lisp/php-mode"))
:commands php-mode)
(use-package web-mode
:commands (web-mode))
(use-package web-completion-data
:load-path "lisp/web-completion-data"
:load-path (lambda() (concat config-dir "lisp/web-completion-data"))
:defer t)
(use-package company-web-html
:after (web-mode company)
:load-path "lisp/company-web"
:load-path (lambda() (concat config-dir "lisp/company-web"))
:bind (([remap complete-symbol] . company-complete)) ;; M-C-i and <M-tab>
:config
;;(add-to-list 'company-backends 'company-web-html)