summary refs log tree commit diff
path: root/emacs/custom/my-settings.el
blob: 04d0182874132849d7ccd0124e6bd68d5298c392 (plain) (blame)
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
;;; my-settings.el --- Sets a number of defaults
;;; Commentary:

;;; Code:
(require 'use-package)

(defvar my/custom-settings (expand-file-name "var/emacs-custom.el" user-emacs-directory)
  "Path to Emacs custom variables.")

;; set utf-8 as the default encoding
(prefer-coding-system 'utf-8-unix)
(setq locale-coding-system 'utf-8)
(set-language-environment 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)

;; alias yes-or-no to y-or-n
(fset 'yes-or-no-p 'y-or-n-p)

(setq auto-save-default nil)                     ;; don't auto save files
(setq auto-save-list-file-prefix nil)            ;; no backups
(setq create-lockfiles nil)                      ;; don't use a lock file
(setq custom-file my/custom-settings)            ;; where to save custom settings
(setq make-backup-files nil)                     ;; really no backups
(setq minibuffer-message-timeout 0.5)            ;; How long to display an echo-area message
(setq next-screen-context-lines 5)               ;; scroll 5 lines at a time
(setq require-final-newline t)                   ;; ensure newline exists at the end of the file
(setq ring-bell-function 'ignore)                ;; really no bell
(setq tab-always-indent 'complete)               ;; when using TAB, always indent
(setq visible-bell nil)                          ;; no bell
(setq column-number-mode t)                      ;; show column number in the mode line
(setq-default indent-tabs-mode nil)              ;; turn off tab indentation
(setq-default cursor-type 'box)                  ;; cursor is a horizontal bar
(setq-default delete-by-moving-to-trash t)       ;; delete files by moving them to the trash
(setq initial-scratch-message "")                ;; empty scratch buffer
(setq garbage-collection-messages t)             ;; log when the gc kicks in

(custom-set-variables
 '(use-file-dialog nil)
 '(use-dialog-box nil)
 '(inhibit-startup-screen t)
 '(inhibit-startup-message t)
 '(inhibit-startup-echo-area-message t))

(setq user-full-name "Franck Cuny"
      user-mail-address "franck@fcuny.net"
      add-log-mailing-address "franck@fcuny.net")

(setq savehist-file (expand-file-name "var/history" user-emacs-directory))
(setq url-history-file (expand-file-name "var/url-history" user-emacs-directory))
(setq bookmark-file (expand-file-name "var/bookmarks" user-emacs-directory))
(setq url-cookie-file (expand-file-name "var/cookies" user-emacs-directory))

;; delete buffers that have not been displayed in the last 3 days
(use-package midnight
  :config
  (midnight-mode t))

(unless (and (fboundp 'server-running-p)
             (server-running-p))
  (server-start))

(use-package savehist
  :init
  (savehist-mode))

(use-package exec-path-from-shell
  :ensure t
  :if (memq window-system '(mac ns))
  :hook (emacs-startup . (lambda ()
                           (setq exec-path-from-shell-arguments '("-l")) ; removed the -i for faster startup
                           (exec-path-from-shell-initialize))))

(provide 'my-settings)
;;; my-settings.el ends here