.emacs
changeset 1199 dff272add01e
parent 1198 81709141a539
child 1215 c7e52e93465a
--- a/.emacs	Tue Jan 27 22:53:39 2015 +0200
+++ b/.emacs	Wed Jan 28 00:45:31 2015 +0200
@@ -9,61 +9,45 @@
 ;; ======================================================================
 ;; Load path.
 
-(defun my-find-subdirs (dir)
-  (if (file-directory-p dir)
-      (cons dir (apply 'append (mapcar 'my-find-subdirs (directory-files dir t "^[^.]")) ) )
-    ))
-(defun my-add-subdirs-to-load-path (dir)
-  (mapc
-   (lambda (d)
-     (add-to-list 'load-path d t)
-     (message "Load-path updated with: %s" d)
-     )
-   (my-find-subdirs dir)) )
 
-(defvar my-usr-el-dir
+(defvar my-usr-lisp-dir
   (expand-file-name "~/usr/share/emacs/site-lisp")
   "Here live additional lisp packages.")
-(my-add-subdirs-to-load-path my-usr-el-dir)
+(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)))
+
+(unless (boundp 'user-emacs-directory)
+  (setq user-emacs-directory "~/.emacs.d/"))
 
 (defvar my-lisp-dir
-  (expand-file-name (concat user-emacs-directory "my-lisp"))
+  (expand-file-name (concat user-emacs-directory "my/"))
   "Here live my lisp packages.")
-(my-add-subdirs-to-load-path my-lisp-dir)
-
-(defvar my-autoload (concat my-lisp-dir "/autoload-my.el")
-  "Path to autoload for mode files.")
-(defvar my-auth (expand-file-name "~/.emacs-auth")
-  "Path to auth info for Emacs.")
-(defvar dot-emacs-autogen (expand-file-name "~/.emacs-autogen")
-  "Path to automatically generated config file. It content depend on
-  installation environment and it was overridden on install.")
-(defvar dot-emacs-pre (expand-file-name "~/.emacs-pre")
-  "Path to file with pre-loaded custom settings.")
-(defvar dot-emacs-post (expand-file-name "~/.emacs-post")
-  "Path to file with post-loaded custom settings.")
+(add-to-list 'load-path my-lisp-dir)
 
-
-(if (file-exists-p dot-emacs-autogen)
-    (load dot-emacs-autogen))
-
-(if (file-exists-p my-auth)
-    (load my-auth))
-
-;; pre-load custom settings
-(if (file-exists-p dot-emacs-pre)
-    (load dot-emacs-pre))
-
-(if (file-exists-p my-autoload)
-    (load my-autoload))
-
-(setq custom-file "~/.emacs-custom.el")
+(setq custom-file (concat my-lisp-dir ".emacs-custom"))
 (if (file-exists-p custom-file)
     (load custom-file))
 
-;; load main customization
-(load "~/.emacs-my")
+(defvar my-lisp-autoload (concat my-lisp-dir "loaddefs.el")
+  "Path to autoload for mode files.")
+(defvar my-lisp-auth (concat my-lisp-dir ".emacs-auth")
+  "Path to auth info for Emacs.")
+(defvar my-lisp-autogen (concat my-lisp-dir ".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 my-lisp-dir ".emacs-pre")
+  "Path to file with pre-settings. Intended for local modifications.")
+(defvar my-lisp-dotemacs (concat my-lisp-dir ".emacs-my")
+  "Path to file with settings. Overwritten on install.")
+(defvar my-lisp-post (concat my-lisp-dir ".emacs-post")
+  "Path to file with post-settings. Intended for local modifications.")
 
-;; post-load custom settings
-(if (file-exists-p dot-emacs-post)
-    (load dot-emacs-post))
+(setq save-place-file (concat my-lisp-dir ".emacs-places"))
+
+(mapc
+ (lambda (fname)
+   (if (file-exists-p fname)
+       (load fname)))
+ (list custom-file my-lisp-autogen my-lisp-auth my-lisp-pre my-lisp-autoload my-lisp-dotemacs my-lisp-post))