Skip to content

Commit

Permalink
feat(core): add +sensitive-data-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Feb 14, 2024
1 parent bd0a364 commit fec482a
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions core/me-builtin.el
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
(auto-save-default t)
;; Include big deletions
(auto-save-include-big-deletions t)
;; Set file naming transform
;; Set file naming transform for `auto-save'
(auto-save-file-name-transforms
`(;; Prefix tramp autosaves with "tramp-"
("\\`/[^/]*:\\([^/]*/\\)*\\([^/]*\\)\\'" ,(concat auto-save-list-file-prefix "tramp-\\2") t)
Expand Down Expand Up @@ -218,7 +218,31 @@ or file path may exist now."
(concat x-win-dir (file-name-nondirectory session-filename))))

;; Don't show session files in recentf list and so on
(+ignore-root x-win-dir)))
(+ignore-root x-win-dir))

;; https://anirudhsasikumar.net/blog/2005.01.21.html
(define-minor-mode +sensitive-data-mode
"For sensitive files like password lists.
It disables backup creation and auto saving."
;; The initial value.
:init-value nil
;; The indicator for the mode line.
:lighter " Sensitive"
;; The minor mode bindings.
:keymap nil
(if +sensitive-data-mode
(progn
;; Disable backups
(setq-local backup-inhibited t)
;; Disable auto-save
(when auto-save-default (auto-save-mode -1))
;; Disable super-save
(when (bound-and-true-p super-save-mode) (super-save-mode -1)))
;; Restore to default value of backup-inhibited
(kill-local-variable 'backup-inhibited)
;; Restore to default auto save setting
(when auto-save-default (auto-save-mode 1)))))

(use-package minibuffer
:custom
Expand Down

0 comments on commit fec482a

Please sign in to comment.