[Fix #1453] Re-enable auto-save-mode
- Re-enable - Move all autosave files to spacemacs-cache-directory - Allow Auto-saving directly on current buffer. - Add option to customize. - Update .spacemacs template.
This commit is contained in:
parent
651e6a2e70
commit
4a19bd9d33
|
@ -87,6 +87,10 @@ with `:' and Emacs commands are executed with `<leader> :'.")
|
|||
"If non nil then `ido' replaces `helm' for some commands. For now only
|
||||
`find-files' (SPC f f) is replaced.")
|
||||
|
||||
(defvar dotspacemacs-autosave-file-directly nil
|
||||
"If non-nil, auto-save to the file directly. If nil, just save
|
||||
to auto-save file in `spacemacs-cache-directory'")
|
||||
|
||||
(defvar dotspacemacs-enable-paste-micro-state t
|
||||
"If non nil the paste micro-state is enabled. While enabled pressing `p`
|
||||
several times cycle between the kill ring content.'")
|
||||
|
|
|
@ -96,6 +96,9 @@ before layers configuration."
|
|||
;; By default the command key is `:' so ex-commands are executed like in Vim
|
||||
;; with `:' and Emacs commands are executed with `<leader> :'.
|
||||
dotspacemacs-command-key ":"
|
||||
;; If non-nil, auto-save to the file directly. If nil, just save
|
||||
;; to auto-save file in `spacemacs-cache-directory'
|
||||
dotspacemacs-autosave-file-directly nil
|
||||
;; If non nil then `ido' replaces `helm' for some commands. For now only
|
||||
;; `find-files' (SPC f f) is replaced.
|
||||
dotspacemacs-use-ido nil
|
||||
|
|
|
@ -214,11 +214,14 @@ Can be installed with `brew install trash'."
|
|||
(setq custom-file (dotspacemacs/location))
|
||||
;; scratch buffer empty
|
||||
(setq initial-scratch-message nil)
|
||||
;; don't create backup~ or #auto-save# files
|
||||
;; don't create backup~ files
|
||||
(setq backup-by-copying t
|
||||
make-backup-files nil
|
||||
auto-save-default nil
|
||||
create-lockfiles nil)
|
||||
|
||||
(setq auto-save-file-name-transforms `((".*" ,spacemacs-cache-directory t)))
|
||||
(add-hook 'auto-save-hook 'save-buffer-if-visiting-file)
|
||||
|
||||
(require 'uniquify)
|
||||
;; When having windows with repeated filenames, uniquify them
|
||||
;; by the folder they are in rather those annoying <2>,<3>,.. etc
|
||||
|
|
|
@ -1008,3 +1008,10 @@ the right."
|
|||
(create-align-repeat-x "left-paren" "(")
|
||||
(create-align-repeat-x "right-paren" ")" t)
|
||||
|
||||
(defun save-buffer-if-visiting-file (&optional args)
|
||||
"Save the current buffer only if it is visiting a file"
|
||||
(interactive)
|
||||
(if (and dotspacemacs-autosave-file-directly
|
||||
(buffer-file-name)
|
||||
(buffer-modified-p))
|
||||
(save-buffer args)))
|
||||
|
|
Loading…
Reference in New Issue