Advertisement
Shinmera

.emacs 2013.06.15

Jun 14th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 3.57 KB | None | 0 0
  1. ;; Packages
  2. (require 'package)
  3. (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
  4. (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
  5. (package-initialize)
  6.  
  7. ;; AC
  8. (require 'auto-complete)
  9. (define-globalized-minor-mode real-global-auto-complete-mode
  10.   auto-complete-mode (lambda ()
  11.                        (if (not (minibufferp (current-buffer)))
  12.                          (auto-complete-mode 1))
  13.                        ))
  14. (real-global-auto-complete-mode t)
  15.  
  16. ;; Slime
  17. (setq inferior-lisp-program "/usr/bin/sbcl")
  18. (add-to-list 'load-path "/opt/slime/")
  19. (require 'slime-autoloads)
  20. (slime-setup '(slime-fancy))
  21.  
  22. ;; AC-Slime
  23. (require 'ac-slime)
  24. (add-hook 'slime-mode-hook 'set-up-slime-ac)
  25. (add-hook 'slime-repl-mode-hook 'set-up-slime-ac)
  26. (eval-after-load "auto-complete"
  27.   '(add-to-list 'ac-modes 'slime-repl-mode))
  28.  
  29. ;; Fix fuckken slime history keys
  30. (add-hook 'slime-repl-mode-hook
  31.           (lambda ()
  32.             (local-set-key (kbd "C-x <up>") 'slime-repl-backward-input)
  33.             (local-set-key (kbd "C-x <down>") 'slime-repl-forward-input)))
  34.  
  35. ;; Custom
  36. (custom-set-variables
  37.  ;; custom-set-variables was added by Custom.
  38.  ;; If you edit it by hand, you could mess it up, so be careful.
  39.  ;; Your init file should contain only one such instance.
  40.  ;; If there is more than one, they won't work right.
  41.  '(backup-directory-alist (quote ((".*" . "~/.saves/"))))
  42.  '(inhibit-startup-screen t))
  43. (custom-set-faces
  44.  ;; custom-set-faces was added by Custom.
  45.  ;; If you edit it by hand, you could mess it up, so be careful.
  46.  ;; Your init file should contain only one such instance.
  47.  ;; If there is more than one, they won't work right.
  48.  )
  49.  
  50. ;; Tabs suck
  51. (setq-default indent-tabs-mode nil)
  52.  
  53. ;;;; Copypaste for X
  54. ;; http://hugoheden.wordpress.com/2009/03/08/copypaste-with-emacs-in-terminal/
  55. ;; I prefer using the "clipboard" selection (the one the
  56. ;; typically is used by c-c/c-v) before the primary selection
  57. ;; (that uses mouse-select/middle-button-click)
  58. (setq x-select-enable-clipboard t)
  59.  
  60. ;; If emacs is run in a terminal, the clipboard- functions have no
  61. ;; effect. Instead, we use of xsel, see
  62. ;; http://www.vergenet.net/~conrad/software/xsel/ -- "a command-line
  63. ;; program for getting and setting the contents of the X selection"
  64. (unless window-system
  65.  (when (getenv "DISPLAY")
  66.   ;; Callback for when user cuts
  67.   (defun xsel-cut-function (text &optional push)
  68.     ;; Insert text to temp-buffer, and "send" content to xsel stdin
  69.     (with-temp-buffer
  70.       (insert text)
  71.       ;; I prefer using the "clipboard" selection (the one the
  72.       ;; typically is used by c-c/c-v) before the primary selection
  73.       ;; (that uses mouse-select/middle-button-click)
  74.       (call-process-region (point-min) (point-max) "xsel" nil 0 nil "--clipboard" "--input")))
  75.   ;; Call back for when user pastes
  76.   (defun xsel-paste-function()
  77.     ;; Find out what is current selection by xsel. If it is different
  78.     ;; from the top of the kill-ring (car kill-ring), then return
  79.     ;; it. Else, nil is returned, so whatever is in the top of the
  80.     ;; kill-ring will be used.
  81.     (let ((xsel-output (shell-command-to-string "xsel --clipboard --output")))
  82.       (unless (string= (car kill-ring) xsel-output)
  83.     xsel-output )))
  84.   ;; Attach callbacks to hooks
  85.   (setq interprogram-cut-function 'xsel-cut-function)
  86.   (setq interprogram-paste-function 'xsel-paste-function)
  87.   ;; Idea from
  88.   ;; http://shreevatsa.wordpress.com/2006/10/22/emacs-copypaste-and-x/
  89.   ;; http://www.mail-archive.com/help-gnu-emacs@gnu.org/msg03577.html
  90.  ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement