.emacs-defs
author Oleksandr Gavenko <gavenkoa@gmail.com>
Thu, 23 Apr 2015 02:04:23 +0300
changeset 1288 6333a733046f
parent 1285 8e2c4332223d
child 1669 33d096a97345
permissions -rw-r--r--
Use new autobm mode!

;; -*- 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.")

(unless (boundp 'user-emacs-directory)
  (setq user-emacs-directory "~/.emacs.d/"))

(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)))))