From 611260642a69de11a4909cec00c5eae6a9c27550 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Thu, 10 Jan 2013 18:05:10 +0100 Subject: [PATCH] Emacs: check for existence for loading, to avoid error. --- .emacs.d/plugins.el | 126 +++++++++++++++++++++++--------------------- 1 file changed, 66 insertions(+), 60 deletions(-) diff --git a/.emacs.d/plugins.el b/.emacs.d/plugins.el index 7507ebb7..ef3fbadf 100644 --- a/.emacs.d/plugins.el +++ b/.emacs.d/plugins.el @@ -3,7 +3,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; User plugin path. -(add-to-list 'load-path "~/.emacs.d/plugins") +;; (add-to-list 'load-path "~/.emacs.d/plugins") ;;============================================================================== ;; Yasnippet @@ -17,22 +17,24 @@ ;; Next follows a traditional, yet not-optimized configuration for Yasnippet. ;; (add-to-list 'load-path "/usr/share/emacs/site-lisp/yas") -(require 'yasnippet) ;; not yasnippet-bundle - -(setq yas-snippet-dirs "~/.emacs.d/snippets" ) - -(if (fboundp 'yas/initialize) - ;; Old yasnippet versions. +(if (require 'yasnippet nil t) (progn - (yas/initialize) - (yas/load-directory yas-snippet-dirs)) - - ;; New yasnippet versions. - (progn - (yas-global-mode 1) - (yas-load-directory yas-snippet-dirs)) -) + (setq yas-snippet-dirs "~/.emacs.d/snippets" ) + (if (fboundp 'yas/initialize) + ;; Old yasnippet versions. + (progn + (yas/initialize) + (yas/load-directory yas-snippet-dirs)) + + ;; New yasnippet versions. + (progn + (yas-global-mode 1) + (yas-load-directory yas-snippet-dirs)) + + ) + + )) ;;============================================================================== ;; Lua @@ -44,43 +46,46 @@ ;; MediaWiki ;;============================================================================== -(require 'mediawiki) +(if (require 'mediawiki nil t) + (progn -;; Macros. -;; Use C-( stuff C-) to record a macro. -;; Use 'name-last-kbd-macro' to give it a name. -;; Use 'insert-kbd-macro' in your init file to insert the code. -;; You can assign a key: (local-set-key (kbd "C-c a") 'my-macro) -(fset 'ltx-template-source-to-latex - "\C-@\C-s>\C-m\C-w\C-@\C-s\C-w\C-?\C-m\C-w\C-d\C-@\C-s\C-m\C-w\C-@\C-s\C-w\C-?\C-m\C-w\C-d\C-@\C-s") 'zlc-select-next-vertical) - (define-key map (kbd "C-") 'zlc-select-previous-vertical) - (define-key map (kbd "C-") 'zlc-select-next) - (define-key map (kbd "C-") 'zlc-select-previous) +(if (require 'zlc nil t) + (let ((map minibuffer-local-map)) + ;; Like Zsh menu select. Should not use arrows directly because it overrides + ;; default controls like previous entry, or previous/next char. + (define-key map (kbd "C-") 'zlc-select-next-vertical) + (define-key map (kbd "C-") 'zlc-select-previous-vertical) + (define-key map (kbd "C-") 'zlc-select-next) + (define-key map (kbd "C-") 'zlc-select-previous) - ;;; Reset selection. - (define-key map (kbd "C-c") 'zlc-reset) - ) + ;; Reset selection. + (define-key map (kbd "C-c") 'zlc-reset) -;; (setq zlc-select-completion-immediately t) + ;; (setq zlc-select-completion-immediately t) -;; To change style, M-x customize-face and input zlc-selected-completion-face. + ;; To change style, M-x customize-face and input zlc-selected-completion-face. + ) +)