[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: |
Wed, 18 May 2016 18:45:06 +0200 |
Hello,
Rasmus <address@hidden> writes:
> Here’s a new version.
Thank you.
> New idea, an optional 2nd argument to modification-time. E.g.
>
> {{{modification-time(%Y, vc)}}}
Even better!
>> If you think that is useful, then I vote for a different macro.
>
> I prefer an argument as it gives a clear ranking: get the modified time
> from vc, if possible (if the second argument is vc), otherwise get it from
> the file system (also default behavior).
Why enforcing "vc" and not any non-nil/non-empty second argument instead ?
> Is cl-lib OK now?!
cl-lib is OK in master. Minimal requirement for master is Emacs 24.3.
> +the modification date and time, respectively. @var{FORMAT} should be a
> +format string understood by @code{format-time-string}. If the second
> +argument to the @code{modification-time} macro is @samp{vc}, Org will try to
> +find the modification time via version control (using @code{vc.el}).
Suggestion:
Org retrieves the information from the version control system (using
@file{vc.el}) instead of the file attributes.
> + (format "(eval (format-time-string \"$1\" (or (when
> (equal (org-trim (downcase \"$2\")) \"vc\") (org-macro--vc-modified-time %s))
> '%s)))"
when => and
> + (when (cl-some 'identity time)
> + (setq date (apply #'encode-time time))))))))
Why #'encode-time and not #'identity ?
In any case, this looks good. Please push when you're happy with the
result.
Regards,
--
Nicolas Goaziou