aboutsummaryrefslogtreecommitdiffstats
path: root/modules/init-editing-utils.el
blob: b789d2c5029c110da32458133e7a156e2ba1086b (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
;;; init-editing-utils.el --- .Emacs Configuration -*- lexical-binding: t -*-
;;; Commentary:
;;

;;; Code:

;;----------------------------------------------------------------------------
;; Remove whitespaces
;;----------------------------------------------------------------------------
;; Delete trailing whitespace before saving fil → all modes
;; (add-hook 'before-save-hook 'delete-trailing-whitespace)

;; Delete-trailing-whitespace-when-saving-except-certain-modes
(add-hook 'before-save-hook
          (lambda ()
            (unless (eq major-mode 'diff-mode)
              (delete-trailing-whitespace))))
;;----------------------------------------------------------------------------
;; Automatic pairs open symbols (, {, [...
;; Disable for default.
;; Uncomment the next 4 lines if you want to enable the pairs-mode
;;(when (fboundp 'electric-pair-mode)
;;  (electric-pair-mode))
;;(when (eval-when-compile (version< "24.4" emacs-version))
;;  (electric-indent-mode 1))

;; Active auto-revert-mode that automatically reloads modified files out of Emacs.
;; It is very useful to see logs (like auto-revert-tail-mode) among many other cases.
(global-auto-revert-mode)
(setq global-auto-revert-non-file-buffers t
      auto-revert-verbose nil)

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

;;----------------------------------------------------------------------------
;; More useful things - only one line
;;----------------------------------------------------------------------------
(set-default 'truncate-lines t)
(setq show-trailing-whitespace nil)

;;----------------------------------------------------------------------------
;; Some basic preferences
;;----------------------------------------------------------------------------
(setq-default
 indent-tabs-mode nil)

;;----------------------------------------------------------------------------
;; Undo-tree
;;----------------------------------------------------------------------------
(use-package undo-tree
  :diminish undo-tree-mode
  :config
  (progn
    (global-undo-tree-mode)
    (setq undo-tree-visualizer-timestamps nil)
    (setq undo-tree-visualizer-diff nil)))

;;----------------------------------------------------------------------------
(load-file "~/.emacs.d/modules/lib/myemacs.el")

(provide 'init-editing-utils)

;; Local Variables:
;; byte-compile-warnings: (not free-vars)
;; End:
;;; init-editing-utils.el ends here