Guest User

Untitled

a guest
Jul 7th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 4.99 KB | None | 0 0
  1. ;| Maximize emacs
  2. (w32-send-sys-command #xf030)
  3.  
  4. ;| Utils
  5. (defmacro x2 (form)
  6.   `(progn ,form
  7. ,form))
  8.  
  9. (defun site-load (path)
  10.   (load (concat site-lisp-path path)))
  11.  
  12. (defun buffer-mode (buffer-or-string)
  13.   "Returns the major mode associated with a buffer."
  14.   (save-excursion
  15.      (set-buffer buffer-or-string)
  16.      major-mode))
  17.  
  18. ;| General
  19. (scroll-bar-mode -1)
  20. (tool-bar-mode -1)
  21. (blink-cursor-mode -1)
  22.  
  23. (setq blink-matching-paren nil
  24.       inhibit-splash-screen t)
  25.  
  26. ;| Global-Keybindings
  27. (define-key global-map [(control \\)] [?\u03BB])
  28. (define-key global-map (kbd "RET") 'newline-and-indent)
  29.  
  30. ;| UTF-8
  31. (setq default-buffer-file-coding-system 'utf-8
  32.       locale-coding-system 'utf-8)
  33.  
  34. (set-terminal-coding-system 'utf-8)
  35. (set-keyboard-coding-system 'utf-8)
  36. (set-selection-coding-system 'utf-8)
  37.  
  38. (prefer-coding-system 'utf-8)
  39.  
  40. ;| Paths
  41. (setq site-lisp-path "C:/Program Files (x86)/Emacs/site-lisp/"
  42.       prog-path "S:/prog/"
  43.       sandbox-path "S:/prog/sandbox/"
  44.       hs-proj-path "S:/prog/lang.haskell/-.proj/")
  45.  
  46. (mapc (lambda (path)
  47. (add-to-list 'load-path
  48. (concat site-lisp-path path)))
  49.       '(""
  50. "color-theme-6.6.0"
  51. "slime-2011-11-09"))
  52.  
  53. ;| Code-Window Init
  54. (setq code-window (car (get-buffer-window-list)))
  55.  
  56. ;| Speedbar
  57. (require 'speedbar)
  58. (require 'sr-speedbar)
  59.  
  60. (nconc speedbar-ignored-modes
  61.        '(shell-mode
  62. inferior-haskell-mode))
  63.  
  64. (mapc 'speedbar-add-supported-extension
  65.       '(".hs" ".lhs" ".lisp"))
  66.  
  67. (sr-speedbar-toggle)
  68.  
  69. (defun speedbar-set-directory (path)
  70.   (select-window sr-speedbar-window)
  71.   (setq default-directory path)
  72.   (speedbar-update-contents))
  73.  
  74. ;| Windows
  75. (setq interactive-window (split-window sr-speedbar-window 15)
  76.       speedbar-menu-window (split-window sr-speedbar-window () t)
  77.       interactive-menu-window (split-window speedbar-menu-window))
  78.  
  79. ;| PowerShell
  80. (autoload 'powershell "powershell"
  81.   "Run powershell as a shell within emacs." t)
  82.  
  83. (setq powershell-process
  84.       (get-buffer-process (powershell)))
  85.  
  86. (push (lambda ()
  87. (process-send-string powershell-process
  88. (concat "cd \"" default-directory "\"\n")))
  89.       speedbar-update-contents-hook)
  90.  
  91.  
  92. ; speedbar-menu-window resizer (to 13 columns)
  93. (push (lambda (_)
  94. (let ((w (window-width speedbar-menu-window)))
  95. (when (> w 13)
  96. (with-selected-window speedbar-menu-window
  97. (shrink-window-horizontally (- w 13))))))
  98.       window-size-change-functions)
  99.  
  100. ; powershell-window resizer
  101. (push (lambda (_)
  102. (if (= 59 (window-width interactive-window))
  103. (powershell--set-window-width powershell-process 59)))
  104.       window-size-change-functions)
  105.  
  106. ;| Navigation
  107. (require 'button)
  108.  
  109. (set-window-buffer speedbar-menu-window
  110. (generate-new-buffer "menu-a"))
  111.  
  112. (defface green-link '((t (:foreground "green")))
  113.   "Face for green links in upper navigation menu."
  114.   :group 'basic-faces)
  115.  
  116. (with-current-buffer "menu-a"
  117.   (end-of-buffer)
  118.   (flet (($ (label path)
  119. (x2 (newline))
  120. (insert-button label
  121. 'action `(lambda (_)
  122. (speedbar-set-directory ,path))
  123. 'face 'green-link
  124. 'help-echo nil)))
  125.     ($ " [ hs-proj ] " hs-proj-path)
  126.     ($ " [ sandbox ] " sandbox-path)
  127.     ($ " [ prog ] " prog-path)
  128.     ($ "[ site-lisp ]" site-lisp-path)))
  129.  
  130. (set-window-buffer interactive-menu-window
  131. (generate-new-buffer "menu-b"))
  132.  
  133. (defface yellow-link '((t (:foreground "yellow")))
  134.   "Face for yellow links in lower navigation menu."
  135.   :group 'basic-faces)
  136.  
  137. (defface orange-link '((t (:foreground "orange")))
  138.   "Face for orange links in lower navigation menu."
  139.   :group 'basic-faces)
  140.  
  141. (with-current-buffer "menu-b"
  142.   (end-of-buffer)
  143.   (flet (($ (label buffer &optional face action)
  144. (x2 (newline))
  145. (insert-button label
  146. 'action (or action
  147. `(lambda (_)
  148. (set-window-buffer interactive-window
  149. ,buffer)))
  150. 'face (or face
  151. 'yellow-link)
  152. 'help-echo nil)))
  153.     ($ " [ ghci ] " "*haskell*")
  154.     ($ " [ ps ] " "*PowerShell*")
  155.     (newline)
  156.     ($ " [ init.el ] " ()
  157.        'orange-link
  158.        (lambda (_)
  159. (with-selected-window code-window
  160. (set-window-buffer code-window
  161. (or (get-buffer "init.el")
  162. (find-file "~/.emacs.d/init.el"))))))))
  163.  
  164. ;| Color-Theme
  165. (require 'color-theme)
  166. (color-theme-initialize)
  167. (color-theme-dark-blue2)
  168.  
  169. ;| Haskell-Mode
  170. (site-load "haskell-mode-2.8.0/haskell-site-file.el")
  171.  
  172. (mapc (lambda (event)
  173. (add-hook 'haskell-mode-hook event))
  174.       '(turn-on-haskell-doc-mode
  175. turn-on-haskell-indentation
  176. font-lock-mode))
  177.  
  178. (require 'inf-haskell)
  179.  
  180. (inferior-haskell-start-process '("ghci"))
  181. (set-window-buffer interactive-window
  182. inferior-haskell-buffer)
  183.  
  184. ;| Octave
  185. (autoload 'octave-mode "octave-mod" nil t)
  186.  
  187. (setq auto-mode-alist
  188.       (cons '("\\.m$" . octave-mode)
  189. auto-mode-alist))
  190.  
  191. (add-hook 'octave-mode-hook
  192.           (lambda ()
  193. (abbrev-mode 1)
  194. (auto-fill-mode 1)
  195. (if (eq window-system 'x)
  196. (font-lock-mode 1))))
  197.  
  198. ;| Slime
  199. (setq inferior-lisp-program "sbcl")
  200. (require 'slime)
  201. (require 'slime-autoloads)
  202. (slime-setup '(slime-fancy slime-indentation))
  203.  
  204. ;| Geiser
  205. (site-load "geiser-0.1.3/elisp/geiser.el")
  206. (setq geiser-impl-installed-implementations '(racket))
Add Comment
Please, Sign In to add comment