Archived
1
0
Fork 0
This repository has been archived on 2024-10-19. You can view files and clone it, but cannot push or open issues or pull requests.
emacs/emacs.md
2022-04-23 17:36:44 -04:00

123 lines
3.6 KiB
Markdown

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
cd [profile_path]
git clone https://github.com/mnewt/dired-rainbow-listing
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
persp-mode
diminish
dash
transpose-frame
s
f
oragami
ido-completing-read+
dired-single
all-the-icons-dired
dired-rainbow
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)
```