]> git.siccegge.de Git - dotfiles/emacs.git/commitdiff
Conditionalize emacs startup snippets
authorChristoph Egger <christoph@christoph-egger.org>
Sat, 17 Sep 2016 08:31:27 +0000 (08:31 +0000)
committerChristoph Egger <christoph@christoph-egger.org>
Sat, 17 Sep 2016 08:34:13 +0000 (10:34 +0200)
config/general.el
config/irony.el
config/whitespace.el
config/yas.el

index c8c406e43a8bab2dfa4b447a96d3d58e932af2f4..76eba1a07e4266cd9d35449ff25d172f9ad2726c 100644 (file)
@@ -1,6 +1,7 @@
 (message "General emacs setup")
 
-(tool-bar-mode -1)
+(if window-system
+    (tool-bar-mode -1))
 (setq inhibit-startup-message t)
 
 ;; Indentation
 (require 'uniquify)
 (setq uniquify-buffer-name-style 'post-forward)
 
-(require 'auto-complete)
+(if (locate-library "auto-complete")
+    (require 'auto-complete))
 
-(require 'magit)
+(if (locate-library "auto-complete")
+    (require 'magit))
 
 ;; Ido mode
 (require 'ido)
@@ -56,5 +59,8 @@
 (global-set-key (kbd "<XF86Paste>") 'paste-x-selection)
 (global-set-key (kbd "C-S-<insert>") 'paste-x-selection)
 
-(require 'dired-narrow)
-(define-key dired-mode-map "/" 'dired-narrow)
+
+(if (locate-library "dired-narrow")
+    (progn
+      (require 'dired-narrow)
+      (define-key dired-mode-map "/" 'dired-narrow)))
index 95b6c488aa8e7bbaec68d8e85e85a078963b033f..c00ab4571b5b0f3911de10e4a4a3642b231966bb 100644 (file)
@@ -1,13 +1,15 @@
-(require 'irony)
-(add-hook 'c++-mode-hook 'irony-mode)
-(add-hook 'c-mode-hook 'irony-mode)
-(add-hook 'objc-mode-hook 'irony-mode)
+(if (locate-library "irony")
+    (progn
+      (require 'irony)
+      (add-hook 'c++-mode-hook 'irony-mode)
+      (add-hook 'c-mode-hook 'irony-mode)
+      (add-hook 'objc-mode-hook 'irony-mode)
 
-;; replace the `completion-at-point' and `complete-symbol' bindings in
-;; irony-mode's buffers by irony-mode's function
-(defun my-irony-mode-hook ()
-  (define-key irony-mode-map [remap completion-at-point]
-    'irony-completion-at-point-async)
-  (define-key irony-mode-map [remap complete-symbol]
-    'irony-completion-at-point-async))
-(add-hook 'irony-mode-hook 'my-irony-mode-hook)
+      ;; replace the `completion-at-point' and `complete-symbol' bindings in
+      ;; irony-mode's buffers by irony-mode's function
+      (defun my-irony-mode-hook ()
+        (define-key irony-mode-map [remap completion-at-point]
+          'irony-completion-at-point-async)
+        (define-key irony-mode-map [remap complete-symbol]
+          'irony-completion-at-point-async))
+      (add-hook 'irony-mode-hook 'my-irony-mode-hook)))
index 1c1ad0cdb38026cbc853721bf4666b638ed645fc..3009628d577ac0d9f1728b012013ab57ad34b76e 100644 (file)
@@ -1,3 +1,5 @@
 ;; Show whitespaces by default
-(require 'show-wspace)
-(global-font-lock-mode 1)
+(if (locate-library "show-wspace")
+    (progn
+      (require 'show-wspace)
+      (global-font-lock-mode 1)))
index 2eb1e1f8281d5789e067a4982c4d8b530b5c8d5c..78bb4213076c44a610c375cee6eadffe7faf2ec0 100644 (file)
@@ -1,6 +1,6 @@
-(require 'yasnippet)
-
-(setq yas-snippet-dirs '("~/proj/snippets"))
-
-(yas-global-mode 1)
+(if (locate-library "yasnippet")
+    (progn
+      (require 'yasnippet)
+      (setq yas-snippet-dirs '("~/proj/snippets"))
+      (yas-global-mode 1)))