Skip to content

Latest commit

 

History

History
153 lines (108 loc) · 4.79 KB

freemacs-defaults.org

File metadata and controls

153 lines (108 loc) · 4.79 KB

Defaults Configuration


The code below collects customizations for Emacs built-in components.

(use-package emacs
  :custom
  <<emacs_custom>>
  :config
  <<emacs_config>>)

Automatic Time Stamps

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)

Bidirectional Editing

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:

  1. Tell Emacs that text should be read from left to right.
    (bidi-paragraph-direction 'left-to-right)
        
  2. Turn off bidrectional editing mode.
    (if (version<= "27.1" emacs-version)
        (setq bidi-inhibit-bpa t))
        

Default Margin

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

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))

Backup Files with Version Control

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)

Indent Using Spaces

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 Delay

(register-preview-delay 0)

Ring Bell Function

Disable the bell error sound in Emacs and use a visible bell instead.

(ring-bell-function #'ignore)
(visible-bell t)

Send Deleted Files to System Trash

Send files to the system trash instead of directly deleing them.

(delete-by-moving-to-trash t)

Shorten “Yes or No” to “Y or N”

Instead of typing “yes” or “no” for each question prompt, use just “y” or “n”.

(fset 'yes-or-no-p 'y-or-n-p)

Show Column Number

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 Buffer List

Use IBuffer instead of the traditional buffer list.

(use-package ibuffer
  :straight (:type built-in)
  :bind
  ("C-x C-b" . ibuffer))

End

(provide 'freemacs-defaults)

;;; freemacs-defaults.el ends here