emacs-config/init.org.d/10-misc.org

1.5 KiB

Misc. Settings (Head)

Settings here can't be categorized or too small to be it's own topic/file, but has to be set before other settings.

Tools

Functions needed at the start of the configuration

  (defun safe-getenv (env-name sub-env)
    "like getenv, but uses subEnv var as a value substitute if envName isn't found/empty"
    (if (string= nil (getenv env-name)) sub-env (getenv env-name)))

User Emacs Directories

set the directory for emacs and it's apps to put stuff.

  (setq user-emacs-directory
        (expand-file-name "emacs" (safe-getenv "XDG_DATA_HOME" "~/.local/share")))

Custom File

This emacs feature is currently not used since a way to integrate this feature into this kind of configuration.

  (setq custom-file (expand-file-name "custom.el" user-emacs-directory))

Personal File

This file stores variables containing personal information, and is not distributed. A sample of this file though is included in this config to be used

  (let ((personal-file-path (expand-file-name "personal.org" user-emacs-config-directory))
        (sample-personal-file-path (expand-file-name "/personal-sample.org" user-emacs-config-directory )))

    ;; load main personal file if it exists
    (if (file-exists-p personal-file-path)
        (org-babel-load-file personal-file-path)
      (org-babel-load-file sample-personal-file-path)))