.emacs-defs
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sat, 02 Jan 2021 01:15:49 +0200
changeset 1669 33d096a97345
parent 1285 8e2c4332223d
child 1670 c3a11a672d0d
permissions -rw-r--r--
No need to define user-emacs-directory as it is in a pretty old v22.1.

;; -*- mode: emacs-lisp; coding: utf-8; fill-column: 78; no-byte-compile: t; -*-

(defvar my-usr-lisp-dir
  (expand-file-name "~/usr/share/emacs/site-lisp")
  "Here live additional lisp packages.")

(defvar my-lisp-dir
  (expand-file-name (concat user-emacs-directory "my/"))
  "Here live my lisp packages.")
(add-to-list 'load-path my-lisp-dir)

(defvar my-lisp-autoload (concat my-lisp-dir "loaddefs.el")
  "Path to autoload for mode files.")
(defvar my-lisp-auth (concat user-emacs-directory ".emacs-auth")
  "Path to auth info for Emacs.")
(defvar my-lisp-autogen (concat user-emacs-directory ".emacs-autogen")
  "Path to automatically generated config file. It content depend on
  installation environment and it was overridden on install.")
(defvar my-lisp-pre (concat user-emacs-directory ".emacs-pre")
  "Path to file with pre-settings. Intended for local modifications.")
(defvar my-lisp-dotemacs (concat user-emacs-directory ".emacs-my")
  "Path to file with settings. Overwritten on install.")
(defvar my-lisp-post (concat user-emacs-directory ".emacs-post")
  "Path to file with post-settings. Intended for local modifications.")

(setq custom-file (concat user-emacs-directory ".emacs-custom"))
(setq save-place-file (concat user-emacs-directory ".emacs-places"))
(setq bookmark-default-file (concat user-emacs-directory "bookmarks"))
(setq ido-save-directory-list-file (concat user-emacs-directory ".ido.last"))

(defun my-load.add-my-loadpaths ()
  (when (file-directory-p my-usr-lisp-dir)
    (add-to-list 'load-path my-usr-lisp-dir)
    (let ((default-directory my-usr-lisp-dir))
      (normal-top-level-add-subdirs-to-load-path))))

(defmacro my--eval-after-load (feature &rest forms)
  (declare (indent defun))
  `(,(if (or (not (boundp 'byte-compile-current-file))
             (not byte-compile-current-file)
             (if (symbolp feature)
                 (require feature nil :no-error)
               (load feature :no-message :no-error)))
         'progn
       (message "my--eval-after-load: cannot find %s" feature)
       'with-no-warnings)
    (eval-after-load ',feature
      '(funcall (lambda () ,@forms)))))