Changes committed gnus/lisp (19 files)
"Miles Bader" <[email protected]> Fri, 04 Jul 2008 02:09:29 +0200
| Newsgroups | gmane.emacs.gnus.commits |
|---|---|
| Message-ID | <[email protected]> |
Added: vc-annotate.el vc-dir.el
Modified: ChangeLog ChangeLog.2 gnus-demon.el gnus.el hashcash.el
message.el mm-util.el mml1991.el nndb.el nnimap.el nnkiboze.el
nnmairix.el rfc2047.el sasl-ntlm.el sasl.el sieve-manage.el
smime.el
Merge from emacs--devo--0, gnus--rel--5.10
Patches applied:
* emacs--devo--0 (patch 1254-1310)
- Update from CVS
- Fix behavior of text-scale-increase when text-scale-mode is disabled
- Tweak interface of buffer-face-mode functions
- Fix variable names in buffer-face-mode-invoke
- Fix autoload building command in src Makefile
- Fix autoload directives in lisp/face-remap.el
- (text-scale-adjust): Bind `echo-keystrokes' to nil.
- Handle void selection in mouse-appearance-menu
- Update from CVS: lisp/ibuf-ext.el (diff-sentinel): Declare.
- Fix a bug with parsing of overlapping markup sequences in rcirc
- Merge from emacs--rel--22
- Implement display-time wrap/line-prefix feature
- Merge from gnus--devo--0
- Add missing doc/misc/ChangeLog entry
* emacs--rel--22 (patch 277)
* gnus--rel--5.10 (patch 297)
- Update from CVS
2008-07-02 Juanma Barranquero <[email protected]>
* lisp/nnimap.el (nnimap-id):
* lisp/sieve-manage.el (sieve-manage-open): Doc fixes.
2008-07-02 Francesc Rocher <[email protected]>
* lisp/gnus.el (gnus-group-startup-message): Prefer SVG or PNG image,
if available.
2008-06-25 Stefan Monnier <[email protected]>
* lisp/mm-util.el (mm-with-multibyte, mm-with-unibyte): Remove.
* lisp/nnkiboze.el (nnkiboze-generate-group):
Use explicit mm-disable-multibyte rather than mm-with-unibyte.
* lisp/nnmairix.el: Require CL.
Revision: [email protected]/gnus--devo--0--patch-517
Index: ChangeLog
diff -u gnus/lisp/ChangeLog:7.1885 gnus/lisp/ChangeLog:7.1886
--- ChangeLog:7.1885 Wed Jul 2 13:47:36 2008
+++ ChangeLog Fri Jul 4 02:09:29 2008
@@ -17,6 +17,25 @@
* gnus-score.el (gnus-score-find-trace): Add "Total score" line.
+2008-07-02 Juanma Barranquero <[email protected]>
+
+ * nnimap.el (nnimap-id):
+ * sieve-manage.el (sieve-manage-open): Doc fixes.
+
+2008-07-02 Francesc Rocher <[email protected]>
+
+ * gnus.el (gnus-group-startup-message): Prefer SVG or PNG image,
+ if available.
+
+2008-06-25 Stefan Monnier <[email protected]>
+
+ * mm-util.el (mm-with-multibyte, mm-with-unibyte): Remove.
+
+ * nnkiboze.el (nnkiboze-generate-group):
+ Use explicit mm-disable-multibyte rather than mm-with-unibyte.
+
+ * nnmairix.el: Require CL.
+
2008-06-16 Katsumi Yamaoka <[email protected]>
* dgnushack.el: Autoload get-display-table and put-display-table for
@@ -31,16 +50,16 @@
2008-06-14 Aidan Kehoe <[email protected]>
- * gnus-util.el (gnus-put-display-table, gnus-get-display-table): New
- macros that expand to an `aset'/`aref' call under Emacs, and to a
+ * gnus-util.el (gnus-put-display-table, gnus-get-display-table):
+ New macros that expand to an `aset'/`aref' call under Emacs, and to a
runtime choice under XEmacs.
- * gnus-sum.el (gnus-summary-set-display-table): Use
- `gnus-put-display-table', `gnus-get-display-table',
+ * gnus-sum.el (gnus-summary-set-display-table):
+ Use `gnus-put-display-table', `gnus-get-display-table',
`gnus-set-display-table' for the display table, instead of `aset'.
- * gnus-xmas.el (gnus-xmas-summary-set-display-table): Use
- `gnus-put-display-table', `gnus-get-display-table',
+ * gnus-xmas.el (gnus-xmas-summary-set-display-table):
+ Use `gnus-put-display-table', `gnus-get-display-table',
`gnus-set-display-table' for the display table.
2008-06-14 Reiner Steib <[email protected]>
@@ -10319,7 +10338,7 @@
2004-09-01 Simon Josefsson <[email protected]>
* message.el (message-canlock-generate): Require sha1, not
- sha1-el. (Can we get rid of this require alltogheter? It is ugly
+ sha1-el. (Can we get rid of this require altogether? It is ugly
to require within a function. Sadly, if sha1.el isn't loaded, the
let binding in m-c-g will hide the defcustom definition, which is
bad.)
Index: ChangeLog.2
diff -u gnus/lisp/ChangeLog.2:7.25 gnus/lisp/ChangeLog.2:7.26
--- ChangeLog.2:7.25 Tue Jun 17 23:37:01 2008
+++ ChangeLog.2 Fri Jul 4 02:09:29 2008
@@ -2456,7 +2456,7 @@
2003-05-10 Lars Magne Ingebrigtsen <[email protected]>
- * gnus.el (gnus-logo-color-alist): Added no colours.
+ * gnus.el (gnus-logo-color-alist): Added no colors.
2003-05-09 Dave Love <[email protected]>
@@ -12530,7 +12530,7 @@
* mm-encode.el (mm-encode-content-transfer-encoding): Fix error
message. (Gnus does not "default" to using 8bit for the message,
it default to use 8bit encoding and the user-supplied CTE
- value. Calling this behaviour "treating it as 8bit" is perhaps
+ value. Calling this behavior "treating it as 8bit" is perhaps
better.)
* mm-bodies.el (mm-body-encoding): Intern encoding if needed
@@ -12815,7 +12815,7 @@
(imap-remassoc): Copied from `gnus-remassoc'.
(imap-add-callback): New function.
(imap-mailbox-expunge, imap-mailbox-close): Support asynchronous
- behaviour.
+ behavior.
(imap-parse-response): Call the callback.
* message.el (message-insert-canlock): New variable.
Index: gnus-demon.el
diff -u gnus/lisp/gnus-demon.el:7.18 gnus/lisp/gnus-demon.el:7.19
--- gnus-demon.el:7.18 Mon May 19 10:47:42 2008
+++ gnus-demon.el Fri Jul 4 02:09:29 2008
@@ -1,4 +1,4 @@
-;;; gnus-demon.el --- daemonic Gnus behaviour
+;;; gnus-demon.el --- daemonic Gnus behavior
;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
Index: gnus.el
diff -u gnus/lisp/gnus.el:7.85 gnus/lisp/gnus.el:7.86
--- gnus.el:7.85 Wed Jun 11 16:19:44 2008
+++ gnus.el Fri Jul 4 02:09:29 2008
@@ -1015,7 +1015,9 @@
(symbol-value 'image-load-path))
(t load-path)))
(image (find-image
- `((:type xpm :file "gnus.xpm"
+ `((:type svg :file "gnus.svg")
+ (:type png :file "gnus.png")
+ (:type xpm :file "gnus.xpm"
:color-symbols
(("thing" . ,(car gnus-logo-colors))
("shadow" . ,(cadr gnus-logo-colors))
Index: hashcash.el
diff -u gnus/lisp/hashcash.el:7.27 gnus/lisp/hashcash.el:7.28
--- hashcash.el:7.27 Mon May 19 10:47:42 2008
+++ hashcash.el Fri Jul 4 02:09:29 2008
@@ -50,6 +50,8 @@
(eval-and-compile
(unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
+(eval-when-compile (require 'cl)) ; for case
+
(defgroup hashcash nil
"Hashcash configuration."
:group 'mail)
Index: message.el
diff -u gnus/lisp/message.el:7.265 gnus/lisp/message.el:7.266
--- message.el:7.265 Wed Jun 11 16:19:44 2008
+++ message.el Fri Jul 4 02:09:29 2008
@@ -4543,7 +4543,7 @@
(apply
'call-process-region (point-min) (point-max)
message-qmail-inject-program nil nil nil
- ;; qmail-inject's default behaviour is to look for addresses on the
+ ;; qmail-inject's default behavior is to look for addresses on the
;; command line; if there're none, it scans the headers.
;; yes, it does The Right Thing w.r.t. Resent-To and it's kin.
;;
Index: mm-util.el
diff -u gnus/lisp/mm-util.el:7.78 gnus/lisp/mm-util.el:7.79
--- mm-util.el:7.78 Mon May 19 10:47:42 2008
+++ mm-util.el Fri Jul 4 02:09:29 2008
@@ -1093,20 +1093,6 @@
(put 'mm-with-unibyte-current-buffer 'lisp-indent-function 0)
(put 'mm-with-unibyte-current-buffer 'edebug-form-spec '(body))
-(defmacro mm-with-unibyte (&rest forms)
- "Eval the FORMS with the default value of `enable-multibyte-characters' nil."
- `(let (default-enable-multibyte-characters)
- ,@forms))
-(put 'mm-with-unibyte 'lisp-indent-function 0)
-(put 'mm-with-unibyte 'edebug-form-spec '(body))
-
-(defmacro mm-with-multibyte (&rest forms)
- "Eval the FORMS with the default value of `enable-multibyte-characters' t."
- `(let ((default-enable-multibyte-characters t))
- ,@forms))
-(put 'mm-with-multibyte 'lisp-indent-function 0)
-(put 'mm-with-multibyte 'edebug-form-spec '(body))
-
(defun mm-find-charset-region (b e)
"Return a list of Emacs charsets in the region B to E."
(cond
Index: mml1991.el
diff -u gnus/lisp/mml1991.el:7.28 gnus/lisp/mml1991.el:7.29
--- mml1991.el:7.28 Wed Jun 11 16:19:44 2008
+++ mml1991.el Fri Jul 4 02:09:29 2008
@@ -133,7 +133,7 @@
'never))
cipher
(result-buffer (get-buffer-create "*GPG Result*")))
- ;; Strip MIME Content[^ ]: headers since it will be ASCII ARMOURED
+ ;; Strip MIME Content[^ ]: headers since it will be ASCII ARMORED
(goto-char (point-min))
(while (looking-at "^Content[^ ]+:") (forward-line))
(unless (bobp)
@@ -213,7 +213,7 @@
(let ((text (current-buffer))
cipher
(result-buffer (get-buffer-create "*GPG Result*")))
- ;; Strip MIME Content[^ ]: headers since it will be ASCII ARMOURED
+ ;; Strip MIME Content[^ ]: headers since it will be ASCII ARMORED
(goto-char (point-min))
(while (looking-at "^Content[^ ]+:") (forward-line))
(unless (bobp)
@@ -303,7 +303,7 @@
(let ((cte (save-restriction
(narrow-to-region (point-min) (point))
(mail-fetch-field "content-transfer-encoding"))))
- ;; Strip MIME headers since it will be ASCII armoured.
+ ;; Strip MIME headers since it will be ASCII armored.
(forward-line 1)
(delete-region (point-min) (point))
(when cte
@@ -424,7 +424,7 @@
(let ((cte (save-restriction
(narrow-to-region (point-min) (point))
(mail-fetch-field "content-transfer-encoding"))))
- ;; Strip MIME headers since it will be ASCII armoured.
+ ;; Strip MIME headers since it will be ASCII armored.
(forward-line 1)
(delete-region (point-min) (point))
(when cte
Index: nndb.el
diff -u gnus/lisp/nndb.el:7.18 gnus/lisp/nndb.el:7.19
--- nndb.el:7.18 Mon May 19 10:47:41 2008
+++ nndb.el Fri Jul 4 02:09:29 2008
@@ -1,7 +1,7 @@
;;; nndb.el --- nndb access for Gnus
-;; Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004, 2005, 2006, 2007,
+;; 2008 Free Software Foundation, Inc.
;; Author: Masanobu UMEDA <[email protected]>
;; Kai Grossjohann <[email protected]>
@@ -307,7 +307,7 @@
; nndb-request-rename-group does not exist
; todo -- maybe later
-;; -- standard compatability functions
+;; -- standard compatibility functions
(deffoo nndb-status-message (&optional server)
"Return server status as a string."
Index: nnimap.el
diff -u gnus/lisp/nnimap.el:7.52 gnus/lisp/nnimap.el:7.53
--- nnimap.el:7.52 Sun Jun 15 18:14:01 2008
+++ nnimap.el Fri Jul 4 02:09:29 2008
@@ -424,8 +424,8 @@
(defcustom nnimap-id nil
"Plist with client identity to send to server upon login.
-Nil means no information is sent, symbol `no' to disable ID query
-alltogheter, or plist with identifier-value pairs to send to
+A nil value means no information is sent, symbol `no' to disable ID query
+altogether, or plist with identifier-value pairs to send to
server. RFC 2971 describes the list as follows:
Any string may be sent as a field, but the following are defined to
Index: nnkiboze.el
diff -u gnus/lisp/nnkiboze.el:7.15 gnus/lisp/nnkiboze.el:7.16
--- nnkiboze.el:7.15 Mon May 19 10:47:42 2008
+++ nnkiboze.el Fri Jul 4 02:09:29 2008
@@ -247,101 +247,102 @@
(unless info
(error "No such group: %s" group))
;; Load the kiboze newsrc file for this group.
- (mm-with-unibyte
- (when (file-exists-p newsrc-file)
- (load newsrc-file))
- (let ((coding-system-for-write nnkiboze-file-coding-system))
- (gnus-make-directory (file-name-directory nov-file))
- (with-temp-file nov-file
- (when (file-exists-p nov-file)
- (insert-file-contents nov-file))
- (setq nov-buffer (current-buffer))
- ;; Go through the active hashtb and add new all groups that match the
- ;; kiboze regexp.
- (mapatoms
- (lambda (group)
- (and (string-match nnkiboze-regexp
- (setq gname (symbol-name group))) ; Match
- (not (assoc gname nnkiboze-newsrc)) ; It isn't registered
- (numberp (car (symbol-value group))) ; It is active
- (or (> nnkiboze-level 7)
- (and (setq glevel
- (gnus-info-level (gnus-get-info gname)))
- (>= nnkiboze-level glevel)))
- (not (string-match "^nnkiboze:" gname)) ; Exclude kibozes
- (push (cons gname (1- (car (symbol-value group))))
- nnkiboze-newsrc)))
- gnus-active-hashtb)
- ;; `newsrc' is set to the list of groups that possibly are
- ;; component groups to this kiboze group. This list has elements
- ;; on the form `(GROUP . NUMBER)', where NUMBER is the highest
- ;; number that has been kibozed in GROUP in this kiboze group.
- (setq newsrc nnkiboze-newsrc)
- (while newsrc
- (if (not (setq active (gnus-active (caar newsrc))))
- ;; This group isn't active after all, so we remove it from
- ;; the list of component groups.
- (setq nnkiboze-newsrc (delq (car newsrc) nnkiboze-newsrc))
- (setq lowest (cdar newsrc))
- ;; Ok, we have a valid component group, so we jump to it.
- (switch-to-buffer gnus-group-buffer)
- (gnus-group-jump-to-group (caar newsrc))
- (gnus-message 3 "nnkiboze: Checking %s..." (caar newsrc))
- (setq ginfo (gnus-get-info (gnus-group-group-name))
- orig-info (gnus-copy-sequence ginfo)
- num-unread (gnus-group-unread (caar newsrc)))
- (unwind-protect
- (progn
- ;; We set all list of article marks to nil. Since we operate
- ;; on copies of the real lists, we can destroy anything we
- ;; want here.
- (when (nth 3 ginfo)
- (setcar (nthcdr 3 ginfo) nil))
- ;; We set the list of read articles to be what we expect for
- ;; this kiboze group -- either nil or `(1 . LOWEST)'.
- (when ginfo
- (setcar (nthcdr 2 ginfo)
- (and (not (= lowest 1)) (cons 1 lowest))))
- (when (and (or (not ginfo)
- (> (length (gnus-list-of-unread-articles
- (car ginfo)))
- 0))
- (progn
- (ignore-errors
- (gnus-group-select-group nil))
- (eq major-mode 'gnus-summary-mode)))
- ;; We are now in the group where we want to be.
- (setq method (gnus-find-method-for-group
- gnus-newsgroup-name))
- (when (eq method gnus-select-method)
- (setq method nil))
- ;; We go through the list of scored articles.
- (while gnus-newsgroup-scored
- (when (> (caar gnus-newsgroup-scored) lowest)
- ;; If it has a good score, then we enter this article
- ;; into the kiboze group.
- (nnkiboze-enter-nov
- nov-buffer
- (gnus-summary-article-header
- (caar gnus-newsgroup-scored))
- gnus-newsgroup-name))
- (setq gnus-newsgroup-scored (cdr gnus-newsgroup-scored)))
- ;; That's it. We exit this group.
- (when (eq major-mode 'gnus-summary-mode)
- (kill-buffer (current-buffer)))))
- ;; Restore the proper info.
- (when ginfo
- (setcdr ginfo (cdr orig-info)))
- (setcar (gnus-group-entry (caar newsrc)) num-unread)))
- (setcdr (car newsrc) (cdr active))
- (gnus-message 3 "nnkiboze: Checking %s...done" (caar newsrc))
- (setq newsrc (cdr newsrc)))))
- ;; We save the kiboze newsrc for this group.
- (gnus-make-directory (file-name-directory newsrc-file))
- (with-temp-file newsrc-file
- (insert "(setq nnkiboze-newsrc '")
- (gnus-prin1 nnkiboze-newsrc)
- (insert ")\n")))
+ (when (file-exists-p newsrc-file)
+ (load newsrc-file))
+ (let ((coding-system-for-write nnkiboze-file-coding-system))
+ (gnus-make-directory (file-name-directory nov-file))
+ (with-temp-file nov-file
+ (mm-disable-multibyte)
+ (when (file-exists-p nov-file)
+ (insert-file-contents nov-file))
+ (setq nov-buffer (current-buffer))
+ ;; Go through the active hashtb and add new all groups that match the
+ ;; kiboze regexp.
+ (mapatoms
+ (lambda (group)
+ (and (string-match nnkiboze-regexp
+ (setq gname (symbol-name group))) ; Match
+ (not (assoc gname nnkiboze-newsrc)) ; It isn't registered
+ (numberp (car (symbol-value group))) ; It is active
+ (or (> nnkiboze-level 7)
+ (and (setq glevel
+ (gnus-info-level (gnus-get-info gname)))
+ (>= nnkiboze-level glevel)))
+ (not (string-match "^nnkiboze:" gname)) ; Exclude kibozes
+ (push (cons gname (1- (car (symbol-value group))))
+ nnkiboze-newsrc)))
+ gnus-active-hashtb)
+ ;; `newsrc' is set to the list of groups that possibly are
+ ;; component groups to this kiboze group. This list has elements
+ ;; on the form `(GROUP . NUMBER)', where NUMBER is the highest
+ ;; number that has been kibozed in GROUP in this kiboze group.
+ (setq newsrc nnkiboze-newsrc)
+ (while newsrc
+ (if (not (setq active (gnus-active (caar newsrc))))
+ ;; This group isn't active after all, so we remove it from
+ ;; the list of component groups.
+ (setq nnkiboze-newsrc (delq (car newsrc) nnkiboze-newsrc))
+ (setq lowest (cdar newsrc))
+ ;; Ok, we have a valid component group, so we jump to it.
+ (switch-to-buffer gnus-group-buffer)
+ (gnus-group-jump-to-group (caar newsrc))
+ (gnus-message 3 "nnkiboze: Checking %s..." (caar newsrc))
+ (setq ginfo (gnus-get-info (gnus-group-group-name))
+ orig-info (gnus-copy-sequence ginfo)
+ num-unread (gnus-group-unread (caar newsrc)))
+ (unwind-protect
+ (progn
+ ;; We set all list of article marks to nil. Since we operate
+ ;; on copies of the real lists, we can destroy anything we
+ ;; want here.
+ (when (nth 3 ginfo)
+ (setcar (nthcdr 3 ginfo) nil))
+ ;; We set the list of read articles to be what we expect for
+ ;; this kiboze group -- either nil or `(1 . LOWEST)'.
+ (when ginfo
+ (setcar (nthcdr 2 ginfo)
+ (and (not (= lowest 1)) (cons 1 lowest))))
+ (when (and (or (not ginfo)
+ (> (length (gnus-list-of-unread-articles
+ (car ginfo)))
+ 0))
+ (progn
+ (ignore-errors
+ (gnus-group-select-group nil))
+ (eq major-mode 'gnus-summary-mode)))
+ ;; We are now in the group where we want to be.
+ (setq method (gnus-find-method-for-group
+ gnus-newsgroup-name))
+ (when (eq method gnus-select-method)
+ (setq method nil))
+ ;; We go through the list of scored articles.
+ (while gnus-newsgroup-scored
+ (when (> (caar gnus-newsgroup-scored) lowest)
+ ;; If it has a good score, then we enter this article
+ ;; into the kiboze group.
+ (nnkiboze-enter-nov
+ nov-buffer
+ (gnus-summary-article-header
+ (caar gnus-newsgroup-scored))
+ gnus-newsgroup-name))
+ (setq gnus-newsgroup-scored (cdr gnus-newsgroup-scored)))
+ ;; That's it. We exit this group.
+ (when (eq major-mode 'gnus-summary-mode)
+ (kill-buffer (current-buffer)))))
+ ;; Restore the proper info.
+ (when ginfo
+ (setcdr ginfo (cdr orig-info)))
+ (setcar (gnus-group-entry (caar newsrc)) num-unread)))
+ (setcdr (car newsrc) (cdr active))
+ (gnus-message 3 "nnkiboze: Checking %s...done" (caar newsrc))
+ (setq newsrc (cdr newsrc)))))
+ ;; We save the kiboze newsrc for this group.
+ (gnus-make-directory (file-name-directory newsrc-file))
+ (with-temp-file newsrc-file
+ (mm-disable-multibyte)
+ (insert "(setq nnkiboze-newsrc '")
+ (gnus-prin1 nnkiboze-newsrc)
+ (insert ")\n"))
(unless inhibit-list-groups
(save-excursion
(set-buffer gnus-group-buffer)
Index: nnmairix.el
diff -u gnus/lisp/nnmairix.el:7.10 gnus/lisp/nnmairix.el:7.11
--- nnmairix.el:7.10 Sat Jun 14 17:39:11 2008
+++ nnmairix.el Fri Jul 4 02:09:29 2008
@@ -163,6 +163,8 @@
;;; Code:
+(eval-when-compile (require 'cl)) ;For (pop (cdr ogroup)).
+
(require 'nnoo)
(require 'gnus-group)
(require 'gnus-sum)
Index: rfc2047.el
diff -u gnus/lisp/rfc2047.el:7.71 gnus/lisp/rfc2047.el:7.72
--- rfc2047.el:7.71 Mon May 19 10:47:41 2008
+++ rfc2047.el Fri Jul 4 02:09:29 2008
@@ -291,7 +291,7 @@
;; 8-bit names. The group name mail copy just got
;; unconditionally encoded. Previously, it would ask
;; whether to encode, which was quite confusing for the
- ;; user. If the new behaviour is wrong, tell me. I have
+ ;; user. If the new behavior is wrong, tell me. I have
;; left the old code commented out below.
;; -- Per Abrahamsen <[email protected]> Date: 2001-10-07.
;; Modified by Dave Love, with the commented-out code changed
Index: sasl-ntlm.el
diff -u gnus/lisp/sasl-ntlm.el:7.8 gnus/lisp/sasl-ntlm.el:7.9
--- sasl-ntlm.el:7.8 Mon May 19 10:47:42 2008
+++ sasl-ntlm.el Fri Jul 4 02:09:29 2008
@@ -36,12 +36,12 @@
'(ignore ;nothing to do before making
sasl-ntlm-request ;authentication request
sasl-ntlm-response) ;response to challenge
- "A list of functions to be called in sequnece for the NTLM
-authentication steps. Ther are called by 'sasl-next-step.")
+ "A list of functions to be called in sequence for the NTLM
+authentication steps. They are called by `sasl-next-step'.")
(defun sasl-ntlm-request (client step)
"SASL step function to generate a NTLM authentication request to the server.
-Called from 'sasl-next-step.
+Called from `sasl-next-step'.
CLIENT is a vector [mechanism user service server sasl-client-properties]
STEP is a vector [<previous step function> <result of previous step function>]"
(let ((user (sasl-client-name client)))
@@ -49,7 +49,7 @@
(defun sasl-ntlm-response (client step)
"SASL step function to generate a NTLM response against the server
-challenge stored in the 2nd element of STEP. Called from 'sasl-next-step."
+challenge stored in the 2nd element of STEP. Called from `sasl-next-step'."
(let* ((user (sasl-client-name client))
(passphrase
(sasl-read-passphrase (format "NTLM passphrase for %s: " user)))
Index: sasl.el
diff -u gnus/lisp/sasl.el:7.8 gnus/lisp/sasl.el:7.9
--- sasl.el:7.8 Mon May 19 10:47:41 2008
+++ sasl.el Fri Jul 4 02:09:29 2008
@@ -86,7 +86,7 @@
(setplist (aref client 4) plist))
(defun sasl-client-set-property (client property value)
- "Add the given property/value to CLIENT."
+ "Add the given PROPERTY/VALUE to CLIENT."
(put (aref client 4) property value))
(defun sasl-client-property (client property)
@@ -103,7 +103,7 @@
(defun sasl-make-mechanism (name steps)
"Make an authentication mechanism.
NAME is a IANA registered SASL mechanism name.
-STEPS is list of continuation function."
+STEPS is list of continuation functions."
(vector name
(mapcar
(lambda (step)
@@ -121,7 +121,7 @@
(aref mechanism 1))
(defun sasl-find-mechanism (mechanisms)
- "Retrieve an apropriate mechanism object from MECHANISMS hints."
+ "Retrieve an appropriate mechanism object from MECHANISMS hints."
(let* ((sasl-mechanisms sasl-mechanisms)
(mechanism
(catch 'done
@@ -147,9 +147,9 @@
(defun sasl-next-step (client step)
"Evaluate the challenge and prepare an appropriate next response.
-The data type of the value and optional 2nd argument STEP is nil or
-opaque authentication step which holds the reference to the next action
-and the current challenge. At the first time STEP should be set to nil."
+The data type of the value and 2nd argument STEP is nil or opaque
+authentication step which holds the reference to the next action and
+the current challenge. At the first time STEP should be set to nil."
(let* ((steps
(sasl-mechanism-steps
(sasl-client-mechanism client)))
Index: sieve-manage.el
diff -u gnus/lisp/sieve-manage.el:7.23 gnus/lisp/sieve-manage.el:7.24
--- sieve-manage.el:7.23 Wed Jun 11 16:19:44 2008
+++ sieve-manage.el Fri Jul 4 02:09:29 2008
@@ -443,12 +443,12 @@
(defun sieve-manage-open (server &optional port stream auth buffer)
"Open a network connection to a managesieve SERVER (string).
-Optional variable PORT is port number (integer) on remote server.
-Optional variable STREAM is any of `sieve-manage-streams' (a symbol).
-Optional variable AUTH indicates authenticator to use, see
-`sieve-manage-authenticators' for available authenticators. If nil, chooses
-the best stream the server is capable of.
-Optional variable BUFFER is buffer (buffer, or string naming buffer)
+Optional argument PORT is port number (integer) on remote server.
+Optional argument STREAM is any of `sieve-manage-streams' (a symbol).
+Optional argument AUTH indicates authenticator to use, see
+`sieve-manage-authenticators' for available authenticators.
+If nil, chooses the best stream the server is capable of.
+Optional argument BUFFER is buffer (buffer, or string naming buffer)
to work in."
(setq buffer (or buffer (format " *sieve* %s:%d" server (or port 2000))))
(with-current-buffer (get-buffer-create buffer)
Index: smime.el
diff -u gnus/lisp/smime.el:7.35 gnus/lisp/smime.el:7.36
--- smime.el:7.35 Mon May 19 10:47:42 2008
+++ smime.el Fri Jul 4 02:09:29 2008
@@ -63,7 +63,7 @@
;;
;; Now you should be able to sign messages! Create a buffer and write
;; something and run M-x smime-sign-buffer RET RET and you should see
-;; your message MIME armoured and a signature. Encryption, M-x
+;; your message MIME armored and a signature. Encryption, M-x
;; smime-encrypt-buffer, should also work.
;;
;; To be able to verify messages you need to build up trust with
Index: vc-annotate.el
diff -u /dev/null gnus/lisp/vc-annotate.el:7.1
--- /dev/null Fri Jul 4 02:09:29 2008
+++ vc-annotate.el Fri Jul 4 02:09:29 2008
@@ -0,0 +1,631 @@
+;;; vc-annotate.el --- VC Annotate Support
+
+;; Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+;; 2007, 2008 Free Software Foundation, Inc.
+
+;; Author: Martin Lorentzson <[email protected]>
+;; Maintainer: FSF
+;; Keywords: tools
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+
+(require 'vc-hooks)
+(require 'vc)
+
+;;; Code:
+(eval-when-compile
+ (require 'cl))
+
+(defcustom vc-annotate-display-mode 'fullscale
+ "Which mode to color the output of \\[vc-annotate] with by default."
+ :type '(choice (const :tag "By Color Map Range" nil)
+ (const :tag "Scale to Oldest" scale)
+ (const :tag "Scale Oldest->Newest" fullscale)
+ (number :tag "Specify Fractional Number of Days"
+ :value "20.5"))
+ :group 'vc)
+
+(defcustom vc-annotate-color-map
+ (if (and (tty-display-color-p) (<= (display-color-cells) 8))
+ ;; A custom sorted TTY colormap
+ (let* ((colors
+ (sort
+ (delq nil
+ (mapcar (lambda (x)
+ (if (not (or
+ (string-equal (car x) "white")
+ (string-equal (car x) "black") ))
+ (car x)))
+ (tty-color-alist)))
+ (lambda (a b)
+ (cond
+ ((or (string-equal a "red") (string-equal b "blue")) t)
+ ((or (string-equal b "red") (string-equal a "blue")) nil)
+ ((string-equal a "yellow") t)
+ ((string-equal b "yellow") nil)
+ ((string-equal a "cyan") t)
+ ((string-equal b "cyan") nil)
+ ((string-equal a "green") t)
+ ((string-equal b "green") nil)
+ ((string-equal a "magenta") t)
+ ((string-equal b "magenta") nil)
+ (t (string< a b))))))
+ (date 20.)
+ (delta (/ (- 360. date) (1- (length colors)))))
+ (mapcar (lambda (x)
+ (prog1
+ (cons date x)
+ (setq date (+ date delta)))) colors))
+ ;; Normal colormap: hue stepped from 0-240deg, value=1., saturation=0.75
+ '(( 20. . "#FF3F3F")
+ ( 40. . "#FF6C3F")
+ ( 60. . "#FF993F")
+ ( 80. . "#FFC63F")
+ (100. . "#FFF33F")
+ (120. . "#DDFF3F")
+ (140. . "#B0FF3F")
+ (160. . "#83FF3F")
+ (180. . "#56FF3F")
+ (200. . "#3FFF56")
+ (220. . "#3FFF83")
+ (240. . "#3FFFB0")
+ (260. . "#3FFFDD")
+ (280. . "#3FF3FF")
+ (300. . "#3FC6FF")
+ (320. . "#3F99FF")
+ (340. . "#3F6CFF")
+ (360. . "#3F3FFF")))
+ "Association list of age versus color, for \\[vc-annotate].
+Ages are given in units of fractional days. Default is eighteen
+steps using a twenty day increment, from red to blue. For TTY
+displays with 8 or fewer colors, the default is red to blue with
+all other colors between (excluding black and white)."
+ :type 'alist
+ :group 'vc)
+
+(defcustom vc-annotate-very-old-color "#3F3FFF"
+ "Color for lines older than the current color range in \\[vc-annotate]]."
+ :type 'string
+ :group 'vc)
+
+(defcustom vc-annotate-background "black"
+ "Background color for \\[vc-annotate].
+Default color is used if nil."
+ :type '(choice (const :tag "Default background" nil) (color))
+ :group 'vc)
+
+(defcustom vc-annotate-menu-elements '(2 0.5 0.1 0.01)
+ "Menu elements for the mode-specific menu of VC-Annotate mode.
+List of factors, used to expand/compress the time scale. See `vc-annotate'."
+ :type '(repeat number)
+ :group 'vc)
+
+(defvar vc-annotate-mode-map
+ (let ((m (make-sparse-keymap)))
+ (define-key m "a" 'vc-annotate-revision-previous-to-line)
+ (define-key m "d" 'vc-annotate-show-diff-revision-at-line)
+ (define-key m "D" 'vc-annotate-show-changeset-diff-revision-at-line)
+ (define-key m "f" 'vc-annotate-find-revision-at-line)
+ (define-key m "j" 'vc-annotate-revision-at-line)
+ (define-key m "l" 'vc-annotate-show-log-revision-at-line)
+ (define-key m "n" 'vc-annotate-next-revision)
+ (define-key m "p" 'vc-annotate-prev-revision)
+ (define-key m "w" 'vc-annotate-working-revision)
+ (define-key m "v" 'vc-annotate-toggle-annotation-visibility)
+ m)
+ "Local keymap used for VC-Annotate mode.")
+
+;;; Annotate functionality
+
+;; Declare globally instead of additional parameter to
+;; temp-buffer-show-function (not possible to pass more than one
+;; parameter). The use of annotate-ratio is deprecated in favor of
+;; annotate-mode, which replaces it with the more sensible "span-to
+;; days", along with autoscaling support.
+(defvar vc-annotate-ratio nil "Global variable.")
+
+;; internal buffer-local variables
+(defvar vc-annotate-backend nil)
+(defvar vc-annotate-parent-file nil)
+(defvar vc-annotate-parent-rev nil)
+(defvar vc-annotate-parent-display-mode nil)
+
+(defconst vc-annotate-font-lock-keywords
+ ;; The fontification is done by vc-annotate-lines instead of font-lock.
+ '((vc-annotate-lines)))
+
+(define-derived-mode vc-annotate-mode special-mode "Annotate"
+ "Major mode for output buffers of the `vc-annotate' command.
+
+You can use the mode-specific menu to alter the time-span of the used
+colors. See variable `vc-annotate-menu-elements' for customizing the
+menu items."
+ ;; Frob buffer-invisibility-spec so that if it is originally a naked t,
+ ;; it will become a list, to avoid initial annotations being invisible.
+ (add-to-invisibility-spec 'foo)
+ (remove-from-invisibility-spec 'foo)
+ (set (make-local-variable 'truncate-lines) t)
+ (set (make-local-variable 'font-lock-defaults)
+ '(vc-annotate-font-lock-keywords t)))
+
+(defun vc-annotate-toggle-annotation-visibility ()
+ "Toggle whether or not the annotation is visible."
+ (interactive)
+ (funcall (if (memq 'vc-annotate-annotation buffer-invisibility-spec)
+ 'remove-from-invisibility-spec
+ 'add-to-invisibility-spec)
+ 'vc-annotate-annotation)
+ (force-window-update (current-buffer)))
+
+(defun vc-annotate-display-default (ratio)
+ "Display the output of \\[vc-annotate] using the default color range.
+The color range is given by `vc-annotate-color-map', scaled by RATIO.
+The current time is used as the offset."
+ (interactive (progn (kill-local-variable 'vc-annotate-color-map) '(1.0)))
+ (message "Redisplaying annotation...")
+ (vc-annotate-display ratio)
+ (message "Redisplaying annotation...done"))
+
+(defun vc-annotate-oldest-in-map (color-map)
+ "Return the oldest time in the COLOR-MAP."
+ ;; Since entries should be sorted, we can just use the last one.
+ (caar (last color-map)))
+
+(defun vc-annotate-get-time-set-line-props ()
+ (let ((bol (point))
+ (date (vc-call-backend vc-annotate-backend 'annotate-time))
+ (inhibit-read-only t))
+ (assert (>= (point) bol))
+ (put-text-property bol (point) 'invisible 'vc-annotate-annotation)
+ date))
+
+(defun vc-annotate-display-autoscale (&optional full)
+ "Highlight the output of \\[vc-annotate] using an autoscaled color map.
+Autoscaling means that the map is scaled from the current time to the
+oldest annotation in the buffer, or, with prefix argument FULL, to
+cover the range from the oldest annotation to the newest."
+ (interactive "P")
+ (let ((newest 0.0)
+ (oldest 999999.) ;Any CVS users at the founding of Rome?
+ (current (vc-annotate-convert-time (current-time)))
+ date)
+ (message "Redisplaying annotation...")
+ ;; Run through this file and find the oldest and newest dates annotated.
+ (save-excursion
+ (goto-char (point-min))
+ (while (not (eobp))
+ (when (setq date (vc-annotate-get-time-set-line-props))
+ (when (> date newest)
+ (setq newest date))
+ (when (< date oldest)
+ (setq oldest date)))
+ (forward-line 1)))
+ (vc-annotate-display
+ (/ (- (if full newest current) oldest)
+ (vc-annotate-oldest-in-map vc-annotate-color-map))
+ (if full newest))
+ (message "Redisplaying annotation...done \(%s\)"
+ (if full
+ (format "Spanned from %.1f to %.1f days old"
+ (- current oldest)
+ (- current newest))
+ (format "Spanned to %.1f days old" (- current oldest))))))
+
+;; Menu -- Using easymenu.el
+(easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map
+ "VC Annotate Display Menu"
+ `("VC-Annotate"
+ ["By Color Map Range" (unless (null vc-annotate-display-mode)
+ (setq vc-annotate-display-mode nil)
+ (vc-annotate-display-select))
+ :style toggle :selected (null vc-annotate-display-mode)]
+ ,@(let ((oldest-in-map (vc-annotate-oldest-in-map vc-annotate-color-map)))
+ (mapcar (lambda (element)
+ (let ((days (* element oldest-in-map)))
+ `[,(format "Span %.1f days" days)
+ (vc-annotate-display-select nil ,days)
+ :style toggle :selected
+ (eql vc-annotate-display-mode ,days) ]))
+ vc-annotate-menu-elements))
+ ["Span ..."
+ (vc-annotate-display-select
+ nil (float (string-to-number (read-string "Span how many days? "))))]
+ "--"
+ ["Span to Oldest"
+ (unless (eq vc-annotate-display-mode 'scale)
+ (vc-annotate-display-select nil 'scale))
+ :help
+ "Use an autoscaled color map from the oldest annotation to the current time"
+ :style toggle :selected
+ (eq vc-annotate-display-mode 'scale)]
+ ["Span Oldest->Newest"
+ (unless (eq vc-annotate-display-mode 'fullscale)
+ (vc-annotate-display-select nil 'fullscale))
+ :help
+ "Use an autoscaled color map from the oldest to the newest annotation"
+ :style toggle :selected
+ (eq vc-annotate-display-mode 'fullscale)]
+ "--"
+ ["Toggle annotation visibility" vc-annotate-toggle-annotation-visibility
+ :help
+ "Toggle whether the annotation is visible or not"]
+ ["Annotate previous revision" vc-annotate-prev-revision
+ :help "Visit the annotation of the revision previous to this one"]
+ ["Annotate next revision" vc-annotate-next-revision
+ :help "Visit the annotation of the revision after this one"]
+ ["Annotate revision at line" vc-annotate-revision-at-line
+ :help
+ "Visit the annotation of the revision identified in the current line"]
+ ["Annotate revision previous to line" vc-annotate-revision-previous-to-line
+ :help "Visit the annotation of the revision before the revision at line"]
+ ["Annotate latest revision" vc-annotate-working-revision
+ :help "Visit the annotation of the working revision of this file"]
+ ["Show log of revision at line" vc-annotate-show-log-revision-at-line
+ :help "Visit the log of the revision at line"]
+ ["Show diff of revision at line" vc-annotate-show-diff-revision-at-line
+ :help "Visit the diff of the revision at line from its previous revision"]
+ ["Show changeset diff of revision at line"
+ vc-annotate-show-changeset-diff-revision-at-line
+ :enable
+ (eq 'repository (vc-call-backend ,vc-annotate-backend 'revision-granularity))
+ :help "Visit the diff of the revision at line from its previous revision"]
+ ["Visit revision at line" vc-annotate-find-revision-at-line
+ :help "Visit the revision identified in the current line"]))
+
+(defun vc-annotate-display-select (&optional buffer mode)
+ "Highlight the output of \\[vc-annotate].
+By default, the current buffer is highlighted, unless overridden by
+BUFFER. `vc-annotate-display-mode' specifies the highlighting mode to
+use; you may override this using the second optional arg MODE."
+ (interactive)
+ (when mode (setq vc-annotate-display-mode mode))
+ (pop-to-buffer (or buffer (current-buffer)))
+ (cond ((null vc-annotate-display-mode)
+ ;; The ratio is global, thus relative to the global color-map.
+ (kill-local-variable 'vc-annotate-color-map)
+ (vc-annotate-display-default (or vc-annotate-ratio 1.0)))
+ ;; One of the auto-scaling modes
+ ((eq vc-annotate-display-mode 'scale)
+ (vc-exec-after `(vc-annotate-display-autoscale)))
+ ((eq vc-annotate-display-mode 'fullscale)
+ (vc-exec-after `(vc-annotate-display-autoscale t)))
+ ((numberp vc-annotate-display-mode) ; A fixed number of days lookback
+ (vc-annotate-display-default
+ (/ vc-annotate-display-mode
+ (vc-annotate-oldest-in-map vc-annotate-color-map))))
+ (t (error "No such display mode: %s"
+ vc-annotate-display-mode))))
+
+;;;###autoload
+(defun vc-annotate (file rev &optional display-mode buf move-point-to)
+ "Display the edit history of the current file using colors.
+
+This command creates a buffer that shows, for each line of the current
+file, when it was last edited and by whom. Additionally, colors are
+used to show the age of each line--blue means oldest, red means
+youngest, and intermediate colors indicate intermediate ages. By
+default, the time scale stretches back one year into the past;
+everything that is older than that is shown in blue.
+
+With a prefix argument, this command asks two questions in the
+minibuffer. First, you may enter a revision number; then the buffer
+displays and annotates that revision instead of the working revision
+\(type RET in the minibuffer to leave that default unchanged). Then,
+you are prompted for the time span in days which the color range
+should cover. For example, a time span of 20 days means that changes
+over the past 20 days are shown in red to blue, according to their
+age, and everything that is older than that is shown in blue.
+
+If MOVE-POINT-TO is given, move the point to that line.
+
+Customization variables:
+
+`vc-annotate-menu-elements' customizes the menu elements of the
+mode-specific menu. `vc-annotate-color-map' and
+`vc-annotate-very-old-color' define the mapping of time to colors.
+`vc-annotate-background' specifies the background color."
+ (interactive
+ (save-current-buffer
+ (vc-ensure-vc-buffer)
+ (list buffer-file-name
+ (let ((def (vc-working-revision buffer-file-name)))
+ (if (null current-prefix-arg) def
+ (read-string
+ (format "Annotate from revision (default %s): " def)
+ nil nil def)))
+ (if (null current-prefix-arg)
+ vc-annotate-display-mode
+ (float (string-to-number
+ (read-string "Annotate span days (default 20): "
+ nil nil "20")))))))
+ (vc-ensure-vc-buffer)
+ (setq vc-annotate-display-mode display-mode) ;Not sure why. --Stef
+ (let* ((temp-buffer-name (format "*Annotate %s (rev %s)*" (buffer-name) rev))
+ (temp-buffer-show-function 'vc-annotate-display-select)
+ ;; If BUF is specified, we presume the caller maintains current line,
+ ;; so we don't need to do it here. This implementation may give
+ ;; strange results occasionally in the case of REV != WORKFILE-REV.
+ (current-line (or move-point-to (unless buf (line-number-at-pos)))))
+ (message "Annotating...")
+ ;; If BUF is specified it tells in which buffer we should put the
+ ;; annotations. This is used when switching annotations to another
+ ;; revision, so we should update the buffer's name.
+ (when buf (with-current-buffer buf
+ (rename-buffer temp-buffer-name t)
+ ;; In case it had to be uniquified.
+ (setq temp-buffer-name (buffer-name))))
+ (with-output-to-temp-buffer temp-buffer-name
+ (let ((backend (vc-backend file)))
+ (vc-call-backend backend 'annotate-command file
+ (get-buffer temp-buffer-name) rev)
+ ;; we must setup the mode first, and then set our local
+ ;; variables before the show-function is called at the exit of
+ ;; with-output-to-temp-buffer
+ (with-current-buffer temp-buffer-name
+ (unless (equal major-mode 'vc-annotate-mode)
+ (vc-annotate-mode))
+ (set (make-local-variable 'vc-annotate-backend) backend)
+ (set (make-local-variable 'vc-annotate-parent-file) file)
+ (set (make-local-variable 'vc-annotate-parent-rev) rev)
+ (set (make-local-variable 'vc-annotate-parent-display-mode)
+ display-mode))))
+
+ (with-current-buffer temp-buffer-name
+ (vc-exec-after
+ `(progn
+ ;; Ideally, we'd rather not move point if the user has already
+ ;; moved it elsewhere, but really point here is not the position
+ ;; of the user's cursor :-(
+ (when ,current-line ;(and (bobp))
+ (goto-line ,current-line)
+ (setq vc-sentinel-movepoint (point)))
+ (unless (active-minibuffer-window)
+ (message "Annotating... done")))))))
+
+(defun vc-annotate-prev-revision (prefix)
+ "Visit the annotation of the revision previous to this one.
+
+With a numeric prefix argument, annotate the revision that many
+revisions previous."
+ (interactive "p")
+ (vc-annotate-warp-revision (- 0 prefix)))
+
+(defun vc-annotate-next-revision (prefix)
+ "Visit the annotation of the revision after this one.
+
+With a numeric prefix argument, annotate the revision that many
+revisions after."
+ (interactive "p")
+ (vc-annotate-warp-revision prefix))
+
+(defun vc-annotate-working-revision ()
+ "Visit the annotation of the working revision of this file."
+ (interactive)
+ (if (not (equal major-mode 'vc-annotate-mode))
+ (message "Cannot be invoked outside of a vc annotate buffer")
+ (let ((warp-rev (vc-working-revision vc-annotate-parent-file)))
+ (if (equal warp-rev vc-annotate-parent-rev)
+ (message "Already at revision %s" warp-rev)
+ (vc-annotate-warp-revision warp-rev)))))
+
+(defun vc-annotate-extract-revision-at-line ()
+ "Extract the revision number of the current line."
+ ;; This function must be invoked from a buffer in vc-annotate-mode
+ (vc-call-backend vc-annotate-backend 'annotate-extract-revision-at-line))
+
+(defun vc-annotate-revision-at-line ()
+ "Visit the annotation of the revision identified in the current line."
+ (interactive)
+ (if (not (equal major-mode 'vc-annotate-mode))
+ (message "Cannot be invoked outside of a vc annotate buffer")
+ (let ((rev-at-line (vc-annotate-extract-revision-at-line)))
+ (if (not rev-at-line)
+ (message "Cannot extract revision number from the current line")
+ (if (equal rev-at-line vc-annotate-parent-rev)
+ (message "Already at revision %s" rev-at-line)
+ (vc-annotate-warp-revision rev-at-line))))))
+
+(defun vc-annotate-find-revision-at-line ()
+ "Visit the revision identified in the current line."
+ (interactive)
+ (if (not (equal major-mode 'vc-annotate-mode))
+ (message "Cannot be invoked outside of a vc annotate buffer")
+ (let ((rev-at-line (vc-annotate-extract-revision-at-line)))
+ (if (not rev-at-line)
+ (message "Cannot extract revision number from the current line")
+ (vc-revision-other-window rev-at-line)))))
+
+(defun vc-annotate-revision-previous-to-line ()
+ "Visit the annotation of the revision before the revision at line."
+ (interactive)
+ (if (not (equal major-mode 'vc-annotate-mode))
+ (message "Cannot be invoked outside of a vc annotate buffer")
+ (let ((rev-at-line (vc-annotate-extract-revision-at-line))
+ (prev-rev nil))
+ (if (not rev-at-line)
+ (message "Cannot extract revision number from the current line")
+ (setq prev-rev
+ (vc-call-backend vc-annotate-backend 'previous-revision
+ vc-annotate-parent-file rev-at-line))
+ (vc-annotate-warp-revision prev-rev)))))
+
+(defun vc-annotate-show-log-revision-at-line ()
+ "Visit the log of the revision at line."
+ (interactive)
+ (if (not (equal major-mode 'vc-annotate-mode))
+ (message "Cannot be invoked outside of a vc annotate buffer")
+ (let ((rev-at-line (vc-annotate-extract-revision-at-line)))
+ (if (not rev-at-line)
+ (message "Cannot extract revision number from the current line")
+ (vc-print-log rev-at-line)))))
+
+(defun vc-annotate-show-diff-revision-at-line-internal (fileset)
+ (if (not (equal major-mode 'vc-annotate-mode))
+ (message "Cannot be invoked outside of a vc annotate buffer")
+ (let ((rev-at-line (vc-annotate-extract-revision-at-line))
+ (prev-rev nil))
+ (if (not rev-at-line)
+ (message "Cannot extract revision number from the current line")
+ (setq prev-rev
+ (vc-call-backend vc-annotate-backend 'previous-revision
+ vc-annotate-parent-file rev-at-line))
+ (if (not prev-rev)
+ (message "Cannot diff from any revision prior to %s" rev-at-line)
+ (save-window-excursion
+ (vc-diff-internal
+ nil
+ ;; The value passed here should follow what
+ ;; `vc-deduce-fileset' returns.
+ (cons vc-annotate-backend (cons fileset nil))
+ prev-rev rev-at-line))
+ (switch-to-buffer "*vc-diff*"))))))
+
+(defun vc-annotate-show-diff-revision-at-line ()
+ "Visit the diff of the revision at line from its previous revision."
+ (interactive)
+ (vc-annotate-show-diff-revision-at-line-internal (list vc-annotate-parent-file)))
+
+(defun vc-annotate-show-changeset-diff-revision-at-line ()
+ "Visit the diff of the revision at line from its previous revision for all files in the changeset."
+ (interactive)
+ (when (eq 'file (vc-call-backend vc-annotate-backend 'revision-granularity))
+ (error "The %s backend does not support changeset diffs" vc-annotate-backend))
+ (vc-annotate-show-diff-revision-at-line-internal nil))
+
+(defun vc-annotate-warp-revision (revspec)
+ "Annotate the revision described by REVSPEC.
+
+If REVSPEC is a positive integer, warp that many revisions
+forward, if possible, otherwise echo a warning message. If
+REVSPEC is a negative integer, warp that many revisions backward,
+if possible, otherwise echo a warning message. If REVSPEC is a
+string, then it describes a revision number, so warp to that
+revision."
+ (if (not (equal major-mode 'vc-annotate-mode))
+ (message "Cannot be invoked outside of a vc annotate buffer")
+ (let* ((buf (current-buffer))
+ (oldline (line-number-at-pos))
+ (revspeccopy revspec)
+ (newrev nil))
+ (cond
+ ((and (integerp revspec) (> revspec 0))
+ (setq newrev vc-annotate-parent-rev)
+ (while (and (> revspec 0) newrev)
+ (setq newrev (vc-call-backend vc-annotate-backend 'next-revision
+ vc-annotate-parent-file newrev))
+ (setq revspec (1- revspec)))
+ (unless newrev
+ (message "Cannot increment %d revisions from revision %s"
+ revspeccopy vc-annotate-parent-rev)))
+ ((and (integerp revspec) (< revspec 0))
+ (setq newrev vc-annotate-parent-rev)
+ (while (and (< revspec 0) newrev)
+ (setq newrev (vc-call-backend vc-annotate-backend 'previous-revision
+ vc-annotate-parent-file newrev))
+ (setq revspec (1+ revspec)))
+ (unless newrev
+ (message "Cannot decrement %d revisions from revision %s"
+ (- 0 revspeccopy) vc-annotate-parent-rev)))
+ ((stringp revspec) (setq newrev revspec))
+ (t (error "Invalid argument to vc-annotate-warp-revision")))
+ (when newrev
+ (vc-annotate vc-annotate-parent-file newrev
+ vc-annotate-parent-display-mode
+ buf
+ ;; Pass the current line so that vc-annotate will
+ ;; place the point in the line.
+ (min oldline (progn (goto-char (point-max))
+ (forward-line -1)
+ (line-number-at-pos))))))))
+
+(defun vc-annotate-compcar (threshold a-list)
+ "Test successive cons cells of A-LIST against THRESHOLD.
+Return the first cons cell with a car that is not less than THRESHOLD,
+nil if no such cell exists."
+ (let ((i 1)
+ (tmp-cons (car a-list)))
+ (while (and tmp-cons (< (car tmp-cons) threshold))
+ (setq tmp-cons (car (nthcdr i a-list)))
+ (setq i (+ i 1)))
+ tmp-cons)) ; Return the appropriate value
+
+(defun vc-annotate-convert-time (time)
+ "Convert a time value to a floating-point number of days.
+The argument TIME is a list as returned by `current-time' or
+`encode-time', only the first two elements of that list are considered."
+ (/ (+ (* (float (car time)) (lsh 1 16)) (cadr time)) 24 3600))
+
+(defun vc-annotate-difference (&optional offset)
+ "Return the time span in days to the next annotation.
+This calls the backend function annotate-time, and returns the
+difference in days between the time returned and the current time,
+or OFFSET if present."
+ (let ((next-time (vc-annotate-get-time-set-line-props)))
+ (when next-time
+ (- (or offset
+ (vc-call-backend vc-annotate-backend 'annotate-current-time))
+ next-time))))
+
+(defun vc-default-annotate-current-time (backend)
+ "Return the current time, encoded as fractional days."
+ (vc-annotate-convert-time (current-time)))
+
+(defvar vc-annotate-offset nil)
+
+(defun vc-annotate-display (ratio &optional offset)
+ "Highlight `vc-annotate' output in the current buffer.
+RATIO, is the expansion that should be applied to `vc-annotate-color-map'.
+The annotations are relative to the current time, unless overridden by OFFSET."
+ (when (/= ratio 1.0)
+ (set (make-local-variable 'vc-annotate-color-map)
+ (mapcar (lambda (elem) (cons (* (car elem) ratio) (cdr elem)))
+ vc-annotate-color-map)))
+ (set (make-local-variable 'vc-annotate-offset) offset)
+ (font-lock-mode 1))
+
+(defun vc-annotate-lines (limit)
+ (while (< (point) limit)
+ (let ((difference (vc-annotate-difference vc-annotate-offset))
+ (start (point))
+ (end (progn (forward-line 1) (point))))
+ (when difference
+ (let* ((color (or (vc-annotate-compcar difference vc-annotate-color-map)
+ (cons nil vc-annotate-very-old-color)))
+ ;; substring from index 1 to remove any leading `#' in the name
+ (face-name (concat "vc-annotate-face-"
+ (if (string-equal
+ (substring (cdr color) 0 1) "#")
+ (substring (cdr color) 1)
+ (cdr color))))
+ ;; Make the face if not done.
+ (face (or (intern-soft face-name)
+ (let ((tmp-face (make-face (intern face-name))))
+ (set-face-foreground tmp-face (cdr color))
+ (when vc-annotate-background
+ (set-face-background tmp-face
+ vc-annotate-background))
+ tmp-face)))) ; Return the face
+ (put-text-property start end 'face face)))))
+ ;; Pretend to font-lock there were no matches.
+ nil)
+
+(provide 'vc-annotate)
+
+;; arch-tag: c3454a89-80e5-4ffd-8993-671b59612898
+;;; vc-annotate.el ends here
Index: vc-dir.el
diff -u /dev/null gnus/lisp/vc-dir.el:7.1
--- /dev/null Fri Jul 4 02:09:29 2008
+++ vc-dir.el Fri Jul 4 02:09:29 2008
@@ -0,0 +1,1067 @@
+;;; vc-dir.el --- Directory status display under VC
+
+;; Copyright (C) 2007, 2008
+;; Free Software Foundation, Inc.
+
+;; Author: Dan Nicolaescu <[email protected]>
+;; Keywords: tools
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Credits:
+
+;; The original VC directory status implementation was based on dired.
+;; This implementation was inspired by PCL-CVS.
+;; Many people contributed comments, ideas and code to this
+;; implementation. These include:
+;;
+;; Alexandre Julliard <[email protected]>
+;; Stefan Monnier <[email protected]>
+;; Tom Tromey <[email protected]>
+
+;;; Commentary:
+;;
+
+;;; Todo: see vc.el.
+
+(require 'vc-hooks)
+(require 'vc)
+(require 'tool-bar)
+(require 'ewoc)
+
+;;; Code:
+(eval-when-compile
+ (require 'cl))
+
+(defcustom vc-dir-mode-hook nil
+ "Normal hook run by `vc-dir-mode'.
+See `run-hooks'."
+ :type 'hook
+ :group 'vc)
+
+;; Used to store information for the files displayed in the directory buffer.
+;; Each item displayed corresponds to one of these defstructs.
+(defstruct (vc-dir-fileinfo
+ (:copier nil)
+ (:type list) ;So we can use `member' on lists of FIs.
+ (:constructor
+ ;; We could define it as an alias for `list'.
+ vc-dir-create-fileinfo (name state &optional extra marked directory))
+ (:conc-name vc-dir-fileinfo->))
+ name ;Keep it as first, for `member'.
+ state
+ ;; For storing backend specific information.
+ extra
+ marked
+ ;; To keep track of not updated files during a global refresh
+ needs-update
+ ;; To distinguish files and directories.
+ directory)
+
+(defvar vc-ewoc nil)
+
+(defvar vc-dir-process-buffer nil
+ "The buffer used for the asynchronous call that computes status.")
+
+(defvar vc-dir-backend nil
+ "The backend used by the current *vc-dir* buffer.")
+
+(defun vc-dir-move-to-goal-column ()
+ ;; Used to keep the cursor on the file name column.
+ (beginning-of-line)
+ (unless (eolp)
+ ;; Must be in sync with vc-default-status-printer.
+ (forward-char 25)))
+
+(defun vc-dir-prepare-status-buffer (bname dir backend &optional create-new)
+ "Find a buffer named BNAME showing DIR, or create a new one."
+ (setq dir (expand-file-name dir))
+ (let*
+ ;; Look for another buffer name BNAME visiting the same directory.
+ ((buf (save-excursion
+ (unless create-new
+ (dolist (buffer (buffer-list))
+ (set-buffer buffer)
+ (when (and (derived-mode-p 'vc-dir-mode)
+ (eq vc-dir-backend backend)
+ (string= (expand-file-name default-directory) dir))
+ (return buffer)))))))
+ (or buf
+ ;; Create a new buffer named BNAME.
+ (with-current-buffer (create-file-buffer bname)
+ (cd dir)
+ (vc-setup-buffer (current-buffer))
+ ;; Reset the vc-parent-buffer-name so that it does not appear
+ ;; in the mode-line.
+ (setq vc-parent-buffer-name nil)
+ (current-buffer)))))
+
+(defvar vc-dir-menu-map
+ (let ((map (make-sparse-keymap "VC-dir")))
+ (define-key map [quit]
+ '(menu-item "Quit" quit-window
+ :help "Quit"))
+ (define-key map [kill]
+ '(menu-item "Kill Update Command" vc-dir-kill-dir-status-process
+ :enable (vc-dir-busy)
+ :help "Kill the command that updates the directory buffer"))
+ (define-key map [refresh]
+ '(menu-item "Refresh" revert-buffer
+ :enable (not (vc-dir-busy))
+ :help "Refresh the contents of the directory buffer"))
+ (define-key map [remup]
+ '(menu-item "Hide up-to-date" vc-dir-hide-up-to-date
+ :help "Hide up-to-date items from display"))
+ ;; Movement.
+ (define-key map [sepmv] '("--"))
+ (define-key map [next-line]
+ '(menu-item "Next line" vc-dir-next-line
+ :help "Go to the next line" :keys "n"))
+ (define-key map [previous-line]
+ '(menu-item "Previous line" vc-dir-previous-line
+ :help "Go to the previous line"))
+ ;; Marking.
+ (define-key map [sepmrk] '("--"))
+ (define-key map [unmark-all]
+ '(menu-item "Unmark All" vc-dir-unmark-all-files
+ :help "Unmark all files that are in the same state as the current file\
+\nWith prefix argument unmark all files"))
+ (define-key map [unmark-previous]
+ '(menu-item "Unmark previous " vc-dir-unmark-file-up
+ :help "Move to the previous line and unmark the file"))
+
+ (define-key map [mark-all]
+ '(menu-item "Mark All" vc-dir-mark-all-files
+ :help "Mark all files that are in the same state as the current file\
+\nWith prefix argument mark all files"))
+ (define-key map [unmark]
+ '(menu-item "Unmark" vc-dir-unmark
+ :help "Unmark the current file or all files in the region"))
+
+ (define-key map [mark]
+ '(menu-item "Mark" vc-dir-mark
+ :help "Mark the current file or all files in the region"))
+
+ (define-key map [sepopn] '("--"))
+ (define-key map [open-other]
+ '(menu-item "Open in other window" vc-dir-find-file-other-window
+ :help "Find the file on the current line, in another window"))
+ (define-key map [open]
+ '(menu-item "Open file" vc-dir-find-file
+ :help "Find the file on the current line"))
+ (define-key map [sepvcdet] '("--"))
+ ;; FIXME: This needs a key binding. And maybe a better name
+ ;; ("Insert" like PCL-CVS uses does not sound that great either)...
+ (define-key map [ins]
+ '(menu-item "Show File" vc-dir-show-fileentry
+ :help "Show a file in the VC status listing even though it might be up to date"))
+ (define-key map [annotate]
+ '(menu-item "Annotate" vc-annotate
+ :help "Display the edit history of the current file using colors"))
+ (define-key map [diff]
+ '(menu-item "Compare with Base Version" vc-diff
+ :help "Compare file set with the base version"))
+ (define-key map [log]
+ '(menu-item "Show history" vc-print-log
+ :help "List the change log of the current file set in a window"))
+ ;; VC commands.
+ (define-key map [sepvccmd] '("--"))
+ (define-key map [update]
+ '(menu-item "Update to latest version" vc-update
+ :help "Update the current fileset's files to their tip revisions"))
+ (define-key map [revert]
+ '(menu-item "Revert to base version" vc-revert
+ :help "Revert working copies of the selected fileset to their repository contents."))
+ (define-key map [next-action]
+ ;; FIXME: This really really really needs a better name!
+ ;; And a key binding too.
+ '(menu-item "Check In/Out" vc-next-action
+ :help "Do the next logical version control operation on the current fileset"))
+ (define-key map [register]
+ '(menu-item "Register" vc-register
+ :help "Register file set into the version control system"))
+ map)
+ "Menu for dispatcher status")
+
+;; VC backends can use this to add mode-specific menu items to
+;; vc-dir-menu-map.
+(defun vc-dir-menu-map-filter (orig-binding)
+ (when (and (symbolp orig-binding) (fboundp orig-binding))
+ (setq orig-binding (indirect-function orig-binding)))
+ (let ((ext-binding
+ (when (derived-mode-p 'vc-dir-mode)
+ (vc-call-backend vc-dir-backend 'extra-status-menu))))
+ (if (null ext-binding)
+ orig-binding
+ (append orig-binding
+ '("----")
+ ext-binding))))
+
+(defvar vc-dir-mode-map
+ (let ((map (make-keymap)))
+ (suppress-keymap map)
+ ;; VC commands
+ (define-key map "v" 'vc-next-action) ;; C-x v v
+ (define-key map "=" 'vc-diff) ;; C-x v =
+ (define-key map "i" 'vc-register) ;; C-x v i
+ (define-key map "+" 'vc-update) ;; C-x v +
+ (define-key map "l" 'vc-print-log) ;; C-x v l
+ ;; More confusing than helpful, probably
+ ;;(define-key map "R" 'vc-revert) ;; u is taken by dispatcher unmark.
+ ;;(define-key map "A" 'vc-annotate) ;; g is taken by dispatcher refresh
+ ;; Marking.
+ (define-key map "m" 'vc-dir-mark)
+ (define-key map "M" 'vc-dir-mark-all-files)
+ (define-key map "u" 'vc-dir-unmark)
+ (define-key map "U" 'vc-dir-unmark-all-files)
+ (define-key map "\C-?" 'vc-dir-unmark-file-up)
+ (define-key map "\M-\C-?" 'vc-dir-unmark-all-files)
+ ;; Movement.
+ (define-key map "n" 'vc-dir-next-line)
+ (define-key map " " 'vc-dir-next-line)
+ (define-key map "\t" 'vc-dir-next-directory)
+ (define-key map "p" 'vc-dir-previous-line)
+ (define-key map [backtab] 'vc-dir-previous-directory)
+ ;;; Rebind paragraph-movement commands.
+ (define-key map "\M-}" 'vc-dir-next-directory)
+ (define-key map "\M-{" 'vc-dir-previous-directory)
+ (define-key map [C-down] 'vc-dir-next-directory)
+ (define-key map [C-up] 'vc-dir-previous-directory)
+ ;; The remainder.
+ (define-key map "f" 'vc-dir-find-file)
+ (define-key map "\C-m" 'vc-dir-find-file)
+ (define-key map "o" 'vc-dir-find-file-other-window)
+ (define-key map "\C-c\C-c" 'vc-dir-kill-dir-status-process)
+ (define-key map [down-mouse-3] 'vc-dir-menu)
+ (define-key map [mouse-2] 'vc-dir-toggle-mark)
+ (define-key map "x" 'vc-dir-hide-up-to-date)
+
+ ;; Hook up the menu.
+ (define-key map [menu-bar vc-dir-mode]
+ `(menu-item
+ ;; VC backends can use this to add mode-specific menu items to
+ ;; vc-dir-menu-map.
+ "VC-dir" ,vc-dir-menu-map :filter vc-dir-menu-map-filter))
+ map)
+ "Keymap for directory buffer.")
+
+(defmacro vc-at-event (event &rest body)
+ "Evaluate `body' with point located at event-start of `event'.
+If `body' uses `event', it should be a variable,
+ otherwise it will be evaluated twice."
+ (let ((posn (make-symbol "vc-at-event-posn")))
+ `(let ((,posn (event-start ,event)))
+ (save-excursion
+ (set-buffer (window-buffer (posn-window ,posn)))
+ (goto-char (posn-point ,posn))
+ ,@body))))
+
+(defun vc-dir-menu (e)
+ "Popup the dispatcher status menu."
+ (interactive "e")
+ (vc-at-event e (popup-menu vc-dir-menu-map e)))
+
+(defvar vc-dir-tool-bar-map
+ (let ((map (make-sparse-keymap)))
+ (tool-bar-local-item-from-menu 'vc-dir-find-file "open"
+ map vc-dir-mode-map)
+ (tool-bar-local-item "bookmark_add"
+ 'vc-dir-toggle-mark 'vc-dir-toggle-mark map
+ :help "Toggle mark on current item")
+ (tool-bar-local-item-from-menu 'vc-dir-previous-line "left-arrow"
+ map vc-dir-mode-map
+ :rtl "right-arrow")
+ (tool-bar-local-item-from-menu 'vc-dir-next-line "right-arrow"
+ map vc-dir-mode-map
+ :rtl "left-arrow")
+ (tool-bar-local-item-from-menu 'vc-print-log "info"
+ map vc-dir-mode-map)
+ (tool-bar-local-item-from-menu 'revert-buffer "refresh"
+ map vc-dir-mode-map)
+ (tool-bar-local-item-from-menu 'nonincremental-search-forward
+ "search" map)
+ (tool-bar-local-item-from-menu 'vc-dir-kill-dir-status-process "cancel"
+ map vc-dir-mode-map)
+ (tool-bar-local-item-from-menu 'quit-window "exit"
+ map vc-dir-mode-map)
+ map))
+
+(defun vc-dir-node-directory (node)
+ ;; Compute the directory for NODE.
+ ;; If it's a directory node, get it from the the node.
+ (let ((data (ewoc-data node)))
+ (or (vc-dir-fileinfo->directory data)
+ ;; Otherwise compute it from the file name.
+ (file-name-directory
+ (expand-file-name
+ (vc-dir-fileinfo->name data))))))
+
+(defun vc-dir-update (entries buffer &optional noinsert)
+ "Update BUFFER's ewoc from the list of ENTRIES.
+If NOINSERT, ignore elements on ENTRIES which are not in the ewoc."
+ ;; Add ENTRIES to the vc-dir buffer BUFFER.
+ (with-current-buffer buffer
+ ;; Insert the entries sorted by name into the ewoc.
+ ;; We assume the ewoc is sorted too, which should be the
+ ;; case if we always add entries with vc-dir-update.
+ (setq entries
+ ;; Sort: first files and then subdirectories.
+ ;; XXX: this is VERY inefficient, it computes the directory
+ ;; names too many times
+ (sort entries
+ (lambda (entry1 entry2)
+ (let ((dir1 (file-name-directory (expand-file-name (car entry1))))
+ (dir2 (file-name-directory (expand-file-name (car entry2)))))
+ (cond
+ ((string< dir1 dir2) t)
+ ((not (string= dir1 dir2)) nil)
+ ((string< (car entry1) (car entry2))))))))
+ ;; Insert directory entries in the right places.
+ (let ((entry (car entries))
+ (node (ewoc-nth vc-ewoc 0)))
+ ;; Insert . if it is not present.
+ (unless node
+ (let ((rd (file-relative-name default-directory)))
+ (ewoc-enter-last
+ vc-ewoc (vc-dir-create-fileinfo
+ rd nil nil nil (expand-file-name default-directory))))
+ (setq node (ewoc-nth vc-ewoc 0)))
+
+ (while (and entry node)
+ (let* ((entryfile (car entry))
+ (entrydir (file-name-directory (expand-file-name entryfile)))
+ (nodedir (vc-dir-node-directory node)))
+ (cond
+ ;; First try to find the directory.
+ ((string-lessp nodedir entrydir)
+ (setq node (ewoc-next vc-ewoc node)))
+ ((string-equal nodedir entrydir)
+ ;; Found the directory, find the place for the file name.
+ (let ((nodefile (vc-dir-fileinfo->name (ewoc-data node))))
+ (cond
+ ((string-lessp nodefile entryfile)
+ (setq node (ewoc-next vc-ewoc node)))
+ ((string-equal nodefile entryfile)
+ (setf (vc-dir-fileinfo->state (ewoc-data node)) (nth 1 entry))
+ (setf (vc-dir-fileinfo->extra (ewoc-data node)) (nth 2 entry))
+ (setf (vc-dir-fileinfo->needs-update (ewoc-data node)) nil)
+ (ewoc-invalidate vc-ewoc node)
+ (setq entries (cdr entries))
+ (setq entry (car entries))
+ (setq node (ewoc-next vc-ewoc node)))
+ (t
+ (ewoc-enter-before vc-ewoc node
+ (apply 'vc-dir-create-fileinfo entry))
+ (setq entries (cdr entries))
+ (setq entry (car entries))))))
+ (t
+ ;; We might need to insert a directory node if the
+ ;; previous node was in a different directory.
+ (let* ((rd (file-relative-name entrydir))
+ (prev-node (ewoc-prev vc-ewoc node))
+ (prev-dir (vc-dir-node-directory prev-node)))
+ (unless (string-equal entrydir prev-dir)
+ (ewoc-enter-before
+ vc-ewoc node (vc-dir-create-fileinfo rd nil nil nil entrydir))))
+ ;; Now insert the node itself.
+ (ewoc-enter-before vc-ewoc node
+ (apply 'vc-dir-create-fileinfo entry))
+ (setq entries (cdr entries) entry (car entries))))))
+ ;; We're past the last node, all remaining entries go to the end.
+ (unless (or node noinsert)
+ (let ((lastdir (vc-dir-node-directory (ewoc-nth vc-ewoc -1))))
+ (dolist (entry entries)
+ (let ((entrydir (file-name-directory (expand-file-name (car entry)))))
+ ;; Insert a directory node if needed.
+ (unless (string-equal lastdir entrydir)
+ (setq lastdir entrydir)
+ (let ((rd (file-relative-name entrydir)))
+ (ewoc-enter-last
+ vc-ewoc (vc-dir-create-fileinfo rd nil nil nil entrydir))))
+ ;; Now insert the node itself.
+ (ewoc-enter-last vc-ewoc
+ (apply 'vc-dir-create-fileinfo entry)))))))))
+
+(defun vc-dir-busy ()
+ (and (buffer-live-p vc-dir-process-buffer)
+ (get-buffer-process vc-dir-process-buffer)))
+
+(defun vc-dir-kill-dir-status-process ()
+ "Kill the temporary buffer and associated process."
+ (interactive)
+ (when (buffer-live-p vc-dir-process-buffer)
+ (let ((proc (get-buffer-process vc-dir-process-buffer)))
+ (when proc (delete-process proc))
+ (setq vc-dir-process-buffer nil)
+ (setq mode-line-process nil))))
+
+(defun vc-dir-kill-query ()
+ ;; Make sure that when the status buffer is killed the update
+ ;; process running in background is also killed.
+ (if (vc-dir-busy)
+ (when (y-or-n-p "Status update process running, really kill status buffer? ")
+ (vc-dir-kill-dir-status-process)
+ t)
+ t))
+
+(defun vc-dir-next-line (arg)
+ "Go to the next line.
+If a prefix argument is given, move by that many lines."
+ (interactive "p")
+ (with-no-warnings
+ (ewoc-goto-next vc-ewoc arg)
+ (vc-dir-move-to-goal-column)))
+
+(defun vc-dir-previous-line (arg)
+ "Go to the previous line.
+If a prefix argument is given, move by that many lines."
+ (interactive "p")
+ (ewoc-goto-prev vc-ewoc arg)
+ (vc-dir-move-to-goal-column))
+
+(defun vc-dir-next-directory ()
+ "Go to the next directory."
+ (interactive)
+ (let ((orig (point)))
+ (if
+ (catch 'foundit
+ (while t
+ (let* ((next (ewoc-next vc-ewoc (ewoc-locate vc-ewoc))))
+ (cond ((not next)
+ (throw 'foundit t))
+ (t
+ (progn
+ (ewoc-goto-node vc-ewoc next)
+ (vc-dir-move-to-goal-column)
+ (if (vc-dir-fileinfo->directory (ewoc-data next))
+ (throw 'foundit nil))))))))
+ (goto-char orig))))
+
+(defun vc-dir-previous-directory ()
+ "Go to the previous directory."
+ (interactive)
+ (let ((orig (point)))
+ (if
+ (catch 'foundit
+ (while t
+ (let* ((prev (ewoc-prev vc-ewoc (ewoc-locate vc-ewoc))))
+ (cond ((not prev)
+ (throw 'foundit t))
+ (t
+ (progn
+ (ewoc-goto-node vc-ewoc prev)
+ (vc-dir-move-to-goal-column)
+ (if (vc-dir-fileinfo->directory (ewoc-data prev))
+ (throw 'foundit nil))))))))
+ (goto-char orig))))
+
+(defun vc-dir-mark-unmark (mark-unmark-function)
+ (if (use-region-p)
+ (let ((firstl (line-number-at-pos (region-beginning)))
+ (lastl (line-number-at-pos (region-end))))
+ (save-excursion
+ (goto-char (region-beginning))
+ (while (<= (line-number-at-pos) lastl)
+ (funcall mark-unmark-function))))
+ (funcall mark-unmark-function)))
+
+(defun vc-dir-parent-marked-p (arg)
+ ;; Return nil if none of the parent directories of arg is marked.
+ (let* ((argdir (vc-dir-node-directory arg))
+ (arglen (length argdir))
+ (crt arg)
+ data dir)
+ ;; Go through the predecessors, checking if any directory that is
+ ;; a parent is marked.
+ (while (setq crt (ewoc-prev vc-ewoc crt))
+ (setq data (ewoc-data crt))
+ (setq dir (vc-dir-node-directory crt))
+ (when (and (vc-dir-fileinfo->directory data)
+ (vc-string-prefix-p dir argdir))
+ (when (vc-dir-fileinfo->marked data)
+ (error "Cannot mark `%s', parent directory `%s' marked"
+ (vc-dir-fileinfo->name (ewoc-data arg))
+ (vc-dir-fileinfo->name data)))))
+ nil))
+
+(defun vc-dir-children-marked-p (arg)
+ ;; Return nil if none of the children of arg is marked.
+ (let* ((argdir-re (concat "\\`" (regexp-quote (vc-dir-node-directory arg))))
+ (is-child t)
+ (crt arg)
+ data dir)
+ (while (and is-child (setq crt (ewoc-next vc-ewoc crt)))
+ (setq data (ewoc-data crt))
+ (setq dir (vc-dir-node-directory crt))
+ (if (string-match argdir-re dir)
+ (when (vc-dir-fileinfo->marked data)
+ (error "Cannot mark `%s', child `%s' marked"
+ (vc-dir-fileinfo->name (ewoc-data arg))
+ (vc-dir-fileinfo->name data)))
+ ;; We are done, we got to an entry that is not a child of `arg'.
+ (setq is-child nil)))
+ nil))
+
+(defun vc-dir-mark-file (&optional arg)
+ ;; Mark ARG or the current file and move to the next line.
+ (let* ((crt (or arg (ewoc-locate vc-ewoc)))
+ (file (ewoc-data crt))
+ (isdir (vc-dir-fileinfo->directory file)))
+ (when (or (and isdir (not (vc-dir-children-marked-p crt)))
+ (and (not isdir) (not (vc-dir-parent-marked-p crt))))
+ (setf (vc-dir-fileinfo->marked file) t)
+ (ewoc-invalidate vc-ewoc crt)
+ (unless (or arg (mouse-event-p last-command-event))
+ (vc-dir-next-line 1)))))
+
+(defun vc-dir-mark ()
+ "Mark the current file or all files in the region.
+If the region is active, mark all the files in the region.
+Otherwise mark the file on the current line and move to the next
+line."
+ (interactive)
+ (vc-dir-mark-unmark 'vc-dir-mark-file))
+
+(defun vc-dir-mark-all-files (arg)
+ "Mark all files with the same state as the current one.
+With a prefix argument mark all files.
+If the current entry is a directory, mark all child files.
+
+The commands operate on files that are on the same state.
+This command is intended to make it easy to select all files that
+share the same state."
+ (interactive "P")
+ (if arg
+ ;; Mark all files.
+ (progn
+ ;; First check that no directory is marked, we can't mark
+ ;; files in that case.
+ (ewoc-map
+ (lambda (filearg)
+ (when (and (vc-dir-fileinfo->directory filearg)
+ (vc-dir-fileinfo->marked filearg))
+ (error "Cannot mark all files, directory `%s' marked"
+ (vc-dir-fileinfo->name filearg))))
+ vc-ewoc)
+ (ewoc-map
+ (lambda (filearg)
+ (unless (vc-dir-fileinfo->marked filearg)
+ (setf (vc-dir-fileinfo->marked filearg) t)
+ t))
+ vc-ewoc))
+ (let ((data (ewoc-data (ewoc-locate vc-ewoc))))
+ (if (vc-dir-fileinfo->directory data)
+ ;; It's a directory, mark child files.
+ (let ((crt (ewoc-locate vc-ewoc)))
+ (unless (vc-dir-children-marked-p crt)
+ (while (setq crt (ewoc-next vc-ewoc crt))
+ (let ((crt-data (ewoc-data crt)))
+ (unless (vc-dir-fileinfo->directory crt-data)
+ (setf (vc-dir-fileinfo->marked crt-data) t)
+ (ewoc-invalidate vc-ewoc crt))))))
+ ;; It's a file
+ (let ((state (vc-dir-fileinfo->state data))
+ (crt (ewoc-nth vc-ewoc 0)))
+ (while crt
+ (let ((crt-data (ewoc-data crt)))
+ (when (and (not (vc-dir-fileinfo->marked crt-data))
+ (eq (vc-dir-fileinfo->state crt-data) state)
+ (not (vc-dir-fileinfo->directory crt-data)))
+ (vc-dir-mark-file crt)))
+ (setq crt (ewoc-next vc-ewoc crt))))))))
+
+(defun vc-dir-unmark-file ()
+ ;; Unmark the current file and move to the next line.
+ (let* ((crt (ewoc-locate vc-ewoc))
+ (file (ewoc-data crt)))
+ (setf (vc-dir-fileinfo->marked file) nil)
+ (ewoc-invalidate vc-ewoc crt)
+ (unless (mouse-event-p last-command-event)
+ (vc-dir-next-line 1))))
+
+(defun vc-dir-unmark ()
+ "Unmark the current file or all files in the region.
+If the region is active, unmark all the files in the region.
+Otherwise mark the file on the current line and move to the next
+line."
+ (interactive)
+ (vc-dir-mark-unmark 'vc-dir-unmark-file))
+
+(defun vc-dir-unmark-file-up ()
+ "Move to the previous line and unmark the file."
+ (interactive)
+ ;; If we're on the first line, we won't move up, but we will still
+ ;; remove the mark. This seems a bit odd but it is what buffer-menu
+ ;; does.
+ (let* ((prev (ewoc-goto-prev vc-ewoc 1))
+ (file (ewoc-data prev)))
+ (setf (vc-dir-fileinfo->marked file) nil)
+ (ewoc-invalidate vc-ewoc prev)
+ (vc-dir-move-to-goal-column)))
+
+(defun vc-dir-unmark-all-files (arg)
+ "Unmark all files with the same state as the current one.
+With a prefix argument unmark all files.
+If the current entry is a directory, unmark all the child files.
+
+The commands operate on files that are on the same state.
+This command is intended to make it easy to deselect all files
+that share the same state."
+ (interactive "P")
+ (if arg
+ (ewoc-map
+ (lambda (filearg)
+ (when (vc-dir-fileinfo->marked filearg)
+ (setf (vc-dir-fileinfo->marked filearg) nil)
+ t))
+ vc-ewoc)
+ (let* ((crt (ewoc-locate vc-ewoc))
+ (data (ewoc-data crt)))
+ (if (vc-dir-fileinfo->directory data)
+ ;; It's a directory, unmark child files.
+ (while (setq crt (ewoc-next vc-ewoc crt))
+ (let ((crt-data (ewoc-data crt)))
+ (unless (vc-dir-fileinfo->directory crt-data)
+ (setf (vc-dir-fileinfo->marked crt-data) nil)
+ (ewoc-invalidate vc-ewoc crt))))
+ ;; It's a file
+ (let ((crt-state (vc-dir-fileinfo->state (ewoc-data crt))))
+ (ewoc-map
+ (lambda (filearg)
+ (when (and (vc-dir-fileinfo->marked filearg)
+ (eq (vc-dir-fileinfo->state filearg) crt-state))
+ (setf (vc-dir-fileinfo->marked filearg) nil)
+ t))
+ vc-ewoc))))))
+
+(defun vc-dir-toggle-mark-file ()
+ (let* ((crt (ewoc-locate vc-ewoc))
+ (file (ewoc-data crt)))
+ (if (vc-dir-fileinfo->marked file)
+ (vc-dir-unmark-file)
+ (vc-dir-mark-file))))
+
+(defun vc-dir-toggle-mark (e)
+ (interactive "e")
+ (vc-at-event e (vc-dir-mark-unmark 'vc-dir-toggle-mark-file)))
+
+(defun vc-dir-delete-file ()
+ "Delete the marked files, or the current file if no marks."
+ (interactive)
+ (mapc 'vc-delete-file (or (vc-dir-marked-files)
+ (list (vc-dir-current-file)))))
+
+(defun vc-dir-find-file ()
+ "Find the file on the current line."
+ (interactive)
+ (find-file (vc-dir-current-file)))
+
+(defun vc-dir-find-file-other-window ()
+ "Find the file on the current line, in another window."
+ (interactive)
+ (find-file-other-window (vc-dir-current-file)))
+
+(defun vc-dir-current-file ()
+ (let ((node (ewoc-locate vc-ewoc)))
+ (unless node
+ (error "No file available"))
+ (expand-file-name (vc-dir-fileinfo->name (ewoc-data node)))))
+
+(defun vc-dir-marked-files ()
+ "Return the list of marked files."
+ (mapcar
+ (lambda (elem) (expand-file-name (vc-dir-fileinfo->name elem)))
+ (ewoc-collect vc-ewoc 'vc-dir-fileinfo->marked)))
+
+(defun vc-dir-marked-only-files-and-states ()
+ "Return the list of conses (FILE . STATE) for the marked files.
+For marked directories return the corresponding conses for the
+child files."
+ (let ((crt (ewoc-nth vc-ewoc 0))
+ result)
+ (while crt
+ (let ((crt-data (ewoc-data crt)))
+ (if (vc-dir-fileinfo->marked crt-data)
+ ;; FIXME: use vc-dir-child-files-and-states here instead of duplicating it.
+ (if (vc-dir-fileinfo->directory crt-data)
+ (let* ((dir (vc-dir-fileinfo->directory crt-data))
+ (dirlen (length dir))
+ data)
+ (while
+ (and (setq crt (ewoc-next vc-ewoc crt))
+ (vc-string-prefix-p dir
+ (progn
+ (setq data (ewoc-data crt))
+ (vc-dir-node-directory crt))))
+ (unless (vc-dir-fileinfo->directory data)
+ (push
+ (cons (expand-file-name (vc-dir-fileinfo->name data))
+ (vc-dir-fileinfo->state data))
+ result))))
+ (push (cons (expand-file-name (vc-dir-fileinfo->name crt-data))
+ (vc-dir-fileinfo->state crt-data))
+ result)
+ (setq crt (ewoc-next vc-ewoc crt)))
+ (setq crt (ewoc-next vc-ewoc crt)))))
+ result))
+
+(defun vc-dir-child-files-and-states ()
+ "Return the list of conses (FILE . STATE) for child files of the current entry if it's a directory.
+If it is a file, return the corresponding cons for the file itself."
+ (let* ((crt (ewoc-locate vc-ewoc))
+ (crt-data (ewoc-data crt))
+ result)
+ (if (vc-dir-fileinfo->directory crt-data)
+ (let* ((dir (vc-dir-fileinfo->directory crt-data))
+ (dirlen (length dir))
+ data)
+ (while
+ (and (setq crt (ewoc-next vc-ewoc crt))
+ (vc-string-prefix-p dir (progn
+ (setq data (ewoc-data crt))
+ (vc-dir-node-directory crt))))
+ (unless (vc-dir-fileinfo->directory data)
+ (push
+ (cons (expand-file-name (vc-dir-fileinfo->name data))
+ (vc-dir-fileinfo->state data))
+ result))))
+ (push
+ (cons (expand-file-name (vc-dir-fileinfo->name crt-data))
+ (vc-dir-fileinfo->state crt-data)) result))
+ result))
+
+(defun vc-dir-resynch-file (&optional fname)
+ "Update the entries for FILE in any directory buffers that list it."
+ (let ((file (or fname (expand-file-name buffer-file-name))))
+ (if (file-directory-p file)
+ ;; FIXME: Maybe this should never happen?
+ ;; FIXME: But it is useful to update the state of a directory
+ ;; (more precisely the files in the directory) after some VC
+ ;; operations.
+ nil
+ (let ((found-vc-dir-buf nil))
+ (save-excursion
+ (dolist (status-buf (buffer-list))
+ (set-buffer status-buf)
+ ;; look for a vc-dir buffer that might show this file.
+ (when (derived-mode-p 'vc-dir-mode)
+ (setq found-vc-dir-buf t)
+ (let ((ddir (expand-file-name default-directory)))
+ (when (vc-string-prefix-p ddir file)
+ (let*
+ ;; FIXME: Any reason we don't use file-relative-name?
+ ((file-short (substring file (length ddir)))
+ (state (vc-call-backend vc-dir-backend 'state file))
+ (extra (vc-call-backend vc-dir-backend
+ 'status-fileinfo-extra file))
+ (entry
+ (list file-short state extra)))
+ (vc-dir-update (list entry) status-buf))))))
+ ;; We didn't find any vc-dir buffers, remove the hook, it is
+ ;; not needed.
+ (unless found-vc-dir-buf
+ (remove-hook 'after-save-hook 'vc-dir-resynch-file)))))))
+
+(defvar use-vc-backend) ;; dynamically bound
+
+(define-derived-mode vc-dir-mode special-mode "VC dir"
+ "Major mode for dispatcher directory buffers.
+Marking/Unmarking key bindings and actions:
+m - marks a file/directory or if the region is active, mark all the files
+ in region.
+ Restrictions: - a file cannot be marked if any parent directory is marked
+ - a directory cannot be marked if any child file or
+ directory is marked
+u - marks a file/directory or if the region is active, unmark all the files
+ in region.
+M - if the cursor is on a file: mark all the files with the same state as
+ the current file
+ - if the cursor is on a directory: mark all child files
+ - with a prefix argument: mark all files
+U - if the cursor is on a file: unmark all the files with the same state
+ as the current file
+ - if the cursor is on a directory: unmark all child files
+ - with a prefix argument: unmark all files
+
+
+\\{vc-dir-mode-map}"
+ (set (make-local-variable 'vc-dir-backend) use-vc-backend)
+ (setq buffer-read-only t)
+ (when (boundp 'tool-bar-map)
+ (set (make-local-variable 'tool-bar-map) vc-dir-tool-bar-map))
+ (let ((buffer-read-only nil))
+ (erase-buffer)
+ (set (make-local-variable 'vc-dir-process-buffer) nil)
+ (set (make-local-variable 'vc-ewoc)
+ (ewoc-create #'vc-dir-status-printer
+ (vc-dir-headers vc-dir-backend default-directory)))
+ (set (make-local-variable 'revert-buffer-function)
+ 'vc-dir-revert-buffer-function)
+ (set (make-local-variable 'list-buffers-directory)
+ (expand-file-name default-directory))
+ (add-hook 'after-save-hook 'vc-dir-resynch-file)
+ ;; Make sure that if the directory buffer is killed, the update
+ ;; process running in the background is also killed.
+ (add-hook 'kill-buffer-query-functions 'vc-dir-kill-query nil t)
+ (vc-dir-refresh)))
+
+(defun vc-dir-headers (backend dir)
+ "Display the headers in the *VC dir* buffer.
+It calls the `status-extra-headers' backend method to display backend
+specific headers."
+ (concat
+ (propertize "VC backend : " 'face 'font-lock-type-face)
+ (propertize (format "%s\n" backend) 'face 'font-lock-variable-name-face)
+ (propertize "Working dir: " 'face 'font-lock-type-face)
+ (propertize (format "%s\n" dir) 'face 'font-lock-variable-name-face)
+ (vc-call-backend backend 'status-extra-headers dir)
+ "\n"))
+
+(defun vc-dir-refresh-files (files default-state)
+ "Refresh some files in the *VC-dir* buffer."
+ (let ((def-dir default-directory)
+ (backend vc-dir-backend))
+ (vc-set-mode-line-busy-indicator)
+ ;; Call the `dir-status-file' backend function.
+ ;; `dir-status-file' is supposed to be asynchronous.
+ ;; It should compute the results, and then call the function
+ ;; passed as an argument in order to update the vc-dir buffer
+ ;; with the results.
+ (unless (buffer-live-p vc-dir-process-buffer)
+ (setq vc-dir-process-buffer
+ (generate-new-buffer (format " *VC-%s* tmp status" backend))))
+ (lexical-let ((buffer (current-buffer)))
+ (with-current-buffer vc-dir-process-buffer
+ (cd def-dir)
+ (erase-buffer)
+ (vc-call-backend
+ backend 'dir-status-files def-dir files default-state
+ (lambda (entries &optional more-to-come)
+ ;; ENTRIES is a list of (FILE VC_STATE EXTRA) items.
+ ;; If MORE-TO-COME is true, then more updates will come from
+ ;; the asynchronous process.
+ (with-current-buffer buffer
+ (vc-dir-update entries buffer)
+ (unless more-to-come
+ (setq mode-line-process nil)
+ ;; Remove the ones that haven't been updated at all.
+ ;; Those not-updated are those whose state is nil because the
+ ;; file/dir doesn't exist and isn't versioned.
+ (ewoc-filter vc-ewoc
+ (lambda (info)
+ ;; The state for directory entries might
+ ;; have been changed to 'up-to-date,
+ ;; reset it, othewise it will be removed when doing 'x'
+ ;; next time.
+ ;; FIXME: There should be a more elegant way to do this.
+ (when (and (vc-dir-fileinfo->directory info)
+ (eq (vc-dir-fileinfo->state info)
+ 'up-to-date))
+ (setf (vc-dir-fileinfo->state info) nil))
+
+ (not (vc-dir-fileinfo->needs-update info))))))))))))
+
+(defun vc-dir-revert-buffer-function (&optional ignore-auto noconfirm)
+ (vc-dir-refresh))
+
+(defun vc-dir-refresh ()
+ "Refresh the contents of the *VC-dir* buffer.
+Throw an error if another update process is in progress."
+ (interactive)
+ (if (vc-dir-busy)
+ (error "Another update process is in progress, cannot run two at a time")
+ (let ((def-dir default-directory)
+ (backend vc-dir-backend))
+ (vc-set-mode-line-busy-indicator)
+ ;; Call the `dir-status' backend function.
+ ;; `dir-status' is supposed to be asynchronous.
+ ;; It should compute the results, and then call the function
+ ;; passed as an argument in order to update the vc-dir buffer
+ ;; with the results.
+
+ ;; Create a buffer that can be used by `dir-status' and call
+ ;; `dir-status' with this buffer as the current buffer. Use
+ ;; `vc-dir-process-buffer' to remember this buffer, so that
+ ;; it can be used later to kill the update process in case it
+ ;; takes too long.
+ (unless (buffer-live-p vc-dir-process-buffer)
+ (setq vc-dir-process-buffer
+ (generate-new-buffer (format " *VC-%s* tmp status" backend))))
+ ;; set the needs-update flag on all entries
+ (ewoc-map (lambda (info) (setf (vc-dir-fileinfo->needs-update info) t) nil)
+ vc-ewoc)
+ (lexical-let ((buffer (current-buffer)))
+ (with-current-buffer vc-dir-process-buffer
+ (cd def-dir)
+ (erase-buffer)
+ (vc-call-backend
+ backend 'dir-status def-dir
+ (lambda (entries &optional more-to-come)
+ ;; ENTRIES is a list of (FILE VC_STATE EXTRA) items.
+ ;; If MORE-TO-COME is true, then more updates will come from
+ ;; the asynchronous process.
+ (with-current-buffer buffer
+ (vc-dir-update entries buffer)
+ (unless more-to-come
+ (let ((remaining
+ (ewoc-collect
+ vc-ewoc 'vc-dir-fileinfo->needs-update)))
+ (if remaining
+ (vc-dir-refresh-files
+ (mapcar 'vc-dir-fileinfo->name remaining)
+ 'up-to-date)
+ (setq mode-line-process nil))))))))))))
+
+(defun vc-dir-show-fileentry (file)
+ "Insert an entry for a specific file into the current *VC-dir* listing.
+This is typically used if the file is up-to-date (or has been added
+outside of VC) and one wants to do some operation on it."
+ (interactive "fShow file: ")
+ (vc-dir-update (list (list (file-relative-name file) (vc-state file))) (current-buffer)))
+
+(defun vc-dir-hide-up-to-date ()
+ "Hide up-to-date items from display."
+ (interactive)
+ (let ((crt (ewoc-nth vc-ewoc -1))
+ (first (ewoc-nth vc-ewoc 0)))
+ ;; Go over from the last item to the first and remove the
+ ;; up-to-date files and directories with no child files.
+ (while (not (eq crt first))
+ (let* ((data (ewoc-data crt))
+ (dir (vc-dir-fileinfo->directory data))
+ (next (ewoc-next vc-ewoc crt))
+ (prev (ewoc-prev vc-ewoc crt))
+ ;; ewoc-delete does not work without this...
+ (inhibit-read-only t))
+ (when (or
+ ;; Remove directories with no child files.
+ (and dir
+ (or
+ ;; Nothing follows this directory.
+ (not next)
+ ;; Next item is a directory.
+ (vc-dir-fileinfo->directory (ewoc-data next))))
+ ;; Remove files in the up-to-date state.
+ (eq (vc-dir-fileinfo->state data) 'up-to-date))
+ (ewoc-delete vc-ewoc crt))
+ (setq crt prev)))))
+
+(defun vc-dir-status-printer (fileentry)
+ (vc-call-backend vc-dir-backend 'status-printer fileentry))
+
+(defun vc-dir-deduce-fileset (&optional state-model-only-files)
+ (let ((marked (vc-dir-marked-files))
+ files
+ only-files-list
+ state
+ model)
+ (if marked
+ (progn
+ (setq files marked)
+ (when state-model-only-files
+ (setq only-files-list (vc-dir-marked-only-files-and-states))))
+ (let ((crt (vc-dir-current-file)))
+ (setq files (list crt))
+ (when state-model-only-files
+ (setq only-files-list (vc-dir-child-files-and-states)))))
+
+ (when state-model-only-files
+ (setq state (cdar only-files-list))
+ ;; Check that all files are in a consistent state, since we use that
+ ;; state to decide which operation to perform.
+ (dolist (crt (cdr only-files-list))
+ (unless (vc-compatible-state (cdr crt) state)
+ (error "%s:%s clashes with %s:%s"
+ (car crt) (cdr crt) (caar only-files-list) state)))
+ (setq only-files-list (mapcar 'car only-files-list))
+ (when (and state (not (eq state 'unregistered)))
+ (setq model (vc-checkout-model vc-dir-backend only-files-list))))
+ (list vc-dir-backend files only-files-list state model)))
+
+;;;###autoload
+(defun vc-dir (dir &optional backend)
+ "Show the VC status for DIR.
+Optional second argument BACKEND specifies the VC backend to use.
+Interactively, a prefix argument means to ask for the backend."
+ (interactive
+ (list
+ (read-file-name "VC status for directory: "
+ default-directory default-directory t
+ nil #'file-directory-p)
+ (if current-prefix-arg
+ (intern
+ (completing-read
+ "Use VC backend: "
+ (mapcar (lambda (b) (list (symbol-name b)))
+ vc-handled-backends)
+ nil t nil nil)))))
+ (unless backend
+ (setq backend (vc-responsible-backend dir)))
+ (pop-to-buffer (vc-dir-prepare-status-buffer "*vc-dir*" dir backend))
+ (if (derived-mode-p 'vc-dir-mode)
+ (vc-dir-refresh)
+ ;; FIXME: find a better way to pass the backend to `vc-dir-mode'.
+ (let ((use-vc-backend backend))
+ (vc-dir-mode))))
+
+(defun vc-default-status-extra-headers (backend dir)
+ ;; Be loud by default to remind people to add code to display
+ ;; backend specific headers.
+ ;; XXX: change this to return nil before the release.
+ (concat
+ (propertize "Extra : " 'face 'font-lock-type-face)
+ (propertize "Please add backend specific headers here. It's easy!"
+ 'face 'font-lock-warning-face)))
+
+(defun vc-default-status-printer (backend fileentry)
+ "Pretty print FILEENTRY."
+ ;; If you change the layout here, change vc-dir-move-to-goal-column.
+ (let* ((isdir (vc-dir-fileinfo->directory fileentry))
+ (state (if isdir "" (vc-dir-fileinfo->state fileentry)))
+ (filename (vc-dir-fileinfo->name fileentry)))
+ (insert
+ (propertize
+ (format "%c" (if (vc-dir-fileinfo->marked fileentry) ?* ? ))
+ 'face 'font-lock-type-face)
+ " "
+ (propertize
+ (format "%-20s" state)
+ 'face (cond ((eq state 'up-to-date) 'font-lock-builtin-face)
+ ((memq state '(missing conflict)) 'font-lock-warning-face)
+ (t 'font-lock-variable-name-face))
+ 'mouse-face 'highlight)
+ " "
+ (propertize
+ (format "%s" filename)
+ 'face
+ (if isdir 'font-lock-comment-delimiter-face 'font-lock-function-name-face)
+ 'help-echo
+ (if isdir
+ "Directory\nVC operations can be applied to it\nmouse-3: Pop-up menu"
+ "File\nmouse-3: Pop-up menu")
+ 'mouse-face 'highlight))))
+
+(defun vc-default-extra-status-menu (backend)
+ nil)
+
+(defun vc-default-status-fileinfo-extra (backend file)
+ "Default absence of extra information returned for a file."
+ nil)
+
+(provide 'vc-dir)
+
+;; arch-tag: 0274a2e3-e8e9-4b1a-a73c-e8b9129d5d15
+;;; vc-dir.el ends here