This is not a true literate configuration. Packages that demand complex configuration are configured in separate files. I am rewriting this configuration for a better understanding of my previous work and organizing it in a more sensible way.
- Dependencies for other packages
- Appearances
- A bunch of useful features
- Customizing Emacs
- Pretty hydras
- Terminal and shells
- Dired
- File operations
- Full-text search (and replace)
- Buffer management
- Git
- Project management
- Experimenting with remote APIs
- Web browser integration
- Templates
- Frequent counsel commands
- Avy
- Source code navigation
- Outline editing
- Referencing and reading
- General tools for editing source code
- Editing specific types of formats
- Miscellaneous commands
- Window management
- Visual cues and extra information display
- Startup buffer
- Auto saving
- org-web-tools and clipurl
- Highlighting part(s) of source code and focusing
- Development workflow
- Scratch buffers
- Debugging Emacs
- External tools
- Optimization
- Writing
- Programming languages
- DSLs
- Org mode
- EXWM
- Meta
(autoload 'setq-mode-local "mode-local")
Quite a few packages depend on dash.el
and/or dash-functional.el
, so they should be loaded in the very beginning of package declarations.
(use-package dash)
(use-package dash-functional)
(use-package f)
(akirak/require 'setup-ivy t)
(akirak/require 'setup-helm t)
(akirak/require 'setup-posframe)
(akirak/require 'setup-hydra)
(defconst akirak/major-mode-hydra-key "M-SPC")
(use-package ov
:straight (ov :host github :repo "ShingoFukuyama/ov.el"))
(use-package ts
:straight (ts :host github :repo "alphapapa/ts.el"))
(use-package org-ql
:custom
(org-ql-views nil))
(use-package all-the-icons
;; I prefer install fonts using Nix
;; :preface
;; (defconst akirak/all-the-icons-status-file
;; (no-littering-expand-var-file-name "all-the-icons"))
;; (defvar akirak/all-the-icons-fonts-installed
;; (file-exists-p akirak/all-the-icons-status-file))
;; :config
;; (defun akirak/all-the-icons-install-fonts-if-missing ()
;; (unless akirak/all-the-icons-fonts-installed
;; (all-the-icons-install-fonts t)))
;; (defun akirak/all-the-icons-mark-as-fonts-installed ()
;; (with-temp-buffer
;; (write-file akirak/all-the-icons-status-file))
;; (setq akirak/all-the-icons-fonts-installed t))
;; (advice-add #'all-the-icons-install-fonts
;; :after #'akirak/all-the-icons-mark-as-fonts-installed)
;; (when (and (window-system)
;; (not akirak/all-the-icons-fonts-installed))
;; (all-the-icons-install-fonts))
:general
("C-x 8 i" #'all-the-icons-ivy))
emacsql-sqlite
depends on a pre-built binary executable. This is built and installed by Nix package manager.
(use-package emacsql-sqlite
:straight (emacsql-sqlite :type built-in)
:if (akirak/library-exists-p "emacsql-sqlite"))
(use-package memoize)
(defun akirak/locate-xdg-desktop-file (desktop)
(-some (lambda (root)
(when (file-directory-p root)
(car (directory-files-recursively root
(concat "^" (regexp-quote desktop) "$")
t))))
counsel-linux-apps-directories))
(defun akirak/get-xdg-desktop-window-class (desktop-file)
(with-temp-buffer
(insert-file-contents desktop-file)
(goto-char (point-min))
(when (re-search-forward (rx bol "StartupWmClass=") nil t)
(buffer-substring-no-properties (point) (line-end-position)))))
language-detection is used by eww.
(akirak/require 'setup-language-detection)
(use-package elexandria
:straight (:host github :repo "alphapapa/elexandria"))
- You can set the default theme using the customization interface.
- You can override the default theme at startup with
--theme
command line option, e.g.emacs --theme poet
.
(defcustom akirak/default-theme-module 'setup-dracula-theme
"Symbol of a module to load the default theme."
:type '(choice (const :tag "Dracula (dark bg)" setup-dracula-theme)
(const :tag "Poet (light bg, especially nice for Org mode)" setup-poet-theme)
(const :tag "Kaolin Light (light bg)" setup-kaolin-light-theme)
(const :tag "Doom Solarized Light" setup-doom-solarized-light-theme)
(const :tag "McCarthy (light bg)" setup-mccarthy-theme))
:group 'akirak)
(defun akirak/set-theme-from-command-line (_arg)
(if-let ((theme-name (pop command-line-args-left)))
(or (akirak/require (intern (concat "setup-" theme-name "-theme")))
(progn
(message "%s failed to load. Fallback to the default theme.")
(akirak/require akirak/default-theme-module)))
(error "--theme must be followed by a theme name")))
(add-to-list 'command-switch-alist
'("--theme" . akirak/set-theme-from-command-line))
;; If the option is not given, load the default theme.
(unless (member "--theme" (cdr command-line-args))
(akirak/require akirak/default-theme-module))
Due to consistency with other applications on computer, my eyes tend to stay in the upper area of a window. I prefer relying on the header line extensively rather than the modeline.
(akirak/require 'setup-header-line t)
; Hide the mode line and use the header line
(akirak/require 'setup-feebleline t) ; Display extra information in the echo area
;; (akirak/require 'setup-centaur-tabs)
This modules configures extra face attributes for typography. This feature is enabled if and only if a window system is available.
(cond
((window-system)
(akirak/require 'setup-typeface2))
((daemonp)
(defun akirak/init-typeface ()
(let ((frame (make-frame `((window-system . ,(cl-case system-type
(darwin 'ns)
(windows-nt 'w32)
(t 'x)))
(visibility . nil)))))
(unwind-protect
(progn
(defun akirak/ad-around-font-family-list (orig &optional _frame)
(funcall orig frame))
(advice-add 'font-family-list :around #'akirak/ad-around-font-family-list)
(akirak/require 'setup-typeface2)
(advice-remove 'font-family-list #'akirak/ad-around-font-family-list))
(delete-frame frame))))
(add-hook 'after-init-hook #'akirak/init-typeface)))
If your operating system supports Docker, you can use fonts-container to install fonts used in the module.
(use-package page-break-lines
:hook ((doc-mode
compilation-mode
outline-mode
prog-mode
haskell-mode
help-mode
magit-mode) . page-break-lines-mode))
(akirak/require 'setup-terminal-colors)
(use-package rainbow-mode
;; :diminish 'rainbow-mode
:commands (rainbow-mode)
:hook
(prog-mode . (lambda () (rainbow-mode 1))))
(use-package fontify-face
:hook
(emacs-lisp . (lambda () (fontify-face-mode 1))))
(akirak/require 'setup-perfect-margin)
I’m not using olivetti-mode
(use-package olivetti
:disabled t
:commands (turn-on-olivetti-mode)
:custom (olivetti-body-width 92))
;; desktop needs to be configured in prior to other convenience packages
(akirak/require 'setup-desktop)
(akirak/require 'setup-meta)
(akirak/require 'setup-misc)
(akirak/require 'setup-custom)
;; C-c h
(akirak/bind-user "h" #'akirak/minor-mode-hydra/body)
(general-def [remap text-scale-adjust] 'akirak/appearance-hydra/body)
(akirak/bind-user "k" #'akirak/window-layout-hydra/body)
(pretty-hydra-define akirak/minor-mode-hydra
(:title "Minor modes"
:foreign-keys nil
:quit-key "q")
("Focus"
(("v" view-mode :toggle t))
"Info/check/linting"
(("ed" eldoc-mode :toggle t)
("fc" flycheck-mode :toggle t)
("fv" flycheck-verify-setup)
("fs" flyspell-mode :toggle t)
("fp" flyspell-prog-mode :toggle t)
("ld" lsp-ui-doc-mode :toggle t)
("lp" lsp-ui-peek-mode :toggle t)
("ls" lsp-ui-sideline-mode :toggle t))
"Edit/assistance"
(("s" smartparens-mode :toggle t)
("S" smartparens-strict-mode :toggle t)
("y" lispy-mode :toggle t)
("el" electric-layout-mode :toggle t)
("ei" electric-indent-local-mode :toggle t)
("eq" electric-quote-local-mode :toggle t)
("ea" aggressive-indent-mode :toggle t)
("o" origami-mode :toggle t)
("W" whitespace-cleanup-mode))
"Visual"
(("w" whitespace-mode :toggle t)
("r" rainbow-delimiters-mode :toggle t)
("p" page-break-lines-mode :toggle t)
("n" line-number-mode :toggle t)
("hi" highlight-indent-guides-mode :toggle t)
("hc" fci-mode :toggle t))
"LSP"
(("lh" lsp-describe-session)
("lR" lsp-restart-workspace)
("lS" lsp-shutdown-workspace))))
(pretty-hydra-define akirak/appearance-hydra
(:title (format "Font height: %d" akirak/font-height)
:quit-key "q")
("Default font height"
(("=" akirak/font-height-increase "increase")
("-" akirak/font-height-decrease "decrease")
("s" akirak/set-font-height "set temporarily")
("C-s" (customize-save-variable 'akirak/font-height akirak/font-height)
"save"))
"Buffer font height"
(("+" text-scale-increase "increase")
("_" text-scale-decrease "decrease")
("!" text-scale-set "default"))
;; TODO: Add commands to change the theme and font families
;; "Faces"
;; (("t" akirak/load-theme-package "Change theme")
;; ("f" akirak/configure-font-families "Font families"))
"Inspect"
(("c" describe-char))))
(pretty-hydra-define akirak/window-layout-hydra
(:title (format "Layout\n Window size %sx%s"
(window-width)
(window-height))
:quit-key "q")
("Window size"
(("w" enlarge-window-horizontally "width+")
("W" shrink-window-horizontally "width-")
("h" enlarge-window "height+")
("H" shrink-window "height-")
("ah" (set-window-text-height (selected-window) current-prefix-arg) "abs h"))
"Layout"
(("b" balance-windows "Balance frm")
("B" (balance-windows (selected-window)) "Balance win")
("s" split-window-below "Split below")
("v" split-window-right "Split right")
("d" delete-window "Delete win"))
"Switch win/buf"
(("j" other-window "Next win")
("k" (other-window -1) "Prev win")
("l" counsel-ibuffer "Switch buf"))
"Extra windows"
(("tt" treemacs)
("te" akirak/toggle-flycheck-error-list "flycheck")
("ti" imenu-list-smart-toggle "imenu")
("tb" ibuffer-sidebar "buffers"))
"Views"
(("pv" ivy-pop-view "pop")
("pV" ivy-push-view "push")
("ps" ivy-switch-view "switch"))))
(defun akirak/toggle-flycheck-error-list ()
(interactive)
(if-let ((window (get-buffer-window "*Flycheck errors*")))
(quit-window nil window)
(flycheck-list-errors)))
I will use vterm.
(akirak/require 'setup-vterm)
To open a terminal, use vterm-toggle
. vterm-toggle-cd
command supports tramp.
(akirak/bind-user "t" #'akirak/vterm-toggle-cd)
(general-def "C-x C-j" #'dired-jump)
(akirak/require 'setup-files)
(akirak/bind-search
"M-f" #'org-recoll-search)
(akirak/require 'setup-recoll)
;; buffer management
(general-def
"<f5>" 'revert-buffer
"C-x k" #'kill-this-buffer
"C-x C-b" #'ibuffer)
(use-package git-modes)
(use-package git-attr-linguist
:straight git-attr
:commands (git-attr-linguist)
:hook (find-file . git-attr-linguist))
(use-package magit-todos
:after magit
:config
(unless (akirak/windows-subsystem-for-linux-p)
(magit-todos-mode 1))
:custom
(magit-todos-depth 0)
(magit-todos-exclude-globs '("**/*.map")))
Create a prefix key for browse-at-remote
-variant commands:
(general-create-definer akirak/bind-browse-at-remote :prefix "C-x w"
:wk "browse-at-remote")
Use forge
for working with GitHub and GitLab repositories:
(akirak/require 'setup-github)
To create/fork a repository on GitHub, use hub
CLI.
github-review.el
looks useful for reviewing pull requests on GitHub, but I seldom receive pull requests, so I have never used it.
browse-at-remote
is another package that lets you browse a corresponding web page of the file.
(use-package browse-at-remote
:commands (browse-at-remote))
(akirak/bind-browse-at-remote
"l" #'browse-at-remote
"k" #'browse-at-remote-kill)
Differences between browse-at-remote
and equivalent commands from forge
package:
browse-at-remote
providesbrowse-at-remote-kill
command.browse-at-remote
opens a link with a line number.
akirak/git-clone function lets you clone a Git repository to a designated location from a Git repository, a GitHub repository page, or a path on GitHub (account/name
). It is integrated with ivy-clipurl, so you can clone a Git repository from its web page URL in the clipboard.
(akirak/require 'setup-vc-msg)
(akirak/bind-user "v" #'vc-msg-show)
magit-list-repositories
is a convenient command which lets you browse your repositories on the file system.
To use it, you first have to customize magit-repository-directories
.
(use-package editorconfig
:config
(editorconfig-mode 1))
(akirak/require 'setup-direnv)
(akirak/require 'setup-verb)
(akirak/require 'setup-browse-url)
(use-package atomic-chrome
:disabled t
:init
(atomic-chrome-start-server))
Emacs also provides eww:
(akirak/require 'setup-eww)
(akirak/require 'setup-expansion)
(akirak/require 'setup-autoinsert)
(general-def
"C-x /" #'counsel-rg
"C-x F" #'counsel-recentf
"C-x L" #'counsel-locate)
(akirak/require 'setup-avy)
link-hint
is not part of avy
package, but it is covenient for following a link:
(akirak/bind-jump "f" 'akirak/link-hint-open-link)
(use-package dumb-jump
;; Don't enable dumb-jump-mode. Bind only necessary commands.
:custom
(dumb-jump-selector 'ivy))
(akirak/bind-jump
". " #'dumb-jump-go
"," #'dumb-jump-back)
(akirak/bind-search "i" 'counsel-imenu)
(akirak/bind-search :package 'org :keymaps 'org-mode-map
"u"
(defun akirak/helm-org-ancestors ()
(interactive)
(unless (derived-mode-p 'org-mode)
(user-error "Not in org-mode"))
(let (result
preselect)
(save-excursion
(org-back-to-heading)
(cl-flet
((add-candidate
()
(let ((start (point-at-bol))
(end (point-at-eol)))
(font-lock-ensure start end)
(let ((cand (buffer-substring start end)))
(push (cons cand (point-marker))
result)
;; Pre-select the first candidate, i.e. the current heading.
(unless preselect
(setq preselect cand))))))
(add-candidate)
(while (> (org-outline-level) 1)
(org-up-heading-all 1)
(add-candidate))))
(helm :sources (helm-build-sync-source "Ancestor headings"
:candidates result
:action 'helm-org-headings-actions)
:keymaps 'helm-org-headings-map
:preselect preselect)))
;; Simply browse headings in the buffer.
"i" #'helm-org-in-buffer-headings)
(akirak/bind-search :package 'restclient-helm :keymaps 'restclient-mode-map
"i" #'helm-restclient)
imenu-list
is a useful package which displays an overview of the current buffer.
I’ve added it to akirak/window-layout-hydra
.
(akirak/require 'setup-imenu-list)
(akirak/bind-search "o" 'counsel-outline)
(akirak/bind-search :package 'org :keymaps 'org-mode-map
"o" #'helm-org-ql)
(general-def :keymaps 'outline-minor-mode-map :package 'outshine
"M-RET" 'outshine-insert-heading)
(general-unbind :keymaps 'lispy-mode-map :package 'lispy "M-RET")
(akirak/require 'setup-origami)
(akirak/require 'setup-referencing)
Use pdf-tools
.
pdf-tools
is installed using Nix.
(akirak/require 'setup-epub)
Read pocket-reader
to read web pages on Emacs.
(akirak/require 'setup-pocket)
You can use org-noter to annotate PDF documents as well as other formats supported by doc-view.
I will bind A
to org-noter
both in pdf-tools
and doc-view
:
(general-def :keymaps 'doc-view-mode-map :package 'doc-view
"A" #'org-noter)
(general-def :keymaps 'pdf-view-mode-map :package 'pdf-view
"A" #'org-noter)
(akirak/require 'setup-edit)
(akirak/require 'setup-expand-region)
(akirak/require 'setup-reformatter)
I prefer swiper=
and counsel-rg
.
I added additional keybindings to the keymaps of those commands, so I can now dispatch an occur/noccur session from those commands.
(akirak/require 'setup-occur)
Another useful command is projectile-replace
(and its regexp variant projectile-replace-regexp
).
Resources:
- with-emacs · Using Occur for Search and Replace across Files
- with-emacs · Search and Replacement Techniques
(use-package comment-dwim-2
:general
("M-;" 'comment-dwim-2))
(use-package fix-word
:commands (fix-word-upcase fix-word-downcase fix-word-capitalize)
:hook
(prog-mode . (lambda () (setq fix-word-thing 'symbol)))
:general
([remap upcase-word] 'fix-word-upcase
[remap downcase-word] 'fix-word-downcase
[remap capitalize-word] 'fix-word-capitalize))
(akirak/require 'setup-string-inflection)
Use hl-todo by tarsius
(use-package hl-todo
:config
(akirak/bind-search :keymaps 'hl-todo-mode-map
"t" #'hl-todo-occur)
(akirak/bind-jump :keymaps 'hl-todo-mode-map
"t" #'hl-todo-next
"r" #'hl-todo-previous)
(general-add-hook 'hl-todo-keyword-faces
'(("REVIEW" . "DarkOrange3")
("OPTIMIZE" . "LightSeaGreen")))
:hook
(prog-mode . hl-todo-mode))
There is another package named comment-tags for the same purpose, but I won’t use it since there is hl-todo
(use-package comment-tags
:disabled t
:hook (prog-mode . comment-tags-mode)
:custom
(comment-tags-case-sensitive t)
(comment-tags-comment-start-only t))
web-mode
.
;; (akirak/require 'setup-tagedit)
(defvar org-select-window-last-window nil)
(defun org-select-window (arg)
(interactive "P")
(if arg
(progn
(when org-select-window-last-window
(select-window org-select-window-last-window)
(setq org-select-window-last-window nil)))
(let* ((wlist (window-list))
(i0 (-elem-index (selected-window) wlist))
(queue (append (-slice wlist (1+ i0))
(-take i0 wlist)))
(w (-find (lambda (w)
(with-current-buffer (window-buffer w)
(derived-mode-p 'org-mode)))
queue)))
(if w
(progn
(unless (derived-mode-p 'org-mode)
(setq org-select-window-last-window (selected-window)))
(select-window w))
(message "No other org window in this frame")))))
(use-package modi-org-split-block
:straight nil
:load-path "contrib/modi")
(general-def :package 'org :keymaps 'org-mode-map
[remap org-meta-return] 'modi/org-meta-return)
(akirak/bind-user
"u" #'winner-undo-repeat)
(defun akirak/switch-to-last-buffer-other-window ()
(interactive)
(switch-to-buffer-other-window (other-buffer)))
(general-def ctl-x-map
"B" #'akirak/switch-to-last-buffer-other-window)
I created a hydra for managing frames and windows.
(general-def "M-o" #'ace-window)
;; You can also display the help from the start
;; (akirak/bind-key "M-o" #'aw-show-dispatch-help)
(general-unbind :keymaps 'lispy-mode-map :package 'lispy "M-o")
(use-package fwb-cmds
:straight (fwb-cmds :host github :repo "tarsius/fwb-cmds"))
(use-package buffer-move
:commands (buf-move-up buf-move-down buf-move-left buf-move-right))
(use-package window-go
:straight (window-go :host github :repo "akirak/emacs-window-go"))
Additional visual cues can increase productivity, but they can be noisy at the same time. Therefore I need to justify each package added to my config.
I often lose sight of the cursor when I switch to another window, so this is necessary.
(use-package beacon ; Highlight the cursor on certain events
:disabled t
:unless (akirak/windows-subsystem-for-linux-p)
:config
(general-add-hook 'beacon-dont-blink-commands
'(akirak/scroll-half-page-forward
akirak/scroll-half-page-backward))
(beacon-mode 1))
This is especially useful in editing Lisp code.
(use-package rainbow-delimiters ; Colourize parentheses in source code
:hook
((lisp-mode
emacs-lisp-mode
elixir-mode
haskell-mode
purescript-mode
) . rainbow-delimiters-mode))
This package makes the focused window stands out by dimming the other windows. However, the dimness should be kept small to make referenced text readable.
(akirak/require 'setup-dimmer)
This lets you know which parts of the buffers are modified since the last commit.
(use-package git-gutter
:diminish git-gutter-mode
:init
(global-git-gutter-mode))
(akirak/bind-jump
"j" #'git-gutter:next-hunk
"k" #'git-gutter:previous-hunk)
(general-advice-add '(git-gutter:next-hunk
git-gutter:previous-hunk)
:around
(defun akirak/git-gutter-follow-up-navigation (orig &rest args)
(when (buffer-narrowed-p)
(widen))
(let ((pos (point)))
(prog1 (apply orig args)
(unless (eq pos (point))
(when (derived-mode-p 'org-mode)
(org-show-context)))))))
(akirak/bind-user
"g" 'git-gutter:mark-hunk)
This is helpful in programming languages that depend on indentation levels.
(use-package highlight-indent-guides
:config
(defun akirak/turn-on-highlight-indent-guides-mode ()
(interactive)
(highlight-indent-guides-mode 1))
:hook
((python-mode nim-mode yaml-mode)
. akirak/turn-on-highlight-indent-guides-mode))
(akirak/require 'setup-prism)
(use-package column-enforce-mode
:disabled t
:hook
((prog-mode markdown-mode)
. 80-column-rule))
Visualise (usually) 80 columns.
(use-package fill-column-indicator
:unless (akirak/windows-subsystem-for-linux-p)
:disabled t
:init
(add-hook 'prog-mode-hook 'fci-mode))
Visualise unnecessary, extra whitespace characters in source code.
(akirak/require 'setup-whitespace)
(use-package symbol-overlay
:commands (symbol-overlay-put symbol-overlay-mode)
:config
(akirak/bind-search
"s"
(defun akirak/symbol-overlay-jump ()
(interactive)
(let* ((name (completing-read "Highlighted symbol: "
(-map #'car symbol-overlay-keywords-alist)))
(x (assoc name symbol-overlay-keywords-alist))
(face (cddr x))
(initial (point))
pos)
(goto-char (point-min))
(unless (catch 'finish
(while (setq pos (next-single-char-property-change (point) 'face))
(goto-char pos)
(when (eq face (get-char-property pos 'face))
(throw 'finish t))))
(goto-char initial))))))
(akirak/require 'setup-bm)
By default, *Messages*
buffer is shown at startup.
(akirak/require 'setup-initial-buffer)
Files are automatically saved on certain events by super-save-mode
:
(akirak/require 'setup-super-save)
org-web-tools is handy, but commands in the package often fail to retrieve a proper URL I want to operate on. Therefore I created clipurl
package to pick a URL from the kill ring.
(akirak/require 'setup-org-web-tools)
(defun akirak/insert-previous-url-link ()
(interactive)
(if current-prefix-arg
(call-interactively 'ivy-clipurl)
;; Use ivy-clipurl in place of org-web-tools-insert-link.
(let ((ivy-clipurl-default-action 'clipurl-insert-url-dwim)
(ivy-clipurl-prompt "Choose a URL to insert: "))
(call-interactively 'ivy-clipurl))
;; (call-interactively 'org-web-tools-insert-link-for-url)
))
(akirak/bind-user "w" 'akirak/insert-previous-url-link)
To visit a URL, use browse-url-at-point
:
(akirak/bind-user "o" #'browse-url-at-point)
- bm (visual bookmarks)
- symbol-overlay
(akirak/bind-user
"b" 'helm-bm
"m" 'bm-toggle
"s" 'symbol-overlay-put)
(general-def
"C-x n" #'akirak/narrow-or-widen-dwim)
(general-def :keymaps 'org-mode-map
"C-x n" #'akirak/narrow-or-widen-dwim)
(general-def
"<f9>" 'recompile)
;; Development
(akirak/bind-user
"i" 'scratch)
(akirak/require 'setup-debug-emacs)
(akirak/require 'setup-storage)
(akirak/require 'setup-services)
(akirak/require 'setup-beancount)
(akirak/require 'optimize-minibuf)
Use benchmark-init
for profiling of the startup time.
(akirak/require 'setup-init-time-log)
A modules for supporting a natural language should follow the naming convention of setup-LANGUAGE-SYSTEM
. For example, setup-chinese-pyim
is a Chinese support through pyim.el
.
You can customize a list of modules for supported languages through the following variable. This setting can be done per machine, so different machines can support different languages:
(defcustom akirak/enabled-language-supports
nil
"List of enabled modules for supporting natural languages other than English.
These modules are loaded at startup.
I also suggest you set `default-input-method' to your preferred
input method in the environment."
:group 'akirak
:type '(set (const :tag "Japanese/日本語 (mozc)" setup-japanese-mozc)
(const :tag "Chinese/简体中文 (pyim)" setup-chinese-pyim)
(const :tag "Japanese/日本語 (SKK)" setup-japanese-skk))
:set (lambda (sym value)
(set sym value)
(dolist (module value)
(akirak/require module))
(when (= 1 (length value))
(setq default-input-method
(string-remove-prefix "setup-" (symbol-name (car value)))))))
I don’t set the default input method here. Set default-input-method
in your custom-file
.
(akirak/require 'setup-language-tools)
(akirak/require 'setup-writing)
I will use flyspell-correct to run flyspell.
flyspell-correct-wrapper
is the main entry point to the package. I bindC-c f
to the command.- When
flyspell-mode
is not on, the key sequence turns the mode on.
- When
(akirak/bind-user
"f" #'flyspell-mode)
(akirak/bind-user :keymaps 'flyspell-mode-map
"f" #'flyspell-correct-wrapper)
Typo.el is a successor to typopunct.el.
Note it doesn’t support CJK languages. It can be useful for European languages.
Use wc-mode
or org-wc
for counting words.
Set basic options for org-mode:
(akirak/require 'setup-org t)
;; Use org-edna for dependency management
(akirak/require 'setup-org-edna)
;; org-starter should be loaded after org is loaded
(akirak/require 'setup-org-starter)
Use major-mode-hydra to define a hydra for Org mode:
(akirak/require 'setup-org-hydra)
(akirak/require 'setup-org-babel t)
- Exporting to Hugo
(akirak/require 'setup-ox)
(akirak/require 'setup-org-hugo)
Markdown is supported as well:
(akirak/require 'setup-markdown)
(akirak/require 'setup-elixir)
(akirak/require 'setup-gleam)
(akirak/require 'setup-go)
(akirak/require 'setup-haskell)
Use lsp-mode.
(akirak/require 'setup-javascript)
(akirak/require 'setup-json)
(akirak/require 'setup-emacs-lisp)
(akirak/require 'setup-purescript)
(use-package rust-mode)
(akirak/require 'setup-shell-scripts)
(akirak/require 'setup-vue)
(akirak/require 'setup-web-mode)
Restclient is useful for development in teams where it is used.
(akirak/require 'setup-restclient)
(akirak/require 'setup-css)
(use-package bats-mode)
(akirak/require 'setup-dhall)
(akirak/require 'setup-dockerfile)
(akirak/require 'setup-graphql)
(akirak/require 'setup-graphviz-dot)
(akirak/require 'setup-mermaid)
(akirak/require 'setup-nix)
(akirak/require 'setup-pug)
(akirak/require 'setup-systemd)
(akirak/require 'setup-svelte)
(akirak/require 'setup-terraform)
(akirak/require 'setup-yaml)
(akirak/require 'setup-ansible)
(akirak/bind-jump "M-j" #'counsel-org-clock-goto)
(akirak/bind-search "M-c" #'counsel-org-clock-context)
(akirak/bind-user
"l" 'org-store-link)
(akirak/require 'setup-org-recur)
;; (akirak/require 'setup-org-journal)
(general-def org-agenda-mode-map :package 'org-agenda
"M-n" #'org-agenda-drag-line-forward
"M-p" #'org-agenda-drag-line-backward)
(when (member "--exwm" command-line-args)
(akirak/require 'setup-exwm)
(exwm-enable))
(add-to-list 'command-switch-alist '("--exwm" . (lambda (_) nil)))
When you connect/disconnect to an external monitor, run akirak/exwm-configure-screens
command, unless it is automatically called by the screen change hook.
I am now using myrepos to synchronize my configuration repositories.
(defun akirak/mr-update ()
"Run 'mr update' in the home directory."
(interactive)
(save-some-buffers)
(let ((default-directory "~"))
(akirak/run-interactive-shell-command "mr update")))
(defalias 'akirak/update-configuration 'akirak/mr-update)
(defun akirak/mr-push ()
(interactive)
(let ((default-directory "~"))
(akirak/run-interactive-shell-command "mr push")))
(akirak/require 'setup-straight)
(defun akirak/org-sort-entries-as-desired ()
(interactive)
(org-with-wide-buffer
(goto-char (point-min))
(while (re-search-forward (org-re-property "sort") nil t)
(let ((line (thing-at-point 'line t)))
(if (string-match org-property-re line)
(pcase (match-string 3 line)
("a" (org-sort-entries nil ?a)))
(error "Property didn't match")))
(org-end-of-subtree)))
(when (org-find-property "TOC")
(org-make-toc)))