/ notes / ... / 0124.86b0.html

Better Emacs defaults with minimal intervention

Guilherme Gondim

99essential.el provides better GNU Emacs configuration defaults. It is intended to be installed system-wide. Copy the file below to /etc/emacs/site-start.d/99essential.el or equivalent path in your system.

;;; 99essential.el --- Better defaults with minimal intervention

;; Copyright (C) 2017, 2018  Guilherme Gondim <semente.io>

;; Author: Guilherme Gondim
;; URL: https://semente.io/emacs.el
;; Version: 2018-04-28

;; This file is NOT part of GNU Emacs.

;;; Commentary:

;; 99essential.el provides better GNU Emacs configuration defaults.
;; It is intended to be installed system wide.  Copy this file to
;; /etc/emacs/site-start.d/99essential.el or equivalent path in your
;; system:

;; curl -o /etc/emacs/site-start.d/99essential.el https://semente.io/emacs.el

;; This Phil Hagelberg's package might also interest you:
;; <https://github.com/technomancy/better-defaults>.

;;; License:

;; This program is free software: you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation, either version 3 of the
;; License, or (at your option) any later version.

;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

;;; Code:

(progn

  ;; WARNING: backups and auto-saving are being disabled system-wide! If you
  ;; need it set it to non-nil here or in your user's init file.
  (setq make-backup-files nil
        auto-save-default nil)

  (add-hook 'after-init-hook
            (lambda ()
              (if (or (not make-backup-files) (not auto-save-default))
                  (message "WARNING: `make-backup-files' and/or \
`auto-save-default' are set to nil"))))

  ;; On gnome-terminal Emacs is setting the background mode to light even if I'm
  ;; using a dark one. The fix for this bug will be released together Emacs
  ;; 26. Until then I will force the dark background mode.
  (when (not (display-graphic-p))
    (setq frame-background-mode 'dark))

  (setq apropos-do-all t
        column-number-mode t
        completion-show-help nil
        ediff-window-setup-function 'ediff-setup-windows-plain
        mouse-yank-at-point t
        require-final-newline t
        save-interprogram-paste-before-kill t
        visible-bell t
        backup-directory-alist `(("." . ,(concat user-emacs-directory
                                                 "var/backup/"))))

  (setq-default indent-tabs-mode nil
                tab-width 4)

  (require 'dired-x)

  (require 'ido)
  (ido-mode t)
  (setq ido-enable-flex-matching t)

  (require 'saveplace)
  (setq-default save-place t)

  (require 'uniquify)
  (setq uniquify-buffer-name-style 'post-forward-angle-brackets
        uniquify-ignore-buffers-re "^\\*")

  (show-paren-mode t)
  (winner-mode t)

  (menu-bar-mode -1)
  (if window-system
      (tool-bar-mode -1))

  (global-set-key (kbd "M-/") 'hippie-expand)
  (global-set-key (kbd "M-\\") 'cycle-spacing)
  (global-set-key (kbd "C-x C-b") 'bs-show))

;;; 99essential.el ends here

This Phil Hagelberg’s package might also interest you: https://github.com/technomancy/better-defaults.