about summary refs log tree commit diff
path: root/emacs.d
diff options
context:
space:
mode:
authorVincent Ambo <vincent@spotify.com>2013-07-19T11·57+0200
committerVincent Ambo <vincent@spotify.com>2013-07-19T11·57+0200
commitf61db0ceefcd5d928bf824c3dd4d499fb802cf61 (patch)
tree54b1b13dd35e2b01e7b22d06a2fe11e881c56450 /emacs.d
parenteadc09e76ffe80e3bf8c3e873df1b8367e88f7de (diff)
emacs: Added functions from ESK, removed rcirc connect function, added scripts folder to load path
Diffstat (limited to 'emacs.d')
-rw-r--r--emacs.d/init-bindings.el3
-rw-r--r--emacs.d/init-functions.el39
-rw-r--r--emacs.d/init.el2
3 files changed, 18 insertions, 26 deletions
diff --git a/emacs.d/init-bindings.el b/emacs.d/init-bindings.el
index d60c1cbc037b..214ef5b48921 100644
--- a/emacs.d/init-bindings.el
+++ b/emacs.d/init-bindings.el
@@ -30,6 +30,9 @@
 ;; Start a new eshell even if one is active.
 (global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t)))
 
+;; Eval sexp and replace it with result
+(global-set-key (kbd "C-c e") 'esk-eval-and-replace)
+
 ;; Start a regular shell if you prefer that.
 (global-set-key (kbd "C-x C-m") 'shell)
 
diff --git a/emacs.d/init-functions.el b/emacs.d/init-functions.el
index 640a8f8c620c..b394b999fdcf 100644
--- a/emacs.d/init-functions.el
+++ b/emacs.d/init-functions.el
@@ -52,6 +52,16 @@
                                     ,(make-char 'greek-iso8859-7 107))
                     nil))))))
 
+(defun esk-eval-and-replace ()
+  "Replace the preceding sexp with its value."
+  (interactive)
+  (backward-kill-sexp)
+  (condition-case nil
+      (prin1 (eval (read (current-kill 0)))
+             (current-buffer))
+    (error (message "Invalid expression")
+           (insert (current-kill 0)))))
+
 (defun esk-add-watchwords ()
   (font-lock-add-keywords
    nil '(("\\<\\(FIX\\(ME\\)?\\|TODO\\|HACK\\|REFACTOR\\|NOCOMMIT\\)"
@@ -73,32 +83,9 @@
     (dotimes (_ (- 80 col (length prefix) (length postfix))) (insert "u"))
     (insert postfix)))
 
+(defun esk-turn-off-tool-bar ()
+  (if (functionp 'tool-bar-mode) (tool-bar-mode -1)))
+
 (defun speak (m &optional voice)
   (shell-command (if 'voice (concat "say -v " voice " \"" m "\"")
 		   (concat "say " m))))
-
-
-;; Reconnect rcirc
-(eval-after-load 'rcirc
-  '(defun-rcirc-command reconnect (arg)
-     "Reconnect the server process."
-     (interactive "i")
-     (unless process
-       (error "There's no process for this target"))
-     (let* ((server (car (process-contact process)))
-            (port (process-contact process :service))
-            (nick (rcirc-nick process))
-            channels query-buffers)
-       (dolist (buf (buffer-list))
-         (with-current-buffer buf
-           (when (eq process (rcirc-buffer-process))
-             (remove-hook 'change-major-mode-hook
-                          'rcirc-change-major-mode-hook)
-             (if (rcirc-channel-p rcirc-target)
-                 (setq channels (cons rcirc-target channels))
-               (setq query-buffers (cons buf query-buffers))))))
-       (delete-process process)
-       (rcirc-connect server port nick
-                      rcirc-default-user-name
-                      rcirc-default-full-name
-                      channels))))
diff --git a/emacs.d/init.el b/emacs.d/init.el
index 827eb859b24c..9d4ac4b72036 100644
--- a/emacs.d/init.el
+++ b/emacs.d/init.el
@@ -41,6 +41,8 @@
 
 (load "~/.emacs.d/init-functions.el")
 
+(add-to-list 'load-path "~/.emacs.d/scripts/")
+
 (setq custom-file "~/.emacs.d/init-custom.el")
 (load custom-file)