summaryrefslogtreecommitdiff
path: root/emacs
blob: b6b3993a682a94783cbec4a5dbcfc04dd706f318 (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; C-z under xmonad does nothing useful, and Emacs 23 gets confused
;; (needs to be de-focused and re-focused to de-confuse). Disable C-z.
;;
;; Also, disable C-x C-z. Also make zooming with C-+ etc works.


;; Added by Package.el.  This must come before configurations of
;; installed packages.  Don't delete this line.  If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)

(when (display-graphic-p)
 (global-unset-key "\C-x\C-c")
 (global-unset-key "\C-z")
 (global-unset-key "\C-_")
 (global-unset-key (kbd "\C-x\C-z"))
 (global-unset-key (kbd "<insert>"))
 (global-set-key (kbd "C-=") 'text-scale-adjust)
 (global-set-key (kbd "C-+") 'text-scale-adjust)
 (global-set-key (kbd "C--") 'text-scale-adjust)
 (global-set-key (kbd "C-0") 'text-scale-adjust)
)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Magit
(global-set-key (kbd "C-x g") 'magit-status)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Show column numbers in the mode line.
(column-number-mode t)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Insert spaces instead of TAB characters.
(setq-default indent-tabs-mode nil)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Insert spaces instead of TAB characters, markdown-mode edition.

(require 'markdown-mode)
(add-hook 'markdown-mode-hook
      (lambda ()
        (setq indent-tabs-mode nil)
        )
      )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; In Markdown mode, do not indent a line when Enter is pressed.
(setq markdown-indent-on-enter nil)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; In Markdown mode, do NOT follow links when Enter is pressed.
(setq-default markdown-follow-wiki-link-on-enter nil)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; In Python mode, turn off electric-indent-mode.

(defun electric-indent-no-colon-indent-char ()
    (set 'electric-indent-chars '(10)))
(add-hook 'python-mode-hook 'electric-indent-no-colon-indent-char)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Turn on some modes automatically based on filename.
(setq auto-mode-alist
    '(("\\.mdwn\\'" . markdown-mode)
      ("\\.md\\'" . markdown-mode)
      ("\\.yarn\\'" . markdown-mode)
      ("\\.js\\'" . js-mode)
      ("\\.json\\'" . js-mode)
      ("Makefile" . makefile-mode)
      ("README" . markdown-mode)
      ("NEWS" . markdown-mode)
      ("COMMIT_EDITMSG\\'" . text-mode)
      ("\\.html\\'" . html-mode)
      ("\\.css\\'" . css-mode)
      ("\\.yaml\\'" . yaml-mode)
      ("\\.yml\\'" . yaml-mode)
      ("\\.ick\\'" . yaml-mode)
      ("\\.morph\\'" . yaml-mode)
      ("\\.heat\\'" . yaml-mode)
      ("\\.vmdb\\'" . yaml-mode)
      ("\\.py\\'" . python-mode)
      ("\\.sh\\'" . shell-script-mode)
      ("\\.hs\\'" . haskell-mode)
      ("\\.rs\\'" . rust-mode)
      ("\\.ledger\\'" . ledger-mode)
      ("mutt-.*" . mail-mode)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Turn on auto-fill-mode in all text modes automatically.
(setq text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Do not make backup files when saving.
(setq make-backup-files nil)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Enable X CLIPBOARD selection, instead of PRIMARY.
(setq x-select-enable-clipboard t)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Disable tool bar.
(tool-bar-mode 0)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Don't require double spaces to end sentences.
(setq sentence-end-double-space nil)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Don't show initial help on startup.
(setq inhibit-startup-screen t)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Don't show unwanted files with dired.
;; From: http://stackoverflow.com/questions/14850103/how-do-i-get-emacs-dired-to-ignore-uninteresting-file-extensions
(require 'dired-x)
(setq-default dired-omit-files-p t)
(setq dired-omit-files
    (concat dired-omit-files "\\.pyc$"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Show directories in the Buffers menu.
(setq buffers-menu-show-directories t)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; cc mode style.
(setq c-default-style "linux")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28350
(eval-after-load "enriched"
  '(defun enriched-decode-display-prop (start end &optional param)
     (list start end)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; count words
;; https://raw.githubusercontent.com/tomaszskutnik/word-count-mode/master/word-count.el

(setq load-path (cons (expand-file-name "~/.emacs.d/lisp") load-path))
(autoload 'word-count-mode "word-count"
          "Minor mode to count words." t nil)
(autoload 'wc-mode "word-count"
          "Minor mode to count words." t nil)

;;;;
(require 'cargo)
(add-hook 'rust-mode-hook 'cargo-minor-mode)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Use custom-set-variables to set variables that cant' be set otherwise.

;; truncate-lines:
;; Don't wrap long lines when displaying them. Make me scroll
;; sideways instead.

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(column-number-mode t)
 '(tool-bar-mode nil)
 '(truncate-lines t))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:family "Hack" :foundry "SRC" :slant normal :weight normal :height 120 :width normal)))))