summaryrefslogtreecommitdiff
path: root/lisp/ediff.el
diff options
context:
space:
mode:
authorMichael Kifer <kifer@cs.stonybrook.edu>2000-10-29 04:56:45 +0000
committerMichael Kifer <kifer@cs.stonybrook.edu>2000-10-29 04:56:45 +0000
commit783510919b4460d1ae0503ada406f1092fd846e8 (patch)
tree374b31ad9a2f378188324538201c291ca24ce683 /lisp/ediff.el
parent29bc562fec6bf7ff4b81adc603d2d7ae2a272f36 (diff)
downloademacs-783510919b4460d1ae0503ada406f1092fd846e8.tar.gz
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
* viper-cmd.el (viper-preserve-cursor-color): new test that avoids rewrawing the screen when changing cursor color. (viper-insert-state-pre-command-sentinel, viper-replace-state-pre-command-sentinel, viper-replace-state-post-command-sentinel): use viper-preserve-cursor-color. Many functions changed to use viper= instead of = when comparing characters. * viper-util.el (viper-memq-char,viper=): new functions for working with characters. (viper-change-cursor-color): fixed buglet. Many functions changed to use viper= instead of = when comparing characters. * viper.el (viper-insert-state-mode-list): added eshell. * ediff-init.el (ediff-before-setup-hook): new hook. Several typos fixed in various docstrings. * ediff-merg.el (ediff-show-clashes-only): docstring typo fixed. * ediff-nult.el (ediff-before-session-group-setup-hooks): new hook. (ediff-show-meta-buffer): run ediff-before-session-group-setup-hooks. * ediff-util.el (ediff-setup): run ediff-before-setup-hook. (ediff-other-buffer): use selected buffers if in Buffer-menu buffer. (ediff-get-selected-buffers): new function. * ediff-vers.el (ediff-vc-internal,ediff-rcs-internal, ediff-vc-merge-internal,ediff-rcs-merge-internal): use save-window-excursion. * ediff-wind.el (ediff-skip-unsuitable-frames): more robust termination check in while loop. * ediff.el (ediff-get-default-file-name): better defaults when in dired buffer. (ediff-files,ediff-merge-files,ediff-files3, ediff-merge-files-with-ancestor): use ediff-get-default-file-name.
Diffstat (limited to 'lisp/ediff.el')
-rw-r--r--lisp/ediff.el42
1 files changed, 28 insertions, 14 deletions
diff --git a/lisp/ediff.el b/lisp/ediff.el
index efab0dec0d1..140a80c6846 100644
--- a/lisp/ediff.el
+++ b/lisp/ediff.el
@@ -6,8 +6,8 @@
;; Created: February 2, 1994
;; Keywords: comparing, merging, patching, version control.
-(defconst ediff-version "2.74" "The current version of Ediff")
-(defconst ediff-date "October 31, 1999" "Date of last update")
+(defconst ediff-version "2.75" "The current version of Ediff")
+(defconst ediff-date "October 29, 2000" "Date of last update")
;; This file is part of GNU Emacs.
@@ -163,13 +163,27 @@
(toggle-read-only 1)))
;; Return a plausible default for ediff's first file:
-;; In dired, return the file name under the point, unless it is a directory
-;; If the buffer has a file name, return that file name.
-(defun ediff-get-default-file-name ()
+;; In dired, return the file number FILENO (or 0) in the list
+;; (all-selected-files, filename under the cursor), where directories are
+;; ignored. Otherwise, return DEFAULT file name, if non-nil. Else,
+;; if the buffer is visiting a file, return that file name.
+(defun ediff-get-default-file-name (&optional default fileno)
(cond ((eq major-mode 'dired-mode)
- (let ((f (dired-get-filename nil 'no-error)))
- (if (and (stringp f) (not (file-directory-p f)))
- f)))
+ (let ((current (dired-get-filename nil 'no-error))
+ (marked (condition-case nil
+ (dired-get-marked-files 'no-dir)
+ (error)))
+ aux-list choices result)
+ (or (integerp fileno) (setq fileno 0))
+ (if (stringp default)
+ (setq aux-list (cons default aux-list)))
+ (if (and (stringp current) (not (file-directory-p current)))
+ (setq aux-list (cons current aux-list)))
+ (setq choices (nconc marked aux-list))
+ (setq result (elt choices fileno))
+ (or result
+ default)))
+ ((stringp default) default)
((buffer-file-name (current-buffer))
(file-name-nondirectory (buffer-file-name (current-buffer))))
))
@@ -199,7 +213,7 @@
(file-name-nondirectory f)
dir-B))
file-name-history))
- f))
+ (ediff-get-default-file-name f 1)))
)))
(ediff-files-internal file-A
(if (file-directory-p file-B)
@@ -234,7 +248,7 @@
(file-name-nondirectory f)
dir-B))
file-name-history))
- f)))
+ (ediff-get-default-file-name f 1))))
(ediff-read-file-name "File C to compare"
(setq dir-C (if ediff-use-last-dir
ediff-last-dir-C
@@ -246,7 +260,7 @@
(file-name-nondirectory ff)
dir-C))
file-name-history))
- ff))
+ (ediff-get-default-file-name ff 2)))
)))
(ediff-files-internal file-A
(if (file-directory-p file-B)
@@ -1009,7 +1023,7 @@ Continue anyway? (y/n) "))
(file-name-nondirectory f)
dir-B))
file-name-history))
- f))
+ (ediff-get-default-file-name f 1)))
)))
(setq startup-hooks (cons 'ediff-merge-on-startup startup-hooks))
(ediff-files-internal file-A
@@ -1052,7 +1066,7 @@ Continue anyway? (y/n) "))
(file-name-nondirectory f)
dir-B))
file-name-history))
- f)))
+ (ediff-get-default-file-name f 1))))
(ediff-read-file-name "Ancestor file"
(setq dir-ancestor
(if ediff-use-last-dir
@@ -1065,7 +1079,7 @@ Continue anyway? (y/n) "))
(file-name-nondirectory ff)
dir-ancestor))
file-name-history))
- ff))
+ (ediff-get-default-file-name ff 2)))
)))
(setq startup-hooks (cons 'ediff-merge-on-startup startup-hooks))
(ediff-files-internal file-A