Guest User

Untitled

a guest
Feb 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.25 KB | None | 0 0
  1. ;; This is the Aquamacs Preferences file.
  2. ;; Add Emacs-Lisp code here that should be executed whenever
  3. ;; you start Aquamacs Emacs. If errors occur, Aquamacs will stop
  4. ;; evaluating this file and print errors in the *Messags* buffer.
  5. ;; Use this file in place of ~/.emacs (which is loaded as well.)
  6.  
  7.  
  8. ; Core code, mostly base UI stuff.
  9. (setq-default tab-width 2)
  10. (setq-default indent-tabs-mode nil)
  11. (setq mac-emulate-three-button-mouse nil)
  12. (one-buffer-one-frame-mode 0)
  13. (setq cua-highlight-region-shift-only t)
  14.  
  15. (setq load-path (cons "/Users/dfayram/lib/emacs" load-path))
  16.  
  17. ; I do this so often...
  18. (defun edit-my-preferences ()
  19. "Edits my local preferences."
  20. (interactive)
  21. (find-file
  22. "/Users/dfayram/Library/Preferences/Aquamacs Emacs/Preferences.el"))
  23.  
  24. (define-key global-map "\C-xP" 'edit-my-preferences)
  25. (defadvice zap-to-char (after my-zap-to-char-advice (arg char) activate)
  26. "Kill up to the ARG'th occurence of CHAR, and leave CHAR.
  27. The CHAR is replaced and the point is put before CHAR."
  28. (insert char)
  29. (forward-char -1))
  30.  
  31.  
  32. (defun my-new-frame-with-new-scratch ()
  33. (interactive)
  34. (let ((one-buffer-one-frame t))
  35. (new-frame-with-new-scratch)))
  36. (defun my-close-current-window-asktosave ()
  37. (interactive)
  38. (let ((one-buffer-one-frame t))
  39. (close-current-window-asktosave)))
  40.  
  41. (define-key osx-key-mode-map (kbd "A-n") 'my-new-frame-with-new-scratch)
  42. (define-key osx-key-mode-map (kbd "A-w") 'my-close-current-window-asktosave)
  43.  
  44. (defmacro quick-key (keymap &rest keypairs)
  45. "Quickly define keys for a specific KEYMAP by giving pairs, like (\"\\C-ca\" 'do-nothing-special)"
  46. `(progn ,@(map 'list (lambda (kp)
  47. `(define-key ,keymap ,(car kp) ,(cadr kp)))
  48. keypairs)))
  49.  
  50. ; Sum essential custom mode stuff.
  51. (require 'ido)
  52. (ido-mode t)
  53.  
  54. ; SideBrain
  55. (setq load-path (cons "/Users/dfayram/lib/emacs/sidebrain" load-path))
  56. (require 'sidebrain)
  57. (quick-key global-map
  58. ("\C-c\C-sa" 'sidebrain-begin-task)
  59. ("\C-c\C-se" 'sidebrain-end-task)
  60. ("\C-c\C-sr" 'sidebrain-resume-task)
  61. ("\C-c\C-ss" 'sidebrain-suspend-task)
  62. ("\C-c\C-so" 'sidebrain-observe)
  63. ("\C-c\C-sb" 'sidebrain-browse-tasks)
  64. ("\C-c\C-sP" 'sidebrain-new-project)
  65. ("\C-c\C-sG" 'sidebrain-new-project-group)
  66. ("\C-c\C-sp" 'sidebrain-set-project)
  67. ("\C-c\C-sR" 'sidebrain-reminder))
  68. ;(sidebrain-load-from-file)
  69. (add-hook 'kill-emacs-hook (lambda () (sidebrain-save-to-file)) t)
  70.  
  71. ; Let's go, yasnippet
  72. ;(require 'dropdown-list)
  73. (setq load-path (cons "/Users/dfayram/lib/emacs/yasnippet" load-path))
  74. (require 'yasnippet)
  75. (yas/initialize)
  76. (yas/load-directory "~/lib/emacs/snippets/")
  77. (yas/load-directory "~/lib/emacs/yasnippet/snippets/")
  78.  
  79. ; Distel stuff
  80.  
  81. ;;This is needed for Erlang mode setup
  82. (setq erlang-root-dir "/p/lib/erlang")
  83. (setq load-path (cons "/p/lib/erlang/lib/tools-2.6.1/emacs" load-path))
  84. (setq exec-path (cons "/p/lib/erlang/bin" exec-path))
  85. (require 'erlang-start)
  86.  
  87. ;;This is needed for Distel setup
  88. (let ((distel-dir "/Users/dfayram/lib/emacs/distel/elisp"))
  89. (unless (member distel-dir load-path)
  90. ; Add distel-dir to the end of load-path
  91. (setq load-path (append load-path (list distel-dir)))))
  92.  
  93. (require 'distel)
  94. (distel-setup)
  95.  
  96.  
  97. ;;Some Erlang customizations
  98. (add-hook 'erlang-mode-hook
  99. (lambda ()
  100. ;; when starting an Erlang shell in Emacs, default in the node name
  101. (setq inferior-erlang-machine-options '("-sname" "emacs"))
  102. ;; add Erlang functions to an imenu menu
  103. (imenu-add-to-menubar "imenu")
  104. (yas/minor-mode-on)
  105. (define-key erlang-mode-map [f5] 'compile)
  106. (define-key erlang-mode-map (kbd "\C-c\C-dM") 'erlang-man-function)))
  107.  
  108. ;;A number of the erlang-extended-mode key bindings are useful in the shell too
  109. (defconst distel-shell-keys
  110. '(("\C-\M-i" erl-complete)
  111. ("\M-?" erl-complete)
  112. ("\M-." erl-find-source-under-point)
  113. ("\M-," erl-find-source-unwind)
  114. ("\M-*" erl-find-source-unwind)
  115. )
  116. "Additional keys to bind when in Erlang shell.")
  117.  
  118. (add-hook 'erlang-shell-mode-hook
  119. (lambda ()
  120. ;; add some Distel bindings to the Erlang shell
  121. (dolist (spec distel-shell-keys)
  122. (define-key erlang-shell-mode-map (car spec) (cadr spec)))))
  123. (setq erlang-indent-level 2)
  124.  
  125.  
  126. ; Git setups
  127. (setq load-path (cons "/Users/dfayram/lib/emacs/git" load-path))
  128. (require 'vc-git)
  129. (when (featurep 'vc-git) (add-to-list 'vc-handled-backends 'git))
  130. (require 'git)
  131. (autoload 'git-blame-mode "git-blame"
  132. "Minor mode for incremental blame for Git." t)
  133.  
  134.  
  135.  
  136.  
  137. ; Super-awesome table mode
  138. (require 'table)
  139.  
  140. ; Markdown mode
  141. (require 'markdown-mode)
  142. (setq markdown-mode-alist (cons '("\\.text" . markdown-mode) auto-mode-alist))
  143.  
  144. ; Paredit mode
  145. (require 'paredit)
  146. (setq scheme-mode-hook
  147. '(lambda () (paredit-mode +1)))
  148. (setq emacs-lisp-mode-hook
  149. '(lambda () (paredit-mode +1)))
  150.  
  151.  
  152. ; Configure SLIME
  153. (setq load-path (cons "/Users/dfayram/lib/emacs/slime" load-path))
  154. (require 'slime)
  155. (setq inferior-lisp-program "/Users/dfayram/bin/sbcl"
  156. ;; inferior-lisp-program "/Users/dfayram/lib/ccl/scripts/openmcl64"
  157. lisp-indent-function 'common-lisp-indent-function)
  158. (slime-setup)
  159.  
  160.  
  161. ; Jabber. Completely crazy
  162. ;; (setq load-path (cons "/Users/dfayram/lib/emacs/jabber" load-path))
  163. ;; (require 'gnus)
  164. ;; (require 'jabber)
  165.  
  166. ; Ruby Flymake
  167.  
  168. (require 'flymake)
  169. ;; Invoke ruby with '-c' to get syntax checking
  170. (set-face-background 'flymake-errline "red4")
  171. (set-face-background 'flymake-warnline "dark slate blue")
  172. (defun flymake-ruby-init ()
  173. (let* ((temp-file (flymake-init-create-temp-buffer-copy
  174. 'flymake-create-temp-inplace))
  175. (local-file (file-relative-name
  176. temp-file
  177. (file-name-directory buffer-file-name))))
  178. (list "ruby" (list "-c" local-file))))
  179.  
  180. (push '(".+\\.rb$" flymake-ruby-init) flymake-allowed-file-name-masks)
  181. (push '("Rakefile$" flymake-ruby-init) flymake-allowed-file-name-masks)
  182.  
  183. (push '("^\\(.*\\):\\([0-9]+\\): \\(.*\\)$" 1 2 nil 3) flymake-err-line-patterns)
  184.  
  185. (add-hook 'ruby-mode-hook
  186. '(lambda ()
  187. ;; Don't want flymake mode for ruby regions in rhtml files and also on read only files
  188. (if (and (not (null buffer-file-name)) (file-writable-p buffer-file-name))
  189. (flymake-mode))
  190. ))
  191.  
  192.  
  193. (require 'gist)
Add Comment
Please, Sign In to add comment