unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* New Function vc-annotate-chosen-revision - PATCH
@ 2004-09-10 21:29 jbyler+emacs-lists
  2004-09-10 21:48 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: jbyler+emacs-lists @ 2004-09-10 21:29 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1356 bytes --]

Hi folks,

Included is a very simple patch to vc.el which implements a useful
addition to the vc annotate functionality: the ability to jump to a
specific version prompted for via the minibuffer.  Among other things,
this is useful because it lets you jump to a named tag or branch.

I would appreciate it if someone would check this in to CVS, as it's a
low risk change that could be useful to a lot of people who will be
using 21.4.  If you need a statement of assignment of copyright for
these 9 lines of code, just let me know what it should look like. 
Here's a possible ChangeLog entry:

2004-08-27  First Last <email@address>

        * vc.el (vc-annotate-chosen-revision): New function. 

Thanks,
Jesse

----- Original message -----
From: jbyler+emacs-lists@anon41.eml.cc
To: emacs-pretest-bug@gnu.org
Date: Fri, 27 Aug 2004 16:46:11 -0400
Subject: New Function vc-annotate-chosen-revision

Hi all,

I just discovered the new functionality added to vc-annotate back in
January, and it's GREAT! - very handy features (viewing logs & diffs &
changing versions).

One thing I thought would augment it a little would be the ability to
jump to an arbitrary revision.  Since the code is all so nicely modular
it was a snap to write; I'm including a patch to vc.el in the hopes that
it can be installed in CVS for inclusion in emacs 21.4.

Thanks!
-Jesse

[-- Attachment #2: vc.el-patch --]
[-- Type: application/octet-stream, Size: 1365 bytes --]

Index: vc.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc.el,v
retrieving revision 1.377
diff -c -r1.377 vc.el
*** vc.el	23 Apr 2004 21:02:23 -0000	1.377
--- vc.el	27 Aug 2004 20:41:18 -0000
***************
*** 661,666 ****
--- 661,667 ----
  (define-key vc-annotate-mode-map "N" 'vc-annotate-next-version)
  (define-key vc-annotate-mode-map "P" 'vc-annotate-prev-version)
  (define-key vc-annotate-mode-map "W" 'vc-annotate-workfile-version)
+ (define-key vc-annotate-mode-map "V" 'vc-annotate-chosen-version)
  
  (defvar vc-annotate-mode-menu nil
    "Local keymap used for VC-Annotate mode's menu bar menu.")
***************
*** 3112,3117 ****
--- 3113,3127 ----
  	  (message "Already at version %s" warp-rev)
  	(vc-annotate-warp-version warp-rev)))))
  
+ (defun vc-annotate-chosen-version ()
+   "Visit the annotation of this file for a version selected via the minibuffer"
+   (interactive)
+   (let* ((rev (vc-annotate-extract-revision-at-line))
+          (chosen-rev (read-string
+ 		      (format "Annotate from version: (default %s) " rev)
+ 		      nil nil rev)))
+     (vc-annotate-warp-version chosen-rev)))
+ 
  (defun vc-annotate-extract-revision-at-line ()
    "Extract the revision number of the current line."
    ;; This function must be invoked from a buffer in vc-annotate-mode

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

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

* Re: New Function vc-annotate-chosen-revision - PATCH
  2004-09-10 21:29 New Function vc-annotate-chosen-revision - PATCH jbyler+emacs-lists
@ 2004-09-10 21:48 ` Stefan Monnier
  2004-09-11 18:46   ` jbyler+emacs-lists
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2004-09-10 21:48 UTC (permalink / raw)
  Cc: Emacs Devel List

>         * vc.el (vc-annotate-chosen-revision): New function. 

But C-u C-x v g does basically just that, no?


        Stefan


PS: Please be careful not to label attachments as application/octet-stream.

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

* Re: New Function vc-annotate-chosen-revision - PATCH
  2004-09-10 21:48 ` Stefan Monnier
@ 2004-09-11 18:46   ` jbyler+emacs-lists
  2004-09-11 21:22     ` Stefan
  0 siblings, 1 reply; 5+ messages in thread
From: jbyler+emacs-lists @ 2004-09-11 18:46 UTC (permalink / raw)


On Fri, 10 Sep 2004 17:48:24 -0400, "Stefan Monnier" said:
> >         * vc.el (vc-annotate-chosen-revision): New function. 
> 
> But C-u C-x v g does basically just that, no?

Well, C-u C-x v g does a similar thing but in a different context: it
lets you annotate a chosen revision of the file in the current buffer. 
My new function lets you annotate a chosen revision of the file
*annotated* in the current buffer.  It is meant to be analogous to
vc-annotate-next-version, vc-annotate-prev-version, and
vc-annotate-workfile-version - new functions added in January (I think)
to allow convenient navigation in an annotation buffer.  Now you can
type N, P, or W in an annotate buffer to move to the Next, Previous, or
Workfile version, and I wanted to be able to type V to jump to any
arbitrary version.

-Jesse

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

* Re: New Function vc-annotate-chosen-revision - PATCH
  2004-09-11 18:46   ` jbyler+emacs-lists
@ 2004-09-11 21:22     ` Stefan
  2004-09-12 17:30       ` jbyler+emacs-lists
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan @ 2004-09-11 21:22 UTC (permalink / raw)
  Cc: Emacs Devel List

>> But C-u C-x v g does basically just that, no?

> Well, C-u C-x v g does a similar thing but in a different context: it
> lets you annotate a chosen revision of the file in the current buffer.
> My new function lets you annotate a chosen revision of the file
> *annotated* in the current buffer.

But C-u C-x v g does basically just that (except that it *also* works in
non-annotated buffers, and it doesn't give the same default in the prompt,
and it's bound to a different key), doesn't it?


        Stefan

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

* Re: New Function vc-annotate-chosen-revision - PATCH
  2004-09-11 21:22     ` Stefan
@ 2004-09-12 17:30       ` jbyler+emacs-lists
  0 siblings, 0 replies; 5+ messages in thread
From: jbyler+emacs-lists @ 2004-09-12 17:30 UTC (permalink / raw)


On Sat, 11 Sep 2004 17:22:24 -0400, "Stefan" <monnier@iro.umontreal.ca>
said:
> >> But C-u C-x v g does basically just that, no?
>
> > Well, C-u C-x v g does a similar thing but in a different context:
> > it lets you annotate a chosen revision of the file in the current
> > buffer. My new function lets you annotate a chosen revision of the
> > file *annotated* in the current buffer.
>
> But C-u C-x v g does basically just that (except that it *also* works
> in non-annotated buffers, and it doesn't give the same default in the
> prompt, and it's bound to a different key), doesn't it?

My apologies, you're right.  I guess I assumed C-u C-x v g wouldn't work
in an annotation buffer, but since it does, my new function seems a
little less useful.

I will still use vc-annotate-chosen-version because I can cut down on
keystrokes by binding it to a single key in vc-annotate-mode-map (easily
- no prefix arg needed), and emacs users who don't know elisp might
appreciate this too.  But if the consensus is that it's not generally
useful enough to be included in emacs, I'll just keep it in my own
.emacs file.

Thanks,
-Jesse

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

end of thread, other threads:[~2004-09-12 17:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-10 21:29 New Function vc-annotate-chosen-revision - PATCH jbyler+emacs-lists
2004-09-10 21:48 ` Stefan Monnier
2004-09-11 18:46   ` jbyler+emacs-lists
2004-09-11 21:22     ` Stefan
2004-09-12 17:30       ` jbyler+emacs-lists

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).