help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: vc.el and modified time


From: Rasmus
Subject: Re: vc.el and modified time
Date: Wed, 27 Apr 2016 19:17:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Hi Stefan,

Stefan Monnier <address@hidden> writes:

>> My first attempt is below, but I’m not entirely happy with it.  First, it
>> is intrusive as it might overwrite the user’s *vc-change-log*.
>
> You can avoid hardcoding it by using
>
>    (vc-call print-log file <buf> ...)
>
> See lisp/vc/vc.el's commentary where it describes
>
>     ;; * print-log (files buffer &optional shortlog start-revision limit)
>     ;;
>     ;;   Insert the revision log for FILES into BUFFER.
>     ;;   If SHORTLOG is true insert a short version of the log.
>     ;;   If LIMIT is true insert only insert LIMIT log entries.  If the
>     ;;   backend does not support limiting the number of entries to show
>     ;;   it should return `limit-unsupported'.
>     ;;   If START-REVISION is given, then show the log starting from that
>     ;;   revision ("starting" in the sense of it being the _newest_
>     ;;   revision shown, rather than the working revision, which is normally
>     ;;   the case).  Not all backends support this.  At present, this is
>     ;;   only ever used with LIMIT = 1 (by
>     ;;   vc-annotate-show-log-revision-at-line).

Brilliant!  I read that part, but I didn’t understand since the signature
of vc-print-log didn’t have a buffer argument (only the vc-backend-log
functions).  Thanks for showing me how to use vc-call!

>> Second, *vc-change-log* is build asynchronously, at least sometimes,
>> and I don’t know how I can check if it’s done.
>
> You can do
>
>    (with-current-buffer <buf>
>      (vc-exec-after
>       (lambda ()
>         <the-code-to-run-after-print-log-is-done>)))

Cool, thanks!

> [ Here, I presume you're using -*- lexical-binding:t -*-, which I strongly
>   recommend.  ]

Yes.

Thanks for the hints!

Rasmus

-- 
You people at the NSA are becoming my new best friends!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]