summaryrefslogtreecommitdiff
path: root/.emacs
blob: 5f189b5bb9aca18425253ad39196ea84174e92fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
(add-to-list 'load-path "~/.emacs.d")

;; el-get
(load "el-get-init")

;; evil
(require 'evil)
(load "evil-settings")
;(evil-mode 1)

;; clipboard options
(setq mouse-drag-copy-region nil)  ; stops selection with a mouse being immediately injected to the kill ring
(setq x-select-enable-primary nil)  ; stops killing/yanking interacting with primary X11 selection
(setq x-select-enable-clipboard t)  ; makes killing/yanking interact with clipboard X11 selection

;; wrap long lines
(setq truncate-partial-width-windows nil)

;; show parens
(show-paren-mode 1)

;; line numbering
(global-linum-mode 1)
(setq linum-format "%4d ")

;; scrollbar on the right
(set-scroll-bar-mode 'right)

;; maximize frame
(defun toggle-fullscreen (&optional other_mode)
  "toggles whether the currently selected frame is maximized or reset to prior size"
  (interactive)
  (let ((f (selected-frame)))
    (modify-frame-parameters f `((fullscreen . ,(if (frame-parameter f 'fullscreen) other_mode 'maximized))))))

(defun force-fullscreen ()
  "maximizes the currently selected frame"
  (interactive)
  (toggle-fullscreen 'maximized))

(add-hook 'emacs-startup-hook (lambda () (run-with-idle-timer 0.1 nil 'force-fullscreen)))

;; theming
(require 'color-theme)
(color-theme-initialize)
(color-theme-charcoal-black)

;; set default font
;; this is needed since Emacs-24 to also set all future frames
;; (setting 'default' in custom-set-faces seems not to work anymore)
(add-to-list 'default-frame-alist '(font . "Inconsolata-11"))

;; use Poly/ML as SML interpreter
(setq sml-program-name "poly")

;; work around bugs in Isabelle/PG
;; we need to toggle options twice to make them work
(defun isabelle-repair (what part)
  (let*
    ((msg (format "Repairing %s" (capitalize what)))
     ; create the variable from `what` and `part`
     ; replace spaces by "-" in `what`
     (var (format "isar-%s:%s" part
                  (mapconcat 'identity (split-string (downcase what)) "-")))
     (vart (concat var "-toggle"))
     (repair `(lambda ()
                ; intern-soft also handles the case, that `var` is not existing
                ; (it returns nil then -- making `when` skip)
                (when (intern-soft ,var)
                  (message ,msg)
                  (funcall (intern ,vart) 0) ; toggle off
                  (funcall (intern ,vart) 1) ; toggle on
                ))))
    
    (add-hook 'proof-shell-init-hook repair)))

(isabelle-repair "auto solve direct" "tracing")
(isabelle-repair "auto quickcheck" "tracing")
(isabelle-repair "quick and dirty" "proof")

;; toggle three window mode
(defun toggle-three-panes ()
  (interactive)
  (proof-multiple-frames-toggle)
  (proof-three-window-toggle))

(defun isar-mode-keys ()
  (message "Loading isar keys")
  (local-set-key (kbd "C-c 3") 'toggle-three-panes)
  )

(add-hook 'isar-mode-hook 'isar-mode-keys)

;; custom file
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file)