emacs/emacs.md

133 lines
3.8 KiB
Markdown
Raw Permalink Normal View History

2022-04-22 04:25:29 +00:00
git clone https://github.com/plexus/chemacs2.git ~/.emacs.d (%appdata% on windows)
M-x describe-variable RET user-init-file RET
uncomment the package init line in the appropriate init file(s)
cat > ~/.emacs-profiles.el <<EOF
(("default" . ((user-emacs-directory . "~/.emacs.d.profiles/code")))
("code" . ((user-emacs-directory . "~/.emacs.d.profiles/code")))
("org" . ((user-emacs-directory . "~/.emacs.d.profiles/org")))
("beancount" . ((user-emacs-directory . "~/.emacs.d.profiles/accounting")))
("ledger" . ((user-emacs-directory . "~/.emacs.d.profiles/accounting")))
("accounting" . ((user-emacs-directory . "~/.emacs.d.profiles/accounting")))
)
EOF
; emacs --with-profile my-profile
; emacs --with-profile '((user-emacs-directory . "/path/to/config"))'
; add option to shortcut to runemacs.exe if needed
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cat > ~/.emacs.d.profiles/[profile]/init.el<<EOF
;; -*- lexical-binding: t; -*-
;; TURN ON IN INIT FILE!!!!!
;; Make gc pauses faster by decreasing the threshold.
(setq gc-cons-threshold (* 2 1000 1000))
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(require 'use-package)
EOF
cd [profile_path]
git clone https://github.com/beancount/beancount-mode.git
2022-04-22 21:03:15 +00:00
cd [profile_path]
git clone https://github.com/mnewt/dired-rainbow-listing
2022-04-25 19:23:09 +00:00
install hunspell + dictionaries choco install hunspell.portable / https://github.com/wooorm/dictionaries
2022-04-22 04:25:29 +00:00
open scratch buffer. paste below into it as the contents then do `M-x ev-b RET`
``` elisp
; if get failures on pkg command, run contents of init.el from above first
; code
(defvar packages-code '(markdown-mode
rainbow-mode
rainbow-delimiters
lua-mode
dockerfile-mode
yaml-mode
go-mode
rust-mode
powershell
python-mode
json-mode)
"Code packages")
; accounting
(defvar packages-accounting '(
ledger-mode)
"Accounting packages")
(defvar packages-default '(
modus-themes
all-the-icons
2022-04-22 04:25:29 +00:00
persp-mode
diminish
2022-04-23 21:36:44 +00:00
dash
transpose-frame
2022-04-25 19:23:09 +00:00
helm
2022-04-25 19:54:47 +00:00
helm-ls-git
helm-org
2022-04-25 20:20:00 +00:00
projectile
helm-projectile
persp-mode-projectile-bridge
doom-modeline
s
2022-04-23 21:36:44 +00:00
f
oragami
2022-04-22 04:25:29 +00:00
ido-completing-read+
2022-04-23 21:36:44 +00:00
dired-single
all-the-icons-dired
dired-rainbow
2022-04-22 04:25:29 +00:00
helpful)
"Default packages")
(defun kmn-packages-installed-p ()
(cl-loop for p in packages-default
when (not (package-installed-p p)) do (cl-return nil)
finally (cl-return t)))
(unless (kmn-packages-installed-p)
;; check for new packages (package versions)
(message "%s" "Emacs is now refreshing its package database...")
(package-refresh-contents)
(message "%s" " done.")
;; install the missing packages
(dolist (p packages-default)
(when (not (package-installed-p p))
(package-install p))))
```
speed up runtime by compiling all packages
```
(require 'dash)
(require 'f)
(defun was-compiled-p (path)
"Does the directory at PATH contain any .elc files?"
(--any-p (f-ext? it "elc") (f-files path)))
(defun ensure-packages-compiled ()
"If any packages installed with package.el aren't compiled yet, compile them."
(--each (f-directories package-user-dir)
(unless (was-compiled-p it)
(byte-recompile-directory it 0))))
(ensure-packages-compiled)
```