init.el 19.7 KB
Newer Older
1
 ;;; BOOTSTRAP:
Victor A. Stoichiţă's avatar
Victor A. Stoichiţă committed
2
(require 'package)
3
4
5
6
7
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/") t)
(add-to-list 'package-archives
	     '("org" . "https://orgmode.org/elpa/") t)

Victor A. Stoichiţă's avatar
Victor A. Stoichiţă committed
8
(package-initialize)
Victor A. Stoichiţă's avatar
Victor A. Stoichiţă committed
9

10
;;;; Put variables set by customize out of the way
11
(setq custom-file (expand-file-name "customize.el" user-emacs-directory))
12
13
14
(when (file-exists-p custom-file)
  (load custom-file))

15
16
17
18
19
20
;;;; Put autogenerated files aside
(setq auto-save-file-name-transforms
      (quote
       ((".*" "~/.emacs.d/.autogeneres/auto-save-files/" t))))
(setq auto-save-list-file-prefix "~/.emacs.d/.autogeneres/auto-save-list/saves-")
(setq backup-directory-alist (quote ((".*" . "~/.emacs.d/backups/"))))
Victor A. Stoichiţă's avatar
Victor A. Stoichiţă committed
21

22
23
24
25
26
27
28
29
30
31
32
33
34
35
;;; BASIC DEFAULTS
(setq shift-select-mode t			; select with shift
      transient-mark-mode t			
      x-select-enable-clipboard-manager nil ; dont’t transfer emacs clipboard data to X clipboard manager on exit (avoid hangups)
      hi-lock-file-patterns-policy t ; Automatically load hi-lock patterns if found in file
      help-window-select 'other
      show-paren-style 'mixed) ; Show show the matching paren if it is visible, and the expression otherwise
(show-paren-mode 1)			; turn on paren highlighting
(delete-selection-mode) 
(require 'uniquify) 			;uniquify buffer names
(setq uniquify-buffer-name-style 'reverse) ; path after file name to ease autocompletion
(defalias 'yes-or-no-p 'y-or-n-p)	; Never ask long confirmations
(put 'narrow-to-region 'disabled nil) ; Enable narrow-to region. Bound to C-x n n.
(put 'list-timers 'disabled nil) ; Enable list-timers
36

37
(require 'iso-transl) ; Don’t complain that dead-circumflex is undefined
38

39
40
;;; TEXT DEFAULTS:
;;;; Basics
41
;; (setq visual-line-fringe-indicators '(left-curly-arrow right-curly-arrow)) ; materialiser les limites des lignes
42
43
(electric-pair-mode)
(setq sentence-end-double-space nil)
44
(setq-default use-hard-newlines t) ; <RET> or Ctrl-o to insert hard new lines (never filled)
45
(global-set-key (kbd "M-q") 'org-fill-paragraph) ; Rebind M-q to the org function which seems to work better in mails etc.
Victor A. Stoichiţă's avatar
Victor A. Stoichiţă committed
46

47
;;;; Autofill
48
;; (add-hook 'text-mode-hook 'turn-on-auto-fill)
Victor A. Stoichiţă's avatar
Victor A. Stoichiţă committed
49
50
(add-hook 'fill-nobreak-predicate 'fill-french-nobreak-p)
(add-hook 'fill-nobreak-predicate 'fill-single-word-nobreak-p)
Victor A. Stoichiţă's avatar
Victor A. Stoichiţă committed
51

52
;;;; Guillemets et apostrophes
53
54
55
(defvar V-syntax-table
  (let ((table (make-syntax-table)))
    (modify-syntax-entry ? "w" table)
56
    (modify-syntax-entry ?- "w" table)
57
58
    (modify-syntax-entry ?« "(»" table)
    (modify-syntax-entry ?» ")«" table)
59
60
    table))

61
62
63
64
(defun V-guillemets ()
  "Insert a pair of guillemets and leave cursor in the middle. 
   If region is active wrap in guillemets instead"
  (interactive)
65
66
  (let ((rend (region-end))
	(rbeg (region-beginning)))
67
68
  (if (region-active-p)
      (progn
69
	(goto-char rend)
70
	(insert " »")
71
	(goto-char rbeg)
72
73
74
	(insert "« "))
    (progn
      (insert "«  »");<-- deux espaces insécables
75
      (backward-char 2)))))
76

Victor A. Stoichiţă's avatar
Victor A. Stoichiţă committed
77
78
79
80
81
;; Mimick auto-fill-mode but leave long lines
(add-hook 'visual-line-mode-hook #'visual-fill-column-mode)
(setq visual-fill-column-fringes-outside-margins t)
(advice-add 'text-scale-adjust :after #'visual-fill-column-adjust)

82
(add-hook 'text-mode-hook (lambda ()
83
			    (set-syntax-table V-syntax-table)
84
			    (local-set-key "«" 'V-guillemets)
85
			    (electric-quote-mode) ; Pair curved quotes for opening/closing
86
			    (turn-on-visual-line-mode)))
87
(add-hook 'mu4e-compose-mode-hook (lambda ()
88
				    (local-set-key "«" 'V-guillemets)
89
				    (orgalist-mode 1)
90
91
				    (turn-on-visual-line-mode)))

92
;;;; Opposite of fill-paragraph    
93
94
95
96
97
98
99
100
(defun unfill-region (beg end)
  "Unfill the region, joining text paragraphs into a single
    logical line.  This is useful, e.g., for use with
    `visual-line-mode'."
  (interactive "*r")
  (let ((fill-column (point-max)))
    (fill-region beg end)))
;; Handy key definition
101
(global-set-key "\M-Q" 'unfill-region)
102

103
;;;; Better word navigation
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
;; From https://www.emacswiki.org/emacs/download/misc-cmds.el
(defun to-next-word (&optional n)
  "Go to the beginning of the Nth word after point.
N defaults to 1 (next word)."
  (interactive "p")
  (if (< n 0)
      (to-previous-word (- n))
    (dotimes (_  n)
      (let ((opt  (point)))
        (skip-syntax-forward "^w")
        (when (eq opt (point))
          (skip-syntax-forward "w")
          (skip-syntax-forward "^w"))))))

(defun to-previous-word (&optional n)
  "Go to the beginning of the Nth word before point.
N defaults to 1 (previous word)."
  (interactive "p")
  (if (< n 0)
      (to-next-word (- n))
    (dotimes (_  n)
      (let ((opt  (point)))
        (skip-syntax-backward "w")
        (when (eq opt (point))
          (skip-syntax-backward "^w")
          (skip-syntax-backward "w"))))))

(global-set-key (kbd "M-f") 'to-next-word)
(global-set-key (kbd "M-b") 'to-previous-word)
Victor A. Stoichiţă's avatar
Victor A. Stoichiţă committed
133

134
;;;; Expand-region
135
136
137
(require 'expand-region)
(global-set-key (kbd "C-à") 'er/expand-region)

138
;;;; Wrap region
139
140
141
142
143
144
145
146
147
148
149
150
151
(require 'wrap-region)
(wrap-region-add-wrappers
   '(("*" "*" nil org-mode)
     ("~" "~" nil org-mode)
     ("/" "/" nil org-mode)
     ("=" "=" nil org-mode)
     ("_" "_" nil org-mode)
     ("$" "$" nil (org-mode latex-mode))
     ("« " " »" "«" (org-mode mu4e-compose message-mode))))
(add-hook 'org-mode-hook 'wrap-region-mode)
(add-hook 'mu4e-compose-mode-hook 'wrap-region-mode)
(add-hook 'latex-mode-hook 'wrap-region-mode)

152
153
154
155
156
;;;; Abbrevs
(define-abbrev-table 'global-abbrev-table '(
    ("->" "→")
    ("-->" "⇉")))
(abbrev-mode 1) ; turn on abbrev mode
157

158
159
160
161
162
163
164
165
;;; SOME CUSTOM KEYBINDINGS:
;;;; Isearch
(progn
  ;; set arrow keys in isearch. left/right is backward/forward, up/down is history. press Return to exit
  (define-key isearch-mode-map (kbd "<up>") 'isearch-ring-retreat )
  (define-key isearch-mode-map (kbd "<down>") 'isearch-ring-advance )
  (define-key isearch-mode-map (kbd "<left>") 'isearch-repeat-backward) 
  (define-key isearch-mode-map (kbd "<right>") 'isearch-repeat-forward))
166

167
168
169
170
171
;;;; Various
(global-set-key (kbd "C-ç") 'comment-dwim-2)		
(global-set-key "\M-n" 'forward-paragraph)
(global-set-key "\M-p" 'backward-paragraph)
(global-set-key "\M-/" 'hippie-expand) ; 'dabbrev-expand is one of the functions in hippie-expand-try-functions-list anyway
172

173
174
175
176
177
;;; WINDOW and BUFFER behavior:
;;;; Basics
(setq split-height-threshold 39
      split-width-threshold 80)
(setq ediff-split-window-function 'split-window-horizontally) ; split window vertically for ediff
178

179
;;;; Efficiently Kill buffers and their windows
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
;; From https://www.emacswiki.org/emacs/download/misc-cmds.el
;; Candidate as a replacement for `kill-buffer', at least when used interactively.
;; For example: (define-key global-map [remap kill-buffer] 'kill-buffer-and-its-windows)
;;
;; We cannot just redefine `kill-buffer', because some programs count on a
;; specific other buffer taking the place of the killed buffer (in the window).
(defun kill-buffer-and-its-windows (buffer)
  "Kill BUFFER and delete its windows.  Default is `current-buffer'.
BUFFER may be either a buffer or its name (a string)."
  (interactive (list (read-buffer "Kill buffer: " (current-buffer) 'existing)))
  (setq buffer  (get-buffer buffer))
  (if (buffer-live-p buffer)            ; Kill live buffer only.
      (let ((wins  (get-buffer-window-list buffer nil t))) ; On all frames.
        (when (and (buffer-modified-p buffer)
                   (fboundp '1on1-flash-ding-minibuffer-frame))
          (1on1-flash-ding-minibuffer-frame t)) ; Defined in `oneonone.el'.
        (when (kill-buffer buffer)      ; Only delete windows if buffer killed.
          (dolist (win  wins)           ; (User might keep buffer if modified.)
            (when (window-live-p win)
              ;; Ignore error, in particular,
              ;; "Attempt to delete the sole visible or iconified frame".
              (condition-case nil (delete-window win) (error nil))))))
    (when (interactive-p)
      (error "Cannot kill buffer.  Not a live buffer: `%s'" buffer))))
(define-key global-map [remap kill-buffer] 'kill-buffer-and-its-windows)

(when (fboundp 'quit-restore-window)
  (defun quit-window-delete (&optional kill window)
    "Quit WINDOW, deleting it, and bury its buffer.
WINDOW must be a live window and defaults to the selected one.
With prefix argument KILL non-nil, kill the buffer instead of
burying it.

This is similar to the version of `quit-window' that Emacs had before
the introduction of `quit-restore-window'.  It ignores the information
stored in WINDOW's `quit-restore' window parameter.

It deletes the WINDOW more often, rather than switching to another
buffer in it.  If WINDOW is alone in its frame then the frame is
deleted or iconified, according to option `frame-auto-hide-function'."
    (interactive "P")
    (set-window-parameter window 'quit-restore `(frame frame nil ,(current-buffer)))
    (quit-restore-window window (if kill 'kill 'bury))))

;; Kill window opened by debug, auto-complete etc. 
(defun quit-next-window ()
  "If there are multiple windows, then close the other pane and kill the buffer in it also."
  (interactive)
  (other-window 1)
  (quit-window))

231
232
233
234
235
236
(defun quit-next-window-delete ()
  "If there are multiple windows, then close the other pane and kill the buffer in it also."
  (interactive)
  (other-window 1)
  (quit-window-delete))

237
;;;; Window shortcuts
238
(winner-mode 1)
239
240
241
242
(global-set-key (kbd "M-þ") 'winner-undo)
(global-set-key (kbd "M-\"") 'delete-other-windows)
(global-set-key (kbd "M-«") 'split-window-vertically)
(global-set-key (kbd "M-»") 'split-window-horizontally)
Victor A. Stoichiţă's avatar
Victor A. Stoichiţă committed
243

244

245
246
247
248
249
(require 'ace-window)
(global-unset-key (kbd "M-t")) ;; transpose-char
(global-set-key (kbd "M-t") 'ace-window)
(setq aw-keys '(?t ?s ?r ?n ?a ?u ?i ?e )
      aw-dispatch-always nil)
Victor A. Stoichiţă's avatar
Victor A. Stoichiţă committed
250

251
252
253
;;;; Buffer shortcuts
(global-set-key (kbd "C-ê") 'previous-buffer)
(global-set-key (kbd "M-ê") 'next-buffer)
Victor A. Stoichiţă's avatar
Victor A. Stoichiţă committed
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
;;; APPEARANCE:
;;;; Theme:
;; (load-theme 'monokai t)
(load-theme 'gruvbox-dark-medium t)
;; (load-theme 'gruvbox-light-medium t)
;; (load-theme 'tao-yang t)

;;;;; Monokai settings:
(defun V-monokai-theme ()
  (require 'monokai-theme) ;; Need to load it to configure it
  (setq monokai-height-minus-1 0.8
	monokai-height-plus-1 1.1
	monokai-height-plus-2 1.15
	monokai-height-plus-3 1.2
	monokai-height-plus-4 1.3)
  (setq monokai-use-variable-pitch t)
(custom-theme-set-faces 'monokai `(mu4e-replied-face ((t (:foreground ,"YellowGreen"))) NOW))
(custom-theme-set-faces 'monokai `(mu4e-forwarded-face ((t (:foreground ,"LightGoldenrod"))) NOW)))

;;;; Display time in modeline
(display-time)
(setq display-time-24hr-format t
      display-time-default-load-average nil)

;;;; Mixed-pitch-mode:
(add-hook 'text-mode-hook 'mixed-pitch-mode)
281
(setq mixed-pitch-variable-pitch-cursor 'box)
282
283
284
285
286
287
288
;;;; Toolbar and scrollbar
(tool-bar-mode -1) 			;turn off toolbar
(scroll-bar-mode -1)			;turn off scrollbar

;;; OUTLINE MODE
(add-hook 'emacs-lisp-mode-hook (lambda ()
			   (set (make-local-variable 'outline-regexp) ";;;[;]*")))
289

290
291
(add-hook 'Man-mode-hook (lambda ()
			   (set (make-local-variable 'outline-regexp) "[A-Z]\\|\\s-+[-+]")))
292

293
294
295
296
297
298
299
300
301
302
303
304
305
;;; DIRED:
;;;; Basics
;; -si for human readable size time-style for yyyy-mm-dd
(setq dired-listing-switches "-Al --si --time-style long-iso"
      delete-by-moving-to-trash t
      dired-recursive-copies (quote always) ; always means don’t ask
      dired-recursive-deletes (quote top)
      dired-dwim-target t 		; When 2 visible dired buffers, copy from one to the other
      dired-isearch-filenames 'dwim)

;; Do dired operations (copy, rename etc.) asynchroneously. With prefix arg disables async on the operation 
(autoload 'dired-async-mode "dired-async.el" nil t)
(dired-async-mode 1)
Victor A. Stoichiţă's avatar
Victor A. Stoichiţă committed
306

307
(define-key dired-mode-map "\C-cn" 'dired-narrow)
Victor A. Stoichiţă's avatar
Victor A. Stoichiţă committed
308

309
310
311
(add-hook 'dired-load-hook
	  (lambda ()
	    (load "dired-x")
312
313
314
315
316
317
	    (dired-hide-details-mode 1)   ;; Hide details by default. Unhide with "("
	    (setq dired-x-hands-off-my-keys nil)
	    ;; hide dotfiles
	    (dired-hide-dotfiles-mode)
	    (define-key dired-mode-map "." #'dired-hide-dotfiles-mode)
	    (toggle-truncate-lines t)))
318

319
;;;; Dired-jump
320
321
322
323
324
325
;; autoload dired-jump to work before a dired buffer is opened
;; In any file buffer, Alt+x dired-jump [Ctrl+x Ctrl+j] to jump to the directory of current buffer.
(autoload 'dired-jump "dired-x"
  "Jump to Dired buffer corresponding to current buffer." t)
(autoload 'dired-jump-other-window "dired-x"
  "Like \\[dired-jump] (dired-jump) but in other window." t)
326
327
(define-key global-map (kbd "C-x C-j") 'dired-jump)
(define-key global-map  (kbd "C-x C-S-j") 'dired-jump-other-window)
328

329
330
;;; IVY:
;;;; Basics
331
(ivy-mode)
332
333
(setq
 ivy-use-virtual-buffers t
334
335
336
337
338
 ivy-count-format "(%d/%d) "
 ivy-extra-directories '("./") ;; Don’t print /.. 
 counsel-find-file-ignore-regexp "\(?:\‘[#.]\)\|\(?:[#~]\’\)\|\’\."
 ivy-magic-slash-non-match-action 'ivy-magic-slash-non-match-create
 ivy-display-style 'fancy)
339

340

341
342
343
344
;;;; Ivy-based interface to standard commands
(global-set-key (kbd "C-s") 'swiper-isearch)
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
345
(global-set-key (kbd "C-x f") 'counsel-recentf)
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
(global-set-key (kbd "M-y") 'counsel-yank-pop)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
(global-set-key (kbd "<f1> l") 'counsel-find-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
(global-set-key (kbd "<f2> j") 'counsel-set-variable)
(global-set-key (kbd "C-M-ê") 'ivy-switch-buffer)
(global-set-key (kbd "C-c v") 'ivy-push-view)
(global-set-key (kbd "C-c V") 'ivy-pop-view)
;; Default binding S-SPC is taken by bépo
(define-key ivy-minibuffer-map (kbd "C- ") 'ivy-restrict-to-matches)

;;;; Ivy-based interface to shell and system tools
(global-set-key (kbd "C-c g") 'counsel-git)
(global-set-key (kbd "C-c j") 'counsel-git-grep)
Victor A. Stoichiţă's avatar
Victor A. Stoichiţă committed
362
(global-set-key (kbd "C-c y") 'counsel-git-log)
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
(global-set-key (kbd "C-c k") 'counsel-rg)
;; Interacts with mu
;; (global-set-key (kbd "C-c m") 'counsel-linux-app)
(global-set-key (kbd "C-c n") 'counsel-fzf)
(global-set-key (kbd "C-x l") 'counsel-locate)
(global-set-key (kbd "C-c J") 'counsel-file-jump)
(global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
(global-set-key (kbd "C-c w") 'counsel-wmctrl)

;;;; Ivy-resume and other commands
(global-set-key (kbd "C-c C-r") 'ivy-resume)
(global-set-key (kbd "C-c b") 'counsel-bookmark)
(global-set-key (kbd "C-c d") 'counsel-descbinds)
(global-set-key (kbd "C-c g") 'counsel-git)
(global-set-key (kbd "C-c o") 'counsel-outline)
(global-set-key (kbd "C-c t") 'counsel-load-theme)
(global-set-key (kbd "C-c F") 'counsel-org-file)

381
382
383
384
385
386
387
388
389
390
(defun vic-counsel-find-file-symlink (x)
  "Create symbolic link to file X."
  (counsel--find-file-1 "Link file to: "
                        ivy--directory
                        (lambda (new-name)
                          (make-symbolic-link x new-name 1))
                        'vic-counsel-find-file-symlink))

(ivy-add-actions 'counsel-find-file '(("L" vic-counsel-find-file-symlink "symlink file")))

391
392
393
394
395
396
397
398
;;;; Ivy-bibtex
(autoload 'ivy-bibtex "ivy-bibtex" "" t)
;; ivy-bibtex requires ivy's `ivy--regex-ignore-order` regex builder, which
;; ignores the order of regexp tokens when searching for matching candidates.
;; Add something like this to your init file:
(setq ivy-re-builders-alist
      '((ivy-bibtex . ivy--regex-ignore-order)
        (t . ivy--regex-plus)))
399

400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
;;; TRAMP
(require 'tramp)
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)
(setq tramp-default-method "ssh")		; good for root on localhost too

;;; PASSWORD STORE:
(require 'auth-source-pass)
(auth-source-pass-enable)

;;; ESHELL:
(require 'eshell-toggle)
(global-set-key (kbd "<f8>") 'eshell-toggle)

;;; PDF TOOLS:
;;;; Basics
(pdf-tools-install)
(setq-default pdf-view-display-size 'fit-page) ; open pdfs scaled to fit page
417
(setq pdf-misc-print-program "lpr")
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436

;;;; Functions to save to kill ring after annotating
(defun vic/pdf-annot-add-highlight-markup-annotation-and-kill ()
  "Highlight and copy region to `kill-ring'."
  (interactive)
  (pdf-annot-add-highlight-markup-annotation (pdf-view-active-region nil))
  (pdf-view-kill-ring-save))

(defun vic/pdf-annot-add-underline-markup-annotation-and-kill ()
  "Highlight and copy region to `kill-ring'."
  (interactive)
  (pdf-annot-add-underline-markup-annotation (pdf-view-active-region nil))
  (pdf-view-kill-ring-save))

(defun vic/pdf-annot-add-squiggly-markup-annotation-and-kill ()
  "Highlight and copy region to `kill-ring'."
  (interactive)
  (pdf-annot-add-squiggly-markup-annotation (pdf-view-active-region nil))
  (pdf-view-kill-ring-save))
Victor A. Stoichiţă's avatar
Victor A. Stoichiţă committed
437

438
439
440
441
442
443
444
445
(defun vic/pdf-annot-toggle-activate-created-annotations ()
  "Toggle automatic activation of new annotations"
  (interactive)
  (when (string= major-mode "pdf-view-mode")
    (if pdf-annot-activate-created-annotations
	(setq-local pdf-annot-activate-created-annotations nil)
      (setq-local pdf-annot-activate-created-annotations t))
    (message (format "Activate created annotations %s" pdf-annot-activate-created-annotations))))
446

447
448
449
450
451
452
453
454
;;;; Keybindings
(define-key pdf-view-mode-map (kbd "C-s") 'isearch-forward) ; use normal isearch
(define-key pdf-view-mode-map (kbd "\"") 'vic/pdf-annot-add-underline-markup-annotation-and-kill)
(define-key pdf-view-mode-map (kbd "«") 'vic/pdf-annot-add-highlight-markup-annotation-and-kill)
(define-key pdf-view-mode-map (kbd "»") 'vic/pdf-annot-add-squiggly-markup-annotation-and-kill)
(define-key pdf-view-mode-map (kbd "(") 'pdf-annot-add-text-annotation)
(define-key pdf-view-mode-map (kbd "(") 'pdf-annot-add-text-annotation)
(define-key pdf-view-mode-map (kbd "*") 'vic/pdf-annot-toggle-activate-created-annotations)
455

456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
;;; LILYPOND:
(autoload 'LilyPond-mode "lilypond-mode" "LilyPond Editing Mode" t)
(add-to-list 'auto-mode-alist '("\\.ly$" . LilyPond-mode))
(add-to-list 'auto-mode-alist '("\\.ily$" . LilyPond-mode))
(add-hook 'LilyPond-mode-hook (lambda () (turn-on-font-lock)))
(setq LilyPond-pdf-command "evince %f"
      LilyPond-midi-command "vlc %f"
      LilyPond-fancy-comments t) ;; Distinguish between %, %% and %%% comments

;;; ERC chat:
(add-hook 'erc-mode-hook (lambda ()
			  (add-to-list 'erc-modules 'notifications)
			  (setq erc-echo-notices-in-minibuffer-flag t
				erc-auto-query 'buffer)	;query buffers open automatically when someone sends a private message.
				erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT")))

;;; COMPANY MODE:
(add-hook 'prog-mode-hook 'company-mode)

;;; MAGIT:
(global-set-key (kbd "C-x g") 'magit-status)
477

478
479
480
;;; NXML:

;;;; Basics
481
(setq nxml-slash-auto-complete-flag t)
482

483
;;;; Fold/unfold (hideshow)
484
485
486
487
488
489
490
491
492
493
(require 'hideshow)
(add-to-list 'hs-special-modes-alist
             '(nxml-mode
               "<!--\\|<[^/>]*[^/]>"
               "-->\\|</[^/>]*[^/]>"
               "<!--"
               sgml-skip-tag-forward
               nil))

;; optional key bindings, easier than hs defaults
494
495
496
497
498
499
500
501
502
503
504
505
(add-hook 'nxml-mode-hook
	  (lambda()
	    (require 'hideshow)
	    (add-to-list 'hs-special-modes-alist
             '(nxml-mode
               "<!--\\|<[^/>]*[^/]>"
               "-->\\|</[^/>]*[^/]>"
               "<!--"
               sgml-skip-tag-forward
               nil))
	    (hs-minor-mode)
	    (define-key nxml-mode-map (kbd "C-c h") 'hs-toggle-hiding)))
506

507

508
;;; EWW:
509
(setq eww-search-prefix "https://duckduckgo.com/?q=")
Victor A. Stoichiţă's avatar
Victor A. Stoichiţă committed
510

511
512
513
514
515
516
517
;;; LATEX
 	
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)


518
;;; FINALLY
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
;;;; Load External configs
(add-to-list 'load-path (directory-file-name "~/.emacs.d/site-lisp"))
(cd (expand-file-name "~/.emacs.d"))
(load-file "orgmode_init.el")
(load-file "mu4e_init.el")
(load-file "bib_init.el")
(load-file (expand-file-name "python_init.el"))
(load-file (expand-file-name "web_init.el"))

;;;; Olivetti mode
;; Loaded here for maps in external configs
(define-key org-mode-map (kbd "C-x <f11>") 'olivetti-mode)
(define-key mu4e-view-mode-map (kbd "C-x <f11>") 'olivetti-mode)
(define-key mu4e-compose-mode-map (kbd "C-x <f11>") 'olivetti-mode)

534
(unless (server-running-p) (server-start))
535
(cd (expand-file-name "~"))
536

537
;; Local Variables:
538
;; eval: (outshine-mode)
539
;; End: