Commits

kurtharriger committed 4499a79

various

  • Participants
  • Parent commits 20de370

Comments (0)

Files changed (9)

File init.d/50-beautify-json.el

+(defun beautify-json ()
+  (interactive)
+  (let ((b (if mark-active (min (point) (mark)) (point-min)))
+        (e (if mark-active (max (point) (mark)) (point-max))))
+    (shell-command-on-region b e
+     "python -mjson.tool" (current-buffer) t)))
+
+(defun beautify-json-region ()
+  (interactive)
+  (let ((b (if mark-active (min (point) (mark)) (point-min)))
+        (e (if mark-active (max (point) (mark)) (point-max))))
+    (shell-command-on-region b e
+     "python -mjson.tool" (current-region) t)))

File init.d/50-buffers.el

+(defun kill-other-buffers ()
+    "Kill all other buffers."
+    (interactive)
+    (mapc 'kill-buffer 
+          (delq (current-buffer) 
+                (remove-if-not 'buffer-file-name (buffer-list)))))

File init.d/50-rename.el

+(defun rename-this-buffer-and-file ()
+  "Renames current buffer and file it is visiting."
+  (interactive)
+  (let ((name (buffer-name))
+        (filename (buffer-file-name)))
+    (if (not (and filename (file-exists-p filename)))
+        (error "Buffer '%s' is not visiting a file!" name)
+      (let ((new-name (read-file-name "New name: " filename)))
+        (cond ((get-buffer new-name)
+               (error "A buffer named '%s' already exists!" new-name))
+              (t
+               (rename-file filename new-name 1)
+               (rename-buffer new-name)
+               (set-visited-file-name new-name)
+               (set-buffer-modified-p nil)
+               (message "File '%s' successfully renamed to '%s'" name (file-name-nondirectory new-name))))))))
+

File init.d/50-swap-buffer.el

+;; move buffer to other window
+;; after c-x 3 to split screen this lets you move buffers between sides.
+;; altered code from:
+;; http://stackoverflow.com/questions/1774832/how-to-swap-the-buffers-in-2-windows-emacs
+(defun swap-buffer-window ()
+  "Put the buffer from the selected window in next window, and vice versa"
+  (interactive)
+  (let* ((this (selected-window))
+     (other (next-window))
+     (this-buffer (window-buffer this)))
+    (set-window-buffer other this-buffer)
+    (tabbar-close-tab) ;;close current tab
+    (other-window 1) ;;swap cursor to new buffer
+    )
+  )
+ (global-set-key (kbd "C-x /") 'swap-buffer-window)

File init.d/60-auto-save.el

-(defvar autosave-dir
- (concat dotfiles-dir "autosaves/"))
-(make-directory autosave-dir t)
-(defun auto-save-file-name-p (filename)
-  (string-match "^#.*#$" (file-name-nondirectory filename)))
-(defun make-auto-save-file-name ()
-  (concat autosave-dir
-   (if buffer-file-name
-      (concat "#" (file-name-nondirectory buffer-file-name) "#")
-    (expand-file-name
-     (concat "#%" (buffer-name) "#")))))
-
-
-;; Keep emacs in sync with file system and vs versa
-(setq auto-save-list-file-prefix nil)
-(setq auto-save-interval 0)
-(setq auto-save-timeout 1)
-(global-auto-revert-mode t)
-
-;; (setq auto-save-visited-file-name t) doesn't seem to work, try hook instead
-(setq auto-save-visited-file-name t)
-(defun save-buffer-if-visiting-file (&optional args)
-  "Save the current buffer only if it is visiting a file"
-  (interactive)
-  (if (buffer-file-name)
-      (save-buffer args)))
-
-(defun make-auto-save-file-name ()
-  nil)
-
-(defun make-auto-save-file-name-p ()
-  nil)
-
-
-(add-hook 'auto-save-hook 'save-buffer-if-visiting-file)

File init.d/70-auto-save.el

+
+(setq backup-inhibited t)
+(setq auto-save-default nil)
+(global-auto-revert-mode t)
+(add-hook 'first-change-hook 'save-buffer )
+

File init.d/80-keybindings.el

 ;; (add-hook 'clojure-mode
 ;;           (lambda ()
 ;;             (define-key clojure-mode-map )))
+
+(define-prefix-command 'my-hotkey-preifx)
+(global-set-key "\C-z" 'my-hotkey-prefix)
+
+
+
+

File init.d/81-keybindins.el

+
+
+(defun  mark-to-end-of-line ()
+  (interactive)
+  (set-mark-command nil)
+  (move-end-of-line nil)
+)
+
+(defun  mark-to-beginning-of-line ()
+  (interactive)
+  (set-mark-command nil)
+  (move-beginning-of-line nil)
+)
+
+
+(global-set-key (kbd  "<s-left>") 'move-beginning-of-line) 
+(global-set-key (kbd  "<s-right>") 'move-end-of-line)
+(global-set-key (kbd  "<s-S-left>") 'move-beginning-of-line)
+(global-set-key (kbd  "<s-S-right>") 'mark-to-end-of-line)
+
+
+
+(browse-kill-ring-default-keybindings)
+

File init.d/90-slime.el

+
+;; (setq slime-protocol-version 'ignore) 
+;; (setq clojure-swank-command
+;;   (if (or (locate-file "lein" exec-path) (locate-file "lein.bat" exec-path))
+;;     "lein ritz-in %s"
+;;    "echo \"lein ritz-in %s\" | $SHELL -l"))
+
+(defun slime-redirect-stdout ()
+  (interactive)
+  (slime-interactive-eval
+   "(System/setOut (java.io.PrintStream. (org.apache.commons.io.output.WriterOutputStream. *out* \"UTF-8\" 8192 true)))"))
+
+(defun slime-bootstrap-clojure ()
+  (interactive)
+  (slime-interactive-eval
+   "(use 'clojure.repl)
+    (use 'clojure.reflect)
+    (use 'clojure.pprint)
+    (require '[clojure.string :as string])"))
+
+(defun clojure-mode-slime-font-lock ()
+            (require 'clojure-mode)
+            (let (font-lock-mode)
+              (clojure-mode-font-lock-setup)))
+
+(add-hook 'slime-repl-mode-hook 'clojure-mode-slime-font-lock)
+(add-hook 'slime-connected-hook 'slime-bootstrap-clojure)
+;;(add-hook 'slime-connected-hook 'slime-redirect-stdout)
+