.emacs-defs
author Oleksandr Gavenko <gavenkoa@gmail.com>
Thu, 02 Apr 2015 19:51:29 +0300
changeset 1278 8e47e801be9d
parent 1254 19c7b3be9b3a
child 1284 0e25700290c4
permissions -rw-r--r--
Remove qouting from 'my--eval-after-load' macro usage because that code doesn't evaluated. Set indent for 'my--eval-after-load' macro.

;; -*- mode: emacs-lisp; coding: utf-8; fill-column: 78 -*-

(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 ".emacs.bmk"))
(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 (function ,(lambda () ,@forms))))))