Commit 3a12f9f8 authored by Dan Nicolaescu's avatar Dan Nicolaescu
Browse files

* 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.
parent 31c70002
2007-07-22 Dan Nicolaescu <dann@ics.uci.edu>
* 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.
2007-07-22 Michael Albinus <michael.albinus@gmx.de>
Sync with Tramp 2.1.10.
......
......@@ -258,14 +258,25 @@ See also variable `vc-cvs-sticky-date-format-string'."
Compared to the default implementation, this function does two things:
Handle the special case of a CVS file that is added but not yet
committed and support display of sticky tags."
(let ((sticky-tag (vc-file-getprop file 'vc-cvs-sticky-tag))
(string (if (string= (vc-workfile-version file) "0")
;; A file that is added but not yet committed.
"CVS @@"
(vc-default-mode-line-string 'CVS file))))
(if (zerop (length sticky-tag))
string
(concat string "[" sticky-tag "]"))))
(let* ((sticky-tag (vc-file-getprop file 'vc-cvs-sticky-tag))
help-echo
(string
(if (string= (vc-workfile-version file) "0")
;; A file that is added but not yet committed.
(progn
(setq help-echo "Added file (needs commit) under CVS")
"CVS @@")
(let ((def-ml (vc-default-mode-line-string 'CVS file)))
(setq help-echo
(get-text-property 0 'help-echo def-ml))
def-ml))))
(propertize
(if (zerop (length sticky-tag))
string
(setq help-echo (format "%s on the '%s' branch"
help-echo sticky-tag))
(concat string "[" sticky-tag "]"))
'help-echo help-echo)))
(defun vc-cvs-dired-state-info (file)
"CVS-specific version of `vc-dired-state-info'."
......
......@@ -719,12 +719,29 @@ Before doing that, check if there are any old backups and get rid of them."
The value is set in the current buffer, which should be the buffer
visiting FILE."
(interactive (list buffer-file-name))
(let ((backend (vc-backend file)))
(let ((backend (vc-backend file))
ml-string ml-echo)
(if (not backend)
(setq vc-mode nil)
(setq vc-mode (concat " " (if vc-display-status
(vc-call mode-line-string file)
(symbol-name backend))))
(setq ml-string (vc-call mode-line-string file))
(setq ml-echo (get-text-property 0 'help-echo ml-string))
(setq vc-mode
(concat
" "
(if vc-display-status
(propertize
ml-string
'mouse-face 'mode-line-highlight
'help-echo
(concat (if ml-echo
ml-echo
(format "File under the %s version control system"
backend))
"\nmouse-1: Version Control menu")
'local-map (let ((map (make-sparse-keymap)))
(define-key map [mode-line down-mouse-1]
'vc-menu-map) map))
(symbol-name backend))))
;; If the file is locked by some other user, make
;; the buffer read-only. Like this, even root
;; cannot modify a file that someone else has locked.
......@@ -768,13 +785,10 @@ This function assumes that the file is registered."
;; Not just for the 'edited state, but also a fallback
;; for all other states. Think about different symbols
;; for 'needs-patch and 'needs-merge.
(setq state-echo "Edited file")
(setq state-echo "Locally modified file")
(concat backend ":" rev)))
'mouse-face 'mode-line-highlight
'local-map (let ((map (make-sparse-keymap)))
(define-key map [mode-line down-mouse-1] 'vc-menu-map) map)
'help-echo (concat state-echo " under the " backend
" version control system\nmouse-1: VC Menu"))))
" version control system"))))
(defun vc-follow-link ()
"If current buffer visits a symbolic link, visit the real file.
......
......@@ -166,9 +166,12 @@
;;
;; - mode-line-string (file)
;;
;; If provided, this function should return the VC-specific mode line
;; string for FILE. The default implementation deals well with all
;; states that `vc-state' can return.
;; If provided, this function should return the VC-specific mode
;; line string for FILE. The returned string should have a
;; `help-echo' property which is the text to be displayed as a
;; tooltip when the mouse hovers over the VC entry on the mode-line.
;; The default implementation deals well with all states that
;; `vc-state' can return.
;;
;; - dired-state-info (file)
;;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment