novoid / Memacs

What did I do on February 14th 2007? Visualize your (digital) life in Org-mode
GNU General Public License v3.0
1.03k stars 66 forks source link

Shortened ISO 8601 dates not recognized #41

Closed bdillahu closed 7 years ago

bdillahu commented 7 years ago

I'm new here, so please forgive if I'm missing the obvious :-)

I have a variety of files with "shortend" ISO 8601 dates... either just the year, or the year and month - not all files apply to an exact date in my world.

For example:

2017_Alaska_Cruise.org

(the cruise spanned across a month change, so unless I put a range, even a month doesn't fit)

Maybe I'm being too literal with the ISO 8601 thing, but it seems that the standard allows for these dates, but memacs_filenametimestamps seems to just skip them.

Any reason it has to?

Actually, any reason it has to have a date at all and couldn't have an option to include all files (that it's pointed to). I realize that part of the use is to use with orgmode and agenda and dates, but the ability to "link through" to a file, even if just a filename with no date, seems of value.

Thanks! Bruce

novoid commented 7 years ago

Hi bdillahu,

Excellent request.

For your Alaska Cruise issue - for which I envy you - I personally would add the date period to the file.

Memacs was not built to index YYYY mostly because something like 1234 foo.bar (or any four digit number prefix) would be interpreted as year. Most of the time, this did not make any sense at my side for practical reasons.

The ISO standard is fine but it is not applicable in those cases. For example, the standard defines : as character between hours, minutes, and seconds. Unfortunately, Microsoft (an operating system vendor from the USA with a history of questionable design decisions) decided that : must not be part of a file name in their NTFS file system. So I had to leave the strict path of ISO 8601 multiple times.

You question related to why not indexing all files, not only date/time prefixed ones is a really good one. I was tempted to do it for the general case. But there were some issues in practical life. If you index all of your files, the index gets much bigger, resulting in a worse performance. Then there is the issue with file names that are not unique. For example, you most probably will find many README.org or .gitignore or similar file names on your disk. I would have to skip them or add exception handling.

If you find a nice method to include them as well, drop me a line or even better: send a pull request.

As a workaround for now: anybody with minimal knowledge of (shell) scripting is able to come up with an indexing tool that generates your filename Memacs file for all files. Take this as a starting point:

MEMACS_FILE="$HOME/org/files.org_archive"
echo "* My memacs file index generated by ${0}   :memacs:" > "${MEMACS_FILE}"
find "${HOME}" -print0 | \
    xargs -0 -I {} echo "** [[{}]["`/usr/bin/basename "{}"`"]]" \
    >> "${MEMACS_FILE}"