Skip to content

Instantly share code, notes, and snippets.

@swhib swhib/save_hash_problem.md
Last active Mar 12, 2018

Embed
What would you like to do?
save hash problem

Thanks again for your code.

It's exactly what I need.

But I have two problems:


First: If I save a file (like test.org) for the first time I get the warning Non-existent agenda file /path/to/test.org. [R]emove from list or [A]bort? Without your code I don't get this warning.


Second: Sometimes all headings are udpated

I use markdown syntax because * in example or code blocks still gets treated as a heading when I fold the headings.

I have inserted %S into your code so that seconds are stored in MODIFIED so that I can quicker see if it works.

I testet with a new profile. The init just contains your code.

I tested with an up-to-date Fedora 27. M-x emacs-version evaluates to 'GNU Emacs 25.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.22.19) of 2017-09-15'
In this empty profile I use org-mode 8.2.10 that is bundled with emacs. I also tried (with similar results) in my main profile with the most recent orgmode 9.1.7.

Here are the contents of my buffer (in markdown code blocks) before and after saves.

before the first save

* a

* a

after the first save

* a
  :PROPERTIES:
  :HASH:     2587072
  :MODIFIED: 2018-03-12 22:29:41
  :END:

* a
  :PROPERTIES:
  :HASH:     2587072
  :MODIFIED: 2018-03-12 22:29:41
  :END:

I enter one additional letter to one heading (here the last character "b") - state of the buffer before I save is shown

* a
  :PROPERTIES:
  :HASH:     2587072
  :MODIFIED: 2018-03-12 22:30:27
  :END:

* a
  :PROPERTIES:
  :HASH:     2587072
  :MODIFIED: 2018-03-12 22:30:27
  :END:
b

Then I save and it looks like this

* a
  :PROPERTIES:
  :HASH:     -1807494956069022391
  :MODIFIED: 2018-03-12 22:30:40
  :END:

* a
  :PROPERTIES:
  :HASH:     -1249803186540033563
  :MODIFIED: 2018-03-12 22:30:40
  :END:
b

All headings in the buffer get updated with a new hash and (naturally) the same modification time.

Later saves

Only the affected header is updated and it works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.