This repository has been archived by the owner on Feb 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathORIG-init.el
790 lines (646 loc) · 21.4 KB
/
ORIG-init.el
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
;;; init.el --- Initialization file for Emacs
;;;
;;; William Denton <wtd@pobox.com>
;;;
;; Turn this on when needed
;; (setq debug-on-error t)
;;; Commentary:
;; This is my Emacs init file. One day I will move it all into an Org file!
;; Diego Zambonis' Literature Configuration will be good to read when I do.
;; https://leanpub.com/lit-config/read
;; Org inits to look at:
;; https://github.com/dieggsy/dotfiles/tree/master/emacs/.emacs.d
;; https://github.com/novoid/dot-emacs
;; https://github.com/sachac/.emacs.d
;; https://github.com/thblt/.emacs.d
;; https://github.com/theophilusx/emacs-init-org/
;; https://github.com/zzamboni/dot-emacs/
;; https://gitlab.com/marcowahl/mw.emacs.d
;; To try
;; pdf-tools: https://github.com/politza/pdf-tools
;;; Code:
;; See also early-init.el
;;;;
;;;; Load paths and where to find things
;;;;
;; user-emacs-directory is ~/.emacs.d/
;; Various specific config stuff is in setup files in setup/
(add-to-list 'load-path (expand-file-name "~/.emacs.d/setup"))
;;;;
;;;; Packages
;;;;
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(setq package-archive-priorities
'(("melpa" . 20)
("gnu" . 10)))
;;;;
;;;; use-package
;;;;
;; Thank you, John Wiegley!
;; https://github.com/jwiegley/use-package
;; If it's not installed, get it.
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile
(require 'use-package))
;; Make sure that if I want a package, it gets installed automatically.
(setq use-package-always-ensure t)
;; These two go with use-package
(use-package diminish)
;; (require 'diminish)
(use-package bind-key)
;; (require 'bind-key) ;; if you use any :bind variant
;;;;
;;;; Emacs server
;;;;
;; Run the server; now I can load any file into Emacs with 'emacsclient file'
(server-mode)
;;;;
;;;; Parentheses!
;;;;
;; smartparens
;; https://github.com/Fuco1/smartparens/
(use-package smartparens
:diminish smartparens-mode
:config
(require 'smartparens-config)
(smartparens-global-mode t)
(show-smartparens-global-mode t)
`(sp-show-pair-match-face :inverse-video t :bold t)
`(sp-show-pair-mismatch-face :inverse-video t :bold t)
)
;;;;
;;;; Indenting
;;;;
(electric-indent-mode 1)
;; Show vertical lines to guide indentation
;; https://github.com/zk-phi/indent-guide
(use-package indent-guide
:diminish
:config
(indent-guide-global-mode)
)
;; aggressive-indent is indeed aggressive, but it's very handy.
(use-package aggressive-indent
:diminish aggressive-indent-mode ;; "→"
:config
(global-aggressive-indent-mode 1)
(add-to-list 'aggressive-indent-excluded-modes 'html-mode)
)
;;;;
;;;; Faces 'n' fonts
;;;;
;; Measured in 0.1 pts
(setq wtd-ubuntu-mono-height 130)
;; (setq wtd/fira-code-height 120)
(when (string= (system-name) "work")
;; Need it a little bigger on my work machine
(setq wtd-ubuntu-mono-height 160)
;; (setq wtd-fira-code-height 160)
)
(set-face-attribute 'default nil :font "Ubuntu Mono" :height wtd-ubuntu-mono-height)
;; (set-face-attribute 'default nil :font "Fira Code" :height wtd-fira-code-height)
;; (set-face-attribute 'variable-pitch nil :family "Baskervald ADF Std" :height wtd-font-height)
;; Could help improve performance with Unicode symbols.
(setq inhibit-compacting-font-caches t)
;; This would be the best way to go with mixed variable and fixed pitches,
;; but every time I try it, I go back to fixed pitch everywhere.
;; (use-package mixed-pitch
;; ;; https://gitlab.com/jabranham/mixed-pitch
;; :diminish
;; :hook
;; (org-mode markdown-mode)
;; :config
;; (set-face-attribute 'variable-pitch nil :family "Baskervald ADF Std" :height 200)
;; )
;;;;
;;;; Theme: solarized
;;;;
(use-package solarized-theme
;; https://github.com/bbatsov/solarized-emacs
:config
;; Stop the theme from messing up Org headlines and using variable pitch everywhere.
(setq solarized-use-variable-pitch nil
solarized-scale-org-headlines nil)
(setq x-underline-at-descent-line t) ;; Try this out.
(load-theme 'solarized-dark t)
)
;; Keep custom settings in separate file
;; If custom.el doesn't exist, create an empty file
;; (for starting from scratch).
(setq custom-file "~/.custom.el")
(unless (file-exists-p custom-file)
(write-region "" nil custom-file))
(load custom-file)
;; Always with the font-locking
(setq font-lock-maximum-decoration t)
;; Sentences do not need double spaces to end. (But it's better when they do.)
(set-default 'sentence-end-double-space nil)
;; UTF-8 please (surely this is overkill?)
(set-language-environment "UTF-8")
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
;; Proper line wrapping
(global-visual-line-mode 1)
;; Highlight current line
(global-hl-line-mode 1)
;; And set its colour
;; (set-face-background hl-line-face "#efefef")
;; Calendar should start on Monday
(setq calendar-week-start-day 1)
;; I don't want to type in "yes" or "no"---I want y/n.
(fset 'yes-or-no-p 'y-or-n-p)
;; Lower the time to echo keystrokes
(setq echo-keystrokes 0.1)
;; Never use an X dialog box; use the minibuffer instead
(setq use-dialog-box nil)
;; S-<return> to insert line, indent it, and move the cursor there.
;; http://emacsredux.com/blog/2013/03/26/smarter-open-line/
(defun wtd/smart-open-line ()
"Insert an empty line after the current line.
Position the cursor at its beginning, according to the current mode."
(interactive)
(move-end-of-line nil)
(newline-and-indent))
(global-set-key (kbd "s-<return>") 'wtd/smart-open-line)
;; Break out of default (especially Org) indentation, and just start a new line.
(global-set-key (kbd "C-M-<return>") 'electric-indent-just-newline)
;; Split window horizontally, not vertically (I prefer side by side
;; with the newer wider screens)
(setq split-height-threshold nil)
(setq split-width-threshold 0)
;; Make window splitting more useful
;; http://pages.sachachua.com/.emacs.d/Sacha.html
(defun wtd/vsplit-last-buffer (PREFIX)
"Split the window vertically and display the previous buffer. By default, switch to that new window; with PREFIX, stay where you are."
(interactive "p")
(split-window-vertically)
(other-window 1 nil)
(unless prefix
(switch-to-next-buffer)))
(defun wtd/hsplit-last-buffer (PREFIX)
"Split the window horizontally and display the previous buffer. By default, switch to that new window; with PREFIX, stay where you are."
(interactive "p")
(split-window-horizontally)
(other-window 1 nil)
(unless prefix (switch-to-next-buffer)))
(global-set-key (kbd "C-x 2") 'wtd/vsplit-last-buffer)
(global-set-key (kbd "C-x 3") 'wtd/hsplit-last-buffer)
;; Enable cutting/pasting and putting results into the X clipboard
(global-set-key [(shift delete)] 'clipboard-kill-region)
(global-set-key [(control insert)] 'clipboard-kill-ring-save)
(global-set-key [(shift insert)] 'clipboard-yank)
;; Allow pasting selection outside of Emacs
(setq select-enable-clipboard t)
;; M-backspace is backward-word-kill, and C-backspace is bound to that
;; by default. Change that to backword-kill-line so it deletes from
;; the point to the beginning of the line.
(global-set-key (kbd "C-<backspace>") (lambda ()
(interactive)
(kill-line 0)))
;;;;
;;;; Save where I was and what I had open
;;;;
;; Save point position between sessions
(require 'saveplace)
(setq save-place-file (expand-file-name ".places" user-emacs-directory))
(save-place-mode)
;; Remember all the buffers I have open
(desktop-save-mode 1)
(setq history-length 50)
(setq desktop-buffers-not-to-save
(concat "\\("
"^nn\\.a[0-9]+\\|\\.log\\|(ftp)\\|^tags\\|^TAGS"
"\\|\\.emacs.*\\|\\.diary\\|elpa\/*\\|\\.bbdb"
"\\)$"))
(add-to-list 'desktop-modes-not-to-save 'dired-mode)
(add-to-list 'desktop-modes-not-to-save 'Info-mode)
(add-to-list 'desktop-modes-not-to-save 'info-lookup-mode)
(add-to-list 'desktop-modes-not-to-save 'fundamental-mode)
;;;;
;;;; *scratch* buffer
;;;;
;; The *scratch* buffer is lisp-interaction-mode by default, but I use Org more.
(setq initial-major-mode 'org-mode)
(setq initial-scratch-message "")
;; C-c b to create a new scratch buffer. Default to org-mode.
;; From milkypostman.
;; See also https://emacs.stackexchange.com/a/81/145 and maybe try to glom the two together
(defun create-scratch-buffer nil
"Create a new scratch buffer to work in (could be *scratch* - *scratchX*)."
(interactive)
(let ((n 0)
bufname)
(while (progn
(setq bufname (concat "*scratch"
(if (= n 0) "" (int-to-string n))
"*"))
(setq n (1+ n))
(get-buffer bufname)))
(switch-to-buffer (get-buffer-create bufname))
(org-mode)))
(global-set-key (kbd "C-c b") 'create-scratch-buffer)
;;;
;;; One-line customizations
;;;
;; expand-region (see https://github.com/magnars/expand-region.el)
;; C-= successively expands the region with great intelligence
(use-package expand-region
:defer t
:init
(global-set-key (kbd "C-=") 'er/expand-region)
)
;; "The command other-window is normally bound to C-x o but I find
;; that way too cumbersome for what is such a frequent operation. M-o
;; is normally bound to some rich text formatting nobody cares about."
;; http://www.masteringemacs.org/articles/2014/02/28/my-emacs-keybindings/
(global-set-key (kbd "M-o") 'other-window)
;; Highlight marked text - only works under X.
(transient-mark-mode t)
;; Remove text in active region if inserting text
(delete-selection-mode 1)
;; I sometimes use CamelCase in Ruby and R
(add-hook 'prog-mode-hook 'subword-mode)
;; Scroll by one line at a time.
;; https://www.gnu.org/software/emacs/manual/html_node/efaq/Scrolling-only-one-line.html
(setq scroll-conservatively 10000)
;; https://emacs.stackexchange.com/questions/28736/emacs-pointcursor-movement-lag
(setq auto-window-vscroll nil)
;; Make searches case insensitive.
(setq case-fold-search nil)
;; Turn on highlighting for search strings.
(setq search-highlight t)
;; Remove trailing whitespace automatically
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; Down-arrow at the end of a file doesn't add in a new line.
(setq next-line-add-newlines nil)
;; Silently ensure a file ends in a newline when it's saved.
(setq require-final-newline t)
;; Show me empty lines after buffer end
(set-default 'indicate-empty-lines t)
;; Add parts of each file's directory to the buffer name if not unique
(require 'uniquify)
(setq uniquify-buffer-name-style 'forward)
;; Make script files executable automatically
;; http://www.masteringemacs.org/articles/2011/01/19/script-files-executable-automatically/
(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
;; When I want to kill a buffer, it's always the current one, so don't ask.
;; http://pragmaticemacs.com/emacs/dont-kill-buffer-kill-this-buffer-instead/
(global-set-key (kbd "C-x k") 'kill-this-buffer)
;;;;
;;;; Narrowing to region
;;;;
;; I'm old enough to be able to use narrow-to-region
(put 'narrow-to-region 'disabled nil)
;; This is taken from http://endlessparentheses.com/emacs-narrow-or-widen-dwim.html
(defun narrow-or-widen-dwim (p)
"Widen if buffer is narrowed, narrow-dwim otherwise.
Dwim means: region, org-src-block, org-subtree, or defun,
whichever applies first. Narrowing to org-src-block actually
calls `org-edit-src-code'.
With prefix P, don't widen, just narrow even if buffer is
already narrowed."
(interactive "P")
(declare (interactive-only))
(cond ((and (buffer-narrowed-p) (not p)) (widen))
((region-active-p)
(narrow-to-region (region-beginning) (region-end)))
((derived-mode-p 'org-mode)
;; `org-edit-src-code' is not a real narrowing
;; command. Remove this first conditional if you
;; don't want it.
(cond ((ignore-errors (org-edit-src-code))
(delete-other-windows))
((ignore-errors (org-narrow-to-block) t))
(t (org-narrow-to-subtree))))
((derived-mode-p 'latex-mode)
(LaTeX-narrow-to-environment))
(t (narrow-to-defun))))
(define-key ctl-x-map "w" #'narrow-or-widen-dwim)
(eval-after-load 'latex '(define-key LaTeX-mode-map "\C-xw" nil))
;; rainbow-mode
;; "All strings representing colors will be highlighted with the color they represent."
(use-package rainbow-mode
:init
(add-hook 'prog-mode-hook 'rainbow-mode)
:config
(rainbow-mode t) ;; #0af
)
;; Include the size of the file in the mode line
(size-indication-mode t)
;; Show which column I'm in in the mode line as well
(column-number-mode t)
;; 8 is wrong
(setq tab-width 4)
;; Make the cursor a thin horizontal bar, not a block (but I still
;; like it blinking)
;; Can be 'bar or 'box or '(hbar . 3) etc.
(set-default 'cursor-type '(bar . 2))
;; Use C-c left or C-c right to go back and forth in window
;; configurations
(winner-mode t)
;; anzu-mode provides a "minor mode which display current point and
;; total matched in various search mode."
;; https://github.com/syohex/emacs-anzu
(use-package anzu
:diminish anzu-mode
:config
(global-anzu-mode t)
(global-set-key (kbd "M-%") 'anzu-query-replace)
(global-set-key (kbd "C-M-%") 'anzu-query-replace-regexp)
)
;; I was getting errors about exceeding the defaults on both of these.
(setq max-specpdl-size 50000)
(setq max-lisp-eval-depth 25000)
;; Settings for command interpreter modes, which I use mostly for R
;; and Ruby.
(setq ansi-color-for-comint-mode 'filter)
(setq comint-scroll-to-bottom-on-input t)
(setq comint-scroll-to-bottom-on-output t)
(setq comint-move-point-for-output t)
;;(setq comint-prompt-read-only t)
;; undo-tree-mode
(use-package undo-tree
:diminish undo-tree-mode
:config
(global-undo-tree-mode)
:custom
(undo-tree-visualizer-timestamps t)
(undo-tree-visualizer-diff t)
)
;; Let me upcase or downcase a region, which is disabled by default.
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
;; prettify-symbols
(global-prettify-symbols-mode +1)
(setq prettify-symbols-unprettify-at-point 'right-edge)
;;
(use-package async
:defer t
:config
(dired-async-mode 1)
)
;;;;
;;;; Git
;;;;
(use-package magit
;; It will install with-editor
;; :config
)
;; imenu
(global-set-key (kbd "M-i") 'imenu)
;; Disable byte-compile warnings, which I don't care about.
;; http://tsengf.blogspot.ca/2011/06/disable-byte-compile-warning-in-emacs.html
(setq byte-compile-warnings '(not nresolved
free-vars
callargs
redefine
obsolete
noruntime
cl-functions
interactive-only
))
;; wrap-region to wrap regions in * or / etc.
;; See http://pragmaticemacs.com/emacs/wrap-text-in-custom-characters/
(use-package wrap-region
:defer t
:diminish wrap-region-mode
:config
;; (wrap-region-mode t)
(wrap-region-add-wrappers
'(("*" "*" nil org-mode)
("~" "~" nil org-mode)
("/" "/" nil org-mode)
("=" "=" "+" org-mode)
("_" "_" nil org-mode)
("$" "$" nil (org-mode latex-mode))))
:init
(add-hook 'org-mode-hook 'wrap-region-mode)
(add-hook 'latex-mode-hook 'wrap-region-mode)
)
;; multiple-cursors
(use-package multiple-cursors)
;; Allow searching for Unicode characters by name
;; https://github.com/purcell/list-unicode-display
(use-package list-unicode-display)
;;;;
;;;; The mode line
;;;;
;;;; Tidy up the mode line. I don't need to see everything in there.
(diminish 'abbrev-mode)
(diminish 'emacs-lisp-d-mode " Ⓛ")
(eval-after-load "autorevert" '(diminish 'auto-revert-mode))
(eval-after-load "eldoc" '(diminish 'eldoc-mode))
;; (eval-after-load "flymake" '(diminish 'flymake-mode))
(eval-after-load "flyspell" '(diminish 'flyspell-mode ""))
;;(eval-after-load "magit" '(diminish 'magit-auto-revert-mode))
(eval-after-load "org-indent" '(diminish 'org-indent-mode)) ;; →
(eval-after-load "outline" '(diminish 'outline-minor-mode))
(eval-after-load "rainbow-mode" '(diminish 'rainbow-mode))
(eval-after-load "simple" '(diminish 'visual-line-mode))
(eval-after-load "smerge-mode" '(diminish 'smerge-mode))
(eval-after-load "subword" '(diminish 'subword-mode))
;;;; powerline: Fancy up the mode line!
;; https://github.com/milkypostman/powerline/
;; Sticking with the default seems to be nice enough for me.
(use-package powerline
:config
(powerline-default-theme)
)
;;;;
;;;; amx for completion
;;;;
(use-package amx
:requires helm
:after ivy
:custom
(amx-backend 'ivy)
)
;;;;
;;;; Ivy and Swiper
;;;;
;; https://github.com/abo-abo/swiper
;; See also http://irreal.org/blog/?p=6419
(use-package counsel)
(use-package ivy
:diminish
:config
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq ivy-count-format "%d/%d ")
)
(use-package swiper
:after ivy
:bind (("C-s" . swiper)
("C-c C-r" . ivy-resume)
("M-x" . counsel-M-x)
("C-x C-f" . counsel-find-file)
("C-M-i" . complete-symbol)
("C-." . counsel-imenu)
("C-c 8" . counsel-unicode-char)
("C-c g" . counsel-git)
("C-c k" . counsel-ag)
("C-c v" . ivy-push-view)
("C-c V" . ivy-pop-view)
("M-y" . counsel-yank-pop))
;; :config
)
;;;;
;;;; Projectile (https://github.com/bbatsov/projectile)
;;;;
(use-package projectile
:config
(projectile-mode)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(setq projectile-mode-line-function '(lambda () (format " ᴨ[%s]" (projectile-project-name))))
)
;;;;
;;;; launcher-map, to make it easier to run common things
;;;;
;; http://endlessparentheses.com/launcher-keymap-for-standalone-features.html
(define-prefix-command 'launcher-map)
(define-key ctl-x-map "l" 'launcher-map)
(define-key launcher-map "c" #'calculator) ; calc is too much
(define-key launcher-map "g" #'magit-status)
(define-key launcher-map "l" #'goto-line)
(define-key launcher-map "m" #'mc/edit-lines)
(define-key launcher-map "p" #'list-packages)
(define-key launcher-map "s" #'eshell)
(define-key launcher-map "u" #'magit-pull-from-upstream)
(define-key launcher-map "w" #'count-words-region)
;;;;
;;;; CSV files
;;;;
(use-package csv-mode)
;;;;
;;;; JSON
;;;;
(use-package json-mode)
;;;;
;;;; YASnippet
;;;;
;; https://joaotavora.github.io/yasnippet/
(use-package yasnippet
:diminish yas-minor-mode
:config
(use-package yasnippet-snippets)
(yas-global-mode 1)
)
;;;;
;;;; Git stuff
;;;;
;; git-gutter
;; https://github.com/syohex/emacs-git-gutter
(use-package git-gutter-fringe
:diminish git-gutter-mode
:config
(global-git-gutter-mode t)
(setq git-gutter-fr:side 'right-fringe)
)
;;;;
;;;; which-key
;;;;
;; https://github.com/justbur/emacs-which-key
(use-package which-key
:diminish which-key-mode
:config
(which-key-mode)
)
;;;;
;;;; Spelling and abbreviations and dictionaries etc.
;;;;
;; Turn on spell-checking in comments in programs.
(add-hook 'prog-mode-hook #'flyspell-prog-mode)
;;;;
;;;; flycheck
;;;;
(use-package flycheck
:init (global-flycheck-mode)
:diminish flycheck-mode
:config
(setq flycheck-global-modes '(not org-mode))
;; Could also set :modes to list where I want it.
)
;;;;
;;;; Copying and pasting with volatile-mode
;;;;
(use-package volatile-highlights
:init (volatile-highlights-mode t)
:diminish volatile-highlights-mode
:config
(vhl/define-extension 'undo-tree 'undo-tree-yank 'undo-tree-move)
(vhl/install-extension 'undo-tree)
)
;;;;
;;;; esonify
;;;;
;; "An Emacs extension that sonifies your code."
;; https://github.com/oflatt/esonify
;; M-x esonify-mode to toggle on/off
(use-package esonify)
;;;;
;;;; Window management
;;;;
;; eyebrowse
;; https://github.com/wasamasa/eyebrowse
(use-package eyebrowse
:diminish eyebrowse-mode
:init (eyebrowse-setup-opinionated-keys)
:config
(eyebrowse-mode t)
;; (setq eyebrowse-new-workspace t)
(setq eyebrowse-wrap-around t)
)
;;;;
;;;; nXML
;;;;
;;;; Use nxml for HTML etc.
(add-to-list 'auto-mode-alist
(cons (concat "\\." (regexp-opt '("xml" "xsd" "sch" "rng" "xslt" "svg" "rss") t) "\\'")
'nxml-mode))
(fset 'html-mode 'nxml-mode)
;; Why isn't folding built in?
;; Taken from https://emacs.stackexchange.com/a/3157/145
;; (require 'sgml-mode)-
;; (require 'nxml-mode)
;; (require 'hideshow)
(add-to-list 'hs-special-modes-alist
'(nxml-mode
"<!--\\|<[^/>]*[^/]>"
"-->\\|</[^/>]*[^/]>"
"<!--"
sgml-skip-tag-forward
nil))
(add-hook 'nxml-mode-hook 'hs-minor-mode)
;; (define-key nxml-mode-map (kbd "C-c h") 'hs-toggle-hiding)
(with-eval-after-load "nxml-mode"
;; Need to define this only after nxml-mode has been loaded
(define-key nxml-mode-map "\C-c h" 'hs-toggle-hiding))
;;;;
;;;; Mode-specific customizations
;;;;
(require 'setup-completion)
(require 'setup-elfeed)
;; (require 'setup-eshell) ;; I never use eshell
(require 'setup-ess)
(require 'setup-expansions)
(require 'setup-file-management)
(require 'setup-ibuffer)
;; (require 'setup-javascript)
(require 'setup-jekyll)
(require 'setup-latex)
(require 'setup-markdown)
(require 'setup-orgmode)
(require 'setup-ruby)
(require 'setup-shell-scripts)
;; (require 'setup-sonic-pi)
(require 'setup-useful-functions)
(require 'setup-yaml)
;; (require 'setup-polymode) ;; Keep this last, after Markdown stuff is defined.
(provide 'init)
;;; init.el ends here