comparison lisp/ediff-util.el @ 19774:1ecc4a79d048

new version
author Michael Kifer <kifer@cs.stonybrook.edu>
date Sat, 06 Sep 1997 04:16:05 +0000
parents f90d40b0bff5
children a016beb4f4cf
comparison
equal deleted inserted replaced
19773:24853e0e38d6 19774:1ecc4a79d048
143 (if ediff-emacs-p [mouse-2] [button2]) 'ediff-help-for-quick-help) 143 (if ediff-emacs-p [mouse-2] [button2]) 'ediff-help-for-quick-help)
144 (define-key ediff-mode-map "\C-m" 'ediff-help-for-quick-help) 144 (define-key ediff-mode-map "\C-m" 'ediff-help-for-quick-help)
145 145
146 (define-key ediff-mode-map "p" 'ediff-previous-difference) 146 (define-key ediff-mode-map "p" 'ediff-previous-difference)
147 (define-key ediff-mode-map "\C-?" 'ediff-previous-difference) 147 (define-key ediff-mode-map "\C-?" 'ediff-previous-difference)
148 (define-key ediff-mode-map [backspace] 'ediff-previous-difference)
149 (define-key ediff-mode-map [delete] 'ediff-previous-difference) 148 (define-key ediff-mode-map [delete] 'ediff-previous-difference)
150 (define-key ediff-mode-map "\C-h" (if ediff-no-emacs-help-in-control-buffer 149 (define-key ediff-mode-map "\C-h" (if ediff-no-emacs-help-in-control-buffer
151 'ediff-previous-difference nil)) 150 'ediff-previous-difference nil))
151 ;; must come after C-h, or else C-h wipes out backspace's binding in XEmacs
152 (define-key ediff-mode-map [backspace] 'ediff-previous-difference)
152 (define-key ediff-mode-map "n" 'ediff-next-difference) 153 (define-key ediff-mode-map "n" 'ediff-next-difference)
153 (define-key ediff-mode-map " " 'ediff-next-difference) 154 (define-key ediff-mode-map " " 'ediff-next-difference)
154 (define-key ediff-mode-map "j" 'ediff-jump-to-difference) 155 (define-key ediff-mode-map "j" 'ediff-jump-to-difference)
155 (define-key ediff-mode-map "g" nil) 156 (define-key ediff-mode-map "g" nil)
156 (define-key ediff-mode-map "ga" 'ediff-jump-to-difference-at-point) 157 (define-key ediff-mode-map "ga" 'ediff-jump-to-difference-at-point)
685 (defun ediff-recenter (&optional no-rehighlight) 686 (defun ediff-recenter (&optional no-rehighlight)
686 "Bring the highlighted region of all buffers being compared into view. 687 "Bring the highlighted region of all buffers being compared into view.
687 Reestablish the default three-window display." 688 Reestablish the default three-window display."
688 (interactive) 689 (interactive)
689 (ediff-barf-if-not-control-buffer) 690 (ediff-barf-if-not-control-buffer)
690
691 ;; ;; No longer needed: XEmacs has surrogate minibuffers now.
692 ;; (if ediff-xemacs-p (setq synchronize-minibuffers t))
693
694 (let (buffer-read-only) 691 (let (buffer-read-only)
695 (if (and (ediff-buffer-live-p ediff-buffer-A) 692 (if (and (ediff-buffer-live-p ediff-buffer-A)
696 (ediff-buffer-live-p ediff-buffer-B) 693 (ediff-buffer-live-p ediff-buffer-B)
697 (or (not ediff-3way-job) 694 (or (not ediff-3way-job)
698 (ediff-buffer-live-p ediff-buffer-C))) 695 (ediff-buffer-live-p ediff-buffer-C)))
2916 (erase-buffer)) 2913 (erase-buffer))
2917 (revert-buffer t t)) 2914 (revert-buffer t t))
2918 (error "Buffer out of sync for file %s" buffer-file-name)))) 2915 (error "Buffer out of sync for file %s" buffer-file-name))))
2919 2916
2920 2917
2918 (defun ediff-file-compressed-p (file)
2919 (require 'jka-compr)
2920 (string-match (jka-compr-build-file-regexp) file))
2921
2922 (defun ediff-filename-magic-p (file)
2923 (or (ediff-file-compressed-p file)
2924 (ediff-file-remote-p file)))
2925
2926
2921 (defun ediff-save-buffer (arg) 2927 (defun ediff-save-buffer (arg)
2922 "Safe way of saving buffers A, B, C, and the diff output. 2928 "Safe way of saving buffers A, B, C, and the diff output.
2923 `wa' saves buffer A, `wb' saves buffer B, `wc' saves buffer C, 2929 `wa' saves buffer A, `wb' saves buffer B, `wc' saves buffer C,
2924 and `wd' saves the diff output. 2930 and `wd' saves the diff output.
2925 2931
3312 3318
3313 ;; Like other-buffer, but prefers visible buffers and ignores temporary or 3319 ;; Like other-buffer, but prefers visible buffers and ignores temporary or
3314 ;; other insignificant buffers (those beginning with "^[ *]"). 3320 ;; other insignificant buffers (those beginning with "^[ *]").
3315 ;; Gets one arg--buffer name or a list of buffer names (it won't return 3321 ;; Gets one arg--buffer name or a list of buffer names (it won't return
3316 ;; these buffers). 3322 ;; these buffers).
3317 (defun ediff-other-buffer (buff) 3323 (defun ediff-other-buffer (buff-lst)
3318 (if (not (listp buff)) (setq buff (list buff))) 3324 (or (listp buff-lst) (setq buff-lst (list buff-lst)))
3319 (let* ((frame-buffers (buffer-list)) 3325 (let* ((frame-buffers (buffer-list))
3326 (buff-name-list
3327 (mapcar
3328 (function (lambda (b)
3329 (cond ((stringp b) b)
3330 ((bufferp b) (buffer-name b)))))
3331 buff-lst))
3320 (significant-buffers 3332 (significant-buffers
3321 (mapcar 3333 (mapcar
3322 (function (lambda (x) 3334 (function (lambda (x)
3323 (cond ((member (buffer-name x) buff) 3335 (cond ((member (buffer-name x) buff-name-list) nil)
3324 nil) 3336 ((not (ediff-get-visible-buffer-window x)) nil)
3325 ((not (ediff-get-visible-buffer-window x)) 3337 ((string-match "^[ *]" (buffer-name x)) nil)
3326 nil) 3338 ((memq (ediff-with-current-buffer x major-mode)
3327 ((string-match "^ " (buffer-name x)) 3339 '(dired-mode))
3328 nil) 3340 nil)
3329 (t x)))) 3341 (t x))))
3330 frame-buffers)) 3342 frame-buffers))
3331 (buffers (delq nil significant-buffers)) 3343 (buffers (delq nil significant-buffers))
3332 less-significant-buffers) 3344 less-significant-buffers)
3336 ((setq less-significant-buffers 3348 ((setq less-significant-buffers
3337 (delq nil 3349 (delq nil
3338 (mapcar 3350 (mapcar
3339 (function 3351 (function
3340 (lambda (x) 3352 (lambda (x)
3341 (cond ((member (buffer-name x) buff) nil) 3353 (cond ((member (buffer-name x) buff-name-list) nil)
3342 ((string-match "^[ *]" (buffer-name x)) nil) 3354 ((string-match "^[ *]" (buffer-name x)) nil)
3355 ((memq
3356 (ediff-with-current-buffer x major-mode)
3357 '(dired-mode))
3358 nil)
3343 (t x)))) 3359 (t x))))
3344 frame-buffers))) 3360 frame-buffers)))
3345 (car less-significant-buffers)) 3361 (car less-significant-buffers))
3346 (t (other-buffer (current-buffer)))) 3362 (t (other-buffer (current-buffer))))
3347 )) 3363 ))