diff options
| author | André Spiegel | 1996-09-16 14:43:29 +0000 |
|---|---|---|
| committer | André Spiegel | 1996-09-16 14:43:29 +0000 |
| commit | b667752da8c956319ce80c3f4331b8566e1d66f0 (patch) | |
| tree | fe9ad312866d43ead553ddb447c3096119285761 | |
| parent | a7305f6e9f63ad31a8b59174f85782fb690c5b24 (diff) | |
| download | emacs-b667752da8c956319ce80c3f4331b8566e1d66f0.tar.gz emacs-b667752da8c956319ce80c3f4331b8566e1d66f0.zip | |
(vc-print-log): Set the display window so that it shows
the current log entry completely.
| -rw-r--r-- | lisp/vc.el | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/lisp/vc.el b/lisp/vc.el index 4fb84ab1356..8084b1cc201 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -1565,6 +1565,7 @@ levels in the snapshot." | |||
| 1565 | (vc-backend-print-log file) | 1565 | (vc-backend-print-log file) |
| 1566 | (pop-to-buffer (get-buffer-create "*vc*")) | 1566 | (pop-to-buffer (get-buffer-create "*vc*")) |
| 1567 | (setq default-directory (file-name-directory file)) | 1567 | (setq default-directory (file-name-directory file)) |
| 1568 | (goto-char (point-max)) (forward-line -1) | ||
| 1568 | (while (looking-at "=*\n") | 1569 | (while (looking-at "=*\n") |
| 1569 | (delete-char (- (match-end 0) (match-beginning 0))) | 1570 | (delete-char (- (match-end 0) (match-beginning 0))) |
| 1570 | (forward-line -1)) | 1571 | (forward-line -1)) |
| @@ -1573,14 +1574,36 @@ levels in the snapshot." | |||
| 1573 | (delete-char (- (match-end 0) (match-beginning 0)))) | 1574 | (delete-char (- (match-end 0) (match-beginning 0)))) |
| 1574 | (shrink-window-if-larger-than-buffer) | 1575 | (shrink-window-if-larger-than-buffer) |
| 1575 | ;; move point to the log entry for the current version | 1576 | ;; move point to the log entry for the current version |
| 1576 | (if (not (eq (vc-backend file) 'SCCS)) | 1577 | (and (not (eq (vc-backend file) 'SCCS)) |
| 1577 | (let ((pos (re-search-forward | 1578 | (re-search-forward |
| 1578 | ;; also match some context, for safety | 1579 | ;; also match some context, for safety |
| 1579 | (concat "----\nrevision " (vc-workfile-version file) | 1580 | (concat "----\nrevision " (vc-workfile-version file) |
| 1580 | "\\(\tlocked by:.*\n\\|\n\\)date: ") nil t))) | 1581 | "\\(\tlocked by:.*\n\\|\n\\)date: ") nil t) |
| 1581 | (if pos (progn (goto-char pos) | 1582 | ;; set the display window so that |
| 1582 | (beginning-of-line) | 1583 | ;; the whole log entry is displayed |
| 1583 | (forward-line -1))))) | 1584 | (let (start end lines) |
| 1585 | (beginning-of-line) (forward-line -1) (setq start (point)) | ||
| 1586 | (if (not (re-search-forward "^----*\nrevision" nil t)) | ||
| 1587 | (setq end (point-max)) | ||
| 1588 | (beginning-of-line) (forward-line -1) (setq end (point))) | ||
| 1589 | (setq lines (count-lines start end)) | ||
| 1590 | (cond | ||
| 1591 | ;; if the global information and this log entry fit | ||
| 1592 | ;; into the window, display from the beginning | ||
| 1593 | ((< (count-lines (point-min) end) (window-height)) | ||
| 1594 | (goto-char (point-min)) | ||
| 1595 | (recenter 0) | ||
| 1596 | (goto-char start)) | ||
| 1597 | ;; if the whole entry fits into the window, | ||
| 1598 | ;; display it centered | ||
| 1599 | ((< (1+ lines) (window-height)) | ||
| 1600 | (goto-char start) | ||
| 1601 | (recenter (1- (- (/ (window-height) 2) (/ lines 2))))) | ||
| 1602 | ;; otherwise (the entry is too large for the window), | ||
| 1603 | ;; display from the start | ||
| 1604 | (t | ||
| 1605 | (goto-char start) | ||
| 1606 | (recenter 0))))) | ||
| 1584 | ) | 1607 | ) |
| 1585 | (vc-registration-error buffer-file-name) | 1608 | (vc-registration-error buffer-file-name) |
| 1586 | ) | 1609 | ) |