emacs-devel
[Top][All Lists]
Advanced

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

Re: diff-apply-hunk broken


From: Juri Linkov
Subject: Re: diff-apply-hunk broken
Date: Thu, 25 Mar 2004 23:53:17 +0200
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

Sam Steingold <address@hidden> writes:
> in a modified CVS file, I do C-x v = (vc-diff) and in the resulting
> *vc-diff* buffer I do C-c C-a (diff-apply-hunk) to reverse the section

BTW, what do you think about the following problem?

The problem is that the function `log-view-diff' can correctly work
when her arguments `beg' and `end' are located on the same point.
In this case it makes diffs with the next revision.  But calling
the function is impossible when region is not active.  Due to the "r"
interactive code letter it reports an error about mark-inactive.
This is too inconvenient.

This patch makes it possible to call this function even if region
is not active.

Maybe, a better solution could be to add a new code letter e.g. "R" to
the `interactive' which will work like "r", but will be less restrictive
and will allow a function to be called when region is inactive and
will set both its arguments `beg' and `end' to the current point.
This might be useful for some other functions too, where it makes sense
to call a function either on the selected region or the current point.

Index: emacs/lisp/log-view.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/log-view.el,v
retrieving revision 1.17
diff -c -r1.17 log-view.el
*** emacs/lisp/log-view.el      1 Sep 2003 15:45:13 -0000       1.17
--- emacs/lisp/log-view.el      25 Mar 2004 21:13:11 -0000
***************
*** 192,198 ****
  If the point is the same as the mark, get the diff for this revision.
  Otherwise, get the diff between the revisions
   were the region starts and ends."
!   (interactive "r")
    (let ((fr (log-view-current-tag beg))
          (to (log-view-current-tag end)))
      (when (string-equal fr to)
--- 192,200 ----
  If the point is the same as the mark, get the diff for this revision.
  Otherwise, get the diff between the revisions
   were the region starts and ends."
!   (interactive
!    (list (if mark-active (region-beginning) (point))
!          (if mark-active (region-end) (point))))
    (let ((fr (log-view-current-tag beg))
          (to (log-view-current-tag end)))
      (when (string-equal fr to)

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

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