unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#44534: [PATCH] Remove extra process call from vc-hg-registered
@ 2020-11-09 11:54 Tom Fitzhenry via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2020-11-10 15:45 ` Dmitry Gutov
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Fitzhenry via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-11-09 11:54 UTC (permalink / raw)
  To: 44534


[-- Attachment #1.1: Type: text/plain, Size: 254 bytes --]

Prefer calling vc-state (rather than vc-hg-state) to benefit from the
caching in vc-state.

This same technique is used in vc-git.el, per commit "2018-06-28 "Remove
extra process call from vc-git-find-file-hook"
93c41ce6aa64b14fc9bd7bdd0d909915a79191cd.

[-- Attachment #1.2: Type: text/html, Size: 301 bytes --]

[-- Attachment #2: 0001-Remove-extra-process-call-from-vc-hg-registered.patch --]
[-- Type: text/x-patch, Size: 1150 bytes --]

From 676bfaf89ddd8450e395251762a4153556def2f2 Mon Sep 17 00:00:00 2001
From: Tom Fitzhenry <tomfitzhenry@google.com>
Date: Mon, 9 Nov 2020 22:19:10 +1100
Subject: [PATCH] Remove extra process call from vc-hg-registered

Prefer vc-state to benefit from its caching.

This same technique is used in vc-git.el, per commit "2018-06-28 "Remove extra process call from vc-git-find-file-hook" 93c41ce6aa64b14fc9bd7bdd0d909915a79191cd.

* lisp/vc/vc-hg.el (vc-hg-registered): Use vc-state rather than vc-hg-state.
---
 lisp/vc/vc-hg.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index cb0657e70a..cacdee2226 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -222,7 +222,7 @@ If `ask', you will be prompted for a branch type."
 (defun vc-hg-registered (file)
   "Return non-nil if FILE is registered with hg."
   (when (vc-hg-root file)           ; short cut
-    (let ((state (vc-hg-state file)))  ; expensive
+    (let ((state (vc-state file 'Hg)))  ; expensive
       (and state (not (memq state '(ignored unregistered)))))))
 
 (defun vc-hg-state (file)
-- 
2.29.2.222.g5d2a92d10f8-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#44534: [PATCH] Remove extra process call from vc-hg-registered
  2020-11-09 11:54 bug#44534: [PATCH] Remove extra process call from vc-hg-registered Tom Fitzhenry via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2020-11-10 15:45 ` Dmitry Gutov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Gutov @ 2020-11-10 15:45 UTC (permalink / raw)
  To: Tom Fitzhenry, 44534-done

Version: 28.1

On 09.11.2020 13:54, Tom Fitzhenry via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
> Prefer calling vc-state (rather than vc-hg-state) to benefit from the 
> caching in vc-state.
> 
> This same technique is used in vc-git.el, per commit "2018-06-28 "Remove 
> extra process call from vc-git-find-file-hook" 
> 93c41ce6aa64b14fc9bd7bdd0d909915a79191cd.

Makes sense, thanks! Pushed.

P.S. Next time please try to keep the line width within usual limits, I 
had to fix the following linter errors:

Line longer than 78 characters in commit message
Word longer than 140 characters in commit message
Commit aborted; please see the file CONTRIBUTE





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-10 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-09 11:54 bug#44534: [PATCH] Remove extra process call from vc-hg-registered Tom Fitzhenry via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-11-10 15:45 ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).