* vc/compare-w.el (compare-windows-whitespace):
[bpt/emacs.git] / lisp / vc / log-view.el
index 9f6ad19..b633b7b 100644 (file)
@@ -1,6 +1,6 @@
 ;;; log-view.el --- Major mode for browsing RCS/CVS/SCCS log output -*- lexical-binding: t -*-
 
-;; Copyright (C) 1999-201 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2013 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: rcs, sccs, cvs, log, vc, tools
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 (require 'pcvs-util)
 (autoload 'vc-find-revision "vc")
 (autoload 'vc-diff-internal "vc")
@@ -246,10 +245,10 @@ The match group number 1 should match the revision number itself.")
   '(log-view-font-lock-keywords t nil nil nil))
 
 (defvar log-view-vc-fileset nil
-  "Set this to the fileset corresponding to the current log.")
+  "The VC fileset corresponding to the current log.")
 
 (defvar log-view-vc-backend nil
-  "Set this to the VC backend that created the current log.")
+  "The VC backend that created the current log.")
 
 ;;;;
 ;;;; Actual code
@@ -318,7 +317,9 @@ Otherwise, don't move point."
        result)
     (save-excursion
       (when pos (goto-char pos))
-      (forward-line 1)
+      (forward-line 0)
+      ;; Treat "---" separator lines as part of the following revision.
+      (forward-line (if (looking-at "-\\{20,\\}$") 2 1))
       (while looping
        (setq pos (re-search-backward log-view-message-re nil 'move)
              looping (and pos (log-view-inside-comment-p (point)))))
@@ -376,6 +377,8 @@ log entries."
       marked-list)))
 
 (defun log-view-toggle-entry-display ()
+  "If possible, expand the current Log View entry.
+This calls `log-view-expanded-log-entry-function' to do the work."
   (interactive)
   ;; Don't do anything unless `log-view-expanded-log-entry-function'
   ;; is defined in this mode.
@@ -419,10 +422,10 @@ It assumes that a log entry starts with a line matching
   (if (or (null arg) (zerop arg))
       (setq arg 1))
   (if (< arg 0)
-      (dotimes (n (- arg))
+      (dotimes (_n (- arg))
        (log-view-end-of-defun))
     (catch 'beginning-of-buffer
-      (dotimes (n arg)
+      (dotimes (_n arg)
        (or (log-view-current-entry nil t)
            (throw 'beginning-of-buffer nil)))
       (point))))
@@ -451,7 +454,7 @@ It assumes that a log entry starts with a line matching
 (defun log-view-minor-wrap (buf f)
   (let ((data (with-current-buffer buf
                (let* ((beg (point))
-                      (end (if mark-active (mark) (point)))
+                      (end (if (use-region-p) (mark) (point)))
                       (fr (log-view-current-tag beg))
                       (to (log-view-current-tag end)))
                  (when (string-equal fr to)
@@ -536,15 +539,17 @@ It assumes that a log entry starts with a line matching
 
 (defun log-view-diff (beg end)
   "Get the diff between two revisions.
-If the mark is not active or the mark is on the revision at point,
-get the diff between the revision at point and its previous revision.
-Otherwise, get the diff between the revisions where the region starts
-and ends.
-Contrary to `log-view-diff-changeset', it will only show the part of the
-changeset that affected the currently considered file(s)."
+If the region is inactive or the mark is on the revision at
+point, get the diff between the revision at point and its
+previous revision.  Otherwise, get the diff between the revisions
+where the region starts and ends.
+
+Unlike `log-view-diff-changeset', this function only shows the
+part of the changeset which affected the currently considered
+file(s)."
   (interactive
-   (list (if mark-active (region-beginning) (point))
-         (if mark-active (region-end) (point))))
+   (list (if (use-region-p) (region-beginning) (point))
+         (if (use-region-p) (region-end) (point))))
   (let ((fr (log-view-current-tag beg))
         (to (log-view-current-tag end)))
     (when (string-equal fr to)
@@ -559,20 +564,19 @@ changeset that affected the currently considered file(s)."
               log-view-vc-fileset))
      to fr)))
 
-(declare-function vc-diff-internal "vc"
-                 (async vc-fileset rev1 rev2 &optional verbose))
-
 (defun log-view-diff-changeset (beg end)
   "Get the diff between two revisions.
-If the mark is not active or the mark is on the revision at point,
-get the diff between the revision at point and its previous revision.
-Otherwise, get the diff between the revisions where the region starts
-and ends.
-Contrary to `log-view-diff', it will show the whole changeset including
-the changes that affected other files than the currently considered file(s)."
+If the region is inactive or the mark is on the revision at
+point, get the diff between the revision at point and its
+previous revision.  Otherwise, get the diff between the revisions
+where the region starts and ends.
+
+Unlike `log-view-diff' this function shows the whole changeset,
+including changes affecting other files than the currently
+considered file(s)."
   (interactive
-   (list (if mark-active (region-beginning) (point))
-         (if mark-active (region-end) (point))))
+   (list (if (use-region-p) (region-beginning) (point))
+         (if (use-region-p) (region-end) (point))))
   (when (eq (vc-call-backend log-view-vc-backend 'revision-granularity) 'file)
     (error "The %s backend does not support changeset diffs" log-view-vc-backend))
   (let ((fr (log-view-current-tag beg))