Everything that has to do with Emacs-y stuff.
This is a combination of configurations for built-in packages some external ones.
;;; wal-emacs.el --- Emacs. -*- lexical-binding: t -*-
;;; Commentary:
;;
;; Provide Emacs settings/configurations.
;;; Code:
(eval-when-compile
(require 'wal-useful nil t)
(require 'wal-key-bindings nil t)
(require 'wal-bridge nil t))
(declare-function pdf-tools-install "ext:pdf-tools.el")
(declare-function wal-insert "wal-useful.el")
(declare-function wal-modern-emacs-p "wal-useful.el")
(declare-function wdb-faraway "wal-useful.el")
(declare-function wdb-nearby "wal-useful.el")
(declare-function adjunct "wal-key-bindigns.el")
(defvar wal-fix-syntax-checker)
(wal-on-boot emacs
(wdb-faraway "\\*Messages\\*")
(wdb-faraway 'help-mode)
(wdb-faraway 'shortdoc-mode)
(wdb-faraway 'debug-mode))
(junk-expand emacs
"Let's keep it in Emacs."
:extras (pdf-tools))
Automatic quick expansion.
(use-package abbrev
:custom
(save-abbrevs t)
:delight " abb")
Execute IO actions asynchronously. This is mainly for moving files in Dired.
(use-package async
:defer 2
:after dired
:config
(dired-async-mode 1)
:functions (dired-async-mode))
Leave a bookmark why don’t you. Binds the keymap and sets up annotations.
(use-package bookmark
:init
(that-key "bookmark" :key "C-c m")
:config
(wdb-nearby "\\*Bookmark Annotation\\*" :side 'left :no-other t)
:custom
(bookmark-use-annotations t)
(bookmark-menu-confirm-deletion t)
(bookmark-fringe-mark nil)
:bind-keymap
(("C-c m" . bookmark-map))
:bind
(:map bookmark-map
("l" . bookmark-bmenu-list)
("L" . bookmark-load)))
Quick calculations.
(use-package calc
:bind
("C-c q" . quick-calc))
Show compilations in a pop-up and scroll output.
(use-package compile
:hook
(compilation-filter . ansi-color-compilation-filter)
:config
(wdb-faraway "\\*compilation")
:custom
(compilation-scroll-output t)
(compilation-max-output-line-length nil)
:bind
(("C-c i" . compile)
("C-c r" . recompile)))
Effing diffing.
(use-package diff-mode
:bind
;; Remove `diff-goto-source'.
(:map diff-mode-shared-map
("o" . nil)))
(defvar-local wal-doc-view-page-offset 0)
(put 'wal-doc-view-page-offset 'safe-local-variable #'integerp)
(defun wal-with-page-offset (goto page)
"Go to PAGE with an offset.
GOTO is the advised function
This function only applies the offset if `this-command' is
`doc-view-goto-page' to avoid offsetting going to a previous or
next page."
(let ((offset (if (eq 'doc-view-goto-page this-command)
(+ page wal-doc-view-page-offset)
page)))
(funcall-interactively goto offset)))
(use-package doc-view
:config
(advice-add
'doc-view-goto-page :around
#'wal-with-page-offset))
Contextual information. Package lsp-mode
use eldoc
extensively.
(use-package eldoc
:custom
(eldoc-idle-delay 0.2)
(eldoc-echo-area-prefer-doc-buffer 'maybe)
(eldoc-echo-area-display-truncation-message nil)
:delight " eld")
Follow me around.
(use-package follow
:custom
(follow-mode-line-text " flw"))
Let’s try to be even more helpful
. This provides alternate version
of various describe
commands to provide more information.
(use-package helpful
:wal-ways t
:config
(wdb-faraway 'helpful-mode)
:custom
(helpful-max-buffers 3)
:bind
(([remap describe-command] . helpful-command)
([remap describe-function] . helpful-function)
([remap describe-key] . helpful-key)
([remap describe-variable] . helpful-variable)
([remap describe-symbol] . helpful-symbol)
:map help-map
("M" . helpful-macro)
("C-x" . helpful-kill-buffers)
:map helpful-mode-map
("k" . kill-buffer-and-window))
:defines (helpful-mode-map))
Highlighting the current line.
(use-package hl-line
:hook
((tablist-minor-mode
tabulated-list-mode
dired-mode)
. hl-line-mode))
Some people need macros, okay?
(defun wal-kmacro (arg)
"Toggle kmacro recording with ARG."
(interactive "P")
(cond
(defining-kbd-macro (kmacro-end-macro arg))
(t (kmacro-start-macro arg))))
(use-package kmacro
:general
(editor "k" 'wal-kmacro))
Navigate outline.
(use-package outline
:hook ((text-mode prog-mode harpoon-prog-like) . outline-minor-mode)
:delight
(outline-minor-mode " out")
:config
(that-key "outline" :key "C-c j")
:custom
(outline-minor-mode-prefix (kbd "C-c j")))
Highlight lines.
(defun wal-lighthouse ()
"Do a heavy `pulse-momentary-highlight-one-line'.
This just means increasing duration, delay, size and brightness."
(interactive)
(defvar pulse-iterations)
(let ((pulse-iterations 30))
(pulse-momentary-highlight-one-line (point) 'cursor)))
(use-package pulse
:bind
("C-c p" . wal-lighthouse))
No offender.
(defun wal-clear-registers ()
"Clear all registers."
(interactive)
(setq register-alist nil))
(use-package register
:config
;; Make sure that jumping to a marker attempts to select a window
;; already displaying the buffer first.
(cl-defmethod register-val-jump-to :before ((val marker) arg)
(when-let* ((buffer (marker-buffer val))
(windows (window-list-1))
(live (seq-find (lambda (it) (eq (window-buffer it) buffer))
windows)))
(select-window live)))
:custom
(register-preview-delay 0.8)
:general
(adjunct "r" 'wal-clear-registers)
:wal-bind
((";" . jump-to-register)
("M-;" . point-to-register)))
(use-package repeat
:custom
(repeat-exit-key (kbd "<return>"))
(repeat-exit-timeout 5))
I’d like to kill shells without a process quickly.
(use-package shell
:general
(general-define-key
:keymaps '(shell-mode-map comint-mode-map)
:predicate '(wal-dead-shell-p)
"k" 'kill-buffer-and-window))
No double spaces in sentences.
(use-package text-mode
:init
(harpoon text-mode
:flat t
:functions
(wal-text-mode-flyspell-commit-messages))
:custom
(sentence-end-double-space nil))
(defun wal-text-mode-flyspell-commit-messages ()
"Activate `flyspell-mode' when editing commit messages."
(when (string-match "COMMIT_EDITMSG" (buffer-name))
(flyspell-mode)))
This provides better PDF editing capabilities than the built-in
doc-view-mode
.
(use-package pdf-tools
:defer 3
:after doc-view
:config
(pdf-tools-install))
(provide 'wal-emacs)
;;; wal-emacs.el ends here