]> git.eshelyaron.com Git - emacs.git/commitdiff
(log-view-toggle-mark-entry): New function.
authorDan Nicolaescu <dann@ics.uci.edu>
Fri, 24 Aug 2007 17:28:00 +0000 (17:28 +0000)
committerDan Nicolaescu <dann@ics.uci.edu>
Fri, 24 Aug 2007 17:28:00 +0000 (17:28 +0000)
(log-view-mode-map): Bind it.
(log-view-marked-list): New variable.
(log-view-mode): Make it local.

lisp/ChangeLog
lisp/log-view.el

index 808e99af21fdc785b2643d28e5799f7d11a5f56b..ccf7d130c5231702a27d4d6a6a96c705b4f39f5d 100644 (file)
@@ -1,3 +1,10 @@
+2007-08-24  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * log-view.el (log-view-toggle-mark-entry): New function.
+       (log-view-mode-map): Bind it.
+       (log-view-marked-list): New variable.
+       (log-view-mode): Make it local.
+
 2007-08-24  Thien-Thi Nguyen  <ttn@gnuvola.org>
 
        * play/zone.el (zone-pgm-rat-race): New func.
index 51861da2ae623d6e07d84790a76e93595468d825..4ff80ff21a592d671fc91022e8a660a59470166f 100644 (file)
@@ -89,7 +89,7 @@
 (easy-mmode-defmap log-view-mode-map
   '(("q" . quit-window)
     ("z" . kill-this-buffer)
-    ("m" . set-mark-command)
+    ("m" . log-view-toggle-mark-entry)
     ;; ("e" . cvs-mode-edit-log)
     ("d" . log-view-diff)
     ("f" . log-view-find-version)
@@ -178,6 +178,8 @@ The match group number 1 should match the revision number itself.")
 (defconst log-view-font-lock-defaults
   '(log-view-font-lock-keywords t nil nil nil))
 
+(defvar log-view-marked-list nil)
+
 ;;;;
 ;;;; Actual code
 ;;;;
@@ -186,6 +188,7 @@ The match group number 1 should match the revision number itself.")
 (define-derived-mode log-view-mode fundamental-mode "Log-View"
   "Major mode for browsing CVS log output."
   (setq buffer-read-only t)
+  (make-local-variable 'log-view-marked-list)
   (set (make-local-variable 'font-lock-defaults) log-view-font-lock-defaults)
   (set (make-local-variable 'cvs-minor-wrap-function) 'log-view-minor-wrap))
 
@@ -237,6 +240,43 @@ The match group number 1 should match the revision number itself.")
          (unless (re-search-forward log-view-file-re pt t)
            rev))))))
 
+(defun log-view-toggle-mark-entry ()
+  "Toggle marking for on log entry."
+  (interactive)
+  (save-excursion
+    (forward-line 1)
+    (let ((pt (point)))
+      (when (re-search-backward log-view-message-re nil t)
+       (let ((beg (match-beginning 0))
+             end ov ovlist found tag)
+         (unless (re-search-forward log-view-file-re pt t)
+           ;; Look to see if the current entry is marked by looking
+           ;; at the overlays at point.
+           (setq ovlist (overlays-at (point)))
+           (dolist (ovl ovlist)
+             (when (overlay-get ovl 'log-view-marked)
+               (setq found ovl)))
+           (if found
+               (progn
+                 ;; Remove this entry from the marked list and remove
+                 ;; the overlay.
+                 (setq log-view-marked-list 
+                       (delq (overlay-get found 'log-view-marked)
+                             log-view-marked-list))
+                 (delete-overlay found))
+             ;; Add this entry to the marked list and create an
+             ;; overlay that covers it.
+             (setq tag (log-view-current-tag (point)))
+             (push tag log-view-marked-list)
+             (forward-line 1)
+             (setq end 
+                   (if (re-search-forward log-view-message-re nil t)
+                       (match-beginning 0)
+                     (point-max)))
+             (setq ov (make-overlay beg end))
+             (overlay-put ov 'face 'log-view-file)
+             (overlay-put ov 'log-view-marked tag))))))))
+
 (defvar cvs-minor-current-files)
 (defvar cvs-branch-prefix)
 (defvar cvs-secondary-branch-prefix)