[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [patch] get modification-time from vc
From: |
Nicolas Goaziou |
Subject: |
Re: [O] [patch] get modification-time from vc |
Date: |
Sat, 30 Apr 2016 23:43:38 +0200 |
Hello,
Rasmus <address@hidden> writes:
> The file system modification time as accessed by {{{modification-time}}}
> is often wrong, e.g. when a project is newly cloned or if the file has
> been copied in a sloppy manner. At least if modification time suggest the
> time that the file was edited by an author.
>
> Sometimes vc can provide a better answer. The attached patch tries to get
> a sensible time from vc.
Thank you for the patch.
> WDYT?
Well, if you ask, I do not like much when some software tries to
outsmart me (note that I like it even less when it actually succeeds).
So, I think {{{modification-time}}} should expand to modification time.
If you think that is useful, then I vote for a different macro.
Usual nitpicking follows.
> + (when (search-forward-regexp
> "Date:?[ \t]*" nil t)
Any reason not to use the genuine `re-search-forward'?
Is the search case sensitive? I suggest to bind appropriately
`case-fold-search' in any case.
> + (let ((time (parse-time-string
> + (buffer-substring
> + (point)
> (point-at-eol)))))
Any reason not to use the genuine `line-end-position'?
> + (when (org-some 'identity
> time)
(cl-some #'identity time)
> + (setq date (apply
> 'encode-time time))))))))
(setq date (apply #'encode-time time))
> + (let ((proc (get-buffer-process buf)))
> + (while (and proc
> (accept-process-output proc .5 nil t))))
> + (kill-buffer " *org-vc*")
(kill-buffer buf)
However, I suggest to use `unwind-protect' for this and kill-buffer
during as an unwind form.
Also, I suggest to factor this code out of
`org-macro-initialize-templates'.
Regards,
--
Nicolas Goaziou