summaryrefslogtreecommitdiff
path: root/emacs/inits/01-basic.el
blob: fab972485536fae3aaa8e8b37a04bef26380b6cc (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
;; Time-stamp: <2022-05-04 21h32 CDT (hobbies)>

;; -----------------------------------------------------------------------------
;; Interface

(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
(fset 'yes-or-no-p 'y-or-n-p)

(setq select-enable-clipboard t
      select-enable-primary t
      save-interprogram-paste-before-kill t
      require-final-newline t
      visible-bell nil)

(setq echo-keystrokes 0.1
      confirm-kill-emacs 'y-or-n-p
      disabled-command-function nil
      ring-bell-function 'ignore)

(size-indication-mode t)

(defun enlarge-to-fill ()
  "Stretch the buffer to accomodate `fill-column` many columns."
  (interactive)
  (let ((ww (window-width)))
    (when (< ww (+ 1 fill-column))
      (enlarge-window-horizontally (- (+ 1 fill-column) ww)))))

(global-set-key (kbd "C-c 3") (lambda ()
				(interactive)
				(split-window-horizontally)
				(enlarge-to-fill)))

(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")

(when (eq 'x (window-system))
  (load-theme 'acme t)
  (set-face-attribute 'font-lock-comment-face nil :slant 'italic)
  ;; (set-face-attribute 'region nil :background "orange")
  (set-face-attribute 'default nil :font "Hermit-14")
  (set-face-attribute 'variable-pitch nil :font "Frank Ruehl CLM-18"))


(setq-default line-spacing nil)

(blink-cursor-mode 0)
(setq cursor-type 'box)
;; (set-cursor-color "orange")

(set-fringe-style 0)
;; (set-fringe-mode 128)

;; -----------------------------------------------------------------------------
;; Backups

(setq backup-by-copying t
      backup-directory-alist '(("." . "/home/user/store/backups/"))
      delete-old-versions t
      kept-new-versions 6
      kept-old-versions 2
      version-control t)

(setq create-lockfiles nil)

;; -----------------------------------------------------------------------------
;; Defaults

(setq fill-column 80)

(setq standard-indent 4)
(setq-default tab-width 4
              indent-tabs-mode nil)
(add-hook 'before-save-hook #'whitespace-cleanup)

(show-paren-mode t)

(setq-default truncate-lines t
           	  truncate-partial-width-windows nil)
(setq scroll-step 1
      scroll-margin 5)

(setq next-line-add-newlines nil)

(setq enable-dir-local-variables nil)

(setq shell-file-name "bash")

;; -----------------------------------------------------------------------------
;; Basic packages

(use-package recentf
  :demand t
  :config
  (setq recentf-max-saved-items 42)
  (recentf-mode))

(use-package uniquify
  :config
  (setq uniquify-buffer-name-style 'forward))

(use-package tramp
  :config
  (setq tramp-use-ssh-controlmaster-options nil))

(require 'saveplace)
(save-place-mode)

;; -----------------------------------------------------------------------------
;; Scratch buffer

(defun immortal-scratch ()
  (if (eq (current-buffer) (get-buffer "*scratch*"))
      (progn (bury-buffer) nil) t))

(add-hook 'kill-buffer-query-functions 'immortal-scratch)

;; I couldn't understand the config options, so this is the next best thing
(defun display-startup-echo-area-message () nil)

(setq initial-scratch-message nil
      initial-buffer-choice t)

(add-hook 'after-init-hook
	  (lambda ()
	    (setq default-directory "~/")))