Jeremy,

I'd be honored. Here's a better version:

(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")))))


(That searches for the "modified: " string instead of assuming it's on the 
second line.)

Could you write some documentation for how to set Emacs (or Vim) 
keybindings with CodeMirror? Last time I tried the CodeMirror documentation 
confused me, and I couldn't find TiddlyWiki docs for it.

On Sunday, April 6, 2014 10:28:52 PM UTC+5:30, Jeremy Ruston wrote:
>
> Hi Michael
>
> That's cool. I use SublimeText, and have often wished for a macro that 
> does this.
>
> May I include your code on tiddlywiki.com?
>
> Many thanks,
>
> Jeremy
>
>
>
> On Sun, Apr 6, 2014 at 12:07 PM, Michael Fogleman 
> <[email protected]<javascript:>
> > wrote:
>
>> I have been editing .tid files in Emacs, and wrote some Elisp to update 
>> the modified time:
>>
>> (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))
>>         (forward-line)
>> (kill-line)
>> (insert (format-time-string "modified: %Y%m%d%H%M%S%3N")))))
>>
>> I should probably make some modifications to it, including searching for 
>> the "modified" in case it is not the second line.
>>
>> Anybody else using Emacs to edit .tid files? I haven't figured out how to 
>> get CodeMirror to use Emacs bindings yet.
>>  
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "TiddlyWiki" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/tiddlywiki.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Jeremy Ruston
> mailto:[email protected] <javascript:>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to