emacs-devel
[Top][All Lists]
Advanced

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

Re: HG, git and others actualize the modeline when commit form the comma


From: Uwe Brauer
Subject: Re: HG, git and others actualize the modeline when commit form the command line
Date: Tue, 17 Nov 2020 08:21:19 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Uwe Brauer <oub@mat.ucm.es> writes:

> I use those functions on a magit fork of mine (for updating the modeline
> after certain magit commands) but, for your use case, IMO a command like
> your example above is what you need. You can even travel the buffer
> list, so you don't need to execute the command for every buffer that
> might be affected:

>   (dolist (buffer (buffer-list))
>     (when (string-prefix-p (expand-file-name default-directory)
>                            (buffer-file-name buffer))
>       (with-current-buffer buffer
>         (with-demoted-errors "Error mientras revirtiendo (ignorado) %S"
>           (if (and vc-mode (buffer-stale--default-function t)
>                    (not (buffer-modified-p)))
>               (revert-buffer t t)
>             (vc-file-clearprops buffer-file-name)
>             (vc-state-refresh buffer-file-name 'Git)
>             (vc-mode-line buffer-file-name 'Git))))))

> The code above travels the buffers and, for each buffer which is
> visiting a file under the current directory or its childs, either
> reverts the buffer (if it is not modified and its contents might have
> changed) or just updates the modeline.

Thanks


> As you also use Hg, you need to adapt the code for using the correct
> backeng on each case: (vc-backend buffer-file-name) looks like the
> correct thing, but I didn't test it.

Well replacing  Git by Hg does the thing!


Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

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