Update auto-backup instructions
This commit is contained in:
parent
88ee7710d8
commit
54023fac6a
32
manual.md
32
manual.md
|
@ -13,7 +13,7 @@
|
||||||
1. [chronometrist](#usage-chronometrist)
|
1. [chronometrist](#usage-chronometrist)
|
||||||
2. [chronometrist-report](#usage-chronometrist-report)
|
2. [chronometrist-report](#usage-chronometrist-report)
|
||||||
3. [chronometrist-statistics](#usage-chronometrist-statistics)
|
3. [chronometrist-statistics](#usage-chronometrist-statistics)
|
||||||
4. [chronometrist-details](#orgef95536)
|
4. [chronometrist-details](#orgd0baf02)
|
||||||
5. [common commands](#usage-common-commands)
|
5. [common commands](#usage-common-commands)
|
||||||
6. [Time goals/targets](#time-goals)
|
6. [Time goals/targets](#time-goals)
|
||||||
6. [How-to](#how-to)
|
6. [How-to](#how-to)
|
||||||
|
@ -21,14 +21,14 @@
|
||||||
2. [How to load the program using literate-elisp](#how-to-literate-elisp)
|
2. [How to load the program using literate-elisp](#how-to-literate-elisp)
|
||||||
3. [How to attach tags to time intervals](#how-to-tags)
|
3. [How to attach tags to time intervals](#how-to-tags)
|
||||||
4. [How to attach key-values to time intervals](#how-to-key-value-pairs)
|
4. [How to attach key-values to time intervals](#how-to-key-value-pairs)
|
||||||
5. [How to skip running hooks/attaching tags and key values](#org91eaa24)
|
5. [How to skip running hooks/attaching tags and key values](#org4fb8a60)
|
||||||
6. [How to open certain files when you start a task](#how-to-open-files-on-task-start)
|
6. [How to open certain files when you start a task](#how-to-open-files-on-task-start)
|
||||||
7. [How to warn yourself about uncommitted changes](#how-to-warn-uncommitted-changes)
|
7. [How to warn yourself about uncommitted changes](#how-to-warn-uncommitted-changes)
|
||||||
8. [How to display the current time interval in the activity indicator](#how-to-activity-indicator)
|
8. [How to display the current time interval in the activity indicator](#how-to-activity-indicator)
|
||||||
9. [How to back up your Chronometrist data](#how-to-backup)
|
9. [How to back up your Chronometrist data](#how-to-backup)
|
||||||
7. [Explanation](#orgeaa52ca)
|
7. [Explanation](#org8c92b56)
|
||||||
1. [Literate Program](#explanation-literate-program)
|
1. [Literate Program](#explanation-literate-program)
|
||||||
8. [User's reference](#org3483ac6)
|
8. [User's reference](#org48f1512)
|
||||||
9. [Contributions and contact](#contributions-contact)
|
9. [Contributions and contact](#contributions-contact)
|
||||||
10. [License](#license)
|
10. [License](#license)
|
||||||
11. [Thanks](#thanks)
|
11. [Thanks](#thanks)
|
||||||
|
@ -157,7 +157,7 @@ Run `M-x chronometrist-statistics` (or `chronometrist` with a prefix argument of
|
||||||
Press `b` to look at past time ranges, and `f` for future ones.
|
Press `b` to look at past time ranges, and `f` for future ones.
|
||||||
|
|
||||||
|
|
||||||
<a id="orgef95536"></a>
|
<a id="orgd0baf02"></a>
|
||||||
|
|
||||||
## chronometrist-details
|
## chronometrist-details
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ Evaluate or add to your init.el the following -
|
||||||
To exit the prompt, press the key it indicates for quitting - you can then edit the resulting key-values by hand if required. Press `C-c C-c` to accept the key-values, or `C-c C-k` to cancel.
|
To exit the prompt, press the key it indicates for quitting - you can then edit the resulting key-values by hand if required. Press `C-c C-c` to accept the key-values, or `C-c C-k` to cancel.
|
||||||
|
|
||||||
|
|
||||||
<a id="org91eaa24"></a>
|
<a id="org4fb8a60"></a>
|
||||||
|
|
||||||
## How to skip running hooks/attaching tags and key values
|
## How to skip running hooks/attaching tags and key values
|
||||||
|
|
||||||
|
@ -298,27 +298,21 @@ Another one, prompting the user if they have uncommitted changes in a git reposi
|
||||||
|
|
||||||
## How to back up your Chronometrist data
|
## How to back up your Chronometrist data
|
||||||
|
|
||||||
I suggest backing up Chronometrist data on each save. Here's how you can do that.
|
I suggest backing up Chronometrist data on each save using the [async-backup](https://tildegit.org/contrapunctus/async-backup) package.<sup><a id="fnr.3" class="footref" href="#fn.3" role="doc-backlink">3</a></sup> Here's how you can do that.
|
||||||
|
|
||||||
1. Add the following to your init.
|
1. Add the following to your init.
|
||||||
|
|
||||||
(setq backup-by-copying t
|
(use-package async-backup)
|
||||||
kept-new-versions 10
|
2. Open your Chronometrist file and add `async-backup` to a buffer-local `after-save-hook`.
|
||||||
kept-old-versions 10
|
|
||||||
version-control t)
|
|
||||||
|
|
||||||
(defun my-force-backup ()
|
|
||||||
(setq buffer-backed-up nil))
|
|
||||||
2. Open your Chronometrist file and add the function to `before-save-hook`.
|
|
||||||
|
|
||||||
M-x chronometrist-open-log
|
M-x chronometrist-open-log
|
||||||
M-x add-file-local-variable-prop-line RET eval RET (add-hook 'before-save-hook #'my-force-backup nil t) RET
|
M-x add-file-local-variable-prop-line RET eval RET (add-hook 'after-save-hook #'async-backup nil t) RET
|
||||||
3. Optionally, configure `backup-directory-alist` to set a specific directory for the backups.
|
3. Optionally, configure `backup-directory-alist` to set a specific directory for the backups.
|
||||||
|
|
||||||
Adapted from this [StackOverflow answer](https://stackoverflow.com/questions/6916529/how-can-i-make-emacs-backup-every-time-i-save).
|
Adapted from this [StackOverflow answer](https://stackoverflow.com/questions/6916529/how-can-i-make-emacs-backup-every-time-i-save).
|
||||||
|
|
||||||
|
|
||||||
<a id="orgeaa52ca"></a>
|
<a id="org8c92b56"></a>
|
||||||
|
|
||||||
# Explanation
|
# Explanation
|
||||||
|
|
||||||
|
@ -334,7 +328,7 @@ The Org file can also be loaded directly using the [literate-elisp](https://gi
|
||||||
`chronometrist.org` is also included in MELPA installs, although not used directly by default, since doing so would interfere with automatic generation of autoloads.
|
`chronometrist.org` is also included in MELPA installs, although not used directly by default, since doing so would interfere with automatic generation of autoloads.
|
||||||
|
|
||||||
|
|
||||||
<a id="org3483ac6"></a>
|
<a id="org48f1512"></a>
|
||||||
|
|
||||||
# User's reference
|
# User's reference
|
||||||
|
|
||||||
|
@ -412,3 +406,5 @@ fiete and wu-lee for testing and bug reports
|
||||||
<sup><a id="fn.1" href="#fnr.1">1</a></sup> but not `chronometrist-before-in-functions`
|
<sup><a id="fn.1" href="#fnr.1">1</a></sup> but not `chronometrist-before-in-functions`
|
||||||
|
|
||||||
<sup><a id="fn.2" href="#fnr.2">2</a></sup> but not `chronometrist-before-in-functions`
|
<sup><a id="fn.2" href="#fnr.2">2</a></sup> but not `chronometrist-before-in-functions`
|
||||||
|
|
||||||
|
<sup><a id="fn.3" href="#fnr.3">3</a></sup> It is possible to use Emacs' built-in backup system to do it, but since it is synchronous, doing so will greatly slow down saving of the Chronometrist file.
|
||||||
|
|
24
manual.org
24
manual.org
|
@ -172,7 +172,7 @@ Evaluate or add to your init.el the following -
|
||||||
:CUSTOM_ID: how-to-tags
|
:CUSTOM_ID: how-to-tags
|
||||||
:END:
|
:END:
|
||||||
|
|
||||||
1. Add =chronometrist-tags-add= to one or more of these hooks [fn:1] -
|
1. Add =chronometrist-tags-add= to one or more of these hooks [fn:2] -
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(add-to-list 'chronometrist-after-in-functions 'chronometrist-tags-add)
|
(add-to-list 'chronometrist-after-in-functions 'chronometrist-tags-add)
|
||||||
|
@ -183,14 +183,14 @@ Evaluate or add to your init.el the following -
|
||||||
|
|
||||||
The prompt suggests past combinations you used for the current task, which you can browse with =M-p=/=M-n=. You can leave it blank by pressing =RET=.
|
The prompt suggests past combinations you used for the current task, which you can browse with =M-p=/=M-n=. You can leave it blank by pressing =RET=.
|
||||||
|
|
||||||
[fn:1] but not =chronometrist-before-in-functions=
|
[fn:2] but not =chronometrist-before-in-functions=
|
||||||
|
|
||||||
** How to attach key-values to time intervals
|
** How to attach key-values to time intervals
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:CUSTOM_ID: how-to-key-value-pairs
|
:CUSTOM_ID: how-to-key-value-pairs
|
||||||
:END:
|
:END:
|
||||||
|
|
||||||
1. Add =chronometrist-kv-add= to one or more of these hooks [fn:2] -
|
1. Add =chronometrist-kv-add= to one or more of these hooks [fn:3] -
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(add-to-list 'chronometrist-after-in-functions 'chronometrist-kv-add)
|
(add-to-list 'chronometrist-after-in-functions 'chronometrist-kv-add)
|
||||||
|
@ -200,7 +200,7 @@ Evaluate or add to your init.el the following -
|
||||||
|
|
||||||
To exit the prompt, press the key it indicates for quitting - you can then edit the resulting key-values by hand if required. Press =C-c C-c= to accept the key-values, or =C-c C-k= to cancel.
|
To exit the prompt, press the key it indicates for quitting - you can then edit the resulting key-values by hand if required. Press =C-c C-c= to accept the key-values, or =C-c C-k= to cancel.
|
||||||
|
|
||||||
[fn:2] but not =chronometrist-before-in-functions=
|
[fn:3] but not =chronometrist-before-in-functions=
|
||||||
|
|
||||||
** How to skip running hooks/attaching tags and key values
|
** How to skip running hooks/attaching tags and key values
|
||||||
Use =M-RET= (=chronometrist-toggle-task-no-hooks=) to clock in/out.
|
Use =M-RET= (=chronometrist-toggle-task-no-hooks=) to clock in/out.
|
||||||
|
@ -270,25 +270,21 @@ Return nil (and run `magit-status') if the user answers no."
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:CUSTOM_ID: how-to-backup
|
:CUSTOM_ID: how-to-backup
|
||||||
:END:
|
:END:
|
||||||
I suggest backing up Chronometrist data on each save. Here's how you can do that.
|
I suggest backing up Chronometrist data on each save using the [[https://tildegit.org/contrapunctus/async-backup][async-backup]] package.[fn:1] Here's how you can do that.
|
||||||
|
|
||||||
1. Add the following to your init.
|
1. Add the following to your init.
|
||||||
#+BEGIN_SRC emacs-lisp
|
#+BEGIN_SRC emacs-lisp
|
||||||
(setq backup-by-copying t
|
(use-package async-backup)
|
||||||
kept-new-versions 10
|
|
||||||
kept-old-versions 10
|
|
||||||
version-control t)
|
|
||||||
|
|
||||||
(defun my-force-backup ()
|
|
||||||
(setq buffer-backed-up nil))
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
2. Open your Chronometrist file and add the function to =before-save-hook=.
|
2. Open your Chronometrist file and add =async-backup= to a buffer-local =after-save-hook=.
|
||||||
: M-x chronometrist-open-log
|
: M-x chronometrist-open-log
|
||||||
: M-x add-file-local-variable-prop-line RET eval RET (add-hook 'before-save-hook #'my-force-backup nil t) RET
|
: M-x add-file-local-variable-prop-line RET eval RET (add-hook 'after-save-hook #'async-backup nil t) RET
|
||||||
3. Optionally, configure =backup-directory-alist= to set a specific directory for the backups.
|
3. Optionally, configure =backup-directory-alist= to set a specific directory for the backups.
|
||||||
|
|
||||||
Adapted from this [[https://stackoverflow.com/questions/6916529/how-can-i-make-emacs-backup-every-time-i-save][StackOverflow answer]].
|
Adapted from this [[https://stackoverflow.com/questions/6916529/how-can-i-make-emacs-backup-every-time-i-save][StackOverflow answer]].
|
||||||
|
|
||||||
|
[fn:1] It is possible to use Emacs' built-in backup system to do it, but since it is synchronous, doing so will greatly slow down saving of the Chronometrist file.
|
||||||
|
|
||||||
* Explanation
|
* Explanation
|
||||||
** Literate Program
|
** Literate Program
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
|
|
Reference in New Issue
Block a user