-
Notifications
You must be signed in to change notification settings - Fork 29
/
standalone.el
63 lines (51 loc) · 1.99 KB
/
standalone.el
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
;; This is to support loading from a non-standard .emacs.d
;; via emacs -q --load "/path/to/standalone.el"
;; see https://emacs.stackexchange.com/a/4258/22184
(setq user-init-file (or load-file-name (buffer-file-name)))
(setq user-emacs-directory (file-name-directory user-init-file))
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(require 'package)
(add-to-list 'package-archives '("tromey" . "http://tromey.com/elpa/"))
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
(setq package-user-dir (expand-file-name "elpa/" user-emacs-directory))
(package-initialize)
;; Work around an Emacs v26 bug.
;; https://www.reddit.com/r/emacs/comments/cdei4p/failed_to_download_gnu_archive_bad_request/
(when (version< emacs-version "27")
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))
;; Install use-package that we require for managing all other dependencies
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
;; I find these light-weight and helpful
(use-package which-key
:ensure
:init
(which-key-mode))
(use-package selectrum
:ensure
:init
(selectrum-mode)
:custom
(completion-styles '(flex substring partial-completion)))
;; Some common sense settings
(load-theme 'leuven t)
(fset 'yes-or-no-p 'y-or-n-p)
(recentf-mode 1)
(setq recentf-max-saved-items 100
inhibit-startup-message t
ring-bell-function 'ignore)
(tool-bar-mode 0)
(menu-bar-mode 0)
(when (fboundp 'scroll-bar-mode)
(scroll-bar-mode 0))
(cond
((member "Monaco" (font-family-list))
(set-face-attribute 'default nil :font "Monaco-12"))
((member "Inconsolata" (font-family-list))
(set-face-attribute 'default nil :font "Inconsolata-12"))
((member "Consolas" (font-family-list))
(set-face-attribute 'default nil :font "Consolas-11"))
((member "DejaVu Sans Mono" (font-family-list))
(set-face-attribute 'default nil :font "DejaVu Sans Mono-10")))
(load-file (expand-file-name "init.el" user-emacs-directory))