From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [patch] get modification-time from vc Date: Wed, 18 May 2016 18:45:06 +0200 Message-ID: <8737pfxqlp.fsf@saiph.selenimh> References: <877ffhn3gz.fsf@gmx.us> <87shy2ydpx.fsf@saiph.selenimh> <87k2irad3q.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b34ax-0000Em-Qh for emacs-orgmode@gnu.org; Wed, 18 May 2016 12:45:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b34aw-0002qM-MK for emacs-orgmode@gnu.org; Wed, 18 May 2016 12:45:15 -0400 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:55775) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b34aw-0002qE-FM for emacs-orgmode@gnu.org; Wed, 18 May 2016 12:45:14 -0400 In-Reply-To: <87k2irad3q.fsf@gmx.us> (rasmus@gmx.us's message of "Wed, 18 May 2016 12:12:57 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Rasmus Cc: emacs-orgmode@gnu.org Hello, Rasmus writes: > Here=E2=80=99s 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 tr= y 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-tri= m (downcase \"$2\")) \"vc\") (org-macro--vc-modified-time %s)) '%s)))" when =3D> 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, --=20 Nicolas Goaziou