* how to `register' vc-hg-region-history in vc-region-history?
@ 2018-01-18 14:27 Uwe Brauer
2018-01-18 14:46 ` Dmitry Gutov
2018-01-18 14:51 ` Stefan Monnier
0 siblings, 2 replies; 6+ messages in thread
From: Uwe Brauer @ 2018-01-18 14:27 UTC (permalink / raw)
To: emacs-devel
Hi
I just tried out a new function
(right now I don't care much about keybinding and font locking
So the function
(defun vc-hg-region-history (file buffer lfrom lto)
Seems a natural generalization of vc-git-region-history However I
don't see how to tell vc-region-history to tell that the new
function now exists. I tried to debug it
(defun vc-region-history (from to)
(vc-call region-history file buf lfrom lto)
And there vc aborts for HG. What do I miss?
Uwe Brauer
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how to `register' vc-hg-region-history in vc-region-history?
2018-01-18 14:27 how to `register' vc-hg-region-history in vc-region-history? Uwe Brauer
@ 2018-01-18 14:46 ` Dmitry Gutov
2018-01-18 14:51 ` Stefan Monnier
1 sibling, 0 replies; 6+ messages in thread
From: Dmitry Gutov @ 2018-01-18 14:46 UTC (permalink / raw)
To: emacs-devel
On 1/18/18 17:27, Uwe Brauer wrote:
>
> Hi
>
> I just tried out a new function
> (right now I don't care much about keybinding and font locking
>
> So the function (defun vc-hg-region-history (file buffer lfrom lto)
> Seems a natural generalization of vc-git-region-history However I don't
> see how to tell vc-region-history to tell that the new function now
> exists. I tried to debug it
>
>
> (defun vc-region-history (from to) (vc-call region-history file buf
> lfrom lto)
> And there vc aborts for HG. What do I miss?
You also need vc-hg-region-history-mode. vc-region-history calls it.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how to `register' vc-hg-region-history in vc-region-history?
2018-01-18 14:27 how to `register' vc-hg-region-history in vc-region-history? Uwe Brauer
2018-01-18 14:46 ` Dmitry Gutov
@ 2018-01-18 14:51 ` Stefan Monnier
2018-01-18 15:13 ` Stefan Monnier
2018-01-18 16:14 ` Uwe Brauer
1 sibling, 2 replies; 6+ messages in thread
From: Stefan Monnier @ 2018-01-18 14:51 UTC (permalink / raw)
To: emacs-devel
Uwe Brauer <oub@mat.ucm.es> writes:
> Seems a natural generalization of vc-git-region-history However I don't see
> how to tell vc-region-history to tell that the new function now
> exists.
VC automatically discovers that. But it also remembers what it failed
to find, os if you had tried vc-region-history in the same session
before defining that function, you need to
(put 'HG 'vc-functions nil)
to flush VC's cache of known backend functions.
Not sure why this line is missing from vc-hg.el, contrarily to, say, vc-cvs.el.
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how to `register' vc-hg-region-history in vc-region-history?
2018-01-18 14:51 ` Stefan Monnier
@ 2018-01-18 15:13 ` Stefan Monnier
2018-01-18 16:14 ` Uwe Brauer
1 sibling, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2018-01-18 15:13 UTC (permalink / raw)
To: emacs-devel
> (put 'HG 'vc-functions nil)
^^^
'Hg
I plan on installing the patch below into master as soon as
git.sv.gnu.org responds again,
Stefan
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 626cf6165a..2d6ca1386a 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -183,6 +183,10 @@ vc-git-log-output-coding-system
;; History of Git commands.
(defvar vc-git-history nil)
+;; Clear up the cache to force vc-call to check again and discover
+;; new functions when we reload this file.
+(put 'Git 'vc-functions nil)
+
;;; BACKEND PROPERTIES
(defun vc-git-revision-granularity () 'repository)
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 08b1be8f6d..ad817fd9b9 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -175,6 +175,10 @@ vc-hg-root-log-format
:version "24.5")
\f
+;; Clear up the cache to force vc-call to check again and discover
+;; new functions when we reload this file.
+(put 'Hg 'vc-functions nil)
+
;;; Properties of the backend
(defvar vc-hg-history nil)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: how to `register' vc-hg-region-history in vc-region-history?
2018-01-18 14:51 ` Stefan Monnier
2018-01-18 15:13 ` Stefan Monnier
@ 2018-01-18 16:14 ` Uwe Brauer
2018-01-19 1:47 ` Stefan Monnier
1 sibling, 1 reply; 6+ messages in thread
From: Uwe Brauer @ 2018-01-18 16:14 UTC (permalink / raw)
To: emacs-devel
>>> "Stefan" == Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Uwe Brauer <oub@mat.ucm.es> writes:
>> Seems a natural generalization of vc-git-region-history However I don't see
>> how to tell vc-region-history to tell that the new function now
>> exists.
> VC automatically discovers that. But it also remembers what it failed
> to find, os if you had tried vc-region-history in the same session
> before defining that function, you need to
> (put 'HG 'vc-functions nil)
That is what I was looking for.
I can test my function now.
But alas, I don't understand enough of git.
The git function has the following call
(vc-call-backend 'hg 'diff file "HEAD" nil (current-buffer))
Mercurial has no HEAD as part of a command. Would that be tip for
mercurial? What do the vc-hg.el authors say?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: how to `register' vc-hg-region-history in vc-region-history?
2018-01-18 16:14 ` Uwe Brauer
@ 2018-01-19 1:47 ` Stefan Monnier
0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2018-01-19 1:47 UTC (permalink / raw)
To: emacs-devel
> (vc-call-backend 'hg 'diff file "HEAD" nil (current-buffer))
The purpose of this call is to get the diff between the current file's
contents and the contents of the version in which "git log -L" will
interpret the line numbers.
> Mercurial has no HEAD as part of a command. Would that be tip for
> mercurial?
Probably, but it depends on what version is used by `hg` when it
interprets the line numbers of `hg log -fp -L foo.c,10:20`.
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-01-19 1:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-18 14:27 how to `register' vc-hg-region-history in vc-region-history? Uwe Brauer
2018-01-18 14:46 ` Dmitry Gutov
2018-01-18 14:51 ` Stefan Monnier
2018-01-18 15:13 ` Stefan Monnier
2018-01-18 16:14 ` Uwe Brauer
2018-01-19 1:47 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.