mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-17 15:24:50 +00:00
Add Michael Fogleman's Emacs macro
This commit is contained in:
parent
14f90b9519
commit
e21d558ff0
@ -0,0 +1,26 @@
|
|||||||
|
created: 20140406210404245
|
||||||
|
modified: 20140406210649764
|
||||||
|
tags: tips
|
||||||
|
title: Editing Tiddlers with Emacs
|
||||||
|
type: text/vnd.tiddlywiki
|
||||||
|
|
||||||
|
This [[Emacs|http://www.gnu.org/software/emacs/]] macro from Michael Fogleman simplifies editing tiddlers in `*.tid` files by automatically updating the `modified` field:
|
||||||
|
|
||||||
|
```
|
||||||
|
(defun tid-time ()
|
||||||
|
"If called in a tiddler file, this function updates the metadata to
|
||||||
|
reflect the modification time."
|
||||||
|
(interactive)
|
||||||
|
(when
|
||||||
|
(and
|
||||||
|
(> (length (buffer-file-name)) 4)
|
||||||
|
(string-equal (substring (buffer-file-name) -4) ".tid"))
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
|
||||||
|
(search-forward "modified: ")
|
||||||
|
(beginning-of-line)
|
||||||
|
|
||||||
|
(kill-line)
|
||||||
|
(insert (format-time-string "modified: %Y%m%d%H%M%S%3N")))))
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user