]> git.eshelyaron.com Git - emacs.git/commitdiff
(log-view-marked-list): Delete variable.
authorDan Nicolaescu <dann@ics.uci.edu>
Sat, 25 Aug 2007 20:07:23 +0000 (20:07 +0000)
committerDan Nicolaescu <dann@ics.uci.edu>
Sat, 25 Aug 2007 20:07:23 +0000 (20:07 +0000)
(log-view-mode): Don't use it.
(log-view-toggle-mark-entry): Likewise, simplify.
(log-view-current-tag): Don't return properties.
(log-view-get-marked): New function.

lisp/ChangeLog
lisp/log-view.el

index 1e061579124575c910628450b16cfe2ee12022f6..cb8fe2027934210e320b08650a6f061bdd318ee2 100644 (file)
@@ -1,3 +1,11 @@
+2007-08-25  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * log-view.el (log-view-marked-list): Delete variable.
+       (log-view-mode): Don't use it.
+       (log-view-toggle-mark-entry): Likewise, simplify.
+       (log-view-current-tag): Don't return properties.
+       (log-view-get-marked): New function.
+
 2007-08-25  Alexandre Julliard  <julliard@winehq.org>
 
        * vc-git.el (vc-git-mode-line-string): New function.
index 4ff80ff21a592d671fc91022e8a660a59470166f..4fe2200b4ea39b5624f4bd39907757ae665f869d 100644 (file)
@@ -178,8 +178,6 @@ 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
 ;;;;
@@ -188,7 +186,6 @@ 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))
 
@@ -236,12 +233,11 @@ The match group number 1 should match the revision number itself.")
     (forward-line 1)
     (let ((pt (point)))
       (when (re-search-backward log-view-message-re nil t)
-       (let ((rev (match-string 1)))
+       (let ((rev (match-string-no-properties 1)))
          (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)
@@ -250,33 +246,34 @@ The match group number 1 should match the revision number itself.")
        (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)))
+           ;; Look to see if the current entry is marked.
+           (setq found (get-char-property (point) 'log-view-self))
            (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.
+               (delete-overlay found)
+             ;; Create an overlay that covers this entry and change
+             ;; it's color.
              (setq tag (log-view-current-tag (point)))
-             (push tag log-view-marked-list)
              (forward-line 1)
-             (setq end 
+             (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)
+             ;; This is used to check if the overlay is present.
+             (overlay-put ov 'log-view-self ov)
              (overlay-put ov 'log-view-marked tag))))))))
 
+(defun log-view-get-marked ()
+  (save-excursion
+    (let ((pos (point-min))
+         marked-list ov)
+      (while (setq pos (next-single-property-change pos 'face))
+       (when (setq ov (get-char-property pos 'log-view-self))
+         (push (overlay-get ov 'log-view-marked) marked-list)
+         (setq pos (overlay-end ov))))
+      marked-list)))
+
 (defvar cvs-minor-current-files)
 (defvar cvs-branch-prefix)
 (defvar cvs-secondary-branch-prefix)