Mercurial > emacs
annotate lisp/log-view.el @ 62845:28ffa958559d
(gdb-assembler-custom): Be more careful about preserving point.
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Sat, 28 May 2005 12:15:33 +0000 |
parents | e7ec1f80fc80 |
children | ecbe83adff58 bf0d492ea2d5 |
rev | line source |
---|---|
29041
49e8918cab44
Fix file description.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28861
diff
changeset
|
1 ;;; log-view.el --- Major mode for browsing RCS/CVS/SCCS log output |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2 |
60145
e7ec1f80fc80
(log-view-message-re): Fix up Subversion regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55175
diff
changeset
|
3 ;; Copyright (C) 1999, 2000, 2001, 2005 Free Software Foundation, Inc. |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
4 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
5 ;; Author: Stefan Monnier <monnier@cs.yale.edu> |
29041
49e8918cab44
Fix file description.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28861
diff
changeset
|
6 ;; Keywords: rcs sccs cvs log version-control |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
7 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
8 ;; This file is part of GNU Emacs. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
9 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
10 ;; GNU Emacs is free software; you can redistribute it and/or modify |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
11 ;; it under the terms of the GNU General Public License as published by |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
13 ;; any later version. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
14 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
15 ;; GNU Emacs is distributed in the hope that it will be useful, |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
18 ;; GNU General Public License for more details. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
19 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
20 ;; You should have received a copy of the GNU General Public License |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
23 ;; Boston, MA 02111-1307, USA. |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
24 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
25 ;;; Commentary: |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
26 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
27 ;; Todo: |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
28 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
29 ;; - add compatibility with cvs-log.el |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
30 ;; - add ability to modify a log-entry (via cvs-mode-admin ;-) |
29041
49e8918cab44
Fix file description.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28861
diff
changeset
|
31 ;; - remove references to cvs-* |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
32 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
33 ;;; Code: |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
34 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
35 (eval-when-compile (require 'cl)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
36 (require 'pcvs-util) |
40958
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
37 (autoload 'vc-version-diff "vc") |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
38 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
39 (defgroup log-view nil |
29041
49e8918cab44
Fix file description.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28861
diff
changeset
|
40 "Major mode for browsing log output of RCS/CVS/SCCS." |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
41 :group 'pcl-cvs |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
42 :prefix "log-view-") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
43 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
44 (easy-mmode-defmap log-view-mode-map |
40958
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
45 '(("q" . quit-window) |
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
46 ("z" . kill-this-buffer) |
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
47 ("m" . set-mark-command) |
49236
8df2e5ef3962
(log-view-message-re): The rev might be locked.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42456
diff
changeset
|
48 ;; ("e" . cvs-mode-edit-log) |
40958
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
49 ("d" . log-view-diff) |
41557
be985e4c1430
(log-view-find-version): New function.
André Spiegel <spiegel@gnu.org>
parents:
41137
diff
changeset
|
50 ("f" . log-view-find-version) |
40958
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
51 ("n" . log-view-msg-next) |
28251
21d27711125f
(log-view-(msg|file)-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
52 ("p" . log-view-msg-prev) |
21d27711125f
(log-view-(msg|file)-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
53 ("N" . log-view-file-next) |
21d27711125f
(log-view-(msg|file)-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
54 ("P" . log-view-file-prev) |
40450
d29fac587062
(log-view-mode-map): Bind `M-n' and `M-p', not `M n'
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
34652
diff
changeset
|
55 ("\M-n" . log-view-file-next) |
d29fac587062
(log-view-mode-map): Bind `M-n' and `M-p', not `M n'
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
34652
diff
changeset
|
56 ("\M-p" . log-view-file-prev)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
57 "Log-View's keymap." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
58 :group 'log-view |
29041
49e8918cab44
Fix file description.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28861
diff
changeset
|
59 ;; Here I really need either buffer-local keymap-inheritance |
49e8918cab44
Fix file description.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28861
diff
changeset
|
60 ;; or a minor-mode-map with lower precedence than the local map. |
49e8918cab44
Fix file description.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28861
diff
changeset
|
61 :inherit (if (boundp 'cvs-mode-map) cvs-mode-map)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
62 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
63 (defvar log-view-mode-hook nil |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
64 "Hook run at the end of `log-view-mode'.") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
65 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
66 (defface log-view-file-face |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
67 '((((class color) (background light)) |
42456
8a4077ab418c
(various face definitions): Use :weight, not :bold.
Richard M. Stallman <rms@gnu.org>
parents:
42074
diff
changeset
|
68 (:background "grey70" :weight bold)) |
8a4077ab418c
(various face definitions): Use :weight, not :bold.
Richard M. Stallman <rms@gnu.org>
parents:
42074
diff
changeset
|
69 (t (:weight bold))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
70 "Face for the file header line in `log-view-mode'." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
71 :group 'log-view) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
72 (defvar log-view-file-face 'log-view-file-face) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
73 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
74 (defface log-view-message-face |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
75 '((((class color) (background light)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
76 (:background "grey85")) |
42456
8a4077ab418c
(various face definitions): Use :weight, not :bold.
Richard M. Stallman <rms@gnu.org>
parents:
42074
diff
changeset
|
77 (t (:weight bold))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
78 "Face for the message header line in `log-view-mode'." |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
79 :group 'log-view) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
80 (defvar log-view-message-face 'log-view-message-face) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
81 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
82 (defconst log-view-file-re |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
83 (concat "^\\(" |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
84 "Working file: \\(.+\\)" |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
85 "\\|SCCS/s\\.\\(.+\\):" |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
86 "\\)\n")) |
49236
8df2e5ef3962
(log-view-message-re): The rev might be locked.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42456
diff
changeset
|
87 ;; In RCS, a locked revision will look like "revision N.M\tlocked by: FOO". |
60145
e7ec1f80fc80
(log-view-message-re): Fix up Subversion regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55175
diff
changeset
|
88 (defconst log-view-message-re "^\\(revision \\([.0-9]+\\)\\(?:\t.*\\)?\\|r\\([0-9]+\\) | .* | .*\\|D \\([.0-9]+\\) .*\\)$") |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
89 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
90 (defconst log-view-font-lock-keywords |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
91 `((,log-view-file-re |
29041
49e8918cab44
Fix file description.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28861
diff
changeset
|
92 (2 (if (boundp 'cvs-filename-face) cvs-filename-face) nil t) |
49e8918cab44
Fix file description.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28861
diff
changeset
|
93 (3 (if (boundp 'cvs-filename-face) cvs-filename-face) nil t) |
49e8918cab44
Fix file description.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28861
diff
changeset
|
94 (0 log-view-file-face append)) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
95 (,log-view-message-re . log-view-message-face))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
96 (defconst log-view-font-lock-defaults |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
97 '(log-view-font-lock-keywords t nil nil nil)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
98 |
40954 | 99 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
100 ;;;; Actual code |
40954 | 101 ;;;; |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
102 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
103 ;;;###autoload |
28251
21d27711125f
(log-view-(msg|file)-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
104 (define-derived-mode log-view-mode fundamental-mode "Log-View" |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
105 "Major mode for browsing CVS log output." |
40958
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
106 (setq buffer-read-only t) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
107 (set (make-local-variable 'font-lock-defaults) log-view-font-lock-defaults) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
108 (set (make-local-variable 'cvs-minor-wrap-function) 'log-view-minor-wrap)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
109 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
110 ;;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
111 ;;;; Navigation |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
112 ;;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
113 |
28251
21d27711125f
(log-view-(msg|file)-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
114 ;; define log-view-{msg,file}-{next,prev} |
21d27711125f
(log-view-(msg|file)-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
115 (easy-mmode-define-navigation log-view-msg log-view-message-re "log message") |
21d27711125f
(log-view-(msg|file)-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
116 (easy-mmode-define-navigation log-view-file log-view-file-re "file") |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
117 |
28861
bab7620d1466
(log-view-goto-rev): New function for the new VC.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28251
diff
changeset
|
118 (defun log-view-goto-rev (rev) |
bab7620d1466
(log-view-goto-rev): New function for the new VC.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28251
diff
changeset
|
119 (goto-char (point-min)) |
bab7620d1466
(log-view-goto-rev): New function for the new VC.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28251
diff
changeset
|
120 (ignore-errors |
bab7620d1466
(log-view-goto-rev): New function for the new VC.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28251
diff
changeset
|
121 (while (not (equal rev (log-view-current-tag))) |
bab7620d1466
(log-view-goto-rev): New function for the new VC.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28251
diff
changeset
|
122 (log-view-msg-next)) |
bab7620d1466
(log-view-goto-rev): New function for the new VC.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28251
diff
changeset
|
123 t)) |
bab7620d1466
(log-view-goto-rev): New function for the new VC.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28251
diff
changeset
|
124 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
125 ;;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
126 ;;;; Linkage to PCL-CVS (mostly copied from cvs-status.el) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
127 ;;;; |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
128 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
129 (defconst log-view-dir-re "^cvs[.ex]* [a-z]+: Logging \\(.+\\)$") |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
130 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
131 (defun log-view-current-file () |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
132 (save-excursion |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
133 (forward-line 1) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
134 (or (re-search-backward log-view-file-re nil t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
135 (re-search-forward log-view-file-re)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
136 (let* ((file (or (match-string 2) (match-string 3))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
137 (cvsdir (and (re-search-backward log-view-dir-re nil t) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
138 (match-string 1))) |
29041
49e8918cab44
Fix file description.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28861
diff
changeset
|
139 (pcldir (and (boundp 'cvs-pcl-cvs-dirchange-re) |
49e8918cab44
Fix file description.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28861
diff
changeset
|
140 (re-search-backward cvs-pcl-cvs-dirchange-re nil t) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
141 (match-string 1))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
142 (dir "")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
143 (let ((default-directory "")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
144 (when pcldir (setq dir (expand-file-name pcldir dir))) |
40958
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
145 (when cvsdir (setq dir (expand-file-name cvsdir dir)))) |
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
146 (expand-file-name file dir)))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
147 |
40958
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
148 (defun log-view-current-tag (&optional where) |
28251
21d27711125f
(log-view-(msg|file)-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
149 (save-excursion |
40958
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
150 (when where (goto-char where)) |
28251
21d27711125f
(log-view-(msg|file)-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
151 (forward-line 1) |
21d27711125f
(log-view-(msg|file)-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
152 (let ((pt (point))) |
21d27711125f
(log-view-(msg|file)-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
153 (when (re-search-backward log-view-message-re nil t) |
42074
fdee0c7c3bf1
(log-view-message-re, log-view-current-tag):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41557
diff
changeset
|
154 (let ((rev (or (match-string 2) (match-string 3) (match-string 4)))) |
28251
21d27711125f
(log-view-(msg|file)-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
155 (unless (re-search-forward log-view-file-re pt t) |
21d27711125f
(log-view-(msg|file)-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
156 rev)))))) |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
157 |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
158 (defun log-view-minor-wrap (buf f) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
159 (let ((data (with-current-buffer buf |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
160 (cons |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
161 (cons (log-view-current-file) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
162 (log-view-current-tag)) |
28861
bab7620d1466
(log-view-goto-rev): New function for the new VC.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28251
diff
changeset
|
163 (when mark-active |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
164 (save-excursion |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
165 (goto-char (mark)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
166 (cons (log-view-current-file) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
167 (log-view-current-tag)))))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
168 (let ((cvs-branch-prefix (cdar data)) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
169 (cvs-secondary-branch-prefix (and (cdar data) (cddr data))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
170 (cvs-minor-current-files |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
171 (cons (caar data) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
172 (when (and (cadr data) (not (equal (caar data) (cadr data)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
173 (list (cadr data))))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
174 ;; FIXME: I need to force because the fileinfos are UNKNOWN |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
175 (cvs-force-command "/F")) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
176 (funcall f)))) |
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
177 |
41557
be985e4c1430
(log-view-find-version): New function.
André Spiegel <spiegel@gnu.org>
parents:
41137
diff
changeset
|
178 (defun log-view-find-version (pos) |
be985e4c1430
(log-view-find-version): New function.
André Spiegel <spiegel@gnu.org>
parents:
41137
diff
changeset
|
179 "Visit the version at point." |
be985e4c1430
(log-view-find-version): New function.
André Spiegel <spiegel@gnu.org>
parents:
41137
diff
changeset
|
180 (interactive "d") |
be985e4c1430
(log-view-find-version): New function.
André Spiegel <spiegel@gnu.org>
parents:
41137
diff
changeset
|
181 (save-excursion |
be985e4c1430
(log-view-find-version): New function.
André Spiegel <spiegel@gnu.org>
parents:
41137
diff
changeset
|
182 (goto-char pos) |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49236
diff
changeset
|
183 (switch-to-buffer (vc-find-version (log-view-current-file) |
41557
be985e4c1430
(log-view-find-version): New function.
André Spiegel <spiegel@gnu.org>
parents:
41137
diff
changeset
|
184 (log-view-current-tag))))) |
be985e4c1430
(log-view-find-version): New function.
André Spiegel <spiegel@gnu.org>
parents:
41137
diff
changeset
|
185 |
42074
fdee0c7c3bf1
(log-view-message-re, log-view-current-tag):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41557
diff
changeset
|
186 ;; |
fdee0c7c3bf1
(log-view-message-re, log-view-current-tag):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41557
diff
changeset
|
187 ;; diff |
fdee0c7c3bf1
(log-view-message-re, log-view-current-tag):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41557
diff
changeset
|
188 ;; |
40958
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
189 |
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
190 (defun log-view-diff (beg end) |
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
191 "Get the diff for several revisions. |
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
192 If the point is the same as the mark, get the diff for this revision. |
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
193 Otherwise, get the diff between the revisions |
55175
e7a5be902830
(log-view-diff): Replace interactive code "r"
Juri Linkov <juri@jurta.org>
parents:
52401
diff
changeset
|
194 were the region starts and ends." |
e7a5be902830
(log-view-diff): Replace interactive code "r"
Juri Linkov <juri@jurta.org>
parents:
52401
diff
changeset
|
195 (interactive |
e7a5be902830
(log-view-diff): Replace interactive code "r"
Juri Linkov <juri@jurta.org>
parents:
52401
diff
changeset
|
196 (list (if mark-active (region-beginning) (point)) |
e7a5be902830
(log-view-diff): Replace interactive code "r"
Juri Linkov <juri@jurta.org>
parents:
52401
diff
changeset
|
197 (if mark-active (region-end) (point)))) |
40958
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
198 (let ((fr (log-view-current-tag beg)) |
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
199 (to (log-view-current-tag end))) |
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
200 (when (string-equal fr to) |
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
201 (save-excursion |
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
202 (goto-char end) |
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
203 (log-view-msg-next) |
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
204 (setq to (log-view-current-tag)))) |
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
205 (vc-version-diff (log-view-current-file) to fr))) |
4b4504c5aa56
* vc.el (vc-print-log): Bind `inhibit-read-only' to t before and
Sam Steingold <sds@gnu.org>
parents:
40954
diff
changeset
|
206 |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
207 (provide 'log-view) |
28251
21d27711125f
(log-view-(msg|file)-(prev|next)): Rename from
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28088
diff
changeset
|
208 |
60145
e7ec1f80fc80
(log-view-message-re): Fix up Subversion regexp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55175
diff
changeset
|
209 ;; arch-tag: 0d64220b-ce7e-4f62-9c2a-6b04c2f81f4f |
28088
b442dfc3cef0
*** empty log message ***
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
210 ;;; log-view.el ends here |