emacs: refactor utility functions and binds

This commit is contained in:
Jeremy Baxter 2024-07-19 09:51:06 +12:00
parent 4c78c8609c
commit adb0b0e0ce

View file

@ -20,23 +20,20 @@
(global-set-key (kbd "C-c k") 'kill-current-buffer)
(global-set-key (kbd "C-c e v") 'eval-buffer)
(defun reindent-buffer (start end &optional column)
"Reindent the current buffer."
(interactive "r\nP")
(save-excursion
(mark-whole-buffer)
(indent-region start end column)))
(global-set-key (kbd "C-c C-r") 'reindent-buffer)
;; utilities
(defun edit-init-file ()
"Switch to a buffer visiting your user's init file.
One will be created if none exist."
"Switch to a buffer visiting your init file."
(interactive)
(find-file user-init-file))
(global-set-key (kbd "C-c e i") 'edit-init-file)
(defun reindent-buffer ()
"Reindent the current buffer."
(interactive)
(indent-region (point-min) (point-max)))
(defalias 'describe-word 'dictionary-search)
(global-set-key (kbd "C-h w") 'describe-word)
;; other key binds
(global-set-key (kbd "C-c e r") 'reindent-buffer)
(global-set-key (kbd "C-c e i") 'edit-init-file)
(global-set-key (kbd "C-h w") 'dictionary-search)
;; variables
(setq compilation-scroll-output t