diff options
| author | Dan Nicolaescu | 2007-07-22 19:04:11 +0000 |
|---|---|---|
| committer | Dan Nicolaescu | 2007-07-22 19:04:11 +0000 |
| commit | 3a12f9f8301f2243bc40791369aa4bde90f8bfe5 (patch) | |
| tree | d24a21473e867a3ec179102dbd7389ca58847112 | |
| parent | 31c700022679c2893d951e403d406d00277e1a59 (diff) | |
| download | emacs-3a12f9f8301f2243bc40791369aa4bde90f8bfe5.tar.gz emacs-3a12f9f8301f2243bc40791369aa4bde90f8bfe5.zip | |
* vc-cvs.el (vc-cvs-mode-line-string): Add support for tooltips
for branches and new files.
* vc-hooks.el (vc-default-mode-line-string): Move mouse-face and
local-map handling ...
(vc-mode-line): ... here. Improve handling of help-echo.
* vc.el (mode-line-string): Document help-echo usage.
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/vc-cvs.el | 27 | ||||
| -rw-r--r-- | lisp/vc-hooks.el | 32 | ||||
| -rw-r--r-- | lisp/vc.el | 9 |
4 files changed, 59 insertions, 20 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 064e070cded..0ee2b68bf6d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2007-07-22 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 2 | |||
| 3 | * vc-cvs.el (vc-cvs-mode-line-string): Add support for tooltips | ||
| 4 | for branches and new files. | ||
| 5 | |||
| 6 | * vc-hooks.el (vc-default-mode-line-string): Move mouse-face and | ||
| 7 | local-map handling ... | ||
| 8 | (vc-mode-line): ... here. Improve handling of help-echo. | ||
| 9 | |||
| 10 | * vc.el (mode-line-string): Document help-echo usage. | ||
| 11 | |||
| 1 | 2007-07-22 Michael Albinus <michael.albinus@gmx.de> | 12 | 2007-07-22 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 13 | ||
| 3 | Sync with Tramp 2.1.10. | 14 | Sync with Tramp 2.1.10. |
diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el index 2daf2f72fba..452d9c16b19 100644 --- a/lisp/vc-cvs.el +++ b/lisp/vc-cvs.el | |||
| @@ -258,14 +258,25 @@ See also variable `vc-cvs-sticky-date-format-string'." | |||
| 258 | Compared to the default implementation, this function does two things: | 258 | Compared to the default implementation, this function does two things: |
| 259 | Handle the special case of a CVS file that is added but not yet | 259 | Handle the special case of a CVS file that is added but not yet |
| 260 | committed and support display of sticky tags." | 260 | committed and support display of sticky tags." |
| 261 | (let ((sticky-tag (vc-file-getprop file 'vc-cvs-sticky-tag)) | 261 | (let* ((sticky-tag (vc-file-getprop file 'vc-cvs-sticky-tag)) |
| 262 | (string (if (string= (vc-workfile-version file) "0") | 262 | help-echo |
| 263 | ;; A file that is added but not yet committed. | 263 | (string |
| 264 | "CVS @@" | 264 | (if (string= (vc-workfile-version file) "0") |
| 265 | (vc-default-mode-line-string 'CVS file)))) | 265 | ;; A file that is added but not yet committed. |
| 266 | (if (zerop (length sticky-tag)) | 266 | (progn |
| 267 | string | 267 | (setq help-echo "Added file (needs commit) under CVS") |
| 268 | (concat string "[" sticky-tag "]")))) | 268 | "CVS @@") |
| 269 | (let ((def-ml (vc-default-mode-line-string 'CVS file))) | ||
| 270 | (setq help-echo | ||
| 271 | (get-text-property 0 'help-echo def-ml)) | ||
| 272 | def-ml)))) | ||
| 273 | (propertize | ||
| 274 | (if (zerop (length sticky-tag)) | ||
| 275 | string | ||
| 276 | (setq help-echo (format "%s on the '%s' branch" | ||
| 277 | help-echo sticky-tag)) | ||
| 278 | (concat string "[" sticky-tag "]")) | ||
| 279 | 'help-echo help-echo))) | ||
| 269 | 280 | ||
| 270 | (defun vc-cvs-dired-state-info (file) | 281 | (defun vc-cvs-dired-state-info (file) |
| 271 | "CVS-specific version of `vc-dired-state-info'." | 282 | "CVS-specific version of `vc-dired-state-info'." |
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el index cbbfd8e7e22..cd5d8db7b0f 100644 --- a/lisp/vc-hooks.el +++ b/lisp/vc-hooks.el | |||
| @@ -719,12 +719,29 @@ Before doing that, check if there are any old backups and get rid of them." | |||
| 719 | The value is set in the current buffer, which should be the buffer | 719 | The value is set in the current buffer, which should be the buffer |
| 720 | visiting FILE." | 720 | visiting FILE." |
| 721 | (interactive (list buffer-file-name)) | 721 | (interactive (list buffer-file-name)) |
| 722 | (let ((backend (vc-backend file))) | 722 | (let ((backend (vc-backend file)) |
| 723 | ml-string ml-echo) | ||
| 723 | (if (not backend) | 724 | (if (not backend) |
| 724 | (setq vc-mode nil) | 725 | (setq vc-mode nil) |
| 725 | (setq vc-mode (concat " " (if vc-display-status | 726 | (setq ml-string (vc-call mode-line-string file)) |
| 726 | (vc-call mode-line-string file) | 727 | (setq ml-echo (get-text-property 0 'help-echo ml-string)) |
| 727 | (symbol-name backend)))) | 728 | (setq vc-mode |
| 729 | (concat | ||
| 730 | " " | ||
| 731 | (if vc-display-status | ||
| 732 | (propertize | ||
| 733 | ml-string | ||
| 734 | 'mouse-face 'mode-line-highlight | ||
| 735 | 'help-echo | ||
| 736 | (concat (if ml-echo | ||
| 737 | ml-echo | ||
| 738 | (format "File under the %s version control system" | ||
| 739 | backend)) | ||
| 740 | "\nmouse-1: Version Control menu") | ||
| 741 | 'local-map (let ((map (make-sparse-keymap))) | ||
| 742 | (define-key map [mode-line down-mouse-1] | ||
| 743 | 'vc-menu-map) map)) | ||
| 744 | (symbol-name backend)))) | ||
| 728 | ;; If the file is locked by some other user, make | 745 | ;; If the file is locked by some other user, make |
| 729 | ;; the buffer read-only. Like this, even root | 746 | ;; the buffer read-only. Like this, even root |
| 730 | ;; cannot modify a file that someone else has locked. | 747 | ;; cannot modify a file that someone else has locked. |
| @@ -768,13 +785,10 @@ This function assumes that the file is registered." | |||
| 768 | ;; Not just for the 'edited state, but also a fallback | 785 | ;; Not just for the 'edited state, but also a fallback |
| 769 | ;; for all other states. Think about different symbols | 786 | ;; for all other states. Think about different symbols |
| 770 | ;; for 'needs-patch and 'needs-merge. | 787 | ;; for 'needs-patch and 'needs-merge. |
| 771 | (setq state-echo "Edited file") | 788 | (setq state-echo "Locally modified file") |
| 772 | (concat backend ":" rev))) | 789 | (concat backend ":" rev))) |
| 773 | 'mouse-face 'mode-line-highlight | ||
| 774 | 'local-map (let ((map (make-sparse-keymap))) | ||
| 775 | (define-key map [mode-line down-mouse-1] 'vc-menu-map) map) | ||
| 776 | 'help-echo (concat state-echo " under the " backend | 790 | 'help-echo (concat state-echo " under the " backend |
| 777 | " version control system\nmouse-1: VC Menu")))) | 791 | " version control system")))) |
| 778 | 792 | ||
| 779 | (defun vc-follow-link () | 793 | (defun vc-follow-link () |
| 780 | "If current buffer visits a symbolic link, visit the real file. | 794 | "If current buffer visits a symbolic link, visit the real file. |
diff --git a/lisp/vc.el b/lisp/vc.el index 2d33bdf1eef..d12a6c20eee 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -166,9 +166,12 @@ | |||
| 166 | ;; | 166 | ;; |
| 167 | ;; - mode-line-string (file) | 167 | ;; - mode-line-string (file) |
| 168 | ;; | 168 | ;; |
| 169 | ;; If provided, this function should return the VC-specific mode line | 169 | ;; If provided, this function should return the VC-specific mode |
| 170 | ;; string for FILE. The default implementation deals well with all | 170 | ;; line string for FILE. The returned string should have a |
| 171 | ;; states that `vc-state' can return. | 171 | ;; `help-echo' property which is the text to be displayed as a |
| 172 | ;; tooltip when the mouse hovers over the VC entry on the mode-line. | ||
| 173 | ;; The default implementation deals well with all states that | ||
| 174 | ;; `vc-state' can return. | ||
| 172 | ;; | 175 | ;; |
| 173 | ;; - dired-state-info (file) | 176 | ;; - dired-state-info (file) |
| 174 | ;; | 177 | ;; |