dotfiles/emacs.d/misc.el

34 lines
1.3 KiB
EmacsLisp

(setq initial-major-mode 'fundamental-mode)
(setq ring-bell-function 'ignore)
(setq sentence-end-double-space nil)
;; TODO: do i really want to enable this?
;; (setopt auto-revert-avoid-polling t)
;; (setopt auto-revert-interval 5)
;; (setopt auto-revert-check-vc-info t)
;; (global-auto-revert-mode)
(setq create-lockfiles nil)
;; put all auto-generated configurations in a separate file
(setq custom-file (locate-user-emacs-file "custom.el"))
(load custom-file :no-error-if-file-is-missing)
;; better "autosaves" file handling (the `#file#` files)
(setq kill-buffer-delete-auto-save-files t)
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
;; keep all *~ backup files inside ~/.emacs.d/backup
(defun get-emacsd-backup-file-name (fpath)
"Return a new file path for a given file path.
If the new path's directory does not exist, this will create them."
(let* ((backup-root-dir "~/.emacs.d/backup/")
(file-path (replace-regexp-in-string "[A-Za-z]:" "" fpath)) ; remove Windows drive letter
(backup-file-path (replace-regexp-in-string "//" "/" (concat backup-root-dir file-path "~"))))
(make-directory (file-name-directory backup-file-path)
(file-name-directory backup-file-path))
backup-file-path))
(setopt make-backup-file-name-function 'get-emacsd-backup-file-name)