comparison lisp/vc.el @ 35820:3cfa6e077b83

(vc-diff-switches): New user option. (vc-version-diff): Use it. (vc-diff-switches-list): New macro.
author André Spiegel <spiegel@gnu.org>
date Thu, 01 Feb 2001 15:08:49 +0000
parents aa38d1de35cb
children 037d66685778
comparison
equal deleted inserted replaced
35819:74e2d9de2fc1 35820:3cfa6e077b83
3 ;; Copyright (C) 1992,93,94,95,96,97,98,2000 Free Software Foundation, Inc. 3 ;; Copyright (C) 1992,93,94,95,96,97,98,2000 Free Software Foundation, Inc.
4 4
5 ;; Author: FSF (see below for full credits) 5 ;; Author: FSF (see below for full credits)
6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> 6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
7 7
8 ;; $Id: vc.el,v 1.293 2001/01/08 16:23:33 spiegel Exp $ 8 ;; $Id: vc.el,v 1.294 2001/01/10 14:42:53 spiegel Exp $
9 9
10 ;; This file is part of GNU Emacs. 10 ;; This file is part of GNU Emacs.
11 11
12 ;; GNU Emacs is free software; you can redistribute it and/or modify 12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by 13 ;; it under the terms of the GNU General Public License as published by
463 "Maximum number of saved comments in the comment ring.") 463 "Maximum number of saved comments in the comment ring.")
464 464
465 ;;; This is duplicated in diff.el. 465 ;;; This is duplicated in diff.el.
466 (defvar diff-switches "-c" 466 (defvar diff-switches "-c"
467 "*A string or list of strings specifying switches to be passed to diff.") 467 "*A string or list of strings specifying switches to be passed to diff.")
468
469 (defcustom vc-diff-switches nil
470 "*A string or list of strings specifying switches for diff under VC.
471 There is also an option vc-BACKEND-diff-switches for each BACKEND that
472 VC can handle."
473 :type '(choice (const :tag "None" nil)
474 (string :tag "Argument String")
475 (repeat :tag "Argument List"
476 :value ("")
477 string))
478 :group 'vc
479 :version "21.1")
468 480
469 ;;;###autoload 481 ;;;###autoload
470 (defcustom vc-checkin-hook nil 482 (defcustom vc-checkin-hook nil
471 "*Normal hook (list of functions) run after a checkin is done. 483 "*Normal hook (list of functions) run after a checkin is done.
472 See `run-hooks'." 484 See `run-hooks'."
1749 (if (and file-rel1 file-rel2) 1761 (if (and file-rel1 file-rel2)
1750 (apply 'vc-do-command t 1 "diff" nil 1762 (apply 'vc-do-command t 1 "diff" nil
1751 (append (if (listp diff-switches) 1763 (append (if (listp diff-switches)
1752 diff-switches 1764 diff-switches
1753 (list diff-switches)) 1765 (list diff-switches))
1766 (if (listp vc-diff-switches)
1767 vc-diff-switches
1768 (list vc-diff-switches))
1754 (list (file-relative-name file-rel1) 1769 (list (file-relative-name file-rel1)
1755 (file-relative-name file-rel2)))) 1770 (file-relative-name file-rel2))))
1756 (cd (file-name-directory file)) 1771 (cd (file-name-directory file))
1757 (vc-call diff file rel1 rel2)))) 1772 (vc-call diff file rel1 rel2))))
1758 (if (and (zerop (buffer-size)) 1773 (if (and (zerop (buffer-size))
1772 (if (eq (buffer-size) 0) 1787 (if (eq (buffer-size) 0)
1773 (insert "No differences found.\n")) 1788 (insert "No differences found.\n"))
1774 (goto-char (point-min)) 1789 (goto-char (point-min))
1775 (shrink-window-if-larger-than-buffer))) 1790 (shrink-window-if-larger-than-buffer)))
1776 t)) 1791 t))
1792
1793 (defmacro vc-diff-switches-list (backend)
1794 "Make a list of `diff-switches', `vc-diff-switches',
1795 and `vc-BACKEND-diff-switches'."
1796 `(append
1797 (if (listp diff-switches) diff-switches (list diff-switches))
1798 (if (listp vc-diff-switches) vc-diff-switches (list vc-diff-switches))
1799 (let ((backend-switches
1800 (eval (intern (concat "vc-" (symbol-name ',backend)
1801 "-diff-switches")))))
1802 (if (listp backend-switches) backend-switches (list backend-switches)))))
1777 1803
1778 ;;;###autoload 1804 ;;;###autoload
1779 (defun vc-version-other-window (rev) 1805 (defun vc-version-other-window (rev)
1780 "Visit version REV of the current buffer in another window. 1806 "Visit version REV of the current buffer in another window.
1781 If the current buffer is named `F', the version is named `F.~REV~'. 1807 If the current buffer is named `F', the version is named `F.~REV~'.