summaryrefslogtreecommitdiff
path: root/emacs/inits/01-basic.el
blob: f1511a342bc0a9835ee3c13122865432792d5147 (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
;; Time-stamp: <2023-08-07 09h15 CEST (anker)>

;; -----------------------------------------------------------------------------
;; 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/")

(use-package circadian
  :ensure t
  :config
  (setq calendar-latitude 52.34
        calendar-longitude 4.87
        circadian-themes '(("07:30" . acme)
                           ("15:00" . modus-operandi)
                           (:sunset . nord)))
  (circadian-setup))

;; (defun my-disable-bold-fonts ()
;;   (interactive)
;;   (mapc
;;    (lambda (face)
;;      (set-face-attribute face nil :weight 'normal))
;;    (face-list)))

;; (my-disable-bold-fonts)

(when 't
  (setq my-font "PxPlus IBM VGA 9x16-24")
  (setq my-font "Sudo-22")
  (setq my-font "Commit Mono-23")
  (set-face-attribute 'fixed-pitch-serif nil :font my-font)
  (set-face-attribute 'fixed-pitch nil :font my-font)
  (set-face-attribute 'default nil :font my-font)
  (set-face-attribute 'font-lock-comment-face nil :font my-font  :slant 'italic)
  ;; (set-face-attribute 'region nil :background "orange")
  (set-face-attribute 'variable-pitch nil :font my-font)
  )


(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 "~/")))