The code below collects customizations for Emacs built-in components.
(use-package emacs
:custom
<<emacs_custom>>
:config
<<emacs_config>>)
Emacs supports time stamps in any text buffer where Time-stamp: <>
can be found in the first eight lines. The time-stamp
command can then be used to automatically update the time. A simpler solution, however, is to have Emacs automatically update the time stamp when the buffer is saved.
(add-hook 'before-save-hook 'time-stamp)
Emacs supports bidirectional editing. This is rarely used feature for many and can actually result in slower performance. To improve performance if bidirectional editing it not used, the following can be set:
- Tell Emacs that text should be read from left to right.
(bidi-paragraph-direction 'left-to-right)
- Turn off bidrectional editing mode.
(if (version<= "27.1" emacs-version) (setq bidi-inhibit-bpa t))
Use a default left and right margin of 3 to help clean up the look of Emacs buffers near window edges.
(setq-default left-margin-width 3 right-margin-width 3)
Display Battery Mode will display the battery charge status in the modeline
(use-package battery
:straight (:type built-in)
:defer 3
:config
(display-battery-mode t))
Emacs has a built-in version control system in which it will create a series of backup files. This will create a number of backup flies, however, that will need to be cleaned up on a regular basis.
(version-control t)
(delete-old-versions t)
(vc-make-backup-files t)
Indenting with spaces rather than tabs is genrally recommended when working with code. Especially when writing code in Python.
(setq-default indent-tabs-mode nil)
(register-preview-delay 0)
Disable the bell error sound in Emacs and use a visible bell instead.
(ring-bell-function #'ignore)
(visible-bell t)
Send files to the system trash instead of directly deleing them.
(delete-by-moving-to-trash t)
Instead of typing “yes” or “no” for each question prompt, use just “y” or “n”.
(fset 'yes-or-no-p 'y-or-n-p)
Many programming language style guides recommend that each line of code is less than 80 characters long. To determine if code lines are too long, a simple tool is to activate column-number-mode
. Once enabled, the current column (i.e. the number of characters on that line) will be displayed.
(column-number-mode t)
A better fix would be to use code formatters to prevent lines from getting too long. For example, Apheleia will run formatters such as Black on Python code to keep code lines from becoming too long.
Use IBuffer instead of the traditional buffer list.
(use-package ibuffer
:straight (:type built-in)
:bind
("C-x C-b" . ibuffer))
(provide 'freemacs-defaults)
;;; freemacs-defaults.el ends here