Auto save git-tracked files in-place
This commit is contained in:
parent
025d532633
commit
bc1522e639
1 changed files with 8 additions and 0 deletions
|
|
@ -1,5 +1,11 @@
|
|||
(load-file ".config/emacs/init-elpaca.el")
|
||||
|
||||
(defun git-tracked-file-p (filename)
|
||||
"Check whether the file FILENAME is tracked by git."
|
||||
(let ((dirname (file-name-parent-directory filename)))
|
||||
(zerop (call-process "git" nil nil nil
|
||||
"-C" dirname "ls-files" "--error-unmatch" filename))))
|
||||
|
||||
(use-package emacs
|
||||
:ensure nil
|
||||
:bind (("C-z" . nil)
|
||||
|
|
@ -20,6 +26,8 @@
|
|||
:custom
|
||||
; keep-sorted start
|
||||
(auto-save-interval 20)
|
||||
(auto-save-visited-mode t)
|
||||
(auto-save-visited-predicate (lambda () (git-tracked-file-p buffer-file-name)))
|
||||
(column-number-mode t)
|
||||
(dired-dwim-target 'dired-dwim-target-next)
|
||||
(display-time-24hr-format t)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue