]> git.eshelyaron.com Git - emacs.git/commitdiff
(vc-hg-print-log): Insert the file name.
authorDan Nicolaescu <dann@ics.uci.edu>
Fri, 22 Jun 2007 17:22:17 +0000 (17:22 +0000)
committerDan Nicolaescu <dann@ics.uci.edu>
Fri, 22 Jun 2007 17:22:17 +0000 (17:22 +0000)
(vc-hg-log-view-mode): Fontify the file name.

lisp/ChangeLog
lisp/vc-hg.el

index 24257e1c1f3976456c307f5efff90a024a2c4a29..94edeb944a1ce95b888f271db3e6396eb80a9fc5 100644 (file)
@@ -1,3 +1,8 @@
+2007-06-22  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * vc-hg.el (vc-hg-print-log): Insert the file name.
+       (vc-hg-log-view-mode): Fontify the file name.
+
 2007-06-22  Jay Belanger  <jay.p.belanger@gmail.com>
 
        * calc/calc-forms.el (math-format-date-part)
index 1c1c47fcf03eb7b64a5c96332660f43a99fd615c..5d27cf432e356e565178d4ac33d980e55af0a374 100644 (file)
@@ -36,7 +36,6 @@
 ;;; Todo:
 
 ;; Implement the rest of the vc interface:
-;; - regexps for log-view to understand the "hg log" output
 ;; - dired
 ;; - snapshot?
 
 
 (defun vc-hg-print-log(file &optional buffer)
   "Get change log associated with FILE."
+  ;; `log-view-mode' needs to have the file name in order to function
+  ;; correctly. "hg log" does not print it, so we insert it here by
+  ;; hand.
+
+  ;; `vc-do-command' creates the buffer, but we need it before running
+  ;; the command.
+  (vc-setup-buffer buffer)
+  ;; If the buffer exists from a previous invocation it might be
+  ;; read-only.
+  (let ((inhibit-read-only t))
+    (with-current-buffer
+       buffer
+      (insert "File:        " (file-name-nondirectory file) "\n")))
   (vc-hg-command
    buffer
    (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0)
 (define-derived-mode vc-hg-log-view-mode log-view-mode "HG-Log-View"
   (require 'add-log) ;; we need the faces add-log
   ;; Don't have file markers, so use impossible regexp.
-  (set (make-local-variable 'log-view-file-re) "\\'\\`")
+  (set (make-local-variable 'log-view-file-re) "^File:[ \t]+\\(.+\\)")
   (set (make-local-variable 'log-view-message-re)
        "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)")
   (set (make-local-variable 'log-view-font-lock-keywords)
        (append 
        ;; XXX maybe use a different face for the version number
-       `((,log-view-message-re  (1 'change-log-acknowledgement)))
+       `((,log-view-message-re  (1 'change-log-acknowledgement))
+         (,log-view-file-re (1 'change-log-file-face)))
        ;; Handle the case:
        ;; user: foo@bar
        '(("^user:[ \t]+\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)"
@@ -226,7 +239,7 @@ and that it passes `vc-hg-global-switches' to it before FLAGS."
            (append vc-hg-global-switches
                    flags))))
 
-(defun vc-hg-internal-log (file)
+(defun vc-hg-internal-log (file &optional buffer)
   "Return log of FILE."
   (with-output-to-string
     (with-current-buffer