Mercurial > emacs
comparison lisp/ediff-util.el @ 44615:a1448e19a9f8
* viper-ex.el: Patch by Samuel Padgett. Copyright papers received.
(viper-ex-print-buf-name): New variable.
(viper-ex-print-buf): New variable.
(ex-token-alist): Invoke ex-print on ":print" Ex commands.
(ex-g-marks): New variable.
(ex-print): New function.
(ex-print-display-lines): New function.
* viper.el (viper-set-hooks): add window-setup-hook, which sets
the cursor color.
* ediff-util.el (ediff-cleanup-mess): delete ctl window on exit
when the window is not in its own frame.
(ediff-clone-buffer-for-region-comparison): more robust window
arrangement while prompting for regions to compare.
(ediff-make-cloned-buffer): use generate-new-buffer-name.
(ediff-inferior-compare-regions): deleted unused vars
ctl-buf and quit-now.
author | Michael Kifer <kifer@cs.stonybrook.edu> |
---|---|
date | Tue, 16 Apr 2002 05:49:11 +0000 |
parents | 182881d68883 |
children | 341d8797885c |
comparison
equal
deleted
inserted
replaced
44614:5adf2b1c20bb | 44615:a1448e19a9f8 |
---|---|
39 (defvar bottom-toolbar-height) | 39 (defvar bottom-toolbar-height) |
40 (defvar mark-active) | 40 (defvar mark-active) |
41 (defvar ediff-emacs-p) | 41 (defvar ediff-emacs-p) |
42 | 42 |
43 (defvar ediff-after-quit-hook-internal nil) | 43 (defvar ediff-after-quit-hook-internal nil) |
44 | |
45 (and noninteractive | |
46 (eval-when-compile | |
47 (load "reporter" 'noerror))) | |
44 | 48 |
45 (eval-when-compile | 49 (eval-when-compile |
46 (let ((load-path (cons (expand-file-name ".") load-path))) | 50 (let ((load-path (cons (expand-file-name ".") load-path))) |
47 (or (featurep 'ediff-init) | 51 (or (featurep 'ediff-init) |
48 (load "ediff-init.el" nil nil 'nosuffix)) | 52 (load "ediff-init.el" nil nil 'nosuffix)) |
2552 (defun ediff-cleanup-mess () | 2556 (defun ediff-cleanup-mess () |
2553 (let* ((buff-A ediff-buffer-A) | 2557 (let* ((buff-A ediff-buffer-A) |
2554 (buff-B ediff-buffer-B) | 2558 (buff-B ediff-buffer-B) |
2555 (buff-C ediff-buffer-C) | 2559 (buff-C ediff-buffer-C) |
2556 (ctl-buf ediff-control-buffer) | 2560 (ctl-buf ediff-control-buffer) |
2561 (ctl-wind (ediff-get-visible-buffer-window ctl-buf)) | |
2557 (ctl-frame ediff-control-frame) | 2562 (ctl-frame ediff-control-frame) |
2558 (three-way-job ediff-3way-job) | 2563 (three-way-job ediff-3way-job) |
2559 (main-frame (cond ((window-live-p ediff-window-A) | 2564 (main-frame (cond ((window-live-p ediff-window-A) |
2560 (window-frame ediff-window-A)) | 2565 (window-frame ediff-window-A)) |
2561 ((window-live-p ediff-window-B) | 2566 ((window-live-p ediff-window-B) |
2569 (ediff-kill-buffer-carefully ediff-msg-buffer) | 2574 (ediff-kill-buffer-carefully ediff-msg-buffer) |
2570 (ediff-kill-buffer-carefully ediff-debug-buffer) | 2575 (ediff-kill-buffer-carefully ediff-debug-buffer) |
2571 (if (boundp 'ediff-patch-diagnostics) | 2576 (if (boundp 'ediff-patch-diagnostics) |
2572 (ediff-kill-buffer-carefully ediff-patch-diagnostics)) | 2577 (ediff-kill-buffer-carefully ediff-patch-diagnostics)) |
2573 | 2578 |
2574 (if (and (ediff-window-display-p) (frame-live-p ctl-frame)) | 2579 ;; delete control frame or window |
2575 (delete-frame ctl-frame)) | 2580 (cond ((and (ediff-window-display-p) (frame-live-p ctl-frame)) |
2581 (delete-frame ctl-frame)) | |
2582 ((window-live-p ctl-wind) | |
2583 (delete-window ctl-wind))) | |
2584 | |
2576 ;; Hide bottom toolbar. --marcpa | 2585 ;; Hide bottom toolbar. --marcpa |
2577 (if (not (ediff-multiframe-setup-p)) | 2586 (if (not (ediff-multiframe-setup-p)) |
2578 (ediff-kill-bottom-toolbar)) | 2587 (ediff-kill-bottom-toolbar)) |
2579 | 2588 |
2580 (ediff-kill-buffer-carefully ctl-buf) | 2589 (ediff-kill-buffer-carefully ctl-buf) |
2601 (progn | 2610 (progn |
2602 (if (and (or (ediff-get-visible-buffer-window buff-A) | 2611 (if (and (or (ediff-get-visible-buffer-window buff-A) |
2603 (ediff-get-visible-buffer-window buff-B)) | 2612 (ediff-get-visible-buffer-window buff-B)) |
2604 (ediff-buffer-live-p buff-C)) | 2613 (ediff-buffer-live-p buff-C)) |
2605 (funcall ediff-split-window-function)) | 2614 (funcall ediff-split-window-function)) |
2606 (switch-to-buffer buff-C) | 2615 (switch-to-buffer buff-C))) |
2607 (balance-windows))) | |
2608 (error))) | 2616 (error))) |
2617 (balance-windows) | |
2609 (message "") | 2618 (message "") |
2610 )) | 2619 )) |
2611 | 2620 |
2612 (defun ediff-janitor (ask keep-variants) | 2621 (defun ediff-janitor (ask keep-variants) |
2613 "Kill buffers A, B, and, possibly, C, if these buffers aren't modified. | 2622 "Kill buffers A, B, and, possibly, C, if these buffers aren't modified. |
3306 | 3315 |
3307 | 3316 |
3308 ;; idea suggested by Hannu Koivisto <azure@iki.fi> | 3317 ;; idea suggested by Hannu Koivisto <azure@iki.fi> |
3309 (defun ediff-clone-buffer-for-region-comparison (buff region-name) | 3318 (defun ediff-clone-buffer-for-region-comparison (buff region-name) |
3310 (let ((cloned-buff (ediff-make-cloned-buffer buff region-name)) | 3319 (let ((cloned-buff (ediff-make-cloned-buffer buff region-name)) |
3311 (wind (ediff-get-visible-buffer-window buff)) | |
3312 (pop-up-windows t) | 3320 (pop-up-windows t) |
3321 wind | |
3313 other-wind | 3322 other-wind |
3314 msg-buf) | 3323 msg-buf) |
3315 (ediff-with-current-buffer cloned-buff | 3324 (ediff-with-current-buffer cloned-buff |
3316 (setq ediff-temp-indirect-buffer t)) | 3325 (setq ediff-temp-indirect-buffer t)) |
3317 (if (window-live-p wind) | |
3318 (set-window-buffer wind cloned-buff)) | |
3319 (pop-to-buffer cloned-buff) | 3326 (pop-to-buffer cloned-buff) |
3327 (setq wind (ediff-get-visible-buffer-window cloned-buff)) | |
3328 (select-window wind) | |
3329 (delete-other-windows) | |
3330 (split-window-vertically) | |
3331 (ediff-select-lowest-window) | |
3332 (setq other-wind (selected-window)) | |
3320 (with-temp-buffer | 3333 (with-temp-buffer |
3321 (erase-buffer) | 3334 (erase-buffer) |
3322 (insert | 3335 (insert |
3323 (format "\n ******* Mark a region in buffer %s *******\n" | 3336 (format "\n ******* Mark a region in buffer %s *******\n" |
3324 (buffer-name cloned-buff))) | 3337 (buffer-name cloned-buff))) |
3325 (insert | 3338 (insert |
3326 (format "\n\t When done, type %s Use %s to abort\n " | 3339 (ediff-with-current-buffer buff |
3327 (ediff-format-bindings-of 'exit-recursive-edit) | 3340 (format "\n\t When done, type %s Use %s to abort\n " |
3328 (ediff-format-bindings-of 'abort-recursive-edit))) | 3341 (ediff-format-bindings-of 'exit-recursive-edit) |
3342 (ediff-format-bindings-of 'abort-recursive-edit)))) | |
3329 (goto-char (point-min)) | 3343 (goto-char (point-min)) |
3330 (setq msg-buf (current-buffer)) | 3344 (setq msg-buf (current-buffer)) |
3331 (other-window 1) | 3345 (set-window-buffer other-wind msg-buf) |
3332 (set-window-buffer (selected-window) msg-buf) | |
3333 (shrink-window-if-larger-than-buffer) | 3346 (shrink-window-if-larger-than-buffer) |
3334 (if (window-live-p wind) | 3347 (if (window-live-p wind) |
3335 (select-window wind)) | 3348 (select-window wind)) |
3336 (condition-case nil | 3349 (condition-case nil |
3337 (recursive-edit) | 3350 (recursive-edit) |
3361 | 3374 |
3362 | 3375 |
3363 | 3376 |
3364 (defun ediff-make-cloned-buffer (buff region-name) | 3377 (defun ediff-make-cloned-buffer (buff region-name) |
3365 (ediff-make-indirect-buffer | 3378 (ediff-make-indirect-buffer |
3366 buff (concat | 3379 buff (generate-new-buffer-name |
3367 (if (stringp buff) buff (buffer-name buff)) | 3380 (concat (if (stringp buff) buff (buffer-name buff)) region-name)) |
3368 region-name (symbol-name (gensym))))) | 3381 )) |
3369 | 3382 |
3370 | 3383 |
3371 (defun ediff-make-indirect-buffer (base-buf indirect-buf-name) | 3384 (defun ediff-make-indirect-buffer (base-buf indirect-buf-name) |
3372 (ediff-cond-compile-for-xemacs-or-emacs | 3385 (ediff-cond-compile-for-xemacs-or-emacs |
3373 (make-indirect-buffer base-buf indirect-buf-name) ; xemacs | 3386 (make-indirect-buffer base-buf indirect-buf-name) ; xemacs |
3442 Ediff Control Panel to restore highlighting." | 3455 Ediff Control Panel to restore highlighting." |
3443 (interactive) | 3456 (interactive) |
3444 (let ((answer "") | 3457 (let ((answer "") |
3445 (possibilities (list ?A ?B ?C)) | 3458 (possibilities (list ?A ?B ?C)) |
3446 (zmacs-regions t) | 3459 (zmacs-regions t) |
3447 (ctl-buf (current-buffer)) | |
3448 quit-now | |
3449 use-current-diff-p | 3460 use-current-diff-p |
3450 begA begB endA endB bufA bufB) | 3461 begA begB endA endB bufA bufB) |
3451 | 3462 |
3452 (if (ediff-valid-difference-p ediff-current-difference) | 3463 (if (ediff-valid-difference-p ediff-current-difference) |
3453 (progn | 3464 (progn |