Stephen Leake <[EMAIL PROTECTED]> writes:
> Matthieu Moy <[EMAIL PROTECTED]> writes:
>
>> On that particular point, it's just because I didn't manage to get it
>> right, but it'd be better to have some additional items in the same
>> menu. That's not totally trivial to do, since you want to add the
>> items for that particular instance of the menu, and not for the same
>> menu in other back-ends (i.e. The DVC-Diff menu a *bzr-status*
>> buffer).
>
> Right. I think you have to recompute the menu each time it is
> displayed (possible but inefficient) or make the menu buffer-local (I
> don't know if that is possible).
>
> Adding back-end specific stuff in a new top level menu is probably better.
Simpler for us (DVC developpers), but increasing the risk for users
not to notice this additional top-level menu.
> Hmm. I don't understand how that avoids showing up in other
> dvc-diff-mode buffers; I really don't understand how Emacs menus work
> at this level.
With my code, that's indeed trivial. xgit-diff-mode defines an
additional menu, but defining a new mode with define-derived-mode
doesn't change the existing mode. define-derived-mode does the right
thing to have two maps overriding each other.
>>> So maybe if we have a policy that says:
>>>
>>> "<back-end>-dvc-diff-mode" should be derived from dvc-diff-mode
>>> (via define-derived-mode), and only extend the menu and keymap
>>> (see xgit.el for a good example).
>>
>> Why not.
>
> Ok. Which leaves the question of where to put this statement.
>
> I guess in a comment at the definition of dvc-diff-mode would be the
> best place.
I've just added a note (slightly adapted from your version, but
restricting the extension to menu and keymap can be too restrictive, I
can very well imagine adding some font-lock stuff here too for
example).
I also added a more general comment in DVC-API, with a reference to
it. For info, the patch is below (but I've already commited it, no
need to apply)
=== modified file 'docs/DVC-API'
--- docs/DVC-API 2007-09-17 20:38:12 +0000
+++ docs/DVC-API 2007-09-22 16:38:55 +0000
@@ -111,3 +111,31 @@
dvc-revision-get-file-in-buffer: get the particular revision of a file
in a buffer.
+
+-----------------------------------------------------------------------------
+* Back-end specific features Vs Unification
+-----------------------------------------------------------------------------
+
+DVC provides the user an interface for multiple revision control
+system, and does it using as much back-end indepentant code as
+possible. This has several benefits :
+
+* For the user:
+ - Similar user-interface, keybindings, ... for different back-ends.
+ - Unified interface for most operations : one menu, one set of
+ keybindings, and DVC detects which back-end to use automatically.
+
+* For the developpers:
+ - much less code to write than individual, indepentant interfaces.
+
+However, some back-end features do not fit well in the DVC common
+interface. For example, git differs from other common version control
+systems in several regards (the index, for example, is something
+probably unique to git, and it leads to a different flow to prepare a
+commit).
+
+In this case, there's nothing wrong providing additional functions,
+which might not have a dvc-* dispatching command. The user can call
+them with M-x <back-end>-command RET explicitely. Additionaly, one can
+extend some DVC modes with additional keybindings and menus. See
+`dvc-diff-mode' and `xgit-diff-mode' for an example.
=== modified file 'lisp/dvc-diff.el'
--- lisp/dvc-diff.el 2007-09-20 18:49:38 +0000
+++ lisp/dvc-diff.el 2007-09-22 16:41:31 +0000
@@ -268,6 +268,11 @@
map)
"Keymap used on files in `dvc-diff-mode' buffers.")
+;; "<back-end>-diff-mode", if defined, will be used instead of this
+;; one. If so, it should be derived from dvc-diff-mode (via
+;; `define-derived-mode'), and rely on it for as many features as
+;; possible (one can, for example, extend the menu and keymap). See
+;; `xgit-diff-mode' in xgit.el for a good example.
(define-derived-mode dvc-diff-mode fundamental-mode "dvc-diff"
"Major mode to display changesets. Derives from `diff-mode'.
--
Matthieu
_______________________________________________
Dvc-dev mailing list
[email protected]
https://mail.gna.org/listinfo/dvc-dev