From 64909222ca2b2ba9e04c8d45e6889b1369f650d8 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Tue, 24 Apr 2012 13:44:27 +0200 Subject: emacs: enable loading if not all modules are available --- emacs | 81 ++++++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 44 insertions(+), 37 deletions(-) (limited to 'emacs') diff --git a/emacs b/emacs index 330564b..8d47021 100644 --- a/emacs +++ b/emacs @@ -241,7 +241,7 @@ ;; define F1 to display man page of the current word (global-set-key [(f1)] (lambda () (interactive) (manual-entry (current-word)))) -(load "/usr/share/emacs/site-lisp/site-gentoo") +(load "/usr/share/emacs/site-lisp/site-gentoo" 'noerror) (setq text-mode-hook 'turn-on-auto-fill) (setq fill-column 72) @@ -410,7 +410,7 @@ ; keine Abfrage wenn ein template existiert (setq template-query nil) -(require 'template-simple) +(require 'template-simple nil 'noerror) ; remember last position in file (setq save-place-file "~/.emacs.d/saveplace") @@ -430,25 +430,29 @@ ido-confirm-unique-completion t) ; server mode (to edit files with emacsclient) -(server-start) +(when (require 'server nil 'noerror) + (if (and (fboundp 'server-running-p) + (not (server-running-p))) + (server-start))) ; emacs code browser -(ecb-activate) +(when (require 'ecb nil 'noerror) + (ecb-activate)) ;; smex (setq smex-save-file "~/.emacs.d/smex.save") -(require 'smex) -(smex-initialize) -(global-set-key (kbd "M-X") 'smex) +(when (require 'smex nil 'noerror) + (smex-initialize) + (global-set-key (kbd "M-X") 'smex)) ;; snippets -(require 'yasnippet) -(yas/initialize) -(yas/load-directory "~/.emacs.d/snippets") +(when (require 'yasnippet nil 'noerror) + (yas/initialize) + (yas/load-directory "~/.emacs.d/snippets")) ; html-php-multi-mode -(require 'html-php) -(setq auto-mode-alist (cons '("\\.php" . html-php-mode) auto-mode-alist)) +(when (require 'html-php nil 'noerror) + (setq auto-mode-alist (cons '("\\.php" . html-php-mode) auto-mode-alist))) ;; copy/paste enhancements ; share clipboard with other X11-Apps @@ -483,42 +487,48 @@ (load "rudel-loaddefs.el") ;; magit -(require 'magit) +(when (require 'magit nil 'noerror) + ;; magit-status (bind if available on ) + (global-set-key (kbd "") 'magit-status)) + ;; linum (generic & *scratch*) -(require 'linum-narrow) -(add-hook 'find-file-hook (lambda () (linum-mode 1))) -(add-hook 'lisp-interaction-mode-hook (lambda () (linum-mode 1))) +(when (require 'linum-narrow nil 'noerror) + (add-hook 'find-file-hook (lambda () (linum-mode 1))) + (add-hook 'lisp-interaction-mode-hook (lambda () (linum-mode 1)))) ;; bookmarks (setq bookmark-default-file "~/.emacs.d/bookmarks") (setq bookmark-save-flag 1) ;; winring -(require 'winring) -(ecb-winman-winring-enable-support) -(winring-initialize) -(global-set-key (kbd "C-x j") 'winring-jump-to-configuration) -(global-set-key (kbd "C-x n") 'winring-new-configuration) - -; ask before deleting winring configuration -(defun winring-ask-delete-configuration () - (interactive) - (if (y-or-n-p "Delete winring configuration? ") - (winring-delete-configuration))) +(when (require 'winring nil 'noerror) + ;; ecb support if ecb is available + (when (fboundp 'ecb-winman-winring-enable-support) + (ecb-winman-winring-enable-support)) + + (winring-initialize) + (global-set-key (kbd "C-x j") 'winring-jump-to-configuration) + (global-set-key (kbd "C-x n") 'winring-new-configuration) -(global-set-key (kbd "C-x K") 'winring-ask-delete-configuration) + ;; ask before deleting winring configuration + (defun winring-ask-delete-configuration () + (interactive) + (if (y-or-n-p "Delete winring configuration? ") + (winring-delete-configuration))) + + (global-set-key (kbd "C-x K") 'winring-ask-delete-configuration)) ;; etags -(require 'etags-table) +(require 'etags-table nil 'noerror) ; autocompletion for etags -(require 'auto-complete-etags) +(require 'auto-complete-etags nil 'noerror) ;; change cursor according to the mode (normal, read only, overwrite) -(require 'cursor-chg) -(toggle-cursor-type-when-idle 1) -(change-cursor-mode 1) +(when (require 'cursor-chg nil 'noerror) + (toggle-cursor-type-when-idle 1) + (change-cursor-mode 1)) ;; windmove (only if available) (when (fboundp 'windmove-default-keybindings) (windmove-default-keybindings)) @@ -527,11 +537,8 @@ ; eassist (define-key lisp-mode-shared-map (kbd "M-m") 'eassist-list-methods) -;; magit-status (bind if available on ) -(when (fboundp 'magit-status) (global-set-key (kbd "") 'magit-status)) - ;; dir-locals -(require 'dir-locals) +(require 'dir-locals nil 'noerror) ;; use sml-modeline if available (when (require 'sml-modeline nil 'noerror) -- cgit v1.2.3