emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/vc.el


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/vc.el
Date: Sat, 17 May 2003 22:53:25 -0400

Index: emacs/lisp/vc.el
diff -c emacs/lisp/vc.el:1.352 emacs/lisp/vc.el:1.353
*** emacs/lisp/vc.el:1.352      Fri May  9 12:33:10 2003
--- emacs/lisp/vc.el    Sat May 17 22:53:24 2003
***************
*** 1,12 ****
  ;;; vc.el --- drive a version-control system from within Emacs
  
! ;; Copyright (C) 1992,93,94,95,96,97,98,2000,2001  Free Software Foundation, 
Inc.
  
  ;; Author:     FSF (see below for full credits)
  ;; Maintainer: Andre Spiegel <address@hidden>
  ;; Keywords: tools
  
! ;; $Id: vc.el,v 1.352 2003/05/09 16:33:10 monnier Exp $
  
  ;; This file is part of GNU Emacs.
  
--- 1,13 ----
  ;;; vc.el --- drive a version-control system from within Emacs
  
! ;; Copyright (C) 1992,93,94,95,96,97,98,2000,01,2003
! ;;           Free Software Foundation, Inc.
  
  ;; Author:     FSF (see below for full credits)
  ;; Maintainer: Andre Spiegel <address@hidden>
  ;; Keywords: tools
  
! ;; $Id: vc.el,v 1.353 2003/05/18 02:53:24 monnier Exp $
  
  ;; This file is part of GNU Emacs.
  
***************
*** 522,530 ****
    :type '(repeat string)
    :group 'vc)
  
- (defconst vc-maximum-comment-ring-size 32
-   "Maximum number of saved comments in the comment ring.")
- 
  (defcustom vc-diff-switches nil
    "*A string or list of strings specifying switches for diff under VC.
  When running diff under a given BACKEND, VC concatenates the values of
--- 523,528 ----
***************
*** 670,691 ****
                          "21.1")
  
  
- ;; The main keymap
- 
- ;; Initialization code, to be done just once at load-time
- (defvar vc-log-mode-map
-   (let ((map (make-sparse-keymap)))
-     (set-keymap-parent map text-mode-map)
-     (define-key map "\M-n" 'vc-next-comment)
-     (define-key map "\M-p" 'vc-previous-comment)
-     (define-key map "\M-r" 'vc-comment-search-reverse)
-     (define-key map "\M-s" 'vc-comment-search-forward)
-     (define-key map "\C-c\C-c" 'vc-finish-logentry)
-     map))
- ;; Compatibility with old name.  Should we bother ?
- (defvar vc-log-entry-mode vc-log-mode-map)
- 
- 
  ;; Variables the user doesn't need to know about.
  (defvar vc-log-operation nil)
  (defvar vc-log-after-operation-hook nil)
--- 668,673 ----
***************
*** 706,715 ****
  (defvar vc-dired-mode nil)
  (make-variable-buffer-local 'vc-dired-mode)
  
- (defvar vc-comment-ring (make-ring vc-maximum-comment-ring-size))
- (defvar vc-comment-ring-index nil)
- (defvar vc-last-comment-match "")
- 
  ;; functions that operate on RCS revision numbers.  This code should
  ;; also be moved into the backends.  It stays for now, however, since
  ;; it is used in code below.
--- 688,693 ----
***************
*** 754,765 ****
  ;; File property caching
  
  (defun vc-clear-context ()
!   "Clear all cached file properties and the comment ring."
    (interactive)
!   (fillarray vc-file-prop-obarray 0)
!   ;; Note: there is potential for minor lossage here if there is an open
!   ;; log buffer with a nonzero local value of vc-comment-ring-index.
!   (setq vc-comment-ring (make-ring vc-maximum-comment-ring-size)))
  
  (defmacro with-vc-properties (file form settings)
    "Execute FORM, then maybe set per-file properties for FILE.
--- 732,740 ----
  ;; File property caching
  
  (defun vc-clear-context ()
!   "Clear all cached file properties."
    (interactive)
!   (fillarray vc-file-prop-obarray 0))
  
  (defmacro with-vc-properties (file form settings)
    "Execute FORM, then maybe set per-file properties for FILE.
***************
*** 1586,1645 ****
       (message "Checking in %s...done" file))
     'vc-checkin-hook))
  
- (defun vc-comment-to-change-log (&optional whoami file-name)
-   "Enter last VC comment into the change log for the current file.
- WHOAMI (interactive prefix) non-nil means prompt for user name
- and site.  FILE-NAME is the name of the change log; if nil, use
- `change-log-default-name'.
- 
- This may be useful as a `vc-checkin-hook' to update change logs
- automatically."
-   (interactive (if current-prefix-arg
-                  (list current-prefix-arg
-                        (prompt-for-change-log-name))))
-   ;; Make sure the defvar for add-log-current-defun-function has been executed
-   ;; before binding it.
-   (require 'add-log)
-   (let (;; Extract the comment first so we get any error before doing 
anything.
-       (comment (ring-ref vc-comment-ring 0))
-       ;; Don't let add-change-log-entry insert a defun name.
-       (add-log-current-defun-function 'ignore)
-       end)
-     ;; Call add-log to do half the work.
-     (add-change-log-entry whoami file-name t t)
-     ;; Insert the VC comment, leaving point before it.
-     (setq end (save-excursion (insert comment) (point-marker)))
-     (if (looking-at "\\s *\\s(")
-       ;; It starts with an open-paren, as in "(foo): Frobbed."
-       ;; So remove the ": " add-log inserted.
-       (delete-char -2))
-     ;; Canonicalize the white space between the file name and comment.
-     (just-one-space)
-     ;; Indent rest of the text the same way add-log indented the first line.
-     (let ((indentation (current-indentation)))
-       (save-excursion
-       (while (< (point) end)
-         (forward-line 1)
-         (indent-to indentation))
-       (setq end (point))))
-     ;; Fill the inserted text, preserving open-parens at bol.
-     (let ((paragraph-separate (concat paragraph-separate "\\|\\s *\\s("))
-         (paragraph-start (concat paragraph-start "\\|\\s *\\s(")))
-       (beginning-of-line)
-       (fill-region (point) end))
-     ;; Canonicalize the white space at the end of the entry so it is
-     ;; separated from the next entry by a single blank line.
-     (skip-syntax-forward " " end)
-     (delete-char (- (skip-syntax-backward " ")))
-     (or (eobp) (looking-at "\n\n")
-       (insert "\n"))))
- 
  (defun vc-finish-logentry (&optional nocomment)
    "Complete the operation implied by the current log entry.
  Use the contents of the current buffer as a check-in or registration
  comment.  If the optional arg NOCOMMENT is non-nil, then don't check
! the buffer contents as a comment, and don't add it to
! `vc-comment-ring'."
    (interactive)
    ;; Check and record the comment, if any.
    (unless nocomment
--- 1561,1571 ----
       (message "Checking in %s...done" file))
     'vc-checkin-hook))
  
  (defun vc-finish-logentry (&optional nocomment)
    "Complete the operation implied by the current log entry.
  Use the contents of the current buffer as a check-in or registration
  comment.  If the optional arg NOCOMMENT is non-nil, then don't check
! the buffer contents as a comment."
    (interactive)
    ;; Check and record the comment, if any.
    (unless nocomment
***************
*** 1647,1659 ****
      (vc-call-backend (or (and vc-log-file (vc-backend vc-log-file))
                         (vc-responsible-backend default-directory))
                     'logentry-check)
!     (run-hooks 'vc-logentry-check-hook)
!     ;; Record the comment in the comment ring
!     (let ((comment (buffer-string)))
!       (unless (and (ring-p vc-comment-ring)
!                  (not (ring-empty-p vc-comment-ring))
!                  (equal comment (ring-ref vc-comment-ring 0)))
!       (ring-insert vc-comment-ring comment))))
    ;; Sync parent buffer in case the user modified it while editing the 
comment.
    ;; But not if it is a vc-dired buffer.
    (with-current-buffer vc-parent-buffer
--- 1573,1579 ----
      (vc-call-backend (or (and vc-log-file (vc-backend vc-log-file))
                         (vc-responsible-backend default-directory))
                     'logentry-check)
!     (run-hooks 'vc-logentry-check-hook))
    ;; Sync parent buffer in case the user modified it while editing the 
comment.
    ;; But not if it is a vc-dired buffer.
    (with-current-buffer vc-parent-buffer
***************
*** 1692,1753 ****
  
  ;; Code for access to the comment ring
  
- (defun vc-new-comment-index (stride len)
-   "Return the comment index STRIDE elements from the current one.
- LEN is the length of `vc-comment-ring'."
-   (mod (cond
-       (vc-comment-ring-index (+ vc-comment-ring-index stride))
-       ;; Initialize the index on the first use of this command
-       ;; so that the first M-p gets index 0, and the first M-n gets
-       ;; index -1.
-       ((> stride 0) (1- stride))
-       (t stride))
-        len))
- 
- (defun vc-previous-comment (arg)
-   "Cycle backwards through comment history.
- With a numeric prefix ARG, go back ARG comments."
-   (interactive "*p")
-   (let ((len (ring-length vc-comment-ring)))
-     (if (<= len 0)
-       (progn (message "Empty comment ring") (ding))
-       (erase-buffer)
-       (setq vc-comment-ring-index (vc-new-comment-index arg len))
-       (message "Comment %d" (1+ vc-comment-ring-index))
-       (insert (ring-ref vc-comment-ring vc-comment-ring-index)))))
- 
- (defun vc-next-comment (arg)
-   "Cycle forwards through comment history.
- With a numeric prefix ARG, go forward ARG comments."
-   (interactive "*p")
-   (vc-previous-comment (- arg)))
- 
- (defun vc-comment-search-reverse (str &optional stride)
-   "Search backwards through comment history for substring match of STR.
- If the optional argument STRIDE is present, that is a step-width to use
- when going through the comment ring."
-   ;; Why substring rather than regexp ?   -sm
-   (interactive
-    (list (read-string "Comment substring: " nil nil vc-last-comment-match)))
-   (unless stride (setq stride 1))
-   (if (string= str "")
-       (setq str vc-last-comment-match)
-     (setq vc-last-comment-match str))
-   (let* ((str (regexp-quote str))
-        (len (ring-length vc-comment-ring))
-        (n (vc-new-comment-index stride len)))
-     (while (progn (when (or (>= n len) (< n 0)) (error "Not found"))
-                 (not (string-match str (ring-ref vc-comment-ring n))))
-       (setq n (+ n stride)))
-     (setq vc-comment-ring-index n)
-     (vc-previous-comment 0)))
- 
- (defun vc-comment-search-forward (str)
-   "Search forwards through comment history for a substring match of STR."
-   (interactive
-    (list (read-string "Comment substring: " nil nil vc-last-comment-match)))
-   (vc-comment-search-reverse str -1))
- 
  ;; Additional entry points for examining version histories
  
  ;;;###autoload
--- 1612,1617 ----
***************
*** 2451,2460 ****
          (vc-file-tree-walk
           dir
           (lambda (f) (and
!                       (vc-up-to-date-p f)
!                       (vc-error-occurred
!                        (vc-call checkout f nil "")
!                        (if update (vc-resynch-buffer f t t)))))))
      (let ((result (vc-snapshot-precondition dir)))
        (if (stringp result)
            (error "File %s is locked" result)
--- 2315,2324 ----
          (vc-file-tree-walk
           dir
           (lambda (f) (and
!                (vc-up-to-date-p f)
!                (vc-error-occurred
!                 (vc-call checkout f nil "")
!                 (if update (vc-resynch-buffer f t t)))))))
      (let ((result (vc-snapshot-precondition dir)))
        (if (stringp result)
            (error "File %s is locked" result)
***************
*** 2462,2469 ****
          (vc-file-tree-walk
           dir
           (lambda (f) (vc-error-occurred
!                     (vc-call checkout f nil name)
!                     (if update (vc-resynch-buffer f t t)))))))))
  
  ;; Miscellaneous other entry points
  
--- 2326,2333 ----
          (vc-file-tree-walk
           dir
           (lambda (f) (vc-error-occurred
!                (vc-call checkout f nil name)
!                (if update (vc-resynch-buffer f t t)))))))))
  
  ;; Miscellaneous other entry points
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]