diff options
| author | Stefan Monnier | 2005-12-23 04:57:28 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2005-12-23 04:57:28 +0000 |
| commit | 04864eb004fb57359c3d881aac1b334f75d78570 (patch) | |
| tree | cbf727e7bd8968d68bd65c274258022f856dd874 | |
| parent | 0ee01fffb7c96345023e45b66b7fd564bed3a383 (diff) | |
| download | emacs-04864eb004fb57359c3d881aac1b334f75d78570.tar.gz emacs-04864eb004fb57359c3d881aac1b334f75d78570.zip | |
Remove unnecessary leading * in docstrings.
(vc-annotate-mode-map): Move initialization into declaration.
(vc-static-header-alist): Nitpick on the regexp.
(vc-default-init-version): New fun.
(vc-register): Use it.
(vc-insert-headers): Use dolist.
(vc-annotate-get-backend): Remove unused function.
(vc-annotate-add-menu): Remove. Build the menu directly at toplevel.
(vc-annotate-mode): Remove corresponding call.
(vc-annotate-car-last-cons): Simplify.
(vc-annotate-buffers): Remove var.
(vc-annotate-backend): Make it buffer-local.
(vc-annotate): Move the interaction to the interactive spec.
Add a `buf' argument.
(vc-annotate-warp-version): Use this new `buf' argument to avoid
killing&creating a vc-annotate buffer, which is very disruptive when
the buffers are shown in dedicated frames.
| -rw-r--r-- | lisp/ChangeLog | 22 | ||||
| -rw-r--r-- | lisp/vc.el | 302 |
2 files changed, 149 insertions, 175 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 74170897f37..fa35372c657 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,23 @@ | |||
| 1 | 2005-12-22 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * vc.el: Remove unnecessary leading * in docstrings. | ||
| 4 | (vc-annotate-mode-map): Move initialization into declaration. | ||
| 5 | (vc-static-header-alist): Nitpick on the regexp. | ||
| 6 | (vc-default-init-version): New fun. | ||
| 7 | (vc-register): Use it. | ||
| 8 | (vc-insert-headers): Use dolist. | ||
| 9 | (vc-annotate-get-backend): Remove unused function. | ||
| 10 | (vc-annotate-add-menu): Remove. Build the menu directly at toplevel. | ||
| 11 | (vc-annotate-mode): Remove corresponding call. | ||
| 12 | (vc-annotate-car-last-cons): Simplify. | ||
| 13 | (vc-annotate-buffers): Remove var. | ||
| 14 | (vc-annotate-backend): Make it buffer-local. | ||
| 15 | (vc-annotate): Move the interaction to the interactive spec. | ||
| 16 | Add a `buf' argument. | ||
| 17 | (vc-annotate-warp-version): Use this new `buf' argument to avoid | ||
| 18 | killing&creating a vc-annotate buffer, which is very disruptive when | ||
| 19 | the buffers are shown in dedicated frames. | ||
| 20 | |||
| 1 | 2005-12-23 Nick Roberts <nickrob@snap.net.nz> | 21 | 2005-12-23 Nick Roberts <nickrob@snap.net.nz> |
| 2 | 22 | ||
| 3 | * descr-text.el: Add FSF as maintainer. | 23 | * descr-text.el: Add FSF as maintainer. |
| @@ -11,7 +31,7 @@ | |||
| 11 | (describe-char-unicodedata-file): Make URL link in doc string. | 31 | (describe-char-unicodedata-file): Make URL link in doc string. |
| 12 | 32 | ||
| 13 | 2005-12-22 Richard M. Stallman <rms@gnu.org> | 33 | 2005-12-22 Richard M. Stallman <rms@gnu.org> |
| 14 | 34 | ||
| 15 | * cus-edit.el (custom-variable-prompt): Say "variable" in prompt. | 35 | * cus-edit.el (custom-variable-prompt): Say "variable" in prompt. |
| 16 | (custom-buffer-create-internal): Reword the top-of-buffer help intro. | 36 | (custom-buffer-create-internal): Reword the top-of-buffer help intro. |
| 17 | Don't include buttons that write a file when there's no file. | 37 | Don't include buttons that write a file when there's no file. |
diff --git a/lisp/vc.el b/lisp/vc.el index d06e49ef1ba..6d82b56f9b6 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -469,12 +469,12 @@ | |||
| 469 | :group 'tools) | 469 | :group 'tools) |
| 470 | 470 | ||
| 471 | (defcustom vc-suppress-confirm nil | 471 | (defcustom vc-suppress-confirm nil |
| 472 | "*If non-nil, treat user as expert; suppress yes-no prompts on some things." | 472 | "If non-nil, treat user as expert; suppress yes-no prompts on some things." |
| 473 | :type 'boolean | 473 | :type 'boolean |
| 474 | :group 'vc) | 474 | :group 'vc) |
| 475 | 475 | ||
| 476 | (defcustom vc-delete-logbuf-window t | 476 | (defcustom vc-delete-logbuf-window t |
| 477 | "*If non-nil, delete the *VC-log* buffer and window after each logical action. | 477 | "If non-nil, delete the *VC-log* buffer and window after each logical action. |
| 478 | If nil, bury that buffer instead. | 478 | If nil, bury that buffer instead. |
| 479 | This is most useful if you have multiple windows on a frame and would like to | 479 | This is most useful if you have multiple windows on a frame and would like to |
| 480 | preserve the setting." | 480 | preserve the setting." |
| @@ -482,12 +482,12 @@ preserve the setting." | |||
| 482 | :group 'vc) | 482 | :group 'vc) |
| 483 | 483 | ||
| 484 | (defcustom vc-initial-comment nil | 484 | (defcustom vc-initial-comment nil |
| 485 | "*If non-nil, prompt for initial comment when a file is registered." | 485 | "If non-nil, prompt for initial comment when a file is registered." |
| 486 | :type 'boolean | 486 | :type 'boolean |
| 487 | :group 'vc) | 487 | :group 'vc) |
| 488 | 488 | ||
| 489 | (defcustom vc-default-init-version "1.1" | 489 | (defcustom vc-default-init-version "1.1" |
| 490 | "*A string used as the default version number when a new file is registered. | 490 | "A string used as the default version number when a new file is registered. |
| 491 | This can be overridden by giving a prefix argument to \\[vc-register]. This | 491 | This can be overridden by giving a prefix argument to \\[vc-register]. This |
| 492 | can also be overridden by a particular VC backend." | 492 | can also be overridden by a particular VC backend." |
| 493 | :type 'string | 493 | :type 'string |
| @@ -495,12 +495,12 @@ can also be overridden by a particular VC backend." | |||
| 495 | :version "20.3") | 495 | :version "20.3") |
| 496 | 496 | ||
| 497 | (defcustom vc-command-messages nil | 497 | (defcustom vc-command-messages nil |
| 498 | "*If non-nil, display run messages from back-end commands." | 498 | "If non-nil, display run messages from back-end commands." |
| 499 | :type 'boolean | 499 | :type 'boolean |
| 500 | :group 'vc) | 500 | :group 'vc) |
| 501 | 501 | ||
| 502 | (defcustom vc-checkin-switches nil | 502 | (defcustom vc-checkin-switches nil |
| 503 | "*A string or list of strings specifying extra switches for checkin. | 503 | "A string or list of strings specifying extra switches for checkin. |
| 504 | These are passed to the checkin program by \\[vc-checkin]." | 504 | These are passed to the checkin program by \\[vc-checkin]." |
| 505 | :type '(choice (const :tag "None" nil) | 505 | :type '(choice (const :tag "None" nil) |
| 506 | (string :tag "Argument String") | 506 | (string :tag "Argument String") |
| @@ -510,7 +510,7 @@ These are passed to the checkin program by \\[vc-checkin]." | |||
| 510 | :group 'vc) | 510 | :group 'vc) |
| 511 | 511 | ||
| 512 | (defcustom vc-checkout-switches nil | 512 | (defcustom vc-checkout-switches nil |
| 513 | "*A string or list of strings specifying extra switches for checkout. | 513 | "A string or list of strings specifying extra switches for checkout. |
| 514 | These are passed to the checkout program by \\[vc-checkout]." | 514 | These are passed to the checkout program by \\[vc-checkout]." |
| 515 | :type '(choice (const :tag "None" nil) | 515 | :type '(choice (const :tag "None" nil) |
| 516 | (string :tag "Argument String") | 516 | (string :tag "Argument String") |
| @@ -520,7 +520,7 @@ These are passed to the checkout program by \\[vc-checkout]." | |||
| 520 | :group 'vc) | 520 | :group 'vc) |
| 521 | 521 | ||
| 522 | (defcustom vc-register-switches nil | 522 | (defcustom vc-register-switches nil |
| 523 | "*A string or list of strings; extra switches for registering a file. | 523 | "A string or list of strings; extra switches for registering a file. |
| 524 | These are passed to the checkin program by \\[vc-register]." | 524 | These are passed to the checkin program by \\[vc-register]." |
| 525 | :type '(choice (const :tag "None" nil) | 525 | :type '(choice (const :tag "None" nil) |
| 526 | (string :tag "Argument String") | 526 | (string :tag "Argument String") |
| @@ -530,30 +530,30 @@ These are passed to the checkin program by \\[vc-register]." | |||
| 530 | :group 'vc) | 530 | :group 'vc) |
| 531 | 531 | ||
| 532 | (defcustom vc-dired-listing-switches "-al" | 532 | (defcustom vc-dired-listing-switches "-al" |
| 533 | "*Switches passed to `ls' for vc-dired. MUST contain the `l' option." | 533 | "Switches passed to `ls' for vc-dired. MUST contain the `l' option." |
| 534 | :type 'string | 534 | :type 'string |
| 535 | :group 'vc | 535 | :group 'vc |
| 536 | :version "21.1") | 536 | :version "21.1") |
| 537 | 537 | ||
| 538 | (defcustom vc-dired-recurse t | 538 | (defcustom vc-dired-recurse t |
| 539 | "*If non-nil, show directory trees recursively in VC Dired." | 539 | "If non-nil, show directory trees recursively in VC Dired." |
| 540 | :type 'boolean | 540 | :type 'boolean |
| 541 | :group 'vc | 541 | :group 'vc |
| 542 | :version "20.3") | 542 | :version "20.3") |
| 543 | 543 | ||
| 544 | (defcustom vc-dired-terse-display t | 544 | (defcustom vc-dired-terse-display t |
| 545 | "*If non-nil, show only locked files in VC Dired." | 545 | "If non-nil, show only locked files in VC Dired." |
| 546 | :type 'boolean | 546 | :type 'boolean |
| 547 | :group 'vc | 547 | :group 'vc |
| 548 | :version "20.3") | 548 | :version "20.3") |
| 549 | 549 | ||
| 550 | (defcustom vc-directory-exclusion-list '("SCCS" "RCS" "CVS" "MCVS" ".svn" "{arch}") | 550 | (defcustom vc-directory-exclusion-list '("SCCS" "RCS" "CVS" "MCVS" ".svn" "{arch}") |
| 551 | "*List of directory names to be ignored when walking directory trees." | 551 | "List of directory names to be ignored when walking directory trees." |
| 552 | :type '(repeat string) | 552 | :type '(repeat string) |
| 553 | :group 'vc) | 553 | :group 'vc) |
| 554 | 554 | ||
| 555 | (defcustom vc-diff-switches nil | 555 | (defcustom vc-diff-switches nil |
| 556 | "*A string or list of strings specifying switches for diff under VC. | 556 | "A string or list of strings specifying switches for diff under VC. |
| 557 | When running diff under a given BACKEND, VC concatenates the values of | 557 | When running diff under a given BACKEND, VC concatenates the values of |
| 558 | `diff-switches', `vc-diff-switches', and `vc-BACKEND-diff-switches' to | 558 | `diff-switches', `vc-diff-switches', and `vc-BACKEND-diff-switches' to |
| 559 | get the switches for that command. Thus, `vc-diff-switches' should | 559 | get the switches for that command. Thus, `vc-diff-switches' should |
| @@ -568,7 +568,7 @@ specific to any particular backend." | |||
| 568 | :version "21.1") | 568 | :version "21.1") |
| 569 | 569 | ||
| 570 | (defcustom vc-allow-async-revert nil | 570 | (defcustom vc-allow-async-revert nil |
| 571 | "*Specifies whether the diff during \\[vc-revert-buffer] may be asynchronous. | 571 | "Specifies whether the diff during \\[vc-revert-buffer] may be asynchronous. |
| 572 | Enabling this option means that you can confirm a revert operation even | 572 | Enabling this option means that you can confirm a revert operation even |
| 573 | if the local changes in the file have not been found and displayed yet." | 573 | if the local changes in the file have not been found and displayed yet." |
| 574 | :type '(choice (const :tag "No" nil) | 574 | :type '(choice (const :tag "No" nil) |
| @@ -578,7 +578,7 @@ if the local changes in the file have not been found and displayed yet." | |||
| 578 | 578 | ||
| 579 | ;;;###autoload | 579 | ;;;###autoload |
| 580 | (defcustom vc-checkout-hook nil | 580 | (defcustom vc-checkout-hook nil |
| 581 | "*Normal hook (list of functions) run after checking out a file. | 581 | "Normal hook (list of functions) run after checking out a file. |
| 582 | See `run-hooks'." | 582 | See `run-hooks'." |
| 583 | :type 'hook | 583 | :type 'hook |
| 584 | :group 'vc | 584 | :group 'vc |
| @@ -595,7 +595,7 @@ See `run-hooks'." | |||
| 595 | 595 | ||
| 596 | ;;;###autoload | 596 | ;;;###autoload |
| 597 | (defcustom vc-checkin-hook nil | 597 | (defcustom vc-checkin-hook nil |
| 598 | "*Normal hook (list of functions) run after a checkin is done. | 598 | "Normal hook (list of functions) run after a checkin is done. |
| 599 | See also `log-edit-done-hook'." | 599 | See also `log-edit-done-hook'." |
| 600 | :type 'hook | 600 | :type 'hook |
| 601 | :options '(log-edit-comment-to-change-log) | 601 | :options '(log-edit-comment-to-change-log) |
| @@ -603,13 +603,13 @@ See also `log-edit-done-hook'." | |||
| 603 | 603 | ||
| 604 | ;;;###autoload | 604 | ;;;###autoload |
| 605 | (defcustom vc-before-checkin-hook nil | 605 | (defcustom vc-before-checkin-hook nil |
| 606 | "*Normal hook (list of functions) run before a file is checked in. | 606 | "Normal hook (list of functions) run before a file is checked in. |
| 607 | See `run-hooks'." | 607 | See `run-hooks'." |
| 608 | :type 'hook | 608 | :type 'hook |
| 609 | :group 'vc) | 609 | :group 'vc) |
| 610 | 610 | ||
| 611 | (defcustom vc-logentry-check-hook nil | 611 | (defcustom vc-logentry-check-hook nil |
| 612 | "*Normal hook run by `vc-backend-logentry-check'. | 612 | "Normal hook run by `vc-backend-logentry-check'. |
| 613 | Use this to impose your own rules on the entry in addition to any the | 613 | Use this to impose your own rules on the entry in addition to any the |
| 614 | version control backend imposes itself." | 614 | version control backend imposes itself." |
| 615 | :type 'hook | 615 | :type 'hook |
| @@ -634,25 +634,25 @@ version control backend imposes itself." | |||
| 634 | (300. . "#00CCFF") | 634 | (300. . "#00CCFF") |
| 635 | (320. . "#00CC99") | 635 | (320. . "#00CC99") |
| 636 | (340. . "#0099FF")) | 636 | (340. . "#0099FF")) |
| 637 | "*Association list of age versus color, for \\[vc-annotate]. | 637 | "Association list of age versus color, for \\[vc-annotate]. |
| 638 | Ages are given in units of fractional days. Default is eighteen steps | 638 | Ages are given in units of fractional days. Default is eighteen steps |
| 639 | using a twenty day increment." | 639 | using a twenty day increment." |
| 640 | :type 'alist | 640 | :type 'alist |
| 641 | :group 'vc) | 641 | :group 'vc) |
| 642 | 642 | ||
| 643 | (defcustom vc-annotate-very-old-color "#0046FF" | 643 | (defcustom vc-annotate-very-old-color "#0046FF" |
| 644 | "*Color for lines older than the current color range in \\[vc-annotate]]." | 644 | "Color for lines older than the current color range in \\[vc-annotate]]." |
| 645 | :type 'string | 645 | :type 'string |
| 646 | :group 'vc) | 646 | :group 'vc) |
| 647 | 647 | ||
| 648 | (defcustom vc-annotate-background "black" | 648 | (defcustom vc-annotate-background "black" |
| 649 | "*Background color for \\[vc-annotate]. | 649 | "Background color for \\[vc-annotate]. |
| 650 | Default color is used if nil." | 650 | Default color is used if nil." |
| 651 | :type 'string | 651 | :type 'string |
| 652 | :group 'vc) | 652 | :group 'vc) |
| 653 | 653 | ||
| 654 | (defcustom vc-annotate-menu-elements '(2 0.5 0.1 0.01) | 654 | (defcustom vc-annotate-menu-elements '(2 0.5 0.1 0.01) |
| 655 | "*Menu elements for the mode-specific menu of VC-Annotate mode. | 655 | "Menu elements for the mode-specific menu of VC-Annotate mode. |
| 656 | List of factors, used to expand/compress the time scale. See `vc-annotate'." | 656 | List of factors, used to expand/compress the time scale. See `vc-annotate'." |
| 657 | :type '(repeat number) | 657 | :type '(repeat number) |
| 658 | :group 'vc) | 658 | :group 'vc) |
| @@ -660,24 +660,23 @@ List of factors, used to expand/compress the time scale. See `vc-annotate'." | |||
| 660 | (defvar vc-annotate-mode-map | 660 | (defvar vc-annotate-mode-map |
| 661 | (let ((m (make-sparse-keymap))) | 661 | (let ((m (make-sparse-keymap))) |
| 662 | (define-key m [menu-bar] (make-sparse-keymap "VC-Annotate")) | 662 | (define-key m [menu-bar] (make-sparse-keymap "VC-Annotate")) |
| 663 | (define-key m "A" 'vc-annotate-revision-previous-to-line) | ||
| 664 | (define-key m "D" 'vc-annotate-show-diff-revision-at-line) | ||
| 665 | (define-key m "J" 'vc-annotate-revision-at-line) | ||
| 666 | (define-key m "L" 'vc-annotate-show-log-revision-at-line) | ||
| 667 | (define-key m "N" 'vc-annotate-next-version) | ||
| 668 | (define-key m "P" 'vc-annotate-prev-version) | ||
| 669 | (define-key m "W" 'vc-annotate-workfile-version) | ||
| 663 | m) | 670 | m) |
| 664 | "Local keymap used for VC-Annotate mode.") | 671 | "Local keymap used for VC-Annotate mode.") |
| 665 | 672 | ||
| 666 | (define-key vc-annotate-mode-map "A" 'vc-annotate-revision-previous-to-line) | ||
| 667 | (define-key vc-annotate-mode-map "D" 'vc-annotate-show-diff-revision-at-line) | ||
| 668 | (define-key vc-annotate-mode-map "J" 'vc-annotate-revision-at-line) | ||
| 669 | (define-key vc-annotate-mode-map "L" 'vc-annotate-show-log-revision-at-line) | ||
| 670 | (define-key vc-annotate-mode-map "N" 'vc-annotate-next-version) | ||
| 671 | (define-key vc-annotate-mode-map "P" 'vc-annotate-prev-version) | ||
| 672 | (define-key vc-annotate-mode-map "W" 'vc-annotate-workfile-version) | ||
| 673 | |||
| 674 | (defvar vc-annotate-mode-menu nil | 673 | (defvar vc-annotate-mode-menu nil |
| 675 | "Local keymap used for VC-Annotate mode's menu bar menu.") | 674 | "Local keymap used for VC-Annotate mode's menu bar menu.") |
| 676 | 675 | ||
| 677 | ;; Header-insertion hair | 676 | ;; Header-insertion hair |
| 678 | 677 | ||
| 679 | (defcustom vc-static-header-alist | 678 | (defcustom vc-static-header-alist |
| 680 | '(("\\.c$" . | 679 | '(("\\.c\\'" . |
| 681 | "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n#endif /* lint */\n")) | 680 | "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n#endif /* lint */\n")) |
| 682 | "*Associate static header string templates with file types. | 681 | "*Associate static header string templates with file types. |
| 683 | A \%s in the template is replaced with the first string associated with | 682 | A \%s in the template is replaced with the first string associated with |
| @@ -713,9 +712,7 @@ and that its contents match what the master file says." | |||
| 713 | ;; Variables the user doesn't need to know about. | 712 | ;; Variables the user doesn't need to know about. |
| 714 | (defvar vc-log-operation nil) | 713 | (defvar vc-log-operation nil) |
| 715 | (defvar vc-log-after-operation-hook nil) | 714 | (defvar vc-log-after-operation-hook nil) |
| 716 | (defvar vc-annotate-buffers nil | 715 | |
| 717 | "Alist of current \"Annotate\" buffers and their corresponding backends. | ||
| 718 | The keys are \(BUFFER . BACKEND\). See also `vc-annotate-get-backend'.") | ||
| 719 | ;; In a log entry buffer, this is a local variable | 716 | ;; In a log entry buffer, this is a local variable |
| 720 | ;; that points to the buffer for which it was made | 717 | ;; that points to the buffer for which it was made |
| 721 | ;; (either a file, or a VC dired buffer). | 718 | ;; (either a file, or a VC dired buffer). |
| @@ -1367,6 +1364,8 @@ merge in the changes into your working copy." | |||
| 1367 | 1364 | ||
| 1368 | ;; These functions help the vc-next-action entry point | 1365 | ;; These functions help the vc-next-action entry point |
| 1369 | 1366 | ||
| 1367 | (defun vc-default-init-version (backend) vc-default-init-version) | ||
| 1368 | |||
| 1370 | ;;;###autoload | 1369 | ;;;###autoload |
| 1371 | (defun vc-register (&optional set-version comment) | 1370 | (defun vc-register (&optional set-version comment) |
| 1372 | "Register the current file into a version control system. | 1371 | "Register the current file into a version control system. |
| @@ -1398,10 +1397,8 @@ first backend that could register the file is used." | |||
| 1398 | (if set-version | 1397 | (if set-version |
| 1399 | (read-string (format "Initial version level for %s: " | 1398 | (read-string (format "Initial version level for %s: " |
| 1400 | (buffer-name))) | 1399 | (buffer-name))) |
| 1401 | (let ((backend (vc-responsible-backend buffer-file-name))) | 1400 | (vc-call-backend (vc-responsible-backend buffer-file-name) |
| 1402 | (if (vc-find-backend-function backend 'init-version) | 1401 | 'init-version)) |
| 1403 | (vc-call-backend backend 'init-version) | ||
| 1404 | vc-default-init-version))) | ||
| 1405 | (or comment (not vc-initial-comment)) | 1402 | (or comment (not vc-initial-comment)) |
| 1406 | nil | 1403 | nil |
| 1407 | "Enter initial comment." | 1404 | "Enter initial comment." |
| @@ -1937,24 +1934,19 @@ the variable `vc-BACKEND-header'." | |||
| 1937 | (widen) | 1934 | (widen) |
| 1938 | (if (or (not (vc-check-headers)) | 1935 | (if (or (not (vc-check-headers)) |
| 1939 | (y-or-n-p "Version headers already exist. Insert another set? ")) | 1936 | (y-or-n-p "Version headers already exist. Insert another set? ")) |
| 1940 | (progn | 1937 | (let* ((delims (cdr (assq major-mode vc-comment-alist))) |
| 1941 | (let* ((delims (cdr (assq major-mode vc-comment-alist))) | 1938 | (comment-start-vc (or (car delims) comment-start "#")) |
| 1942 | (comment-start-vc (or (car delims) comment-start "#")) | 1939 | (comment-end-vc (or (car (cdr delims)) comment-end "")) |
| 1943 | (comment-end-vc (or (car (cdr delims)) comment-end "")) | 1940 | (hdsym (vc-make-backend-sym (vc-backend buffer-file-name) |
| 1944 | (hdsym (vc-make-backend-sym (vc-backend buffer-file-name) | 1941 | 'header)) |
| 1945 | 'header)) | 1942 | (hdstrings (and (boundp hdsym) (symbol-value hdsym)))) |
| 1946 | (hdstrings (and (boundp hdsym) (symbol-value hdsym)))) | 1943 | (dolist (s hdstrings) |
| 1947 | (mapcar (lambda (s) | 1944 | (insert comment-start-vc "\t" s "\t" |
| 1948 | (insert comment-start-vc "\t" s "\t" | 1945 | comment-end-vc "\n")) |
| 1949 | comment-end-vc "\n")) | 1946 | (if vc-static-header-alist |
| 1950 | hdstrings) | 1947 | (dolist (f vc-static-header-alist) |
| 1951 | (if vc-static-header-alist | 1948 | (if (string-match (car f) buffer-file-name) |
| 1952 | (mapcar (lambda (f) | 1949 | (insert (format (cdr f) (car hdstrings))))))))))) |
| 1953 | (if (string-match (car f) buffer-file-name) | ||
| 1954 | (insert (format (cdr f) (car hdstrings))))) | ||
| 1955 | vc-static-header-alist)) | ||
| 1956 | ) | ||
| 1957 | ))))) | ||
| 1958 | 1950 | ||
| 1959 | (defun vc-clear-headers (&optional file) | 1951 | (defun vc-clear-headers (&optional file) |
| 1960 | "Clear all version headers in the current buffer (or FILE). | 1952 | "Clear all version headers in the current buffer (or FILE). |
| @@ -2897,8 +2889,7 @@ Uses `rcs2log' which only works for RCS and CVS." | |||
| 2897 | (concat odefault f)))) | 2889 | (concat odefault f)))) |
| 2898 | files))) | 2890 | files))) |
| 2899 | "done" | 2891 | "done" |
| 2900 | (pop-to-buffer | 2892 | (pop-to-buffer (get-buffer-create "*vc*")) |
| 2901 | (set-buffer (get-buffer-create "*vc*"))) | ||
| 2902 | (erase-buffer) | 2893 | (erase-buffer) |
| 2903 | (insert-file-contents tempfile) | 2894 | (insert-file-contents tempfile) |
| 2904 | "failed")) | 2895 | "failed")) |
| @@ -2913,9 +2904,9 @@ Uses `rcs2log' which only works for RCS and CVS." | |||
| 2913 | ;; annotate-mode, which replaces it with the more sensible "span-to | 2904 | ;; annotate-mode, which replaces it with the more sensible "span-to |
| 2914 | ;; days", along with autoscaling support. | 2905 | ;; days", along with autoscaling support. |
| 2915 | (defvar vc-annotate-ratio nil "Global variable.") | 2906 | (defvar vc-annotate-ratio nil "Global variable.") |
| 2916 | (defvar vc-annotate-backend nil "Global variable.") | ||
| 2917 | 2907 | ||
| 2918 | ;; internal buffer-local variables | 2908 | ;; internal buffer-local variables |
| 2909 | (defvar vc-annotate-backend nil) | ||
| 2919 | (defvar vc-annotate-parent-file nil) | 2910 | (defvar vc-annotate-parent-file nil) |
| 2920 | (defvar vc-annotate-parent-rev nil) | 2911 | (defvar vc-annotate-parent-rev nil) |
| 2921 | (defvar vc-annotate-parent-display-mode nil) | 2912 | (defvar vc-annotate-parent-display-mode nil) |
| @@ -2924,12 +2915,6 @@ Uses `rcs2log' which only works for RCS and CVS." | |||
| 2924 | ;; The fontification is done by vc-annotate-lines instead of font-lock. | 2915 | ;; The fontification is done by vc-annotate-lines instead of font-lock. |
| 2925 | '((vc-annotate-lines))) | 2916 | '((vc-annotate-lines))) |
| 2926 | 2917 | ||
| 2927 | (defun vc-annotate-get-backend (buffer) | ||
| 2928 | "Return the backend matching \"Annotate\" buffer BUFFER. | ||
| 2929 | Return nil if no match made. Associations are made based on | ||
| 2930 | `vc-annotate-buffers'." | ||
| 2931 | (cdr (assoc buffer vc-annotate-buffers))) | ||
| 2932 | |||
| 2933 | (define-derived-mode vc-annotate-mode fundamental-mode "Annotate" | 2918 | (define-derived-mode vc-annotate-mode fundamental-mode "Annotate" |
| 2934 | "Major mode for output buffers of the `vc-annotate' command. | 2919 | "Major mode for output buffers of the `vc-annotate' command. |
| 2935 | 2920 | ||
| @@ -2939,8 +2924,7 @@ menu items." | |||
| 2939 | (set (make-local-variable 'truncate-lines) t) | 2924 | (set (make-local-variable 'truncate-lines) t) |
| 2940 | (set (make-local-variable 'font-lock-defaults) | 2925 | (set (make-local-variable 'font-lock-defaults) |
| 2941 | '(vc-annotate-font-lock-keywords t)) | 2926 | '(vc-annotate-font-lock-keywords t)) |
| 2942 | (view-mode 1) | 2927 | (view-mode 1)) |
| 2943 | (vc-annotate-add-menu)) | ||
| 2944 | 2928 | ||
| 2945 | (defun vc-annotate-display-default (&optional ratio) | 2929 | (defun vc-annotate-display-default (&optional ratio) |
| 2946 | "Display the output of \\[vc-annotate] using the default color range. | 2930 | "Display the output of \\[vc-annotate] using the default color range. |
| @@ -2987,70 +2971,48 @@ cover the range from the oldest annotation to the newest." | |||
| 2987 | (format "Spanned to %.1f days old" (- current oldest)))))) | 2971 | (format "Spanned to %.1f days old" (- current oldest)))))) |
| 2988 | 2972 | ||
| 2989 | ;; Menu -- Using easymenu.el | 2973 | ;; Menu -- Using easymenu.el |
| 2990 | (defun vc-annotate-add-menu () | 2974 | (easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map |
| 2991 | "Add the menu 'Annotate' to the menu bar in VC-Annotate mode." | 2975 | "VC Annotate Display Menu" |
| 2992 | (let ((menu-elements vc-annotate-menu-elements) | 2976 | `("VC-Annotate" |
| 2993 | (menu-def | 2977 | ["Default" (unless (null vc-annotate-display-mode) |
| 2994 | '("VC-Annotate" | 2978 | (setq vc-annotate-display-mode nil) |
| 2995 | ["Default" (unless (null vc-annotate-display-mode) | 2979 | (vc-annotate-display-select)) |
| 2996 | (setq vc-annotate-display-mode nil) | 2980 | :style toggle :selected (null vc-annotate-display-mode)] |
| 2997 | (vc-annotate-display-select)) | 2981 | ,@(let ((oldest-in-map (vc-annotate-car-last-cons vc-annotate-color-map))) |
| 2998 | :style toggle :selected (null vc-annotate-display-mode)])) | 2982 | (mapcar (lambda (element) |
| 2999 | (oldest-in-map (vc-annotate-car-last-cons vc-annotate-color-map))) | 2983 | (let ((days (* element oldest-in-map))) |
| 3000 | (while menu-elements | 2984 | `([,(format "Span %.1f days" days) |
| 3001 | (let* ((element (car menu-elements)) | 2985 | (unless (and (numberp vc-annotate-display-mode) |
| 3002 | (days (* element oldest-in-map))) | 2986 | (= vc-annotate-display-mode ,days)) |
| 3003 | (setq menu-elements (cdr menu-elements)) | 2987 | (vc-annotate-display-select nil ,days)) |
| 3004 | (setq menu-def | 2988 | :style toggle :selected |
| 3005 | (append menu-def | 2989 | (and (numberp vc-annotate-display-mode) |
| 3006 | `([,(format "Span %.1f days" days) | 2990 | (= vc-annotate-display-mode ,days)) ]))) |
| 3007 | (unless (and (numberp vc-annotate-display-mode) | 2991 | vc-annotate-menu-elements)) |
| 3008 | (= vc-annotate-display-mode ,days)) | 2992 | ["Span ..." |
| 3009 | (vc-annotate-display-select nil ,days)) | 2993 | (let ((days |
| 3010 | :style toggle :selected | 2994 | (float (string-to-number |
| 3011 | (and (numberp vc-annotate-display-mode) | 2995 | (read-string "Span how many days? "))))) |
| 3012 | (= vc-annotate-display-mode ,days)) ]))))) | 2996 | (vc-annotate-display-select nil days)) t] |
| 3013 | (setq menu-def | 2997 | "--" |
| 3014 | (append menu-def | 2998 | ["Span to Oldest" |
| 3015 | (list | 2999 | (unless (eq vc-annotate-display-mode 'scale) |
| 3016 | ["Span ..." | 3000 | (vc-annotate-display-select nil 'scale)) |
| 3017 | (let ((days | 3001 | :style toggle :selected |
| 3018 | (float (string-to-number | 3002 | (eq vc-annotate-display-mode 'scale)] |
| 3019 | (read-string "Span how many days? "))))) | 3003 | ["Span Oldest->Newest" |
| 3020 | (vc-annotate-display-select nil days)) t]) | 3004 | (unless (eq vc-annotate-display-mode 'fullscale) |
| 3021 | (list "--") | 3005 | (vc-annotate-display-select nil 'fullscale)) |
| 3022 | (list | 3006 | :style toggle :selected |
| 3023 | ["Span to Oldest" | 3007 | (eq vc-annotate-display-mode 'fullscale)] |
| 3024 | (unless (eq vc-annotate-display-mode 'scale) | 3008 | "--" |
| 3025 | (vc-annotate-display-select nil 'scale)) | 3009 | ["Annotate previous revision" vc-annotate-prev-version] |
| 3026 | :style toggle :selected | 3010 | ["Annotate next revision" vc-annotate-next-version] |
| 3027 | (eq vc-annotate-display-mode 'scale)]) | 3011 | ["Annotate revision at line" vc-annotate-revision-at-line] |
| 3028 | (list | 3012 | ["Annotate revision previous to line" vc-annotate-revision-previous-to-line] |
| 3029 | ["Span Oldest->Newest" | 3013 | ["Annotate latest revision" vc-annotate-workfile-version] |
| 3030 | (unless (eq vc-annotate-display-mode 'fullscale) | 3014 | ["Show log of revision at line" vc-annotate-show-log-revision-at-line] |
| 3031 | (vc-annotate-display-select nil 'fullscale)) | 3015 | ["Show diff of revision at line" vc-annotate-show-diff-revision-at-line])) |
| 3032 | :style toggle :selected | ||
| 3033 | (eq vc-annotate-display-mode 'fullscale)]) | ||
| 3034 | (list "--") | ||
| 3035 | (list ["Annotate previous revision" | ||
| 3036 | (call-interactively 'vc-annotate-prev-version)]) | ||
| 3037 | (list ["Annotate next revision" | ||
| 3038 | (call-interactively 'vc-annotate-next-version)]) | ||
| 3039 | (list ["Annotate revision at line" | ||
| 3040 | (vc-annotate-revision-at-line)]) | ||
| 3041 | (list ["Annotate revision previous to line" | ||
| 3042 | (vc-annotate-revision-previous-to-line)]) | ||
| 3043 | (list ["Annotate latest revision" | ||
| 3044 | (vc-annotate-workfile-version)]) | ||
| 3045 | (list ["Show log of revision at line" | ||
| 3046 | (vc-annotate-show-log-revision-at-line)]) | ||
| 3047 | (list ["Show diff of revision at line" | ||
| 3048 | (vc-annotate-show-diff-revision-at-line)]))) | ||
| 3049 | |||
| 3050 | ;; Define the menu | ||
| 3051 | (if (or (featurep 'easymenu) (load "easymenu" t)) | ||
| 3052 | (easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map | ||
| 3053 | "VC Annotate Display Menu" menu-def)))) | ||
| 3054 | 3016 | ||
| 3055 | (defun vc-annotate-display-select (&optional buffer mode) | 3017 | (defun vc-annotate-display-select (&optional buffer mode) |
| 3056 | "Highlight the output of \\[vc-annotate]. | 3018 | "Highlight the output of \\[vc-annotate]. |
| @@ -3083,7 +3045,7 @@ use; you may override this using the second optional arg MODE." | |||
| 3083 | ;;;; the contents in BUFFER. | 3045 | ;;;; the contents in BUFFER. |
| 3084 | 3046 | ||
| 3085 | ;;;###autoload | 3047 | ;;;###autoload |
| 3086 | (defun vc-annotate (prefix &optional revision display-mode) | 3048 | (defun vc-annotate (file rev &optional display-mode buf) |
| 3087 | "Display the edit history of the current file using colors. | 3049 | "Display the edit history of the current file using colors. |
| 3088 | 3050 | ||
| 3089 | This command creates a buffer that shows, for each line of the current | 3051 | This command creates a buffer that shows, for each line of the current |
| @@ -3108,48 +3070,44 @@ Customization variables: | |||
| 3108 | mode-specific menu. `vc-annotate-color-map' and | 3070 | mode-specific menu. `vc-annotate-color-map' and |
| 3109 | `vc-annotate-very-old-color' defines the mapping of time to | 3071 | `vc-annotate-very-old-color' defines the mapping of time to |
| 3110 | colors. `vc-annotate-background' specifies the background color." | 3072 | colors. `vc-annotate-background' specifies the background color." |
| 3111 | (interactive "P") | 3073 | (interactive |
| 3074 | (save-current-buffer | ||
| 3075 | (vc-ensure-vc-buffer) | ||
| 3076 | (list buffer-file-name | ||
| 3077 | (let ((def (vc-workfile-version buffer-file-name))) | ||
| 3078 | (if (null current-prefix-arg) def | ||
| 3079 | (read-string | ||
| 3080 | (format "Annotate from version (default %s): " def) | ||
| 3081 | nil nil def))) | ||
| 3082 | (if (null current-prefix-arg) | ||
| 3083 | vc-annotate-display-mode | ||
| 3084 | (float (string-to-number | ||
| 3085 | (read-string "Annotate span days (default 20): " | ||
| 3086 | nil nil "20"))))))) | ||
| 3112 | (vc-ensure-vc-buffer) | 3087 | (vc-ensure-vc-buffer) |
| 3113 | (let* ((temp-buffer-name nil) | 3088 | (setq vc-annotate-display-mode display-mode) ;Not sure why. --Stef |
| 3114 | (temp-buffer-show-function 'vc-annotate-display-select) | 3089 | (let* ((temp-buffer-name (format "*Annotate %s (rev %s)*" (buffer-name) rev)) |
| 3115 | (rev (or revision (vc-workfile-version buffer-file-name))) | 3090 | (temp-buffer-show-function 'vc-annotate-display-select)) |
| 3116 | (bfn buffer-file-name) | ||
| 3117 | (vc-annotate-version | ||
| 3118 | (if prefix (read-string | ||
| 3119 | (format "Annotate from version (default %s): " rev) | ||
| 3120 | nil nil rev) | ||
| 3121 | rev))) | ||
| 3122 | (if display-mode | ||
| 3123 | (setq vc-annotate-display-mode display-mode) | ||
| 3124 | (if prefix | ||
| 3125 | (setq vc-annotate-display-mode | ||
| 3126 | (float (string-to-number | ||
| 3127 | (read-string "Annotate span days (default 20): " | ||
| 3128 | nil nil "20")))))) | ||
| 3129 | (setq temp-buffer-name (format "*Annotate %s (rev %s)*" | ||
| 3130 | (buffer-name) vc-annotate-version)) | ||
| 3131 | (setq vc-annotate-backend (vc-backend buffer-file-name)) | ||
| 3132 | (message "Annotating...") | 3091 | (message "Annotating...") |
| 3092 | ;; If BUF is specified it tells in which buffer we should put the | ||
| 3093 | ;; annotations. This is used when switching annotations to another | ||
| 3094 | ;; revision, so we should update the buffer's name. | ||
| 3095 | (if buf (with-current-buffer buf | ||
| 3096 | (rename-buffer temp-buffer-name t) | ||
| 3097 | ;; In case it had to be uniquified. | ||
| 3098 | (setq temp-buffer-name (buffer-name)))) | ||
| 3133 | (if (not (vc-find-backend-function vc-annotate-backend 'annotate-command)) | 3099 | (if (not (vc-find-backend-function vc-annotate-backend 'annotate-command)) |
| 3134 | (error "Sorry, annotating is not implemented for %s" | 3100 | (error "Sorry, annotating is not implemented for %s" |
| 3135 | vc-annotate-backend)) | 3101 | vc-annotate-backend)) |
| 3136 | (with-output-to-temp-buffer temp-buffer-name | 3102 | (with-output-to-temp-buffer temp-buffer-name |
| 3137 | (vc-call-backend vc-annotate-backend 'annotate-command | 3103 | (vc-call annotate-command file (get-buffer temp-buffer-name) rev)) |
| 3138 | buffer-file-name | 3104 | (with-current-buffer temp-buffer-name |
| 3139 | (get-buffer temp-buffer-name) | 3105 | (set (make-local-variable 'vc-annotate-backend) (vc-backend file)) |
| 3140 | vc-annotate-version)) | 3106 | (set (make-local-variable 'vc-annotate-parent-file) file) |
| 3141 | (save-excursion | 3107 | (set (make-local-variable 'vc-annotate-parent-rev) rev) |
| 3142 | (set-buffer temp-buffer-name) | ||
| 3143 | (set (make-local-variable 'vc-annotate-parent-file) bfn) | ||
| 3144 | (set (make-local-variable 'vc-annotate-parent-rev) vc-annotate-version) | ||
| 3145 | (set (make-local-variable 'vc-annotate-parent-display-mode) | 3108 | (set (make-local-variable 'vc-annotate-parent-display-mode) |
| 3146 | vc-annotate-display-mode)) | 3109 | display-mode)) |
| 3147 | 3110 | ||
| 3148 | ;; Don't use the temp-buffer-name until the buffer is created | ||
| 3149 | ;; (only after `with-output-to-temp-buffer'.) | ||
| 3150 | (setq vc-annotate-buffers | ||
| 3151 | (append vc-annotate-buffers | ||
| 3152 | (list (cons (get-buffer temp-buffer-name) vc-annotate-backend)))) | ||
| 3153 | (message "Annotating... done"))) | 3111 | (message "Annotating... done"))) |
| 3154 | 3112 | ||
| 3155 | (defun vc-annotate-prev-version (prefix) | 3113 | (defun vc-annotate-prev-version (prefix) |
| @@ -3274,20 +3232,16 @@ revision." | |||
| 3274 | ((stringp revspec) (setq newrev revspec)) | 3232 | ((stringp revspec) (setq newrev revspec)) |
| 3275 | (t (error "Invalid argument to vc-annotate-warp-version"))) | 3233 | (t (error "Invalid argument to vc-annotate-warp-version"))) |
| 3276 | (when newrev | 3234 | (when newrev |
| 3277 | (save-window-excursion | 3235 | (vc-annotate vc-annotate-parent-file newrev |
| 3278 | (find-file vc-annotate-parent-file) | 3236 | vc-annotate-parent-display-mode |
| 3279 | (vc-annotate nil newrev vc-annotate-parent-display-mode)) | 3237 | (current-buffer)) |
| 3280 | (kill-buffer (current-buffer)) ;; kill the buffer we started from | ||
| 3281 | (switch-to-buffer (car (car (last vc-annotate-buffers)))) | ||
| 3282 | (goto-line (min oldline (progn (goto-char (point-max)) | 3238 | (goto-line (min oldline (progn (goto-char (point-max)) |
| 3283 | (previous-line) | 3239 | (previous-line) |
| 3284 | (line-number-at-pos)))))))) | 3240 | (line-number-at-pos)))))))) |
| 3285 | 3241 | ||
| 3286 | (defun vc-annotate-car-last-cons (a-list) | 3242 | (defun vc-annotate-car-last-cons (a-list) |
| 3287 | "Return car of last cons in association list A-LIST." | 3243 | "Return car of last cons in association list A-LIST." |
| 3288 | (if (not (eq nil (cdr a-list))) | 3244 | (caar (last a-list))) |
| 3289 | (vc-annotate-car-last-cons (cdr a-list)) | ||
| 3290 | (car (car a-list)))) | ||
| 3291 | 3245 | ||
| 3292 | (defun vc-annotate-time-span (a-list span &optional quantize) | 3246 | (defun vc-annotate-time-span (a-list span &optional quantize) |
| 3293 | "Apply factor SPAN to the time-span of association list A-LIST. | 3247 | "Apply factor SPAN to the time-span of association list A-LIST. |