blob: d9183a1897eb5bbec71b5a92c6164e77936d7fcc (
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
|
;;; Dotfiles --- Jakub Dlugosz emacs config
;;; Commentary:
;;; Code:
;; Minimize garbage collection during startup
(setq gc-cons-threshold most-positive-fixnum)
;; Lower threshold back to 8 MiB (default is 800kB)
(add-hook 'emacs-startup-hook
(lambda ()
(setq gc-cons-threshold (expt 2 23))))
(defvar jd/manifest-list
nil
"List that contain Emacs packages for GNU/Guix." )
(defvar jd/exwm-p
(or (not (null (getenv "JD_EXWM")))
(and (seq-contains command-line-args "exwm" #'string-match)
t))
"Is non-nil when Emacs is run as a window manager.")
(defvar jd/guix-p
(and (eq system-type 'gnu/linux)
(file-exists-p "/etc/os-release")
(with-temp-buffer
(insert-file-contents "/etc/os-release")
(search-forward "ID=guix" nil t))
t)
"Is non-nil when Emacs packages are installed by GNU/Guix package manager.")
(defun jd/add-package-to-manifest (guix-package-name)
"Add GUIX-PACKAGE-NAME to jd/manifest-list."
(unless (member guix-package-name jd/manifest-list)
(setq jd/manifest-list
(cons guix-package-name jd/manifest-list))))
(add-to-list 'load-path (concat user-emacs-directory "/jd"))
(defun jd/display-startup-time ()
(message "Emacs loaded in %s with %d garbage collections."
(format "%.2f seconds"
(float-time
(time-subtract after-init-time before-init-time)))
gcs-done))
(defun jd-emacs/startup ()
"This procedure will run after Emacs startup."
(electric-pair-mode 1)
(global-company-mode 1)
(jd/display-startup-time))
(add-hook 'emacs-startup-hook #'jd-emacs/startup)
(setq user-full-name "Jakub Dlugosz"
user-mail-address "jdlugosz963@gmail.com")
(setq backup-directory-alist '(("." . "~/.cache/emacs/backup"))
backup-by-copying t
version-control t
delete-old-versions t
kept-new-versions 20
kept-old-versions 5
custom-file (concat user-emacs-directory
"custom.el"))
;; (setq user-emacs-directory "~/.cache/emacs")
(require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
("org" . "https://orgmode.org/elpa/")
("gnu-devel" . "https://elpa.gnu.org/devel/")
("elpa" . "https://elpa.gnu.org/packages/")))
(package-initialize)
(unless package-archive-contents
(package-refresh-contents))
(jd/add-package-to-manifest "emacs-use-package")
(unless jd/guix-p
(unless (package-installed-p 'use-package)
(package-install 'use-package)))
(require 'use-package)
(setq use-package-always-ensure (not jd/guix-p))
(defmacro use-package! (package-name
guix-package-name
&rest body)
(declare (indent defun))
`(progn
,(when guix-package-name
`(jd/add-package-to-manifest ,guix-package-name))
(use-package ,package-name ,@body)))
(defun jd/manifest-generate-to-file (file-name)
"Generate GNU/Guix Emacs manifest to output file provided in: FILE-NAME."
(interactive
(list (read-from-minibuffer "Output file: " )))
(with-temp-file file-name
(insert
(with-temp-buffer
(insert (format ";; This file is auto-generated by Emacs function: jd/manifest-generate-to-file\n%s"
`(specifications->manifest
'(,@(mapcar #'(lambda (guix-package-name)
(concat "\""
guix-package-name
"\"\n"))
jd/manifest-list)))))
(pp-buffer)
(buffer-string)))))
(jd/add-package-to-manifest "emacs")
(jd/add-package-to-manifest "emacs-guix")
(require 'jd-keys)
(require 'jd-ui)
(require 'jd-org)
(require 'jd-dev)
(require 'jd-apps)
(require 'jd-custom)
(require 'jd-mu4e)
(require 'jd-misc)
(require 'jd-sway)
(when jd/exwm-p
(require 'jd-exwm))
;; (setq gc-cons-threshold (* 2 1000 1000))
;;; init.el ends here
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'set-goal-column 'disabled nil)
|