# HG changeset patch # User Oleksandr Gavenko # Date 1423205079 -7200 # Node ID 4f9828e2c1864392dcc98aa3bddcce0187d3eb97 # Parent 17ed3f571ca45f200bc75ea255ede8e863dd06b3# Parent 2d151ab6761d018adc51cb6a7915a13549391f5c merged diff -r 2d151ab6761d -r 4f9828e2c186 .emacs --- a/.emacs Wed Jan 28 15:07:34 2015 +0200 +++ b/.emacs Fri Feb 06 08:44:39 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 "~/.emacs.d/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)) diff -r 2d151ab6761d -r 4f9828e2c186 .emacs-my --- a/.emacs-my Wed Jan 28 15:07:34 2015 +0200 +++ b/.emacs-my Fri Feb 06 08:44:39 2015 +0200 @@ -16,18 +16,20 @@ (when (eq system-type 'cygwin) (setq recentf-save-file "~/.recentf-cygwin")) -(setq recentf-auto-cleanup 'mode) +(setq recentf-auto-cleanup 600) ;; Prevent TRAMP to login on remote host when loading. Its take time and ask passwords! (setq recentf-keep '(file-remote-p file-readable-p)) (setq recentf-exclude ; Use ``M-x recentf-cleanup`` to update recentf-list. '("/devel/[^/]*-\\(orig\\|tmp\\|xxx\\)" - "/devel/my-\\(merge\\|pull\\)/")) + "/devel/my-\\(merge\\|pull\\)/" + "\\.png\\'")) (setq recentf-max-saved-items 10000) (require 'recentf) (recentf-mode t) -(global-set-key (kbd "\e\eq") 'recentf-open-files) +(global-set-key (kbd "\e\eq") 'recentf-open-files) +(global-set-key [?\s-q] 'recentf-open-files) (setq recentf-max-menu-items 40) (setq recentf-show-file-shortcuts-flag nil) @@ -835,10 +837,7 @@ (message "selecting/switching, creating/killing buffers, open file") (message "ido, ffap") -;; Loaded and used by ido. -;; (require 'ffap) - -(require 'ido) +(require 'ffap) (setq ido-enable-flex-matching t) @@ -858,7 +857,15 @@ ;; ido-ignore-directories ;; ido-ignore-files -(ido-mode 1) +(unless + (ignore-errors + (require 'ido) + (ido-mode 1) + (global-set-key [?\s-d] #'ido-dired) + (global-set-key [?\s-f] #'ido-find-file) + t) + (global-set-key [?\s-d] #'dired) + (global-set-key [?\s-f] #'find-file)) (global-set-key [?\C-x right] 'next-buffer) (global-set-key [?\C-x left] 'previous-buffer) @@ -2970,8 +2977,11 @@ (setq desktop-base-file-name ".emacs.desktop-cygwin") (setq desktop-base-lock-name ".emacs.desktop-cygwin.lock") ) +(setq desktop-dirname my-lisp-dir) (when (>= emacs-major-version 22) + (require 'desktop) + (add-to-list 'desktop-path desktop-dirname) (setq desktop-restore-frames nil) (desktop-save-mode 1) (setq diff -r 2d151ab6761d -r 4f9828e2c186 .emacs-obsolete --- a/.emacs-obsolete Wed Jan 28 15:07:34 2015 +0200 +++ b/.emacs-obsolete Fri Feb 06 08:44:39 2015 +0200 @@ -42,3 +42,20 @@ ;; Place dir at end to appear at the start of completion-ignored-extensions. "CVS/" ".hg/" ".svn/" ".git/" ".bzr/" ) ) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(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)) ) + +(my-add-subdirs-to-load-path my-usr-lisp-dir) +(my-add-subdirs-to-load-path my-lisp-dir) diff -r 2d151ab6761d -r 4f9828e2c186 Makefile --- a/Makefile Wed Jan 28 15:07:34 2015 +0200 +++ b/Makefile Fri Feb 06 08:44:39 2015 +0200 @@ -41,6 +41,12 @@ endif ################################################################ +# Installation directories. + +emacsdir := $(HOME)/.emacs.d +mylispdir := $(emacsdir)/my + +################################################################ # Build tool definition/switches. EMACS = emacs @@ -73,34 +79,53 @@ ################################################################ # Install/uninstall targets. +.PHONY: upgrade +upgrade: + \ +if [ ! -d $(mylispdir) ]; then \ + if [ -d $(emacsdir)/my-lisp ]; then \ + rm -f $(emacsdir)/autoload-my.el; \ + mv $(emacsdir)/my-lisp $(mylispdir); \ + else \ + mkdir -p $(mylispdir); \ + fi; \ + mv ~/.emacs-my $(mylispdir)/.emacs || true; \ + mv ~/.emacs-custom.el $(mylispdir)/.emacs-custom || true; \ + mv ~/.emacs-pre $(mylispdir) || true; \ + mv ~/.emacs-post $(mylispdir) || true; \ + mv ~/.emacs-places $(mylispdir) || true; \ + mv ~/.emacs.desktop $(mylispdir) || true; \ + rm -f ~/.emacs-autogen; \ +fi + .PHONY: install-all install-all: install - cp .emacs-pre $(HOME)/.emacs-pre - cp .emacs-post $(HOME)/.emacs-post + cp .emacs-pre $(mylispdir)/.emacs-pre + cp .emacs-post $(mylispdir)/.emacs-post .PHONY: install -install: .emacs .emacs-my .emacs-pre .emacs-post $(EL_FILES) +install: + mkdir -p $(mylispdir) + find $(mylispdir) -type f -name '*.el' -delete for file in .emacs-pre .emacs-post; do \ - [ -f $(HOME)/$$file ] || cp $$file $(HOME)/$$file; \ + [ -f $(mylispdir)/$$file ] || cp $$file $(mylispdir)/$$file; \ done cp .emacs $(HOME)/.emacs - cp .emacs-my $(HOME)/.emacs-my + cp .emacs-my $(mylispdir)/.emacs-my mkdir -p $(HOME)/.gnus/scores cp all.SCORE $(HOME)/.gnus/scores - rm -f -r $(HOME)/.emacs.d/my-lisp - mkdir -p $(HOME)/.emacs.d/my-lisp for file in $(EL_FILES); do \ - cp -f $$file $(HOME)/.emacs.d/my-lisp; \ + cp -f $$file $(mylispdir); \ done - $(EMACS) -Q --batch \ - --eval='(let ( (generated-autoload-file "~/.emacs.d/my-lisp/autoload-my.el") ) (update-directory-autoloads "~/.emacs.d/my-lisp") )' - ./.emacs-autogen.sh $(HOME)/.emacs-autogen + $(EMACS) -Q --batch --eval='(let ((generated-autoload-file "$(mylispdir)/loaddefs.el")) (update-directory-autoloads "$(mylispdir)"))' + ./.emacs-autogen.sh $(mylispdir)/.emacs-autogen cp -r srecode/ $(HOME)/.emacs.d/ .PHONY: uninstall uninstall: - rm -f $(HOME)/.emacs $(HOME)/.emacs-my $(HOME)/.emacs-autogen - rm -f -r $(HOME)/.emacs.d/my-lisp $(HOME)/.emacs.d/srecode + rm -f $(HOME)/.emacs $(mylispdir)/.emacs-my $(mylispdir)/.emacs-autogen + find $(mylispdir) -type f -name '*.el' -delete + rm -f -r $(emacsdir)/srecode .PHONY: tar tar: