summaryrefslogtreecommitdiff
path: root/lisp/ediff-util.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
commit657f9cb8b7f7c3a9687f3998319ce63346ef13a4 (patch)
tree1ee552a157cf60e2c30151a8341d5bef0d9f9e4d /lisp/ediff-util.el
parent4f490d995d44a68878c1bd7dd0df3be5355b81a8 (diff)
downloademacs-657f9cb8b7f7c3a9687f3998319ce63346ef13a4.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-util.el')
-rw-r--r--lisp/ediff-util.el81
1 files changed, 52 insertions, 29 deletions
diff --git a/lisp/ediff-util.el b/lisp/ediff-util.el
index 03beef1e6cd..44c96417189 100644
--- a/lisp/ediff-util.el
+++ b/lisp/ediff-util.el
@@ -254,6 +254,7 @@ to invocation.")
(defun ediff-setup (buffer-A file-A buffer-B file-B buffer-C file-C
startup-hooks setup-parameters
&optional merge-buffer-file)
+ (run-hooks 'ediff-before-setup-hook)
;; ediff-convert-standard-filename puts file names in the form appropriate
;; for the OS at hand.
(setq file-A (ediff-convert-standard-filename (expand-file-name file-A)))
@@ -955,7 +956,7 @@ On a dumb terminal, switches between ASCII highlighting and no highlighting."
(defun ediff-make-or-kill-fine-diffs (arg)
"Compute fine diffs. With negative prefix arg, kill fine diffs.
-In both cases, operates on the currrent difference region."
+In both cases, operates on the current difference region."
(interactive "P")
(ediff-barf-if-not-control-buffer)
(cond ((eq arg '-)
@@ -3459,7 +3460,11 @@ Ediff Control Panel to restore highlighting."
;; EXCL-BUFF-LIST is an exclusion list.
(defun ediff-other-buffer (excl-buff-lst)
(or (listp excl-buff-lst) (setq excl-buff-lst (list excl-buff-lst)))
- (let* ((all-buffers (buffer-list))
+ (let* ((all-buffers (nconc (ediff-get-selected-buffers) (buffer-list)))
+ ;; we compute this the second time because we need to do memq on it
+ ;; later, and nconc above will break it. Either this or use slow
+ ;; append instead of nconc
+ (selected-buffers (ediff-get-selected-buffers))
(prefered-buffer (car all-buffers))
visible-dired-buffers
(excl-buff-name-list
@@ -3488,33 +3493,34 @@ Ediff Control Panel to restore highlighting."
(mapcar
(lambda (x)
(cond ((member (buffer-name x) excl-buff-name-list) nil)
- ((not (ediff-get-visible-buffer-window x)) nil)
- ((eq x prefered-buffer) x)
- ;; if prev selected buffer is dired, look only at
- ;; dired.
- ((eq use-dired-major-mode 'yes)
- (if (eq (ediff-with-current-buffer x major-mode)
- 'dired-mode)
- x nil))
- ((eq (ediff-with-current-buffer x major-mode)
- 'dired-mode)
- (if (null use-dired-major-mode)
- ;; don't know if we must enforce dired.
- ;; Remember this buffer in case
- ;; dired buffs are the only ones visible.
- (setq visible-dired-buffers
- (cons x visible-dired-buffers)))
- ;; skip, if dired is not forced
- nil)
- ((memq (ediff-with-current-buffer x major-mode)
- '(rmail-mode
- vm-mode
- gnus-article-mode
- mh-show-mode))
- x)
- ((string-match "^[ *]" (buffer-name x)) nil)
- ((string= "*scratch*" (buffer-name x)) nil)
- (t x)))
+ ((memq x selected-buffers) x)
+ ((not (ediff-get-visible-buffer-window x)) nil)
+ ((eq x prefered-buffer) x)
+ ;; if prev selected buffer is dired, look only at
+ ;; dired.
+ ((eq use-dired-major-mode 'yes)
+ (if (eq (ediff-with-current-buffer x major-mode)
+ 'dired-mode)
+ x nil))
+ ((eq (ediff-with-current-buffer x major-mode)
+ 'dired-mode)
+ (if (null use-dired-major-mode)
+ ;; don't know if we must enforce dired.
+ ;; Remember this buffer in case
+ ;; dired buffs are the only ones visible.
+ (setq visible-dired-buffers
+ (cons x visible-dired-buffers)))
+ ;; skip, if dired is not forced
+ nil)
+ ((memq (ediff-with-current-buffer x major-mode)
+ '(rmail-mode
+ vm-mode
+ gnus-article-mode
+ mh-show-mode))
+ x)
+ ((string-match "^[ *]" (buffer-name x)) nil)
+ ((string= "*scratch*" (buffer-name x)) nil)
+ (t x)))
all-buffers))
(clean-significant-buffers (delq nil significant-buffers))
less-significant-buffers)
@@ -3547,6 +3553,23 @@ Ediff Control Panel to restore highlighting."
(t "*scratch*"))
))
+
+;; If current buffer is a Buffer-menu buffer, then take the selected buffers
+;; and append the buffer at the cursor to the end.
+;; This list would be the preferred list.
+(defun ediff-get-selected-buffers ()
+ (if (eq major-mode 'Buffer-menu-mode)
+ (let ((lis (condition-case nil
+ (list (Buffer-menu-buffer t))
+ (error))
+ ))
+ (save-excursion
+ (goto-char (point-max))
+ (while (search-backward "\n>" nil t)
+ (forward-char 1)
+ (setq lis (cons (Buffer-menu-buffer t) lis)))
+ lis))
+ ))
;; Construct a unique buffer name.
;; The first one tried is prefixsuffix, then prefix<2>suffix,