diff options
| author | Michael Kifer | 2002-01-08 04:36:01 +0000 |
|---|---|---|
| committer | Michael Kifer | 2002-01-08 04:36:01 +0000 |
| commit | 50a07e18565cc4dd7162908197ac71e85c1781d7 (patch) | |
| tree | 6f0a68647e226b1c14cf00b75444e9c9d54ad847 | |
| parent | fbb70ad9e6e00f3f146b50d3bf433a6ec6ce26c9 (diff) | |
| download | emacs-50a07e18565cc4dd7162908197ac71e85c1781d7.tar.gz emacs-50a07e18565cc4dd7162908197ac71e85c1781d7.zip | |
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-init.el (viper-cond-compile-for-xemacs-or-emacs):
new macro that replaces viper-emacs-p and viper-xemacs-p in many
cases. Used to reduce the number of warnings.
* viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-standard-value): moved here from viper.el.
(viper-set-unread-command-events): moved to viper-util.el
(viper-check-minibuffer-overlay): make sure
viper-minibuffer-overlay is moved to cover the entire input field.
* viper-util.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-read-key-sequence, viper-set-unread-command-events,
viper-char-symbol-sequence-p, viper-char-array-p): moved here.
* viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p,
viper-event-vector-p): moved to viper-util.el
* viper.el (viper-standard-value): moved to viper-cmd.el.
Use viper-cond-compile-for-xemacs-or-emacs.
* ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new
macro designed to be used in many places where ediff-emacs-p or
ediff-xemacs-p was previously used. Reduces the number of
warnings.
Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue
of ediff-xemacs-p.
(ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer,
ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p,
ediff-whitespace-diff-region-p, ediff-get-region-contents):
moved to ediff-util.el.
(ediff-event-key): moved here.
* ediff-merge.el: got rid of unreferenced variables.
* ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs.
(ediff-cleanup-mess): improved the way windows are set up after
quitting ediff.
(ediff-janitor): use ediff-dispose-of-variant-according-to-user.
(ediff-dispose-of-variant-according-to-user): new function
designed to be smarter and also understands indirect buffers.
(ediff-highlight-diff-in-one-buffer,
ediff-unhighlight-diff-in-one-buffer,
ediff-unhighlight-diffs-totally-in-one-buffer,
ediff-highlight-diff, ediff-highlight-diff,
ediff-unhighlight-diff, ediff-unhighlight-diffs-totally,
ediff-empty-diff-region-p, ediff-whitespace-diff-region-p,
ediff-get-region-contents, ediff-make-current-diff-overlay):
moved here.
(ediff-format-bindings-of): new function by Hannu Koivisto
<azure@iki.fi>.
(ediff-setup): make sure the merge buffer is always widened and
modifiable.
(ediff-write-merge-buffer-and-maybe-kill): refuse to write the
result of a merge into a file visited by another buffer.
(ediff-arrange-autosave-in-merge-jobs): check if the merge file
is visited by another buffer and ask to save/delete that buffer.
(ediff-verify-file-merge-buffer): new function to do the above.
* ediff-vers.el: load ediff-init.el at compile time.
* ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff.el (ediff-windows, ediff-regions-wordwise,
ediff-regions-linewise): use indirect buffers to improve
robustness and make it possible to compare regions of the same
buffer (even overlapping regions).
(ediff-clone-buffer-for-region-comparison,
ediff-clone-buffer-for-window-comparison): new functions.
(ediff-files-internal): refuse to compare identical files.
(ediff-regions-internal): get rid of the warning about comparing
regions of the same buffer.
* ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here.
Plus the following fixes courtesy of Dave Love:
Doc fixes.
(ediff-word-1): Use word class and move - to the
front per regexp documentation.
(ediff-wordify): Bind forward-word-function outside loop.
(ediff-copy-to-buffer): Use insert-buffer-substring rather than
consing buffer contents.
(ediff-goto-word): Move syntax table setting outside loop.
| -rw-r--r-- | lisp/ChangeLog | 96 | ||||
| -rw-r--r-- | lisp/ediff-diff.el | 127 | ||||
| -rw-r--r-- | lisp/ediff-help.el | 19 | ||||
| -rw-r--r-- | lisp/ediff-hook.el | 197 | ||||
| -rw-r--r-- | lisp/ediff-init.el | 431 | ||||
| -rw-r--r-- | lisp/ediff-merg.el | 17 | ||||
| -rw-r--r-- | lisp/ediff-mult.el | 188 | ||||
| -rw-r--r-- | lisp/ediff-ptch.el | 4 | ||||
| -rw-r--r-- | lisp/ediff-util.el | 434 | ||||
| -rw-r--r-- | lisp/ediff-vers.el | 30 | ||||
| -rw-r--r-- | lisp/ediff-wind.el | 104 | ||||
| -rw-r--r-- | lisp/ediff.el | 130 | ||||
| -rw-r--r-- | lisp/emulation/viper-cmd.el | 142 | ||||
| -rw-r--r-- | lisp/emulation/viper-ex.el | 18 | ||||
| -rw-r--r-- | lisp/emulation/viper-init.el | 49 | ||||
| -rw-r--r-- | lisp/emulation/viper-keym.el | 17 | ||||
| -rw-r--r-- | lisp/emulation/viper-macs.el | 24 | ||||
| -rw-r--r-- | lisp/emulation/viper-mous.el | 62 | ||||
| -rw-r--r-- | lisp/emulation/viper-util.el | 376 | ||||
| -rw-r--r-- | lisp/emulation/viper.el | 37 | ||||
| -rw-r--r-- | man/ediff.texi | 48 | ||||
| -rw-r--r-- | man/viper.texi | 119 |
22 files changed, 1560 insertions, 1109 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index dde227b915d..77ebab10e1e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,99 @@ | |||
| 1 | 2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu> | ||
| 2 | |||
| 3 | * viper-init.el (viper-cond-compile-for-xemacs-or-emacs): | ||
| 4 | new macro that replaces viper-emacs-p and viper-xemacs-p in many | ||
| 5 | cases. Used to reduce the number of warnings. | ||
| 6 | |||
| 7 | * viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs. | ||
| 8 | (viper-standard-value): moved here from viper.el. | ||
| 9 | (viper-set-unread-command-events): moved to viper-util.el | ||
| 10 | (viper-check-minibuffer-overlay): make sure | ||
| 11 | viper-minibuffer-overlay is moved to cover the entire input field. | ||
| 12 | |||
| 13 | * viper-util.el: use viper-cond-compile-for-xemacs-or-emacs. | ||
| 14 | (viper-read-key-sequence, viper-set-unread-command-events, | ||
| 15 | viper-char-symbol-sequence-p, viper-char-array-p): moved here. | ||
| 16 | |||
| 17 | * viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs. | ||
| 18 | |||
| 19 | * viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs. | ||
| 20 | |||
| 21 | * viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs. | ||
| 22 | |||
| 23 | * viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p, | ||
| 24 | viper-event-vector-p): moved to viper-util.el | ||
| 25 | |||
| 26 | * viper.el (viper-standard-value): moved to viper-cmd.el. | ||
| 27 | Use viper-cond-compile-for-xemacs-or-emacs. | ||
| 28 | |||
| 29 | * ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs. | ||
| 30 | |||
| 31 | * ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs. | ||
| 32 | |||
| 33 | * ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new | ||
| 34 | macro designed to be used in many places where ediff-emacs-p or | ||
| 35 | ediff-xemacs-p was previously used. Reduces the number of | ||
| 36 | warnings. | ||
| 37 | Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue | ||
| 38 | of ediff-xemacs-p. | ||
| 39 | (ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer, | ||
| 40 | ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p, | ||
| 41 | ediff-whitespace-diff-region-p, ediff-get-region-contents): | ||
| 42 | moved to ediff-util.el. | ||
| 43 | (ediff-event-key): moved here. | ||
| 44 | |||
| 45 | * ediff-merge.el: got rid of unreferenced variables. | ||
| 46 | |||
| 47 | * ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs. | ||
| 48 | |||
| 49 | * ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs. | ||
| 50 | (ediff-cleanup-mess): improved the way windows are set up after | ||
| 51 | quitting ediff. | ||
| 52 | (ediff-janitor): use ediff-dispose-of-variant-according-to-user. | ||
| 53 | (ediff-dispose-of-variant-according-to-user): new function | ||
| 54 | designed to be smarter and also understands indirect buffers. | ||
| 55 | (ediff-highlight-diff-in-one-buffer, | ||
| 56 | ediff-unhighlight-diff-in-one-buffer, | ||
| 57 | ediff-unhighlight-diffs-totally-in-one-buffer, | ||
| 58 | ediff-highlight-diff, ediff-highlight-diff, | ||
| 59 | ediff-unhighlight-diff, ediff-unhighlight-diffs-totally, | ||
| 60 | ediff-empty-diff-region-p, ediff-whitespace-diff-region-p, | ||
| 61 | ediff-get-region-contents, ediff-make-current-diff-overlay): | ||
| 62 | moved here. | ||
| 63 | (ediff-format-bindings-of): new function by Hannu Koivisto | ||
| 64 | <azure@iki.fi>. | ||
| 65 | (ediff-setup): make sure the merge buffer is always widened and | ||
| 66 | modifiable. | ||
| 67 | (ediff-write-merge-buffer-and-maybe-kill): refuse to write the | ||
| 68 | result of a merge into a file visited by another buffer. | ||
| 69 | (ediff-arrange-autosave-in-merge-jobs): check if the merge file | ||
| 70 | is visited by another buffer and ask to save/delete that buffer. | ||
| 71 | (ediff-verify-file-merge-buffer): new function to do the above. | ||
| 72 | |||
| 73 | * ediff-vers.el: load ediff-init.el at compile time. | ||
| 74 | |||
| 75 | * ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs. | ||
| 76 | |||
| 77 | * ediff.el (ediff-windows, ediff-regions-wordwise, | ||
| 78 | ediff-regions-linewise): use indirect buffers to improve | ||
| 79 | robustness and make it possible to compare regions of the same | ||
| 80 | buffer (even overlapping regions). | ||
| 81 | (ediff-clone-buffer-for-region-comparison, | ||
| 82 | ediff-clone-buffer-for-window-comparison): new functions. | ||
| 83 | (ediff-files-internal): refuse to compare identical files. | ||
| 84 | (ediff-regions-internal): get rid of the warning about comparing | ||
| 85 | regions of the same buffer. | ||
| 86 | |||
| 87 | * ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here. | ||
| 88 | Plus the following fixes courtesy of Dave Love: | ||
| 89 | Doc fixes. | ||
| 90 | (ediff-word-1): Use word class and move - to the | ||
| 91 | front per regexp documentation. | ||
| 92 | (ediff-wordify): Bind forward-word-function outside loop. | ||
| 93 | (ediff-copy-to-buffer): Use insert-buffer-substring rather than | ||
| 94 | consing buffer contents. | ||
| 95 | (ediff-goto-word): Move syntax table setting outside loop. | ||
| 96 | |||
| 1 | 2002-01-07 Richard M. Stallman <rms@gnu.org> | 97 | 2002-01-07 Richard M. Stallman <rms@gnu.org> |
| 2 | 98 | ||
| 3 | * dired.el (dired-copy-filename-as-kill): Call kill-append | 99 | * dired.el (dired-copy-filename-as-kill): Call kill-append |
diff --git a/lisp/ediff-diff.el b/lisp/ediff-diff.el index df3d7d203bb..7815e632502 100644 --- a/lisp/ediff-diff.el +++ b/lisp/ediff-diff.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; ediff-diff.el --- diff-related utilities | 1 | ;;; ediff-diff.el --- diff-related utilities |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 5 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 6 | 6 | ||
| 7 | ;; This file is part of GNU Emacs. | 7 | ;; This file is part of GNU Emacs. |
| 8 | 8 | ||
| @@ -29,6 +29,7 @@ | |||
| 29 | 29 | ||
| 30 | ;; compiler pacifier | 30 | ;; compiler pacifier |
| 31 | (defvar ediff-default-variant) | 31 | (defvar ediff-default-variant) |
| 32 | (defvar null-device) | ||
| 32 | 33 | ||
| 33 | (eval-when-compile | 34 | (eval-when-compile |
| 34 | (let ((load-path (cons (expand-file-name ".") load-path))) | 35 | (let ((load-path (cons (expand-file-name ".") load-path))) |
| @@ -83,13 +84,13 @@ Must produce output compatible with Unix's diff3 program." | |||
| 83 | ;; make sure that mandatory options are added even if the user changes | 84 | ;; make sure that mandatory options are added even if the user changes |
| 84 | ;; ediff-diff-options or ediff-diff3-options in the customization widget | 85 | ;; ediff-diff-options or ediff-diff3-options in the customization widget |
| 85 | (defun ediff-reset-diff-options (symb val) | 86 | (defun ediff-reset-diff-options (symb val) |
| 86 | (let* ((diff-program | 87 | (let* ((diff-program |
| 87 | (if (eq symb 'ediff-diff-options) | 88 | (if (eq symb 'ediff-diff-options) |
| 88 | ediff-diff-program | 89 | ediff-diff-program |
| 89 | ediff-diff3-program)) | 90 | ediff-diff3-program)) |
| 90 | (mandatory-option (ediff-diff-mandatory-option diff-program)) | 91 | (mandatory-option (ediff-diff-mandatory-option diff-program)) |
| 91 | (spacer (if (string-equal mandatory-option "") "" " "))) | 92 | (spacer (if (string-equal mandatory-option "") "" " "))) |
| 92 | (set symb | 93 | (set symb |
| 93 | (if (string-match mandatory-option val) | 94 | (if (string-match mandatory-option val) |
| 94 | val | 95 | val |
| 95 | (concat mandatory-option spacer val))) | 96 | (concat mandatory-option spacer val))) |
| @@ -102,11 +103,12 @@ Must produce output compatible with Unix's diff3 program." | |||
| 102 | shell-file-name) ; no standard name on MS-DOS | 103 | shell-file-name) ; no standard name on MS-DOS |
| 103 | ((memq system-type '(vax-vms axp-vms)) "*dcl*") ; VMS | 104 | ((memq system-type '(vax-vms axp-vms)) "*dcl*") ; VMS |
| 104 | (t "sh")) ; UNIX | 105 | (t "sh")) ; UNIX |
| 105 | "*The shell used to run diff and patch. If user's .profile or | 106 | "*The shell used to run diff and patch. |
| 106 | .cshrc files are set up correctly, any shell will do. However, some people | 107 | If user's .profile or .cshrc files are set up correctly, any shell |
| 107 | set $prompt or other things incorrectly, which leads to undesirable output | 108 | will do. However, some people set $prompt or other things |
| 108 | messages. These may cause Ediff to fail. In such a case, set ediff-shell | 109 | incorrectly, which leads to undesirable output messages. These may |
| 109 | to a shell that you are not using or, better, fix your shell's startup file." | 110 | cause Ediff to fail. In such a case, set `ediff-shell' to a shell that |
| 111 | you are not using or, better, fix your shell's startup file." | ||
| 110 | :type 'string | 112 | :type 'string |
| 111 | :group 'ediff-diff) | 113 | :group 'ediff-diff) |
| 112 | 114 | ||
| @@ -119,13 +121,13 @@ It must return code 0, if its arguments are identical files." | |||
| 119 | (defcustom ediff-cmp-options nil | 121 | (defcustom ediff-cmp-options nil |
| 120 | "*Options to pass to `ediff-cmp-program'. | 122 | "*Options to pass to `ediff-cmp-program'. |
| 121 | If GNU diff is used as `ediff-cmp-program', then the most useful options | 123 | If GNU diff is used as `ediff-cmp-program', then the most useful options |
| 122 | are `-I RE', to ignore changes whose lines all match the regexp RE." | 124 | are `-I REGEXP', to ignore changes whose lines match the REGEXP." |
| 123 | :type '(repeat string) | 125 | :type '(repeat string) |
| 124 | :group 'ediff-diff) | 126 | :group 'ediff-diff) |
| 125 | 127 | ||
| 126 | (defcustom ediff-diff-options "" | 128 | (defcustom ediff-diff-options "" |
| 127 | "*Options to pass to `ediff-diff-program'. | 129 | "*Options to pass to `ediff-diff-program'. |
| 128 | If diff\(1\) is used as `ediff-diff-program', then the most useful options are | 130 | If Unix diff is used as `ediff-diff-program', then the most useful options are |
| 129 | `-w', to ignore space, and `-i', to ignore case of letters. | 131 | `-w', to ignore space, and `-i', to ignore case of letters. |
| 130 | At present, the option `-c' is not allowed." | 132 | At present, the option `-c' is not allowed." |
| 131 | :set 'ediff-reset-diff-options | 133 | :set 'ediff-reset-diff-options |
| @@ -146,7 +148,7 @@ This output is not used by Ediff internally." | |||
| 146 | 148 | ||
| 147 | (defvar ediff-match-diff3-line "^====\\(.?\\)\C-m?$" | 149 | (defvar ediff-match-diff3-line "^====\\(.?\\)\C-m?$" |
| 148 | "Pattern to match lines produced by diff3 that describe differences.") | 150 | "Pattern to match lines produced by diff3 that describe differences.") |
| 149 | (defcustom ediff-diff3-options "" | 151 | (defcustom ediff-diff3-options "" |
| 150 | "*Options to pass to `ediff-diff3-program'." | 152 | "*Options to pass to `ediff-diff3-program'." |
| 151 | :set 'ediff-reset-diff-options | 153 | :set 'ediff-reset-diff-options |
| 152 | :type 'string | 154 | :type 'string |
| @@ -163,7 +165,7 @@ Lines that do not match are assumed to be error messages." | |||
| 163 | (ediff-defvar-local ediff-diff-status "" "") | 165 | (ediff-defvar-local ediff-diff-status "" "") |
| 164 | 166 | ||
| 165 | 167 | ||
| 166 | ;;; Fine differences | 168 | ;;; Fine differences |
| 167 | 169 | ||
| 168 | (ediff-defvar-local ediff-auto-refine (if (ediff-has-face-support-p) 'on 'nix) | 170 | (ediff-defvar-local ediff-auto-refine (if (ediff-has-face-support-p) 'on 'nix) |
| 169 | "If `on', Ediff auto-highlights fine diffs for the current diff region. | 171 | "If `on', Ediff auto-highlights fine diffs for the current diff region. |
| @@ -183,7 +185,7 @@ Use `setq-default' if setting it in .emacs") | |||
| 183 | 185 | ||
| 184 | ;;; General | 186 | ;;; General |
| 185 | 187 | ||
| 186 | (defvar ediff-diff-ok-lines-regexp | 188 | (defvar ediff-diff-ok-lines-regexp |
| 187 | (concat | 189 | (concat |
| 188 | "^\\(" | 190 | "^\\(" |
| 189 | "[0-9,]+[acd][0-9,]+\C-m?$" | 191 | "[0-9,]+[acd][0-9,]+\C-m?$" |
| @@ -348,7 +350,7 @@ one optional arguments, diff-number to refine.") | |||
| 348 | (ediff-skip-unsuitable-frames) | 350 | (ediff-skip-unsuitable-frames) |
| 349 | (switch-to-buffer error-buf) | 351 | (switch-to-buffer error-buf) |
| 350 | (ediff-kill-buffer-carefully ctl-buf) | 352 | (ediff-kill-buffer-carefully ctl-buf) |
| 351 | (error "Errors in diff output. Diff output is in %S" diff-buff)))) | 353 | (error "Errors in diff output. Diff output is in %S" diff-buff)))) |
| 352 | 354 | ||
| 353 | ;; BOUNDS specifies visibility bounds to use. | 355 | ;; BOUNDS specifies visibility bounds to use. |
| 354 | ;; WORD-MODE tells whether we are in the word-mode or not. | 356 | ;; WORD-MODE tells whether we are in the word-mode or not. |
| @@ -374,7 +376,7 @@ one optional arguments, diff-number to refine.") | |||
| 374 | (setq shift-A | 376 | (setq shift-A |
| 375 | (ediff-overlay-start | 377 | (ediff-overlay-start |
| 376 | (ediff-get-value-according-to-buffer-type 'A bounds)) | 378 | (ediff-get-value-according-to-buffer-type 'A bounds)) |
| 377 | shift-B | 379 | shift-B |
| 378 | (ediff-overlay-start | 380 | (ediff-overlay-start |
| 379 | (ediff-get-value-according-to-buffer-type 'B bounds)))) | 381 | (ediff-get-value-according-to-buffer-type 'B bounds)))) |
| 380 | 382 | ||
| @@ -430,7 +432,7 @@ one optional arguments, diff-number to refine.") | |||
| 430 | ;; compute main diff vector | 432 | ;; compute main diff vector |
| 431 | (if word-mode | 433 | (if word-mode |
| 432 | ;; make diff-list contain word numbers | 434 | ;; make diff-list contain word numbers |
| 433 | (setq diff-list | 435 | (setq diff-list |
| 434 | (nconc diff-list | 436 | (nconc diff-list |
| 435 | (list | 437 | (list |
| 436 | (if (ediff-buffer-live-p C-buffer) | 438 | (if (ediff-buffer-live-p C-buffer) |
| @@ -474,7 +476,7 @@ one optional arguments, diff-number to refine.") | |||
| 474 | (forward-line (- c-end c-begin)) | 476 | (forward-line (- c-end c-begin)) |
| 475 | (setq c-end-pt (point) | 477 | (setq c-end-pt (point) |
| 476 | c-prev c-end))) | 478 | c-prev c-end))) |
| 477 | (setq diff-list | 479 | (setq diff-list |
| 478 | (nconc | 480 | (nconc |
| 479 | diff-list | 481 | diff-list |
| 480 | (list | 482 | (list |
| @@ -495,7 +497,7 @@ one optional arguments, diff-number to refine.") | |||
| 495 | nil nil ; dummy ancestor | 497 | nil nil ; dummy ancestor |
| 496 | nil nil ; dummy state of diff & merge | 498 | nil nil ; dummy state of diff & merge |
| 497 | nil ; dummy state of ancestor | 499 | nil ; dummy state of ancestor |
| 498 | ))) | 500 | ))) |
| 499 | ))) | 501 | ))) |
| 500 | 502 | ||
| 501 | ))) ; end ediff-with-current-buffer | 503 | ))) ; end ediff-with-current-buffer |
| @@ -538,7 +540,7 @@ one optional arguments, diff-number to refine.") | |||
| 538 | (ediff-get-value-according-to-buffer-type | 540 | (ediff-get-value-according-to-buffer-type |
| 539 | buf-type ediff-narrow-bounds))) | 541 | buf-type ediff-narrow-bounds))) |
| 540 | (limit (ediff-overlay-end | 542 | (limit (ediff-overlay-end |
| 541 | (ediff-get-value-according-to-buffer-type | 543 | (ediff-get-value-according-to-buffer-type |
| 542 | buf-type ediff-narrow-bounds))) | 544 | buf-type ediff-narrow-bounds))) |
| 543 | diff-overlay-list list-element total-diffs | 545 | diff-overlay-list list-element total-diffs |
| 544 | begin end pt-saved overlay state-of-diff) | 546 | begin end pt-saved overlay state-of-diff) |
| @@ -615,7 +617,7 @@ one optional arguments, diff-number to refine.") | |||
| 615 | ;; if `flag' is 'noforce then make fine-diffs only if this region's fine | 617 | ;; if `flag' is 'noforce then make fine-diffs only if this region's fine |
| 616 | ;; diffs have not been computed before. | 618 | ;; diffs have not been computed before. |
| 617 | ;; if `flag' is 'skip then don't compute fine diffs for this region. | 619 | ;; if `flag' is 'skip then don't compute fine diffs for this region. |
| 618 | (defun ediff-make-fine-diffs (&optional n flag) | 620 | (defun ediff-make-fine-diffs (&optional n flag) |
| 619 | (or n (setq n ediff-current-difference)) | 621 | (or n (setq n ediff-current-difference)) |
| 620 | 622 | ||
| 621 | (if (< ediff-number-of-differences 1) | 623 | (if (< ediff-number-of-differences 1) |
| @@ -651,13 +653,13 @@ one optional arguments, diff-number to refine.") | |||
| 651 | (if ediff-3way-comparison-job | 653 | (if ediff-3way-comparison-job |
| 652 | (ediff-message-if-verbose | 654 | (ediff-message-if-verbose |
| 653 | "Region %d is empty in all buffers but %S" | 655 | "Region %d is empty in all buffers but %S" |
| 654 | (1+ n) | 656 | (1+ n) |
| 655 | (cond ((not empty-A) 'A) | 657 | (cond ((not empty-A) 'A) |
| 656 | ((not empty-B) 'B) | 658 | ((not empty-B) 'B) |
| 657 | ((not empty-C) 'C))) | 659 | ((not empty-C) 'C))) |
| 658 | (ediff-message-if-verbose | 660 | (ediff-message-if-verbose |
| 659 | "Region %d in buffer %S is empty" | 661 | "Region %d in buffer %S is empty" |
| 660 | (1+ n) | 662 | (1+ n) |
| 661 | (cond (empty-A 'A) | 663 | (cond (empty-A 'A) |
| 662 | (empty-B 'B) | 664 | (empty-B 'B) |
| 663 | (empty-C 'C))) | 665 | (empty-C 'C))) |
| @@ -772,7 +774,7 @@ one optional arguments, diff-number to refine.") | |||
| 772 | "in buffers A & C") | 774 | "in buffers A & C") |
| 773 | (whitespace-C (ediff-mark-diff-as-space-only n 'C) | 775 | (whitespace-C (ediff-mark-diff-as-space-only n 'C) |
| 774 | "in buffers A & B")))) | 776 | "in buffers A & B")))) |
| 775 | (t | 777 | (t |
| 776 | (ediff-mark-diff-as-space-only n nil))) | 778 | (ediff-mark-diff-as-space-only n nil))) |
| 777 | ) | 779 | ) |
| 778 | ) ; end cond | 780 | ) ; end cond |
| @@ -812,7 +814,7 @@ one optional arguments, diff-number to refine.") | |||
| 812 | (defun ediff-set-fine-diff-properties-in-one-buffer (buf-type | 814 | (defun ediff-set-fine-diff-properties-in-one-buffer (buf-type |
| 813 | n &optional default) | 815 | n &optional default) |
| 814 | (let ((fine-diff-vector (ediff-get-fine-diff-vector n buf-type)) | 816 | (let ((fine-diff-vector (ediff-get-fine-diff-vector n buf-type)) |
| 815 | (face (if default | 817 | (face (if default |
| 816 | 'default | 818 | 'default |
| 817 | (face-name | 819 | (face-name |
| 818 | (ediff-get-symbol-from-alist | 820 | (ediff-get-symbol-from-alist |
| @@ -896,11 +898,19 @@ delimiter regions")) | |||
| 896 | ) ; while | 898 | ) ; while |
| 897 | ;; convert the list of difference information into a vector | 899 | ;; convert the list of difference information into a vector |
| 898 | ;; for fast access | 900 | ;; for fast access |
| 899 | (ediff-set-fine-diff-vector | 901 | (ediff-set-fine-diff-vector |
| 900 | region-num buf-type (vconcat diff-overlay-list)) | 902 | region-num buf-type (vconcat diff-overlay-list)) |
| 901 | ))) | 903 | ))) |
| 902 | 904 | ||
| 903 | 905 | ||
| 906 | (defsubst ediff-convert-fine-diffs-to-overlays (diff-list region-num) | ||
| 907 | (ediff-set-fine-overlays-in-one-buffer 'A diff-list region-num) | ||
| 908 | (ediff-set-fine-overlays-in-one-buffer 'B diff-list region-num) | ||
| 909 | (if ediff-3way-job | ||
| 910 | (ediff-set-fine-overlays-in-one-buffer 'C diff-list region-num) | ||
| 911 | )) | ||
| 912 | |||
| 913 | |||
| 904 | ;; Stolen from emerge.el | 914 | ;; Stolen from emerge.el |
| 905 | (defun ediff-get-diff3-group (file) | 915 | (defun ediff-get-diff3-group (file) |
| 906 | ;; This save-excursion allows ediff-get-diff3-group to be called for the | 916 | ;; This save-excursion allows ediff-get-diff3-group to be called for the |
| @@ -958,10 +968,10 @@ delimiter regions")) | |||
| 958 | (setq shift-A | 968 | (setq shift-A |
| 959 | (ediff-overlay-start | 969 | (ediff-overlay-start |
| 960 | (ediff-get-value-according-to-buffer-type 'A bounds)) | 970 | (ediff-get-value-according-to-buffer-type 'A bounds)) |
| 961 | shift-B | 971 | shift-B |
| 962 | (ediff-overlay-start | 972 | (ediff-overlay-start |
| 963 | (ediff-get-value-according-to-buffer-type 'B bounds)) | 973 | (ediff-get-value-according-to-buffer-type 'B bounds)) |
| 964 | shift-C | 974 | shift-C |
| 965 | (if three-way-comp | 975 | (if three-way-comp |
| 966 | (ediff-overlay-start | 976 | (ediff-overlay-start |
| 967 | (ediff-get-value-according-to-buffer-type 'C bounds))))) | 977 | (ediff-get-value-according-to-buffer-type 'C bounds))))) |
| @@ -1026,7 +1036,7 @@ delimiter regions")) | |||
| 1026 | ;; compute main diff vector | 1036 | ;; compute main diff vector |
| 1027 | (if word-mode | 1037 | (if word-mode |
| 1028 | ;; make diff-list contain word numbers | 1038 | ;; make diff-list contain word numbers |
| 1029 | (setq diff-list | 1039 | (setq diff-list |
| 1030 | (nconc diff-list | 1040 | (nconc diff-list |
| 1031 | (list (vector | 1041 | (list (vector |
| 1032 | (- a-begin a-prev) (- a-end a-begin) | 1042 | (- a-begin a-prev) (- a-end a-begin) |
| @@ -1066,7 +1076,7 @@ delimiter regions")) | |||
| 1066 | (forward-line (- c-or-anc-end c-or-anc-begin)) | 1076 | (forward-line (- c-or-anc-end c-or-anc-begin)) |
| 1067 | (setq anc-end-pt (point) | 1077 | (setq anc-end-pt (point) |
| 1068 | anc-prev c-or-anc-end))) | 1078 | anc-prev c-or-anc-end))) |
| 1069 | (setq diff-list | 1079 | (setq diff-list |
| 1070 | (nconc | 1080 | (nconc |
| 1071 | diff-list | 1081 | diff-list |
| 1072 | ;; if comparing with ancestor, then there also is a | 1082 | ;; if comparing with ancestor, then there also is a |
| @@ -1200,7 +1210,7 @@ delimiter regions")) | |||
| 1200 | (delete-process process)))) | 1210 | (delete-process process)))) |
| 1201 | 1211 | ||
| 1202 | 1212 | ||
| 1203 | ;;; Word functions used to refine the current diff | 1213 | ;;; Word functions used to refine the current diff |
| 1204 | 1214 | ||
| 1205 | (defvar ediff-forward-word-function 'ediff-forward-word | 1215 | (defvar ediff-forward-word-function 'ediff-forward-word |
| 1206 | "*Function to call to move to the next word. | 1216 | "*Function to call to move to the next word. |
| @@ -1210,10 +1220,11 @@ Used for splitting difference regions into individual words.") | |||
| 1210 | "*Characters constituting white space. | 1220 | "*Characters constituting white space. |
| 1211 | These characters are ignored when differing regions are split into words.") | 1221 | These characters are ignored when differing regions are split into words.") |
| 1212 | 1222 | ||
| 1213 | (defvar ediff-word-1 "a-zA-Z---_" | 1223 | (defvar ediff-word-1 |
| 1224 | (ediff-cond-compile-for-xemacs-or-emacs "a-zA-Z---_" "-[:word:]_") | ||
| 1214 | "*Characters that constitute words of type 1. | 1225 | "*Characters that constitute words of type 1. |
| 1215 | More precisely, [ediff-word-1] is a regexp that matches type 1 words. | 1226 | More precisely, [ediff-word-1] is a regexp that matches type 1 words. |
| 1216 | See `ediff-forward-word' for more details.") | 1227 | See `ediff-forward-word' for more details.") |
| 1217 | 1228 | ||
| 1218 | (defvar ediff-word-2 "0-9.," | 1229 | (defvar ediff-word-2 "0-9.," |
| 1219 | "*Characters that constitute words of type 2. | 1230 | "*Characters that constitute words of type 2. |
| @@ -1229,7 +1240,7 @@ See `ediff-forward-word' for more details.") | |||
| 1229 | (concat "^" ediff-word-1 ediff-word-2 ediff-word-3 ediff-whitespace) | 1240 | (concat "^" ediff-word-1 ediff-word-2 ediff-word-3 ediff-whitespace) |
| 1230 | "*Characters that constitute words of type 4. | 1241 | "*Characters that constitute words of type 4. |
| 1231 | More precisely, [ediff-word-4] is a regexp that matches type 4 words. | 1242 | More precisely, [ediff-word-4] is a regexp that matches type 4 words. |
| 1232 | See `ediff-forward-word' for more details.") | 1243 | See `ediff-forward-word' for more details.") |
| 1233 | 1244 | ||
| 1234 | ;; Split region along word boundaries. Each word will be on its own line. | 1245 | ;; Split region along word boundaries. Each word will be on its own line. |
| 1235 | ;; Output to buffer out-buffer. | 1246 | ;; Output to buffer out-buffer. |
| @@ -1249,7 +1260,14 @@ arguments to `skip-chars-forward'." | |||
| 1249 | 1260 | ||
| 1250 | 1261 | ||
| 1251 | (defun ediff-wordify (beg end in-buffer out-buffer &optional control-buf) | 1262 | (defun ediff-wordify (beg end in-buffer out-buffer &optional control-buf) |
| 1252 | (let (inbuf-syntax-tbl sv-point diff-string) | 1263 | (let ((forward-word-function |
| 1264 | ;; eval in control buf to let user create local versions for | ||
| 1265 | ;; different invocations | ||
| 1266 | (if control-buf | ||
| 1267 | (ediff-with-current-buffer control-buf | ||
| 1268 | ediff-forward-word-function) | ||
| 1269 | ediff-forward-word-function)) | ||
| 1270 | inbuf-syntax-tbl sv-point diff-string) | ||
| 1253 | (save-excursion | 1271 | (save-excursion |
| 1254 | (set-buffer in-buffer) | 1272 | (set-buffer in-buffer) |
| 1255 | (setq inbuf-syntax-tbl | 1273 | (setq inbuf-syntax-tbl |
| @@ -1271,29 +1289,18 @@ arguments to `skip-chars-forward'." | |||
| 1271 | (delete-region (point-min) (point)) | 1289 | (delete-region (point-min) (point)) |
| 1272 | 1290 | ||
| 1273 | (while (not (eobp)) | 1291 | (while (not (eobp)) |
| 1274 | ;; eval in control buf to let user create local versions for | 1292 | (funcall forward-word-function) |
| 1275 | ;; different invocations | ||
| 1276 | (if control-buf | ||
| 1277 | (funcall | ||
| 1278 | (ediff-with-current-buffer control-buf | ||
| 1279 | ediff-forward-word-function)) | ||
| 1280 | (funcall ediff-forward-word-function)) | ||
| 1281 | (setq sv-point (point)) | 1293 | (setq sv-point (point)) |
| 1282 | (skip-chars-forward ediff-whitespace) | 1294 | (skip-chars-forward ediff-whitespace) |
| 1283 | (delete-region sv-point (point)) | 1295 | (delete-region sv-point (point)) |
| 1284 | (insert "\n"))))) | 1296 | (insert "\n"))))) |
| 1285 | 1297 | ||
| 1286 | ;; copy string from BEG END from IN-BUF to OUT-BUF | 1298 | ;; copy string specified as BEG END from IN-BUF to OUT-BUF |
| 1287 | (defun ediff-copy-to-buffer (beg end in-buffer out-buffer) | 1299 | (defun ediff-copy-to-buffer (beg end in-buffer out-buffer) |
| 1288 | (let (string) | 1300 | (with-current-buffer out-buffer |
| 1289 | (save-excursion | 1301 | (erase-buffer) |
| 1290 | (set-buffer in-buffer) | 1302 | (insert-buffer-substring in-buffer beg end) |
| 1291 | (setq string (buffer-substring beg end)) | 1303 | (goto-char (point-min)))) |
| 1292 | |||
| 1293 | (set-buffer out-buffer) | ||
| 1294 | (erase-buffer) | ||
| 1295 | (insert string) | ||
| 1296 | (goto-char (point-min))))) | ||
| 1297 | 1304 | ||
| 1298 | 1305 | ||
| 1299 | ;; goto word #n starting at current position in buffer `buf' | 1306 | ;; goto word #n starting at current position in buffer `buf' |
| @@ -1305,18 +1312,18 @@ arguments to `skip-chars-forward'." | |||
| 1305 | (syntax-tbl ediff-syntax-table)) | 1312 | (syntax-tbl ediff-syntax-table)) |
| 1306 | (ediff-with-current-buffer buf | 1313 | (ediff-with-current-buffer buf |
| 1307 | (skip-chars-forward ediff-whitespace) | 1314 | (skip-chars-forward ediff-whitespace) |
| 1308 | (while (> n 1) | 1315 | (ediff-with-syntax-table syntax-tbl |
| 1309 | (ediff-with-syntax-table syntax-tbl | 1316 | (while (> n 1) |
| 1310 | (funcall fwd-word-fun)) | 1317 | (funcall fwd-word-fun) |
| 1311 | (skip-chars-forward ediff-whitespace) | 1318 | (skip-chars-forward ediff-whitespace) |
| 1312 | (setq n (1- n))) | 1319 | (setq n (1- n)))) |
| 1313 | (if (and flag (> n 0)) | 1320 | (if (and flag (> n 0)) |
| 1314 | (funcall fwd-word-fun)) | 1321 | (funcall fwd-word-fun)) |
| 1315 | (point)))) | 1322 | (point)))) |
| 1316 | 1323 | ||
| 1317 | (defun ediff-same-file-contents (f1 f2) | 1324 | (defun ediff-same-file-contents (f1 f2) |
| 1318 | "T if F1 and F2 have identical contents." | 1325 | "Return t if F1 and F2 have identical contents." |
| 1319 | (let ((res | 1326 | (let ((res |
| 1320 | (apply 'call-process ediff-cmp-program nil nil nil | 1327 | (apply 'call-process ediff-cmp-program nil nil nil |
| 1321 | (append ediff-cmp-options (list f1 f2))))) | 1328 | (append ediff-cmp-options (list f1 f2))))) |
| 1322 | (and (numberp res) (eq res 0)))) | 1329 | (and (numberp res) (eq res 0)))) |
diff --git a/lisp/ediff-help.el b/lisp/ediff-help.el index ef6807768b8..7d3234db280 100644 --- a/lisp/ediff-help.el +++ b/lisp/ediff-help.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; ediff-help.el --- Code related to the contents of Ediff help buffers | 1 | ;;; ediff-help.el --- Code related to the contents of Ediff help buffers |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1996, 1997 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1996, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 5 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 6 | 6 | ||
| 7 | ;; This file is part of GNU Emacs. | 7 | ;; This file is part of GNU Emacs. |
| 8 | 8 | ||
| @@ -190,12 +190,15 @@ the value of this variable and the variables `ediff-help-message-*' in | |||
| 190 | (let ((pos (ediff-event-point last-command-event)) | 190 | (let ((pos (ediff-event-point last-command-event)) |
| 191 | overl cmd) | 191 | overl cmd) |
| 192 | 192 | ||
| 193 | (if ediff-xemacs-p | 193 | (ediff-cond-compile-for-xemacs-or-emacs |
| 194 | (setq overl (extent-at pos (current-buffer) 'ediff-help-info) | 194 | ;; xemacs |
| 195 | cmd (ediff-overlay-get overl 'ediff-help-info)) | 195 | (setq overl (extent-at pos (current-buffer) 'ediff-help-info) |
| 196 | (setq cmd (car (mapcar (lambda (elt) | 196 | cmd (ediff-overlay-get overl 'ediff-help-info)) |
| 197 | (overlay-get elt 'ediff-help-info)) | 197 | ;; emacs |
| 198 | (overlays-at pos))))) | 198 | (setq cmd (car (mapcar (lambda (elt) |
| 199 | (overlay-get elt 'ediff-help-info)) | ||
| 200 | (overlays-at pos)))) | ||
| 201 | ) | ||
| 199 | 202 | ||
| 200 | (if (not (stringp cmd)) | 203 | (if (not (stringp cmd)) |
| 201 | (error "Hmm... I don't see an Ediff command around here...")) | 204 | (error "Hmm... I don't see an Ediff command around here...")) |
diff --git a/lisp/ediff-hook.el b/lisp/ediff-hook.el index 33c3e4a05c7..63485033466 100644 --- a/lisp/ediff-hook.el +++ b/lisp/ediff-hook.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; ediff-hook.el --- setup for Ediff's menus and autoloads | 1 | ;;; ediff-hook.el --- setup for Ediff's menus and autoloads |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1995, 96, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 5 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 6 | 6 | ||
| 7 | ;; This file is part of GNU Emacs. | 7 | ;; This file is part of GNU Emacs. |
| 8 | 8 | ||
| @@ -46,104 +46,114 @@ | |||
| 46 | ;; allow menus to be set up without ediff-wind.el being loaded | 46 | ;; allow menus to be set up without ediff-wind.el being loaded |
| 47 | ;;;###autoload | 47 | ;;;###autoload |
| 48 | (defvar ediff-window-setup-function) | 48 | (defvar ediff-window-setup-function) |
| 49 | |||
| 50 | ;; This is used to avoid compilation warnings. When emacs/xemacs forms can | ||
| 51 | ;; generate compile time warnings, we use this macro. | ||
| 52 | ;; In this case, the macro will expand into the form that is appropriate to the | ||
| 53 | ;; compiler at hand. | ||
| 54 | ;; Suggested by rms. | ||
| 55 | (defmacro ediff-cond-compile-for-xemacs-or-emacs (xemacs-form emacs-form) | ||
| 56 | (if (string-match "XEmacs" emacs-version) | ||
| 57 | xemacs-form emacs-form)) | ||
| 49 | 58 | ||
| 50 | ;; Note we wrap this in a progn so that we pick up the whole def | 59 | ;; Note we wrap this in a progn so that we pick up the whole def |
| 51 | ;; for auto-autoload. That way we do not load ediff-hook.el when defining | 60 | ;; for auto-autoload. That way we do not load ediff-hook.el when defining |
| 52 | ;; the menus. | 61 | ;; the menus. |
| 53 | ;;;###autoload | 62 | ;;;###autoload |
| 54 | (progn | 63 | (progn |
| 55 | (defun ediff-xemacs-init-menus () | 64 | (ediff-cond-compile-for-xemacs-or-emacs |
| 56 | (if (featurep 'menubar) | 65 | ;; xemacs form |
| 57 | (progn | 66 | (defun ediff-xemacs-init-menus () |
| 58 | (add-submenu | 67 | (if (featurep 'menubar) |
| 59 | '("Tools") ediff-menu "OO-Browser...") | 68 | (progn |
| 60 | (add-submenu | 69 | (add-submenu |
| 61 | '("Tools") ediff-merge-menu "OO-Browser...") | 70 | '("Tools") ediff-menu "OO-Browser...") |
| 62 | (add-submenu | 71 | (add-submenu |
| 63 | '("Tools") epatch-menu "OO-Browser...") | 72 | '("Tools") ediff-merge-menu "OO-Browser...") |
| 64 | (add-submenu | 73 | (add-submenu |
| 65 | '("Tools") ediff-misc-menu "OO-Browser...") | 74 | '("Tools") epatch-menu "OO-Browser...") |
| 66 | (add-menu-button | 75 | (add-submenu |
| 67 | '("Tools") "-------" "OO-Browser...") | 76 | '("Tools") ediff-misc-menu "OO-Browser...") |
| 68 | )))) | 77 | (add-menu-button |
| 69 | 78 | '("Tools") "-------" "OO-Browser...") | |
| 70 | 79 | ))) | |
| 71 | ;; explicit string-match is needed: ediff-xemacs-p is not defined at build time | 80 | nil ; emacs form |
| 81 | )) | ||
| 82 | |||
| 83 | |||
| 72 | ;;;###autoload | 84 | ;;;###autoload |
| 73 | (cond ((string-match "XEmacs" emacs-version) | 85 | (ediff-cond-compile-for-xemacs-or-emacs |
| 74 | (defvar ediff-menu | 86 | (progn |
| 75 | '("Compare" | 87 | (defvar ediff-menu |
| 76 | ["Two Files..." ediff-files t] | 88 | '("Compare" |
| 77 | ["Two Buffers..." ediff-buffers t] | 89 | ["Two Files..." ediff-files t] |
| 78 | ["Three Files..." ediff-files3 t] | 90 | ["Two Buffers..." ediff-buffers t] |
| 79 | ["Three Buffers..." ediff-buffers3 t] | 91 | ["Three Files..." ediff-files3 t] |
| 80 | "---" | 92 | ["Three Buffers..." ediff-buffers3 t] |
| 81 | ["Two Directories..." ediff-directories t] | 93 | "---" |
| 82 | ["Three Directories..." ediff-directories3 t] | 94 | ["Two Directories..." ediff-directories t] |
| 83 | "---" | 95 | ["Three Directories..." ediff-directories3 t] |
| 84 | ["File with Revision..." ediff-revision t] | 96 | "---" |
| 85 | ["Directory Revisions..." ediff-directory-revisions t] | 97 | ["File with Revision..." ediff-revision t] |
| 86 | "---" | 98 | ["Directory Revisions..." ediff-directory-revisions t] |
| 87 | ["Windows Word-by-word..." ediff-windows-wordwise t] | 99 | "---" |
| 88 | ["Windows Line-by-line..." ediff-windows-linewise t] | 100 | ["Windows Word-by-word..." ediff-windows-wordwise t] |
| 89 | "---" | 101 | ["Windows Line-by-line..." ediff-windows-linewise t] |
| 90 | ["Regions Word-by-word..." ediff-regions-wordwise t] | 102 | "---" |
| 91 | ["Regions Line-by-line..." ediff-regions-linewise t] | 103 | ["Regions Word-by-word..." ediff-regions-wordwise t] |
| 92 | )) | 104 | ["Regions Line-by-line..." ediff-regions-linewise t] |
| 93 | (defvar ediff-merge-menu | 105 | )) |
| 94 | '("Merge" | 106 | (defvar ediff-merge-menu |
| 95 | ["Files..." ediff-merge-files t] | 107 | '("Merge" |
| 96 | ["Files with Ancestor..." ediff-merge-files-with-ancestor t] | 108 | ["Files..." ediff-merge-files t] |
| 97 | ["Buffers..." ediff-merge-buffers t] | 109 | ["Files with Ancestor..." ediff-merge-files-with-ancestor t] |
| 98 | ["Buffers with Ancestor..." | 110 | ["Buffers..." ediff-merge-buffers t] |
| 99 | ediff-merge-buffers-with-ancestor t] | 111 | ["Buffers with Ancestor..." |
| 100 | "---" | 112 | ediff-merge-buffers-with-ancestor t] |
| 101 | ["Directories..." ediff-merge-directories t] | 113 | "---" |
| 102 | ["Directories with Ancestor..." | 114 | ["Directories..." ediff-merge-directories t] |
| 103 | ediff-merge-directories-with-ancestor t] | 115 | ["Directories with Ancestor..." |
| 104 | "---" | 116 | ediff-merge-directories-with-ancestor t] |
| 105 | ["Revisions..." ediff-merge-revisions t] | 117 | "---" |
| 106 | ["Revisions with Ancestor..." | 118 | ["Revisions..." ediff-merge-revisions t] |
| 107 | ediff-merge-revisions-with-ancestor t] | 119 | ["Revisions with Ancestor..." |
| 108 | ["Directory Revisions..." ediff-merge-directory-revisions t] | 120 | ediff-merge-revisions-with-ancestor t] |
| 109 | ["Directory Revisions with Ancestor..." | 121 | ["Directory Revisions..." ediff-merge-directory-revisions t] |
| 110 | ediff-merge-directory-revisions-with-ancestor t] | 122 | ["Directory Revisions with Ancestor..." |
| 111 | )) | 123 | ediff-merge-directory-revisions-with-ancestor t] |
| 112 | (defvar epatch-menu | 124 | )) |
| 113 | '("Apply Patch" | 125 | (defvar epatch-menu |
| 114 | ["To a file..." ediff-patch-file t] | 126 | '("Apply Patch" |
| 115 | ["To a buffer..." ediff-patch-buffer t] | 127 | ["To a file..." ediff-patch-file t] |
| 116 | )) | 128 | ["To a buffer..." ediff-patch-buffer t] |
| 117 | (defvar ediff-misc-menu | 129 | )) |
| 118 | '("Ediff Miscellanea" | 130 | (defvar ediff-misc-menu |
| 119 | ["Ediff Manual..." ediff-documentation t] | 131 | '("Ediff Miscellanea" |
| 120 | ["Customize Ediff..." ediff-customize t] | 132 | ["Ediff Manual..." ediff-documentation t] |
| 121 | ["List Ediff Sessions..." ediff-show-registry t] | 133 | ["Customize Ediff..." ediff-customize t] |
| 122 | ["Use separate frame for Ediff control buffer..." | 134 | ["List Ediff Sessions..." ediff-show-registry t] |
| 123 | ediff-toggle-multiframe | 135 | ["Use separate frame for Ediff control buffer..." |
| 124 | :style toggle | 136 | ediff-toggle-multiframe |
| 125 | :selected (if (and (featurep 'ediff-util) | 137 | :style toggle |
| 126 | (boundp 'ediff-window-setup-function)) | 138 | :selected (if (and (featurep 'ediff-util) |
| 127 | (eq ediff-window-setup-function | 139 | (boundp 'ediff-window-setup-function)) |
| 128 | 'ediff-setup-windows-multiframe))] | 140 | (eq ediff-window-setup-function |
| 129 | ["Use a toolbar with Ediff control buffer" | 141 | 'ediff-setup-windows-multiframe))] |
| 130 | ediff-toggle-use-toolbar | 142 | ["Use a toolbar with Ediff control buffer" |
| 131 | :style toggle | 143 | ediff-toggle-use-toolbar |
| 132 | :selected (if (featurep 'ediff-tbar) | 144 | :style toggle |
| 133 | (ediff-use-toolbar-p))] | 145 | :selected (if (featurep 'ediff-tbar) |
| 134 | )) | 146 | (ediff-use-toolbar-p))] |
| 135 | 147 | )) | |
| 136 | ;; put these menus before Object-Oriented-Browser in Tools menu | 148 | |
| 137 | ;;; (add-hook 'before-init-hook 'ediff-xemacs-init-menus) | 149 | ;; put these menus before Object-Oriented-Browser in Tools menu |
| 138 | ;;; (if (not purify-flag) | 150 | (if (and (featurep 'menubar) (not (featurep 'infodock)) |
| 139 | ;;; (ediff-xemacs-init-menus)) | 151 | (not (featurep 'ediff-hook))) |
| 140 | ;;; ) | ||
| 141 | (if (and (featurep 'menubar) (not (featurep 'infodock)) | ||
| 142 | (not (featurep 'ediff-hook))) | ||
| 143 | (ediff-xemacs-init-menus))) | 152 | (ediff-xemacs-init-menus))) |
| 144 | 153 | ||
| 145 | ;; Emacs--only if menu-bar is loaded | 154 | ;; Emacs--only if menu-bar is loaded |
| 146 | ((featurep 'menu-bar) | 155 | (if (featurep 'menu-bar) |
| 156 | (progn | ||
| 147 | ;; initialize menu bar keymaps | 157 | ;; initialize menu bar keymaps |
| 148 | (defvar menu-bar-ediff-misc-menu | 158 | (defvar menu-bar-ediff-misc-menu |
| 149 | (make-sparse-keymap "Ediff Miscellanea")) | 159 | (make-sparse-keymap "Ediff Miscellanea")) |
| @@ -240,7 +250,8 @@ | |||
| 240 | '("Ediff Manual..." . ediff-documentation)) | 250 | '("Ediff Manual..." . ediff-documentation)) |
| 241 | ) | 251 | ) |
| 242 | 252 | ||
| 243 | ) ; cond | 253 | ) ; emacs case |
| 254 | ) ; ediff-cond-compile-for-xemacs-or-emacs | ||
| 244 | 255 | ||
| 245 | ;; arrange for autoloads | 256 | ;; arrange for autoloads |
| 246 | (if purify-flag | 257 | (if purify-flag |
diff --git a/lisp/ediff-init.el b/lisp/ediff-init.el index 336f360f31a..729d6f76e19 100644 --- a/lisp/ediff-init.el +++ b/lisp/ediff-init.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff | 1 | ;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994, 1995, 1996, 1997, 2000 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 5 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 6 | 6 | ||
| 7 | ;; This file is part of GNU Emacs. | 7 | ;; This file is part of GNU Emacs. |
| 8 | 8 | ||
| @@ -35,6 +35,7 @@ | |||
| 35 | (defvar ediff-whitespace) | 35 | (defvar ediff-whitespace) |
| 36 | (defvar ediff-multiframe) | 36 | (defvar ediff-multiframe) |
| 37 | (defvar ediff-use-toolbar-p) | 37 | (defvar ediff-use-toolbar-p) |
| 38 | (defvar mswindowsx-bitmap-file-path) | ||
| 38 | 39 | ||
| 39 | (and noninteractive | 40 | (and noninteractive |
| 40 | (eval-when-compile | 41 | (eval-when-compile |
| @@ -46,6 +47,15 @@ | |||
| 46 | ;; Is it Emacs? | 47 | ;; Is it Emacs? |
| 47 | (defconst ediff-emacs-p (not ediff-xemacs-p)) | 48 | (defconst ediff-emacs-p (not ediff-xemacs-p)) |
| 48 | 49 | ||
| 50 | ;; This is used to avoid compilation warnings. When emacs/xemacs forms can | ||
| 51 | ;; generate compile time warnings, we use this macro. | ||
| 52 | ;; In this case, the macro will expand into the form that is appropriate to the | ||
| 53 | ;; compiler at hand. | ||
| 54 | ;; Suggested by rms. | ||
| 55 | (defmacro ediff-cond-compile-for-xemacs-or-emacs (xemacs-form emacs-form) | ||
| 56 | (if (string-match "XEmacs" emacs-version) | ||
| 57 | xemacs-form emacs-form)) | ||
| 58 | |||
| 49 | (defvar ediff-force-faces nil | 59 | (defvar ediff-force-faces nil |
| 50 | "If t, Ediff will think that it is running on a display that supports faces. | 60 | "If t, Ediff will think that it is running on a display that supports faces. |
| 51 | This is provided as a temporary relief for users of face-capable displays | 61 | This is provided as a temporary relief for users of face-capable displays |
| @@ -53,9 +63,10 @@ that Ediff doesn't know about.") | |||
| 53 | 63 | ||
| 54 | ;; Are we running as a window application or on a TTY? | 64 | ;; Are we running as a window application or on a TTY? |
| 55 | (defsubst ediff-device-type () | 65 | (defsubst ediff-device-type () |
| 56 | (if ediff-emacs-p | 66 | (ediff-cond-compile-for-xemacs-or-emacs |
| 57 | window-system | 67 | (device-type (selected-device)) ; xemacs form |
| 58 | (device-type (selected-device)))) | 68 | window-system ; emacs form |
| 69 | )) | ||
| 59 | 70 | ||
| 60 | ;; in XEmacs: device-type is tty on tty and stream in batch. | 71 | ;; in XEmacs: device-type is tty on tty and stream in batch. |
| 61 | (defun ediff-window-display-p () | 72 | (defun ediff-window-display-p () |
| @@ -69,10 +80,12 @@ that Ediff doesn't know about.") | |||
| 69 | (ediff-emacs-p (memq (ediff-device-type) '(pc))) | 80 | (ediff-emacs-p (memq (ediff-device-type) '(pc))) |
| 70 | (ediff-xemacs-p (memq (ediff-device-type) '(tty pc))))) | 81 | (ediff-xemacs-p (memq (ediff-device-type) '(tty pc))))) |
| 71 | 82 | ||
| 83 | ;; toolbar support for emacs hasn't been implemented in ediff | ||
| 72 | (defun ediff-has-toolbar-support-p () | 84 | (defun ediff-has-toolbar-support-p () |
| 73 | (and ediff-xemacs-p | 85 | (ediff-cond-compile-for-xemacs-or-emacs |
| 74 | (featurep 'toolbar) | 86 | (and (featurep 'toolbar) (console-on-window-system-p)) ; xemacs form |
| 75 | (console-on-window-system-p))) | 87 | nil ; emacs form |
| 88 | )) | ||
| 76 | 89 | ||
| 77 | (defun ediff-use-toolbar-p () | 90 | (defun ediff-use-toolbar-p () |
| 78 | (and (ediff-has-toolbar-support-p) ;Can it do it ? | 91 | (and (ediff-has-toolbar-support-p) ;Can it do it ? |
| @@ -108,6 +121,10 @@ that Ediff doesn't know about.") | |||
| 108 | ;; The Ediff control buffer | 121 | ;; The Ediff control buffer |
| 109 | (ediff-defvar-local ediff-control-buffer nil "") | 122 | (ediff-defvar-local ediff-control-buffer nil "") |
| 110 | 123 | ||
| 124 | (ediff-defvar-local ediff-temp-indirect-buffer nil | ||
| 125 | "If t, the buffer is a temporary indirect buffer. | ||
| 126 | It needs to be killed when we quit the session.") | ||
| 127 | |||
| 111 | 128 | ||
| 112 | ;; Association between buff-type and ediff-buffer-* | 129 | ;; Association between buff-type and ediff-buffer-* |
| 113 | (defconst ediff-buffer-alist | 130 | (defconst ediff-buffer-alist |
| @@ -731,16 +748,18 @@ to temp files when Ediff needs to find fine differences." | |||
| 731 | :group 'ediff) | 748 | :group 'ediff) |
| 732 | 749 | ||
| 733 | 750 | ||
| 734 | (if ediff-xemacs-p | 751 | (ediff-cond-compile-for-xemacs-or-emacs |
| 735 | (progn | 752 | (progn ; xemacs |
| 736 | (fset 'ediff-read-event (symbol-function 'next-command-event)) | 753 | (fset 'ediff-read-event (symbol-function 'next-command-event)) |
| 737 | (fset 'ediff-overlayp (symbol-function 'extentp)) | 754 | (fset 'ediff-overlayp (symbol-function 'extentp)) |
| 738 | (fset 'ediff-make-overlay (symbol-function 'make-extent)) | 755 | (fset 'ediff-make-overlay (symbol-function 'make-extent)) |
| 739 | (fset 'ediff-delete-overlay (symbol-function 'delete-extent))) | 756 | (fset 'ediff-delete-overlay (symbol-function 'delete-extent))) |
| 740 | (fset 'ediff-read-event (symbol-function 'read-event)) | 757 | (progn ; emacs |
| 741 | (fset 'ediff-overlayp (symbol-function 'overlayp)) | 758 | (fset 'ediff-read-event (symbol-function 'read-event)) |
| 742 | (fset 'ediff-make-overlay (symbol-function 'make-overlay)) | 759 | (fset 'ediff-overlayp (symbol-function 'overlayp)) |
| 743 | (fset 'ediff-delete-overlay (symbol-function 'delete-overlay))) | 760 | (fset 'ediff-make-overlay (symbol-function 'make-overlay)) |
| 761 | (fset 'ediff-delete-overlay (symbol-function 'delete-overlay))) | ||
| 762 | ) | ||
| 744 | 763 | ||
| 745 | ;; Check the current version against the major and minor version numbers | 764 | ;; Check the current version against the major and minor version numbers |
| 746 | ;; using op: cur-vers op major.minor If emacs-major-version or | 765 | ;; using op: cur-vers op major.minor If emacs-major-version or |
| @@ -772,41 +791,43 @@ to temp files when Ediff needs to find fine differences." | |||
| 772 | 791 | ||
| 773 | (defun ediff-color-display-p () | 792 | (defun ediff-color-display-p () |
| 774 | (condition-case nil | 793 | (condition-case nil |
| 775 | (if ediff-emacs-p | 794 | (ediff-cond-compile-for-xemacs-or-emacs |
| 776 | (if (fboundp 'display-color-p) | 795 | (eq (device-class (selected-device)) 'color) ; xemacs form |
| 777 | (display-color-p) | 796 | (if (fboundp 'display-color-p) ; emacs form |
| 778 | (x-display-color-p)) | 797 | (display-color-p) |
| 779 | (eq (device-class (selected-device)) 'color)) | 798 | (x-display-color-p)) |
| 780 | (error | 799 | ) |
| 781 | nil))) | 800 | (error nil))) |
| 782 | 801 | ||
| 783 | 802 | ||
| 784 | (if (ediff-has-face-support-p) | 803 | (if (ediff-has-face-support-p) |
| 785 | (if ediff-xemacs-p | 804 | (ediff-cond-compile-for-xemacs-or-emacs |
| 786 | (progn | 805 | (progn ; xemacs |
| 787 | (fset 'ediff-valid-color-p (symbol-function 'valid-color-name-p)) | 806 | (defalias 'ediff-valid-color-p 'valid-color-name-p) |
| 788 | (fset 'ediff-get-face (symbol-function 'get-face))) | 807 | (defalias 'ediff-get-face 'get-face)) |
| 789 | (fset 'ediff-valid-color-p (symbol-function | 808 | (progn ; emacs |
| 790 | (if (fboundp 'color-defined-p) | 809 | (defalias 'ediff-valid-color-p (if (fboundp 'color-defined-p) |
| 791 | 'color-defined-p | 810 | 'color-defined-p |
| 792 | 'x-color-defined-p))) | 811 | 'x-color-defined-p)) |
| 793 | (fset 'ediff-get-face (symbol-function 'internal-get-face)))) | 812 | (defalias 'ediff-get-face 'internal-get-face)) |
| 813 | )) | ||
| 794 | 814 | ||
| 795 | (if (ediff-window-display-p) | 815 | (if (ediff-window-display-p) |
| 796 | (if ediff-xemacs-p | 816 | (ediff-cond-compile-for-xemacs-or-emacs |
| 797 | (progn | 817 | (progn ; xemacs |
| 798 | (fset 'ediff-display-pixel-width | 818 | (fset 'ediff-display-pixel-width (symbol-function 'device-pixel-width)) |
| 799 | (symbol-function 'device-pixel-width)) | 819 | (fset 'ediff-display-pixel-height |
| 800 | (fset 'ediff-display-pixel-height | 820 | (symbol-function 'device-pixel-height))) |
| 801 | (symbol-function 'device-pixel-height))) | 821 | (progn ; emacs |
| 802 | (fset 'ediff-display-pixel-width (symbol-function | 822 | (fset 'ediff-display-pixel-width |
| 803 | (if (fboundp 'display-pixel-width) | 823 | (if (fboundp 'display-pixel-width) |
| 804 | 'display-pixel-width | 824 | (symbol-function 'display-pixel-width) |
| 805 | 'x-display-pixel-width))) | 825 | (symbol-function 'x-display-pixel-width))) |
| 806 | (fset 'ediff-display-pixel-height (symbol-function | 826 | (fset 'ediff-display-pixel-height |
| 807 | (if (fboundp 'display-pixel-height) | 827 | (if (fboundp 'display-pixel-height) |
| 808 | 'display-pixel-height | 828 | (symbol-function 'display-pixel-height) |
| 809 | 'x-display-pixel-height))))) | 829 | (symbol-function 'x-display-pixel-height)))) |
| 830 | )) | ||
| 810 | 831 | ||
| 811 | ;; A-list of current-diff-overlay symbols associated with buf types | 832 | ;; A-list of current-diff-overlay symbols associated with buf types |
| 812 | (defconst ediff-current-diff-overlay-alist | 833 | (defconst ediff-current-diff-overlay-alist |
| @@ -823,21 +844,6 @@ to temp files when Ediff needs to find fine differences." | |||
| 823 | (Ancestor . ediff-current-diff-face-Ancestor))) | 844 | (Ancestor . ediff-current-diff-face-Ancestor))) |
| 824 | 845 | ||
| 825 | 846 | ||
| 826 | (defun ediff-make-current-diff-overlay (type) | ||
| 827 | (if (ediff-has-face-support-p) | ||
| 828 | (let ((overlay (ediff-get-symbol-from-alist | ||
| 829 | type ediff-current-diff-overlay-alist)) | ||
| 830 | (buffer (ediff-get-buffer type)) | ||
| 831 | (face (face-name | ||
| 832 | (symbol-value | ||
| 833 | (ediff-get-symbol-from-alist | ||
| 834 | type ediff-current-diff-face-alist))))) | ||
| 835 | (set overlay | ||
| 836 | (ediff-make-bullet-proof-overlay (point-max) (point-max) buffer)) | ||
| 837 | (ediff-set-overlay-face (symbol-value overlay) face) | ||
| 838 | (ediff-overlay-put (symbol-value overlay) 'ediff ediff-control-buffer)) | ||
| 839 | )) | ||
| 840 | |||
| 841 | (defun ediff-set-overlay-face (extent face) | 847 | (defun ediff-set-overlay-face (extent face) |
| 842 | (ediff-overlay-put extent 'face face) | 848 | (ediff-overlay-put extent 'face face) |
| 843 | (ediff-overlay-put extent 'help-echo 'ediff-region-help-echo)) | 849 | (ediff-overlay-put extent 'help-echo 'ediff-region-help-echo)) |
| @@ -1194,31 +1200,33 @@ this variable represents.") | |||
| 1194 | (defun ediff-highest-priority (start end buffer) | 1200 | (defun ediff-highest-priority (start end buffer) |
| 1195 | (let ((pos (max 1 (1- start))) | 1201 | (let ((pos (max 1 (1- start))) |
| 1196 | ovr-list) | 1202 | ovr-list) |
| 1197 | (if ediff-xemacs-p | 1203 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1198 | (1+ ediff-shadow-overlay-priority) | 1204 | (1+ ediff-shadow-overlay-priority) ; xemacs form |
| 1199 | (ediff-with-current-buffer buffer | 1205 | ;; emacs form |
| 1200 | (while (< pos (min (point-max) (1+ end))) | 1206 | (ediff-with-current-buffer buffer |
| 1201 | (setq ovr-list (append (overlays-at pos) ovr-list)) | 1207 | (while (< pos (min (point-max) (1+ end))) |
| 1202 | (setq pos (next-overlay-change pos))) | 1208 | (setq ovr-list (append (overlays-at pos) ovr-list)) |
| 1203 | (+ 1 ediff-shadow-overlay-priority | 1209 | (setq pos (next-overlay-change pos))) |
| 1204 | (apply 'max | 1210 | (+ 1 ediff-shadow-overlay-priority |
| 1205 | (cons | 1211 | (apply 'max |
| 1206 | 1 | 1212 | (cons |
| 1207 | (mapcar | 1213 | 1 |
| 1208 | (lambda (ovr) | 1214 | (mapcar |
| 1209 | (if (and ovr | 1215 | (lambda (ovr) |
| 1210 | ;; exclude ediff overlays from priority | 1216 | (if (and ovr |
| 1211 | ;; calculation, or else priority will keep | 1217 | ;; exclude ediff overlays from priority |
| 1212 | ;; increasing | 1218 | ;; calculation, or else priority will keep |
| 1213 | (null (ediff-overlay-get ovr 'ediff)) | 1219 | ;; increasing |
| 1214 | (null (ediff-overlay-get ovr 'ediff-diff-num))) | 1220 | (null (ediff-overlay-get ovr 'ediff)) |
| 1215 | ;; use the overlay priority or 0 | 1221 | (null (ediff-overlay-get ovr 'ediff-diff-num))) |
| 1216 | (or (ediff-overlay-get ovr 'priority) 0) | 1222 | ;; use the overlay priority or 0 |
| 1217 | 0)) | 1223 | (or (ediff-overlay-get ovr 'priority) 0) |
| 1218 | ovr-list) | 1224 | 0)) |
| 1219 | ) | 1225 | ovr-list) |
| 1220 | )) | 1226 | ) |
| 1221 | )))) | 1227 | ))) |
| 1228 | ) ; ediff-cond-compile-for-xemacs-or-emacs | ||
| 1229 | )) | ||
| 1222 | 1230 | ||
| 1223 | 1231 | ||
| 1224 | (defvar ediff-toggle-read-only-function nil | 1232 | (defvar ediff-toggle-read-only-function nil |
| @@ -1306,8 +1314,6 @@ This default should work without changes." | |||
| 1306 | (ediff-defvar-local ediff-temp-file-C nil "") | 1314 | (ediff-defvar-local ediff-temp-file-C nil "") |
| 1307 | 1315 | ||
| 1308 | 1316 | ||
| 1309 | ;;; In-line functions | ||
| 1310 | |||
| 1311 | ;; If file-remote-p is defined (as in XEmacs, use it. Otherwise, check | 1317 | ;; If file-remote-p is defined (as in XEmacs, use it. Otherwise, check |
| 1312 | ;; if find-file-name-handler is defined for 'file-local-copy | 1318 | ;; if find-file-name-handler is defined for 'file-local-copy |
| 1313 | (defun ediff-file-remote-p (file-name) | 1319 | (defun ediff-file-remote-p (file-name) |
| @@ -1375,93 +1381,6 @@ This default should work without changes." | |||
| 1375 | (ediff-paint-background-regions-in-one-buffer | 1381 | (ediff-paint-background-regions-in-one-buffer |
| 1376 | 'Ancestor unhighlight)) | 1382 | 'Ancestor unhighlight)) |
| 1377 | 1383 | ||
| 1378 | (defun ediff-highlight-diff-in-one-buffer (n buf-type) | ||
| 1379 | (if (ediff-buffer-live-p (ediff-get-buffer buf-type)) | ||
| 1380 | (let* ((buff (ediff-get-buffer buf-type)) | ||
| 1381 | (last (ediff-with-current-buffer buff (point-max))) | ||
| 1382 | (begin (ediff-get-diff-posn buf-type 'beg n)) | ||
| 1383 | (end (ediff-get-diff-posn buf-type 'end n)) | ||
| 1384 | (xtra (if (equal begin end) 1 0)) | ||
| 1385 | (end-hilit (min last (+ end xtra))) | ||
| 1386 | (current-diff-overlay | ||
| 1387 | (symbol-value | ||
| 1388 | (ediff-get-symbol-from-alist | ||
| 1389 | buf-type ediff-current-diff-overlay-alist)))) | ||
| 1390 | |||
| 1391 | (if ediff-xemacs-p | ||
| 1392 | (ediff-move-overlay current-diff-overlay begin end-hilit) | ||
| 1393 | (ediff-move-overlay current-diff-overlay begin end-hilit buff)) | ||
| 1394 | (ediff-overlay-put current-diff-overlay 'priority | ||
| 1395 | (ediff-highest-priority begin end-hilit buff)) | ||
| 1396 | (ediff-overlay-put current-diff-overlay 'ediff-diff-num n) | ||
| 1397 | |||
| 1398 | ;; unhighlight the background overlay for diff n so it won't | ||
| 1399 | ;; interfere with the current diff overlay | ||
| 1400 | (ediff-set-overlay-face (ediff-get-diff-overlay n buf-type) nil) | ||
| 1401 | ))) | ||
| 1402 | |||
| 1403 | |||
| 1404 | (defun ediff-unhighlight-diff-in-one-buffer (buf-type) | ||
| 1405 | (if (ediff-buffer-live-p (ediff-get-buffer buf-type)) | ||
| 1406 | (let ((current-diff-overlay | ||
| 1407 | (symbol-value | ||
| 1408 | (ediff-get-symbol-from-alist | ||
| 1409 | buf-type ediff-current-diff-overlay-alist))) | ||
| 1410 | (overlay | ||
| 1411 | (ediff-get-diff-overlay ediff-current-difference buf-type)) | ||
| 1412 | ) | ||
| 1413 | |||
| 1414 | (ediff-move-overlay current-diff-overlay 1 1) | ||
| 1415 | |||
| 1416 | ;; rehighlight the overlay in the background of the | ||
| 1417 | ;; current difference region | ||
| 1418 | (ediff-set-overlay-face | ||
| 1419 | overlay | ||
| 1420 | (if (and (ediff-has-face-support-p) | ||
| 1421 | ediff-use-faces ediff-highlight-all-diffs) | ||
| 1422 | (ediff-background-face buf-type ediff-current-difference))) | ||
| 1423 | ))) | ||
| 1424 | |||
| 1425 | (defun ediff-unhighlight-diffs-totally-in-one-buffer (buf-type) | ||
| 1426 | (ediff-unselect-and-select-difference -1) | ||
| 1427 | (if (and (ediff-has-face-support-p) ediff-use-faces) | ||
| 1428 | (let* ((inhibit-quit t) | ||
| 1429 | (current-diff-overlay-var | ||
| 1430 | (ediff-get-symbol-from-alist | ||
| 1431 | buf-type ediff-current-diff-overlay-alist)) | ||
| 1432 | (current-diff-overlay (symbol-value current-diff-overlay-var))) | ||
| 1433 | (ediff-paint-background-regions 'unhighlight) | ||
| 1434 | (if (ediff-overlayp current-diff-overlay) | ||
| 1435 | (ediff-delete-overlay current-diff-overlay)) | ||
| 1436 | (set current-diff-overlay-var nil) | ||
| 1437 | ))) | ||
| 1438 | |||
| 1439 | |||
| 1440 | (defsubst ediff-highlight-diff (n) | ||
| 1441 | "Put face on diff N. Invoked for X displays only." | ||
| 1442 | (ediff-highlight-diff-in-one-buffer n 'A) | ||
| 1443 | (ediff-highlight-diff-in-one-buffer n 'B) | ||
| 1444 | (ediff-highlight-diff-in-one-buffer n 'C) | ||
| 1445 | (ediff-highlight-diff-in-one-buffer n 'Ancestor) | ||
| 1446 | ) | ||
| 1447 | |||
| 1448 | |||
| 1449 | (defsubst ediff-unhighlight-diff () | ||
| 1450 | "Remove overlays from buffers A, B, and C." | ||
| 1451 | (ediff-unhighlight-diff-in-one-buffer 'A) | ||
| 1452 | (ediff-unhighlight-diff-in-one-buffer 'B) | ||
| 1453 | (ediff-unhighlight-diff-in-one-buffer 'C) | ||
| 1454 | (ediff-unhighlight-diff-in-one-buffer 'Ancestor) | ||
| 1455 | ) | ||
| 1456 | |||
| 1457 | ;; delete highlighting overlays, restore faces to their original form | ||
| 1458 | (defsubst ediff-unhighlight-diffs-totally () | ||
| 1459 | (ediff-unhighlight-diffs-totally-in-one-buffer 'A) | ||
| 1460 | (ediff-unhighlight-diffs-totally-in-one-buffer 'B) | ||
| 1461 | (ediff-unhighlight-diffs-totally-in-one-buffer 'C) | ||
| 1462 | (ediff-unhighlight-diffs-totally-in-one-buffer 'Ancestor) | ||
| 1463 | ) | ||
| 1464 | |||
| 1465 | 1384 | ||
| 1466 | ;; arg is a record for a given diff in a difference vector | 1385 | ;; arg is a record for a given diff in a difference vector |
| 1467 | ;; this record is itself a vector | 1386 | ;; this record is itself a vector |
| @@ -1481,49 +1400,55 @@ This default should work without changes." | |||
| 1481 | (ediff-clear-fine-differences-in-one-buffer n 'C))) | 1400 | (ediff-clear-fine-differences-in-one-buffer n 'C))) |
| 1482 | 1401 | ||
| 1483 | 1402 | ||
| 1484 | (defsubst ediff-convert-fine-diffs-to-overlays (diff-list region-num) | ||
| 1485 | (ediff-set-fine-overlays-in-one-buffer 'A diff-list region-num) | ||
| 1486 | (ediff-set-fine-overlays-in-one-buffer 'B diff-list region-num) | ||
| 1487 | (if ediff-3way-job | ||
| 1488 | (ediff-set-fine-overlays-in-one-buffer 'C diff-list region-num) | ||
| 1489 | )) | ||
| 1490 | |||
| 1491 | (defsubst ediff-mouse-event-p (event) | 1403 | (defsubst ediff-mouse-event-p (event) |
| 1492 | (if ediff-xemacs-p | 1404 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1493 | (button-event-p event) | 1405 | (button-event-p event) ; xemacs form |
| 1494 | (string-match "mouse" (format "%S" (event-basic-type event))) | 1406 | (string-match "mouse" (format "%S" (event-basic-type event))) ; emacs form |
| 1495 | )) | 1407 | )) |
| 1496 | 1408 | ||
| 1497 | 1409 | ||
| 1498 | (defsubst ediff-key-press-event-p (event) | 1410 | (defsubst ediff-key-press-event-p (event) |
| 1499 | (if ediff-xemacs-p | 1411 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1500 | (key-press-event-p event) | 1412 | (key-press-event-p event) ; xemacs form |
| 1501 | (or (char-or-string-p event) (symbolp event)))) | 1413 | (or (char-or-string-p event) (symbolp event)) ; emacs form |
| 1414 | )) | ||
| 1502 | 1415 | ||
| 1503 | (defun ediff-event-point (event) | 1416 | (defun ediff-event-point (event) |
| 1504 | (cond ((ediff-mouse-event-p event) | 1417 | (cond ((ediff-mouse-event-p event) |
| 1505 | (if ediff-xemacs-p | 1418 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1506 | (event-point event) | 1419 | (event-point event) ; xemacs form |
| 1507 | (posn-point (event-start event)))) | 1420 | (posn-point (event-start event)) ; emacs form |
| 1421 | ) | ||
| 1422 | ) | ||
| 1508 | ((ediff-key-press-event-p event) | 1423 | ((ediff-key-press-event-p event) |
| 1509 | (point)) | 1424 | (point)) |
| 1510 | (t (error)))) | 1425 | (t (error nil)))) |
| 1511 | 1426 | ||
| 1512 | (defun ediff-event-buffer (event) | 1427 | (defun ediff-event-buffer (event) |
| 1513 | (cond ((ediff-mouse-event-p event) | 1428 | (cond ((ediff-mouse-event-p event) |
| 1514 | (if ediff-xemacs-p | 1429 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1515 | (event-buffer event) | 1430 | (event-buffer event) ; xemacs form |
| 1516 | (window-buffer (posn-window (event-start event))))) | 1431 | (window-buffer (posn-window (event-start event))) ; emacs form |
| 1432 | ) | ||
| 1433 | ) | ||
| 1517 | ((ediff-key-press-event-p event) | 1434 | ((ediff-key-press-event-p event) |
| 1518 | (current-buffer)) | 1435 | (current-buffer)) |
| 1519 | (t (error)))) | 1436 | (t (error nil)))) |
| 1437 | |||
| 1438 | (defun ediff-event-key (event-or-key) | ||
| 1439 | (ediff-cond-compile-for-xemacs-or-emacs | ||
| 1440 | (if (eventp event-or-key) (event-key event-or-key) event-or-key) ; xemacs | ||
| 1441 | event-or-key ; emacs form | ||
| 1442 | )) | ||
| 1520 | 1443 | ||
| 1521 | 1444 | ||
| 1522 | (defsubst ediff-frame-iconified-p (frame) | 1445 | (defsubst ediff-frame-iconified-p (frame) |
| 1523 | (if (and (ediff-window-display-p) (frame-live-p frame)) | 1446 | (if (and (ediff-window-display-p) (frame-live-p frame)) |
| 1524 | (if ediff-xemacs-p | 1447 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1525 | (frame-iconified-p frame) | 1448 | (frame-iconified-p frame) ; xemacs form |
| 1526 | (eq (frame-visible-p frame) 'icon)))) | 1449 | (eq (frame-visible-p frame) 'icon) ; emacs form |
| 1450 | ) | ||
| 1451 | )) | ||
| 1527 | 1452 | ||
| 1528 | (defsubst ediff-window-visible-p (wind) | 1453 | (defsubst ediff-window-visible-p (wind) |
| 1529 | ;; under TTY, window-live-p also means window is visible | 1454 | ;; under TTY, window-live-p also means window is visible |
| @@ -1533,9 +1458,10 @@ This default should work without changes." | |||
| 1533 | 1458 | ||
| 1534 | 1459 | ||
| 1535 | (defsubst ediff-frame-char-width (frame) | 1460 | (defsubst ediff-frame-char-width (frame) |
| 1536 | (if ediff-xemacs-p | 1461 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1537 | (/ (frame-pixel-width frame) (frame-width frame)) | 1462 | (/ (frame-pixel-width frame) (frame-width frame)) ; xemacs |
| 1538 | (frame-char-width frame))) | 1463 | (frame-char-width frame) ; emacs |
| 1464 | )) | ||
| 1539 | 1465 | ||
| 1540 | (defun ediff-reset-mouse (&optional frame do-not-grab-mouse) | 1466 | (defun ediff-reset-mouse (&optional frame do-not-grab-mouse) |
| 1541 | (or frame (setq frame (selected-frame))) | 1467 | (or frame (setq frame (selected-frame))) |
| @@ -1580,23 +1506,29 @@ This default should work without changes." | |||
| 1580 | (t nil)))) | 1506 | (t nil)))) |
| 1581 | 1507 | ||
| 1582 | (defsubst ediff-frame-char-height (frame) | 1508 | (defsubst ediff-frame-char-height (frame) |
| 1583 | (if ediff-xemacs-p | 1509 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1584 | (glyph-height ediff-H-glyph (selected-window frame)) | 1510 | (glyph-height ediff-H-glyph (selected-window frame)) ; xemacs cse |
| 1585 | (frame-char-height frame))) | 1511 | (frame-char-height frame) ; emacs case |
| 1512 | ) | ||
| 1513 | ) | ||
| 1586 | 1514 | ||
| 1587 | ;; Some overlay functions | 1515 | ;; Some overlay functions |
| 1588 | 1516 | ||
| 1589 | (defsubst ediff-overlay-start (overl) | 1517 | (defsubst ediff-overlay-start (overl) |
| 1590 | (if (ediff-overlayp overl) | 1518 | (if (ediff-overlayp overl) |
| 1591 | (if ediff-emacs-p | 1519 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1592 | (overlay-start overl) | 1520 | (extent-start-position overl) ; xemacs form |
| 1593 | (extent-start-position overl)))) | 1521 | (overlay-start overl) ; emacs form |
| 1522 | ) | ||
| 1523 | )) | ||
| 1594 | 1524 | ||
| 1595 | (defsubst ediff-overlay-end (overl) | 1525 | (defsubst ediff-overlay-end (overl) |
| 1596 | (if (ediff-overlayp overl) | 1526 | (if (ediff-overlayp overl) |
| 1597 | (if ediff-emacs-p | 1527 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1598 | (overlay-end overl) | 1528 | (extent-end-position overl) ; xemacs form |
| 1599 | (extent-end-position overl)))) | 1529 | (overlay-end overl) ; emacs form |
| 1530 | ) | ||
| 1531 | )) | ||
| 1600 | 1532 | ||
| 1601 | (defsubst ediff-empty-overlay-p (overl) | 1533 | (defsubst ediff-empty-overlay-p (overl) |
| 1602 | (= (ediff-overlay-start overl) (ediff-overlay-end overl))) | 1534 | (= (ediff-overlay-start overl) (ediff-overlay-end overl))) |
| @@ -1604,16 +1536,18 @@ This default should work without changes." | |||
| 1604 | ;; like overlay-buffer in Emacs. In XEmacs, returns nil if the extent is | 1536 | ;; like overlay-buffer in Emacs. In XEmacs, returns nil if the extent is |
| 1605 | ;; dead. Otherwise, works like extent-buffer | 1537 | ;; dead. Otherwise, works like extent-buffer |
| 1606 | (defun ediff-overlay-buffer (overl) | 1538 | (defun ediff-overlay-buffer (overl) |
| 1607 | (if ediff-emacs-p | 1539 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1608 | (overlay-buffer overl) | 1540 | (and (extent-live-p overl) (extent-object overl)) ; xemacs form |
| 1609 | (and (extent-live-p overl) (extent-object overl)))) | 1541 | (overlay-buffer overl) ; emacs form |
| 1542 | )) | ||
| 1610 | 1543 | ||
| 1611 | ;; like overlay-get in Emacs. In XEmacs, returns nil if the extent is | 1544 | ;; like overlay-get in Emacs. In XEmacs, returns nil if the extent is |
| 1612 | ;; dead. Otherwise, like extent-property | 1545 | ;; dead. Otherwise, like extent-property |
| 1613 | (defun ediff-overlay-get (overl property) | 1546 | (defun ediff-overlay-get (overl property) |
| 1614 | (if ediff-emacs-p | 1547 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1615 | (overlay-get overl property) | 1548 | (and (extent-live-p overl) (extent-property overl property)) ; xemacs form |
| 1616 | (and (extent-live-p overl) (extent-property overl property)))) | 1549 | (overlay-get overl property) ; emacs form |
| 1550 | )) | ||
| 1617 | 1551 | ||
| 1618 | 1552 | ||
| 1619 | ;; These two functions are here because XEmacs refuses to | 1553 | ;; These two functions are here because XEmacs refuses to |
| @@ -1623,9 +1557,10 @@ This default should work without changes." | |||
| 1623 | Checks if overlay's buffer exists before actually doing the move." | 1557 | Checks if overlay's buffer exists before actually doing the move." |
| 1624 | (let ((buf (and overlay (ediff-overlay-buffer overlay)))) | 1558 | (let ((buf (and overlay (ediff-overlay-buffer overlay)))) |
| 1625 | (if (ediff-buffer-live-p buf) | 1559 | (if (ediff-buffer-live-p buf) |
| 1626 | (if ediff-xemacs-p | 1560 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1627 | (set-extent-endpoints overlay beg end) | 1561 | (set-extent-endpoints overlay beg end) ; xemacs form |
| 1628 | (move-overlay overlay beg end buffer)) | 1562 | (move-overlay overlay beg end buffer) ; emacs form |
| 1563 | ) | ||
| 1629 | ;; buffer's dead | 1564 | ;; buffer's dead |
| 1630 | (if overlay | 1565 | (if overlay |
| 1631 | (ediff-delete-overlay overlay))))) | 1566 | (ediff-delete-overlay overlay))))) |
| @@ -1634,46 +1569,25 @@ Checks if overlay's buffer exists before actually doing the move." | |||
| 1634 | "Calls `overlay-put' or `set-extent-property' depending on Emacs version. | 1569 | "Calls `overlay-put' or `set-extent-property' depending on Emacs version. |
| 1635 | Checks if overlay's buffer exists." | 1570 | Checks if overlay's buffer exists." |
| 1636 | (if (ediff-buffer-live-p (ediff-overlay-buffer overlay)) | 1571 | (if (ediff-buffer-live-p (ediff-overlay-buffer overlay)) |
| 1637 | (if ediff-xemacs-p | 1572 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1638 | (set-extent-property overlay prop value) | 1573 | (set-extent-property overlay prop value) ; xemacs form |
| 1639 | (overlay-put overlay prop value)) | 1574 | (overlay-put overlay prop value) ; emacs form |
| 1575 | ) | ||
| 1640 | (ediff-delete-overlay overlay))) | 1576 | (ediff-delete-overlay overlay))) |
| 1641 | 1577 | ||
| 1642 | ;; Some diff region tests | ||
| 1643 | |||
| 1644 | ;; t if diff region is empty. | ||
| 1645 | ;; In case of buffer C, t also if it is not a 3way | ||
| 1646 | ;; comparison job (merging jobs return t as well). | ||
| 1647 | (defun ediff-empty-diff-region-p (n buf-type) | ||
| 1648 | (if (eq buf-type 'C) | ||
| 1649 | (or (not ediff-3way-comparison-job) | ||
| 1650 | (= (ediff-get-diff-posn 'C 'beg n) | ||
| 1651 | (ediff-get-diff-posn 'C 'end n))) | ||
| 1652 | (= (ediff-get-diff-posn buf-type 'beg n) | ||
| 1653 | (ediff-get-diff-posn buf-type 'end n)))) | ||
| 1654 | |||
| 1655 | ;; Test if diff region is white space only. | ||
| 1656 | ;; If 2-way job and buf-type = C, then returns t. | ||
| 1657 | (defun ediff-whitespace-diff-region-p (n buf-type) | ||
| 1658 | (or (and (eq buf-type 'C) (not ediff-3way-job)) | ||
| 1659 | (ediff-empty-diff-region-p n buf-type) | ||
| 1660 | (let ((beg (ediff-get-diff-posn buf-type 'beg n)) | ||
| 1661 | (end (ediff-get-diff-posn buf-type 'end n))) | ||
| 1662 | (ediff-with-current-buffer (ediff-get-buffer buf-type) | ||
| 1663 | (save-excursion | ||
| 1664 | (goto-char beg) | ||
| 1665 | (skip-chars-forward ediff-whitespace) | ||
| 1666 | (>= (point) end)))))) | ||
| 1667 | |||
| 1668 | ;; temporarily uses DIR to abbreviate file name | 1578 | ;; temporarily uses DIR to abbreviate file name |
| 1669 | ;; if DIR is nil, use default-directory | 1579 | ;; if DIR is nil, use default-directory |
| 1670 | (defun ediff-abbreviate-file-name (file &optional dir) | 1580 | (defun ediff-abbreviate-file-name (file &optional dir) |
| 1671 | (cond ((stringp dir) | 1581 | (cond ((stringp dir) |
| 1672 | (let ((directory-abbrev-alist (list (cons dir "")))) | 1582 | (let ((directory-abbrev-alist (list (cons dir "")))) |
| 1673 | (abbreviate-file-name file))) | 1583 | (abbreviate-file-name file))) |
| 1674 | (ediff-emacs-p (abbreviate-file-name file)) | 1584 | (t |
| 1675 | (t ; XEmacs requires addl argument | 1585 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1676 | (abbreviate-file-name file t)))) | 1586 | ;; XEmacs requires addl argument |
| 1587 | (abbreviate-file-name file t) ; xemacs form | ||
| 1588 | (abbreviate-file-name file)) ; emacs form | ||
| 1589 | ) | ||
| 1590 | )) | ||
| 1677 | 1591 | ||
| 1678 | ;; Takes a directory and returns the parent directory. | 1592 | ;; Takes a directory and returns the parent directory. |
| 1679 | ;; does nothing to `/'. If the ARG is a regular file, | 1593 | ;; does nothing to `/'. If the ARG is a regular file, |
| @@ -1740,13 +1654,6 @@ Unless optional argument INPLACE is non-nil, return a new string." | |||
| 1740 | )) | 1654 | )) |
| 1741 | 1655 | ||
| 1742 | 1656 | ||
| 1743 | (defsubst ediff-get-region-contents (n buf-type ctrl-buf &optional start end) | ||
| 1744 | (ediff-with-current-buffer | ||
| 1745 | (ediff-with-current-buffer ctrl-buf (ediff-get-buffer buf-type)) | ||
| 1746 | (buffer-substring | ||
| 1747 | (or start (ediff-get-diff-posn buf-type 'beg n ctrl-buf)) | ||
| 1748 | (or end (ediff-get-diff-posn buf-type 'end n ctrl-buf))))) | ||
| 1749 | |||
| 1750 | ;; If ediff modified mode line, strip the modification | 1657 | ;; If ediff modified mode line, strip the modification |
| 1751 | (defsubst ediff-strip-mode-line-format () | 1658 | (defsubst ediff-strip-mode-line-format () |
| 1752 | (if (member (car mode-line-format) '(" A: " " B: " " C: " " Ancestor: ")) | 1659 | (if (member (car mode-line-format) '(" A: " " B: " " C: " " Ancestor: ")) |
diff --git a/lisp/ediff-merg.el b/lisp/ediff-merg.el index 88034dbbd56..8bb1aa0814f 100644 --- a/lisp/ediff-merg.el +++ b/lisp/ediff-merg.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; ediff-merg.el --- merging utilities | 1 | ;;; ediff-merg.el --- merging utilities |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 5 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 6 | 6 | ||
| 7 | ;; This file is part of GNU Emacs. | 7 | ;; This file is part of GNU Emacs. |
| 8 | 8 | ||
| @@ -122,7 +122,7 @@ Buffer B." | |||
| 122 | (combo-region "") | 122 | (combo-region "") |
| 123 | (err-msg | 123 | (err-msg |
| 124 | "ediff-combination-pattern: Invalid format. Please consult the documentation") | 124 | "ediff-combination-pattern: Invalid format. Please consult the documentation") |
| 125 | diff-region region-delim region-spec) | 125 | region-delim region-spec) |
| 126 | 126 | ||
| 127 | (if (< (length pattern-list) 5) | 127 | (if (< (length pattern-list) 5) |
| 128 | (error err-msg)) | 128 | (error err-msg)) |
| @@ -133,7 +133,7 @@ Buffer B." | |||
| 133 | (or (and (stringp region-delim) (memq region-spec '(A B Ancestor))) | 133 | (or (and (stringp region-delim) (memq region-spec '(A B Ancestor))) |
| 134 | (error err-msg)) | 134 | (error err-msg)) |
| 135 | 135 | ||
| 136 | (condition-case err | 136 | (condition-case nil |
| 137 | (setq combo-region | 137 | (setq combo-region |
| 138 | (concat combo-region | 138 | (concat combo-region |
| 139 | region-delim "\n" | 139 | region-delim "\n" |
| @@ -221,9 +221,10 @@ Buffer B." | |||
| 221 | (setq state-of-merge (ediff-get-state-of-merge n)) | 221 | (setq state-of-merge (ediff-get-state-of-merge n)) |
| 222 | 222 | ||
| 223 | (if remerging | 223 | (if remerging |
| 224 | (let ((reg-A (ediff-get-region-contents n 'A ediff-control-buffer)) | 224 | ;;(let ((reg-A (ediff-get-region-contents n 'A ediff-control-buffer)) |
| 225 | (reg-B (ediff-get-region-contents n 'B ediff-control-buffer)) | 225 | ;; (reg-B (ediff-get-region-contents n 'B ediff-control-buffer)) |
| 226 | (reg-C (ediff-get-region-contents n 'C ediff-control-buffer))) | 226 | ;; (reg-C (ediff-get-region-contents n 'C ediff-control-buffer))) |
| 227 | (let () | ||
| 227 | 228 | ||
| 228 | ;; if region was edited since it was first set by default | 229 | ;; if region was edited since it was first set by default |
| 229 | (if (or (ediff-merge-changed-from-default-p n) | 230 | (if (or (ediff-merge-changed-from-default-p n) |
| @@ -307,7 +308,7 @@ Combining is done according to the specifications in variable | |||
| 307 | (interactive "P") | 308 | (interactive "P") |
| 308 | (setq n (if (numberp n) (1- n) ediff-current-difference)) | 309 | (setq n (if (numberp n) (1- n) ediff-current-difference)) |
| 309 | 310 | ||
| 310 | (let (regA regB reg-combined) | 311 | (let (reg-combined) |
| 311 | ;;(setq regA (ediff-get-region-contents n 'A ediff-control-buffer) | 312 | ;;(setq regA (ediff-get-region-contents n 'A ediff-control-buffer) |
| 312 | ;; regB (ediff-get-region-contents n 'B ediff-control-buffer)) | 313 | ;; regB (ediff-get-region-contents n 'B ediff-control-buffer)) |
| 313 | ;;(setq reg-combined (ediff-make-combined-diff regA regB)) | 314 | ;;(setq reg-combined (ediff-make-combined-diff regA regB)) |
diff --git a/lisp/ediff-mult.el b/lisp/ediff-mult.el index ac779849353..b8e576d72b7 100644 --- a/lisp/ediff-mult.el +++ b/lisp/ediff-mult.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff | 1 | ;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1995, 1996, 1997, 2001 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1995, 96, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 5 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 6 | 6 | ||
| 7 | ;; This file is part of GNU Emacs. | 7 | ;; This file is part of GNU Emacs. |
| 8 | 8 | ||
| @@ -815,9 +815,10 @@ behavior." | |||
| 815 | (erase-buffer) | 815 | (erase-buffer) |
| 816 | ;; delete phony overlays that used to represent sessions before the buff | 816 | ;; delete phony overlays that used to represent sessions before the buff |
| 817 | ;; was redrawn | 817 | ;; was redrawn |
| 818 | (if ediff-emacs-p | 818 | (ediff-cond-compile-for-xemacs-or-emacs |
| 819 | (mapcar 'delete-overlay (overlays-in 1 1)) | 819 | (map-extents 'delete-extent) ; xemacs |
| 820 | (map-extents 'delete-extent)) | 820 | (mapcar 'delete-overlay (overlays-in 1 1)) ; emacs |
| 821 | ) | ||
| 821 | 822 | ||
| 822 | (insert (format ediff-meta-buffer-message | 823 | (insert (format ediff-meta-buffer-message |
| 823 | (ediff-abbrev-jobname ediff-metajob-name))) | 824 | (ediff-abbrev-jobname ediff-metajob-name))) |
| @@ -918,30 +919,32 @@ behavior." | |||
| 918 | (defun ediff-update-session-marker-in-dir-meta-buffer (session-num) | 919 | (defun ediff-update-session-marker-in-dir-meta-buffer (session-num) |
| 919 | (let (buffer-meta-overlays session-info overl buffer-read-only) | 920 | (let (buffer-meta-overlays session-info overl buffer-read-only) |
| 920 | (setq overl | 921 | (setq overl |
| 921 | (if ediff-xemacs-p | 922 | (ediff-cond-compile-for-xemacs-or-emacs |
| 922 | (map-extents | 923 | (map-extents ; xemacs |
| 923 | (lambda (ext maparg) | 924 | (lambda (ext maparg) |
| 924 | (if (and | 925 | (if (and |
| 925 | (ediff-overlay-get ext 'ediff-meta-info) | 926 | (ediff-overlay-get ext 'ediff-meta-info) |
| 926 | (eq (ediff-overlay-get ext 'ediff-meta-session-number) | 927 | (eq (ediff-overlay-get ext 'ediff-meta-session-number) |
| 927 | session-num)) | 928 | session-num)) |
| 928 | ext))) | 929 | ext))) |
| 929 | ;; Emacs doesn't have map-extents, so try harder | 930 | ;; Emacs doesn't have map-extents, so try harder |
| 930 | ;; Splice overlay lists to get all buffer overlays | 931 | ;; Splice overlay lists to get all buffer overlays |
| 931 | (setq buffer-meta-overlays (overlay-lists) | 932 | (progn |
| 932 | buffer-meta-overlays (append (car buffer-meta-overlays) | 933 | (setq buffer-meta-overlays (overlay-lists) |
| 933 | (cdr buffer-meta-overlays))) | 934 | buffer-meta-overlays (append (car buffer-meta-overlays) |
| 934 | (car | 935 | (cdr buffer-meta-overlays))) |
| 935 | (delq nil | 936 | (car |
| 936 | (mapcar | 937 | (delq nil |
| 937 | (lambda (overl) | 938 | (mapcar |
| 938 | (if (and | 939 | (lambda (overl) |
| 939 | (ediff-overlay-get overl 'ediff-meta-info) | 940 | (if (and |
| 940 | (eq (ediff-overlay-get | 941 | (ediff-overlay-get overl 'ediff-meta-info) |
| 941 | overl 'ediff-meta-session-number) | 942 | (eq (ediff-overlay-get |
| 942 | session-num)) | 943 | overl 'ediff-meta-session-number) |
| 943 | overl)) | 944 | session-num)) |
| 944 | buffer-meta-overlays))))) | 945 | overl)) |
| 946 | buffer-meta-overlays)))) | ||
| 947 | )) | ||
| 945 | (or overl | 948 | (or overl |
| 946 | (error | 949 | (error |
| 947 | "Bug in ediff-update-session-marker-in-dir-meta-buffer: no overlay with given number %S" | 950 | "Bug in ediff-update-session-marker-in-dir-meta-buffer: no overlay with given number %S" |
| @@ -1179,9 +1182,10 @@ Useful commands: | |||
| 1179 | (erase-buffer) | 1182 | (erase-buffer) |
| 1180 | ;; delete phony overlays that used to represent sessions before the buff | 1183 | ;; delete phony overlays that used to represent sessions before the buff |
| 1181 | ;; was redrawn | 1184 | ;; was redrawn |
| 1182 | (if ediff-emacs-p | 1185 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1183 | (mapcar 'delete-overlay (overlays-in 1 1)) | 1186 | (map-extents 'delete-extent) ; xemacs |
| 1184 | (map-extents 'delete-extent)) | 1187 | (mapcar 'delete-overlay (overlays-in 1 1)) ; emacs |
| 1188 | ) | ||
| 1185 | 1189 | ||
| 1186 | (insert "This is a registry of all active Ediff sessions. | 1190 | (insert "This is a registry of all active Ediff sessions. |
| 1187 | 1191 | ||
| @@ -1507,7 +1511,7 @@ all marked sessions must be active." | |||
| 1507 | 1511 | ||
| 1508 | ;; This function executes in meta buffer. It knows where event happened. | 1512 | ;; This function executes in meta buffer. It knows where event happened. |
| 1509 | (defun ediff-filegroup-action () | 1513 | (defun ediff-filegroup-action () |
| 1510 | "Execute appropriate action for the selected session." | 1514 | "Execute appropriate action for a selected session." |
| 1511 | (interactive) | 1515 | (interactive) |
| 1512 | (let* ((pos (ediff-event-point last-command-event)) | 1516 | (let* ((pos (ediff-event-point last-command-event)) |
| 1513 | (meta-buf (ediff-event-buffer last-command-event)) | 1517 | (meta-buf (ediff-event-buffer last-command-event)) |
| @@ -1795,6 +1799,8 @@ all marked sessions must be active." | |||
| 1795 | (setq frame (window-frame wind)) | 1799 | (setq frame (window-frame wind)) |
| 1796 | (raise-frame frame) | 1800 | (raise-frame frame) |
| 1797 | (ediff-reset-mouse frame))) | 1801 | (ediff-reset-mouse frame))) |
| 1802 | (sit-for 0) ; sometimes needed to synch the display and ensure that the | ||
| 1803 | ; point ends up after the just completed session | ||
| 1798 | (run-hooks 'ediff-show-session-group-hook) | 1804 | (run-hooks 'ediff-show-session-group-hook) |
| 1799 | )) | 1805 | )) |
| 1800 | 1806 | ||
| @@ -1975,19 +1981,22 @@ If this is a session registry buffer then just bury it." | |||
| 1975 | (let (result olist tmp) | 1981 | (let (result olist tmp) |
| 1976 | (if (and point (ediff-buffer-live-p buf)) | 1982 | (if (and point (ediff-buffer-live-p buf)) |
| 1977 | (ediff-with-current-buffer buf | 1983 | (ediff-with-current-buffer buf |
| 1978 | (if ediff-xemacs-p | 1984 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1979 | (setq result | 1985 | (setq result ; xemacs |
| 1980 | (if (setq tmp (extent-at point buf 'ediff-meta-info)) | 1986 | (if (setq tmp (extent-at point buf 'ediff-meta-info)) |
| 1981 | (ediff-overlay-get tmp 'ediff-meta-info))) | 1987 | (ediff-overlay-get tmp 'ediff-meta-info))) |
| 1982 | (setq olist (overlays-at point)) | 1988 | (progn ; emacs |
| 1983 | (setq olist | 1989 | (setq olist (overlays-at point)) |
| 1984 | (mapcar (lambda (elt) | 1990 | (setq olist |
| 1985 | (unless (overlay-get elt 'invisible) | 1991 | (mapcar (lambda (elt) |
| 1986 | (overlay-get elt 'ediff-meta-info))) | 1992 | (unless (overlay-get elt 'invisible) |
| 1987 | olist)) | 1993 | (overlay-get elt 'ediff-meta-info))) |
| 1988 | (while (and olist (null (car olist))) | 1994 | olist)) |
| 1989 | (setq olist (cdr olist))) | 1995 | (while (and olist (null (car olist))) |
| 1990 | (setq result (car olist))))) | 1996 | (setq olist (cdr olist))) |
| 1997 | (setq result (car olist))) | ||
| 1998 | ) | ||
| 1999 | )) | ||
| 1991 | (if result | 2000 | (if result |
| 1992 | result | 2001 | result |
| 1993 | (if noerror | 2002 | (if noerror |
| @@ -1997,14 +2006,17 @@ If this is a session registry buffer then just bury it." | |||
| 1997 | 2006 | ||
| 1998 | 2007 | ||
| 1999 | (defun ediff-get-meta-overlay-at-pos (point) | 2008 | (defun ediff-get-meta-overlay-at-pos (point) |
| 2000 | (if ediff-xemacs-p | 2009 | (ediff-cond-compile-for-xemacs-or-emacs |
| 2001 | (extent-at point (current-buffer) 'ediff-meta-info) | 2010 | (extent-at point (current-buffer) 'ediff-meta-info) ; xemacs |
| 2002 | (let* ((overl-list (overlays-at point)) | 2011 | ;; emacs |
| 2003 | (overl (car overl-list))) | 2012 | (let* ((overl-list (overlays-at point)) |
| 2004 | (while (and overl (null (overlay-get overl 'ediff-meta-info))) | 2013 | (overl (car overl-list))) |
| 2005 | (setq overl-list (cdr overl-list) | 2014 | (while (and overl (null (overlay-get overl 'ediff-meta-info))) |
| 2006 | overl (car overl-list))) | 2015 | (setq overl-list (cdr overl-list) |
| 2007 | overl))) | 2016 | overl (car overl-list))) |
| 2017 | overl) | ||
| 2018 | ) | ||
| 2019 | ) | ||
| 2008 | 2020 | ||
| 2009 | (defsubst ediff-get-session-number-at-pos (point &optional meta-buffer) | 2021 | (defsubst ediff-get-session-number-at-pos (point &optional meta-buffer) |
| 2010 | (setq meta-buffer (if (ediff-buffer-live-p meta-buffer) | 2022 | (setq meta-buffer (if (ediff-buffer-live-p meta-buffer) |
| @@ -2020,18 +2032,21 @@ If this is a session registry buffer then just bury it." | |||
| 2020 | (if (eobp) | 2032 | (if (eobp) |
| 2021 | (goto-char (point-min)) | 2033 | (goto-char (point-min)) |
| 2022 | (let ((overl (ediff-get-meta-overlay-at-pos point))) | 2034 | (let ((overl (ediff-get-meta-overlay-at-pos point))) |
| 2023 | (if ediff-xemacs-p | 2035 | (ediff-cond-compile-for-xemacs-or-emacs |
| 2024 | (progn | 2036 | (progn ; xemacs |
| 2025 | (if overl | 2037 | (if overl |
| 2026 | (setq overl (next-extent overl)) | 2038 | (setq overl (next-extent overl)) |
| 2027 | (setq overl (next-extent (current-buffer)))) | 2039 | (setq overl (next-extent (current-buffer)))) |
| 2028 | (if overl | 2040 | (if overl |
| 2029 | (extent-start-position overl) | 2041 | (extent-start-position overl) |
| 2030 | (point-max))) | 2042 | (point-max))) |
| 2031 | (if overl | 2043 | ;; emacs |
| 2032 | ;; note: end of current overlay is the beginning of the next one | 2044 | (if overl |
| 2033 | (overlay-end overl) | 2045 | ;; note: end of current overlay is the beginning of the next one |
| 2034 | (next-overlay-change point)))) | 2046 | (overlay-end overl) |
| 2047 | (next-overlay-change point)) | ||
| 2048 | ) | ||
| 2049 | ) | ||
| 2035 | )) | 2050 | )) |
| 2036 | 2051 | ||
| 2037 | 2052 | ||
| @@ -2039,27 +2054,30 @@ If this is a session registry buffer then just bury it." | |||
| 2039 | (if (bobp) | 2054 | (if (bobp) |
| 2040 | (goto-char (point-max)) | 2055 | (goto-char (point-max)) |
| 2041 | (let ((overl (ediff-get-meta-overlay-at-pos point))) | 2056 | (let ((overl (ediff-get-meta-overlay-at-pos point))) |
| 2042 | (if ediff-xemacs-p | 2057 | (ediff-cond-compile-for-xemacs-or-emacs |
| 2043 | (progn | 2058 | (progn |
| 2044 | (if overl | 2059 | (if overl |
| 2045 | (setq overl (previous-extent overl)) | 2060 | (setq overl (previous-extent overl)) |
| 2046 | (setq overl (previous-extent (current-buffer)))) | 2061 | (setq overl (previous-extent (current-buffer)))) |
| 2047 | (if overl | 2062 | (if overl |
| 2048 | (extent-start-position overl) | 2063 | (extent-start-position overl) |
| 2049 | (point-min))) | 2064 | (point-min))) |
| 2050 | (if overl (setq point (overlay-start overl))) | 2065 | (progn |
| 2051 | ;; to get to the beginning of prev overlay | 2066 | (if overl (setq point (overlay-start overl))) |
| 2052 | (if (not (bobp)) | 2067 | ;; to get to the beginning of prev overlay |
| 2053 | ;; trick to overcome an emacs bug--doesn't always find previous | 2068 | (if (not (bobp)) |
| 2054 | ;; overlay change correctly | 2069 | ;; trick to overcome an emacs bug--doesn't always find previous |
| 2055 | (setq point (1- point))) | 2070 | ;; overlay change correctly |
| 2056 | (setq point (previous-overlay-change point)) | 2071 | (setq point (1- point))) |
| 2057 | ;; If we are not over an overlay after subtracting 1, it means we are | 2072 | (setq point (previous-overlay-change point)) |
| 2058 | ;; in the description area preceding session records. In this case, | 2073 | ;; If we are not over an overlay after subtracting 1, it means we are |
| 2059 | ;; goto the top of the registry buffer. | 2074 | ;; in the description area preceding session records. In this case, |
| 2060 | (or (car (overlays-at point)) | 2075 | ;; goto the top of the registry buffer. |
| 2061 | (setq point (point-min))) | 2076 | (or (car (overlays-at point)) |
| 2062 | point)))) | 2077 | (setq point (point-min))) |
| 2078 | point) | ||
| 2079 | ) | ||
| 2080 | ))) | ||
| 2063 | 2081 | ||
| 2064 | ;; this is the action invoked when the user selects a patch from the meta | 2082 | ;; this is the action invoked when the user selects a patch from the meta |
| 2065 | ;; buffer. | 2083 | ;; buffer. |
diff --git a/lisp/ediff-ptch.el b/lisp/ediff-ptch.el index 95d93ed5899..b3ee2f9a527 100644 --- a/lisp/ediff-ptch.el +++ b/lisp/ediff-ptch.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; ediff-ptch.el --- Ediff's patch support | 1 | ;;; ediff-ptch.el --- Ediff's patch support |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1996, 1997 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1996, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 5 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 6 | 6 | ||
| 7 | ;; This file is part of GNU Emacs. | 7 | ;; This file is part of GNU Emacs. |
| 8 | 8 | ||
diff --git a/lisp/ediff-util.el b/lisp/ediff-util.el index 22925c1fc03..c7f0be3638d 100644 --- a/lisp/ediff-util.el +++ b/lisp/ediff-util.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; ediff-util.el --- the core commands and utilities of ediff | 1 | ;;; ediff-util.el --- the core commands and utilities of ediff |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 5 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 6 | 6 | ||
| 7 | ;; This file is part of GNU Emacs. | 7 | ;; This file is part of GNU Emacs. |
| 8 | 8 | ||
| @@ -296,6 +296,11 @@ to invocation.") | |||
| 296 | (make-local-variable 'ediff-window-setup-function) | 296 | (make-local-variable 'ediff-window-setup-function) |
| 297 | (make-local-variable 'ediff-keep-variants) | 297 | (make-local-variable 'ediff-keep-variants) |
| 298 | 298 | ||
| 299 | (ediff-cond-compile-for-xemacs-or-emacs | ||
| 300 | (make-local-hook 'ediff-after-quit-hook-internal) ; xemacs form | ||
| 301 | nil ; emacs form | ||
| 302 | ) | ||
| 303 | |||
| 299 | ;; unwrap set up parameters passed as argument | 304 | ;; unwrap set up parameters passed as argument |
| 300 | (while setup-parameters | 305 | (while setup-parameters |
| 301 | (set (car (car setup-parameters)) (cdr (car setup-parameters))) | 306 | (set (car (car setup-parameters)) (cdr (car setup-parameters))) |
| @@ -317,8 +322,10 @@ to invocation.") | |||
| 317 | (if (string-match "buffer" (symbol-name ediff-job-name)) | 322 | (if (string-match "buffer" (symbol-name ediff-job-name)) |
| 318 | (setq ediff-keep-variants t)) | 323 | (setq ediff-keep-variants t)) |
| 319 | 324 | ||
| 320 | (if ediff-xemacs-p | 325 | (ediff-cond-compile-for-xemacs-or-emacs |
| 321 | (make-local-hook 'pre-command-hook)) | 326 | (make-local-hook 'pre-command-hook) ; xemacs form |
| 327 | nil ; emacs form | ||
| 328 | ) | ||
| 322 | 329 | ||
| 323 | (if (ediff-window-display-p) | 330 | (if (ediff-window-display-p) |
| 324 | (add-hook 'pre-command-hook 'ediff-spy-after-mouse nil 'local)) | 331 | (add-hook 'pre-command-hook 'ediff-spy-after-mouse nil 'local)) |
| @@ -351,6 +358,7 @@ to invocation.") | |||
| 351 | (set-buffer buffer-C) | 358 | (set-buffer buffer-C) |
| 352 | (insert-buffer buf) | 359 | (insert-buffer buf) |
| 353 | (funcall (ediff-with-current-buffer buf major-mode)) | 360 | (funcall (ediff-with-current-buffer buf major-mode)) |
| 361 | (widen) ; merge buffer is always widened | ||
| 354 | (add-hook 'local-write-file-hooks 'ediff-set-merge-mode nil t) | 362 | (add-hook 'local-write-file-hooks 'ediff-set-merge-mode nil t) |
| 355 | ))) | 363 | ))) |
| 356 | (setq buffer-read-only nil | 364 | (setq buffer-read-only nil |
| @@ -451,6 +459,10 @@ to invocation.") | |||
| 451 | (if ediff-3way-job | 459 | (if ediff-3way-job |
| 452 | (ediff-with-current-buffer ediff-buffer-C | 460 | (ediff-with-current-buffer ediff-buffer-C |
| 453 | (ediff-nuke-selective-display) | 461 | (ediff-nuke-selective-display) |
| 462 | ;; the merge bufer should never be narrowed | ||
| 463 | ;; (it can happen if it is on rmail-mode or similar) | ||
| 464 | (if (ediff-with-current-buffer control-buffer ediff-merge-job) | ||
| 465 | (widen)) | ||
| 454 | (run-hooks 'ediff-prepare-buffer-hook) | 466 | (run-hooks 'ediff-prepare-buffer-hook) |
| 455 | ;; add control-buffer to the list of sessions | 467 | ;; add control-buffer to the list of sessions |
| 456 | (or (memq control-buffer ediff-this-buffer-ediff-sessions) | 468 | (or (memq control-buffer ediff-this-buffer-ediff-sessions) |
| @@ -458,7 +470,8 @@ to invocation.") | |||
| 458 | (cons control-buffer | 470 | (cons control-buffer |
| 459 | ediff-this-buffer-ediff-sessions))) | 471 | ediff-this-buffer-ediff-sessions))) |
| 460 | (if ediff-make-buffers-readonly-at-startup | 472 | (if ediff-make-buffers-readonly-at-startup |
| 461 | (setq buffer-read-only t)) | 473 | (setq buffer-read-only t) |
| 474 | (setq buffer-read-only nil)) | ||
| 462 | )) | 475 | )) |
| 463 | 476 | ||
| 464 | (if (ediff-buffer-live-p ediff-ancestor-buffer) | 477 | (if (ediff-buffer-live-p ediff-ancestor-buffer) |
| @@ -472,7 +485,7 @@ to invocation.") | |||
| 472 | ediff-this-buffer-ediff-sessions))) | 485 | ediff-this-buffer-ediff-sessions))) |
| 473 | )) | 486 | )) |
| 474 | 487 | ||
| 475 | ;; must come after setting up ediff-narrow-bounds AND after | 488 | ;; the following must be after setting up ediff-narrow-bounds AND after |
| 476 | ;; nuking selective display | 489 | ;; nuking selective display |
| 477 | (funcall ediff-setup-diff-regions-function file-A file-B file-C) | 490 | (funcall ediff-setup-diff-regions-function file-A file-B file-C) |
| 478 | (setq ediff-number-of-differences (length ediff-difference-vector-A)) | 491 | (setq ediff-number-of-differences (length ediff-difference-vector-A)) |
| @@ -575,6 +588,7 @@ to invocation.") | |||
| 575 | (if (stringp ediff-merge-store-file) | 588 | (if (stringp ediff-merge-store-file) |
| 576 | (progn | 589 | (progn |
| 577 | ;; save before leaving ctl buffer | 590 | ;; save before leaving ctl buffer |
| 591 | (ediff-verify-file-merge-buffer ediff-merge-store-file) | ||
| 578 | (setq merge-buffer-file ediff-merge-store-file) | 592 | (setq merge-buffer-file ediff-merge-store-file) |
| 579 | (ediff-with-current-buffer ediff-buffer-C | 593 | (ediff-with-current-buffer ediff-buffer-C |
| 580 | (set-visited-file-name merge-buffer-file)))) | 594 | (set-visited-file-name merge-buffer-file)))) |
| @@ -1326,9 +1340,13 @@ To change the default, set the variable `ediff-use-toolbar-p', which see." | |||
| 1326 | ;; will not re-appear after our cleanup here. Is there a way | 1340 | ;; will not re-appear after our cleanup here. Is there a way |
| 1327 | ;; to do "push" and "pop" toolbars ? --marcpa | 1341 | ;; to do "push" and "pop" toolbars ? --marcpa |
| 1328 | (if (ediff-use-toolbar-p) | 1342 | (if (ediff-use-toolbar-p) |
| 1329 | (progn | 1343 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1330 | (set-specifier bottom-toolbar (list (selected-frame) nil)) | 1344 | (progn ; xemacs |
| 1331 | (set-specifier bottom-toolbar-visible-p (list (selected-frame) nil))))) | 1345 | (set-specifier bottom-toolbar (list (selected-frame) nil)) |
| 1346 | (set-specifier bottom-toolbar-visible-p (list (selected-frame) nil))) | ||
| 1347 | nil ; emacs | ||
| 1348 | ) | ||
| 1349 | )) | ||
| 1332 | 1350 | ||
| 1333 | ;; If wants to use toolbar, make it. | 1351 | ;; If wants to use toolbar, make it. |
| 1334 | ;; If not, zero the toolbar for XEmacs. | 1352 | ;; If not, zero the toolbar for XEmacs. |
| @@ -1338,15 +1356,24 @@ To change the default, set the variable `ediff-use-toolbar-p', which see." | |||
| 1338 | (progn | 1356 | (progn |
| 1339 | (setq frame (or frame (selected-frame))) | 1357 | (setq frame (or frame (selected-frame))) |
| 1340 | (cond ((ediff-use-toolbar-p) ; this checks for XEmacs | 1358 | (cond ((ediff-use-toolbar-p) ; this checks for XEmacs |
| 1341 | (set-specifier | 1359 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1342 | bottom-toolbar | 1360 | (progn ; xemacs |
| 1343 | (list frame (if (ediff-3way-comparison-job) | 1361 | (set-specifier |
| 1344 | ediff-toolbar-3way ediff-toolbar))) | 1362 | bottom-toolbar |
| 1345 | (set-specifier bottom-toolbar-visible-p (list frame t)) | 1363 | (list frame (if (ediff-3way-comparison-job) |
| 1346 | (set-specifier bottom-toolbar-height | 1364 | ediff-toolbar-3way ediff-toolbar))) |
| 1347 | (list frame ediff-toolbar-height))) | 1365 | (set-specifier bottom-toolbar-visible-p (list frame t)) |
| 1366 | (set-specifier bottom-toolbar-height | ||
| 1367 | (list frame ediff-toolbar-height))) | ||
| 1368 | nil ; emacs | ||
| 1369 | ) | ||
| 1370 | ) | ||
| 1348 | ((ediff-has-toolbar-support-p) | 1371 | ((ediff-has-toolbar-support-p) |
| 1349 | (set-specifier bottom-toolbar-height (list frame 0))) | 1372 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1373 | (set-specifier bottom-toolbar-height (list frame 0)) ; xemacs | ||
| 1374 | nil ; emacs | ||
| 1375 | ) | ||
| 1376 | ) | ||
| 1350 | )) | 1377 | )) |
| 1351 | )) | 1378 | )) |
| 1352 | 1379 | ||
| @@ -1907,8 +1934,8 @@ determine the source and the target buffers instead of the command keys." | |||
| 1907 | 1934 | ||
| 1908 | (let* ((key1 (aref keys 0)) | 1935 | (let* ((key1 (aref keys 0)) |
| 1909 | (key2 (aref keys 1)) | 1936 | (key2 (aref keys 1)) |
| 1910 | (char1 (if (and ediff-xemacs-p (eventp key1)) (event-key key1) key1)) | 1937 | (char1 (ediff-event-key key1)) |
| 1911 | (char2 (if (and ediff-xemacs-p (eventp key1)) (event-key key2) key2)) | 1938 | (char2 (ediff-event-key key2)) |
| 1912 | ediff-verbose-p) | 1939 | ediff-verbose-p) |
| 1913 | (ediff-copy-diff ediff-current-difference | 1940 | (ediff-copy-diff ediff-current-difference |
| 1914 | (ediff-char-to-buftype char1) | 1941 | (ediff-char-to-buftype char1) |
| @@ -2380,7 +2407,7 @@ temporarily reverses the meaning of this variable." | |||
| 2380 | 2407 | ||
| 2381 | (ediff-delete-temp-files) | 2408 | (ediff-delete-temp-files) |
| 2382 | 2409 | ||
| 2383 | ;; Restore visibility range. This affects only ediff-*-regions/windows. | 2410 | ;; Restore the visibility range. This affects only ediff-*-regions/windows. |
| 2384 | ;; Since for other job names ediff-visible-region sets | 2411 | ;; Since for other job names ediff-visible-region sets |
| 2385 | ;; ediff-visible-bounds to ediff-wide-bounds, the settings below are | 2412 | ;; ediff-visible-bounds to ediff-wide-bounds, the settings below are |
| 2386 | ;; ignored for such jobs. | 2413 | ;; ignored for such jobs. |
| @@ -2462,11 +2489,12 @@ temporarily reverses the meaning of this variable." | |||
| 2462 | 2489 | ||
| 2463 | (run-hooks 'ediff-cleanup-hook) | 2490 | (run-hooks 'ediff-cleanup-hook) |
| 2464 | 2491 | ||
| 2465 | ;; now kill buffers A/B/C, if requested | 2492 | (ediff-janitor |
| 2466 | (let ((ediff-keep-variants ediff-keep-variants)) | 2493 | 'ask |
| 2467 | (if reverse-default-keep-variants | 2494 | ;; reverse-default-keep-variants is t if the user quits with a prefix arg |
| 2468 | (setq ediff-keep-variants (not ediff-keep-variants))) | 2495 | (if reverse-default-keep-variants |
| 2469 | (or ediff-keep-variants (ediff-janitor 'ask))) | 2496 | (not ediff-keep-variants) |
| 2497 | ediff-keep-variants)) | ||
| 2470 | 2498 | ||
| 2471 | ;; one hook here is ediff-cleanup-mess, which kills the control buffer and | 2499 | ;; one hook here is ediff-cleanup-mess, which kills the control buffer and |
| 2472 | ;; other auxiliary buffers. we made it into a hook to let the users do their | 2500 | ;; other auxiliary buffers. we made it into a hook to let the users do their |
| @@ -2548,9 +2576,7 @@ temporarily reverses the meaning of this variable." | |||
| 2548 | (ediff-kill-buffer-carefully ctl-buf) | 2576 | (ediff-kill-buffer-carefully ctl-buf) |
| 2549 | 2577 | ||
| 2550 | (if (frame-live-p main-frame) | 2578 | (if (frame-live-p main-frame) |
| 2551 | (progn | 2579 | (select-frame main-frame)) |
| 2552 | (select-frame main-frame) | ||
| 2553 | (delete-other-windows))) | ||
| 2554 | 2580 | ||
| 2555 | ;; display only if not visible | 2581 | ;; display only if not visible |
| 2556 | (condition-case nil | 2582 | (condition-case nil |
| @@ -2560,7 +2586,8 @@ temporarily reverses the meaning of this variable." | |||
| 2560 | (condition-case nil | 2586 | (condition-case nil |
| 2561 | (or (ediff-get-visible-buffer-window buff-A) | 2587 | (or (ediff-get-visible-buffer-window buff-A) |
| 2562 | (progn | 2588 | (progn |
| 2563 | (if (ediff-get-visible-buffer-window buff-B) | 2589 | (if (and (ediff-get-visible-buffer-window buff-B) |
| 2590 | (ediff-buffer-live-p buff-A)) | ||
| 2564 | (funcall ediff-split-window-function)) | 2591 | (funcall ediff-split-window-function)) |
| 2565 | (switch-to-buffer buff-A))) | 2592 | (switch-to-buffer buff-A))) |
| 2566 | (error)) | 2593 | (error)) |
| @@ -2568,8 +2595,9 @@ temporarily reverses the meaning of this variable." | |||
| 2568 | (condition-case nil | 2595 | (condition-case nil |
| 2569 | (or (ediff-get-visible-buffer-window buff-C) | 2596 | (or (ediff-get-visible-buffer-window buff-C) |
| 2570 | (progn | 2597 | (progn |
| 2571 | (if (or (ediff-get-visible-buffer-window buff-A) | 2598 | (if (and (or (ediff-get-visible-buffer-window buff-A) |
| 2572 | (ediff-get-visible-buffer-window buff-B)) | 2599 | (ediff-get-visible-buffer-window buff-B)) |
| 2600 | (ediff-buffer-live-p buff-C)) | ||
| 2573 | (funcall ediff-split-window-function)) | 2601 | (funcall ediff-split-window-function)) |
| 2574 | (switch-to-buffer buff-C) | 2602 | (switch-to-buffer buff-C) |
| 2575 | (balance-windows))) | 2603 | (balance-windows))) |
| @@ -2577,36 +2605,52 @@ temporarily reverses the meaning of this variable." | |||
| 2577 | (message "") | 2605 | (message "") |
| 2578 | )) | 2606 | )) |
| 2579 | 2607 | ||
| 2580 | (defun ediff-janitor (&optional ask) | 2608 | (defun ediff-janitor (ask keep-variants) |
| 2581 | "Kill buffers A, B, and, possibly, C, if these buffers aren't modified. | 2609 | "Kill buffers A, B, and, possibly, C, if these buffers aren't modified. |
| 2582 | In merge jobs, buffer C is never deleted. | 2610 | In merge jobs, buffer C is not deleted here, but rather according to |
| 2583 | However, the side effect of cleaning up may be that you cannot compare the same | 2611 | ediff-quit-merge-hook. |
| 2584 | buffer in two separate Ediff sessions: quitting one of them will delete this | 2612 | A side effect of cleaning up may be that you should be careful when comparing |
| 2585 | buffer in another session as well." | 2613 | the same buffer in two separate Ediff sessions: quitting one of them might |
| 2586 | (or (not (ediff-buffer-live-p ediff-buffer-A)) | 2614 | delete this buffer in another session as well." |
| 2587 | (buffer-modified-p ediff-buffer-A) | 2615 | (ediff-dispose-of-variant-according-to-user |
| 2588 | (and ask | 2616 | ediff-buffer-A 'A ask keep-variants) |
| 2589 | (not (y-or-n-p (format "Kill buffer A [%s]? " | 2617 | (ediff-dispose-of-variant-according-to-user |
| 2590 | (buffer-name ediff-buffer-A))))) | 2618 | ediff-buffer-B 'B ask keep-variants) |
| 2591 | (ediff-kill-buffer-carefully ediff-buffer-A)) | ||
| 2592 | (or (not (ediff-buffer-live-p ediff-buffer-B)) | ||
| 2593 | (buffer-modified-p ediff-buffer-B) | ||
| 2594 | (and ask | ||
| 2595 | (not (y-or-n-p (format "Kill buffer B [%s]? " | ||
| 2596 | (buffer-name ediff-buffer-B))))) | ||
| 2597 | (ediff-kill-buffer-carefully ediff-buffer-B)) | ||
| 2598 | (if ediff-merge-job ; don't del buf C if merging--del ancestor buf instead | 2619 | (if ediff-merge-job ; don't del buf C if merging--del ancestor buf instead |
| 2599 | (or (not (ediff-buffer-live-p ediff-ancestor-buffer)) | 2620 | (ediff-dispose-of-variant-according-to-user |
| 2600 | (buffer-modified-p ediff-ancestor-buffer) | 2621 | ediff-ancestor-buffer 'Ancestor ask keep-variants) |
| 2601 | (and ask | 2622 | (ediff-dispose-of-variant-according-to-user |
| 2602 | (not (y-or-n-p (format "Kill the ancestor buffer [%s]? " | 2623 | ediff-buffer-C 'C ask keep-variants) |
| 2603 | (buffer-name ediff-ancestor-buffer))))) | 2624 | )) |
| 2604 | (ediff-kill-buffer-carefully ediff-ancestor-buffer)) | 2625 | |
| 2605 | (or (not (ediff-buffer-live-p ediff-buffer-C)) | 2626 | ;; Kill the variant buffer, according to user directives (ask, kill |
| 2606 | (buffer-modified-p ediff-buffer-C) | 2627 | ;; unconditionaly, keep) |
| 2607 | (and ask (not (y-or-n-p (format "Kill buffer C [%s]? " | 2628 | ;; BUFF is the buffer, BUFF-TYPE is either 'A, or 'B, 'C, 'Ancestor |
| 2608 | (buffer-name ediff-buffer-C))))) | 2629 | (defun ediff-dispose-of-variant-according-to-user (buff bufftype ask keep-variants) |
| 2609 | (ediff-kill-buffer-carefully ediff-buffer-C)))) | 2630 | ;; if this is indirect buffer, kill it and substitute with direct buf |
| 2631 | (if (ediff-with-current-buffer buff ediff-temp-indirect-buffer) | ||
| 2632 | (let ((wind (ediff-get-visible-buffer-window buff)) | ||
| 2633 | (base (buffer-base-buffer buff)) | ||
| 2634 | (modified-p (buffer-modified-p buff))) | ||
| 2635 | (if (and (window-live-p wind) (ediff-buffer-live-p base)) | ||
| 2636 | (set-window-buffer wind base)) | ||
| 2637 | ;; Kill indirect buffer even if it is modified, because the base buffer | ||
| 2638 | ;; is still there. Note that if the base buffer is dead then so will be | ||
| 2639 | ;; the indirect buffer | ||
| 2640 | (ediff-with-current-buffer buff | ||
| 2641 | (set-buffer-modified-p nil)) | ||
| 2642 | (ediff-kill-buffer-carefully buff) | ||
| 2643 | (ediff-with-current-buffer base | ||
| 2644 | (set-buffer-modified-p modified-p))) | ||
| 2645 | ;; otherwise, ask or use the value of keep-variants | ||
| 2646 | (or (not (ediff-buffer-live-p buff)) | ||
| 2647 | keep-variants | ||
| 2648 | (buffer-modified-p buff) | ||
| 2649 | (and ask | ||
| 2650 | (not (y-or-n-p (format "Kill buffer %S [%s]? " | ||
| 2651 | bufftype (buffer-name buff))))) | ||
| 2652 | (ediff-kill-buffer-carefully buff)) | ||
| 2653 | )) | ||
| 2610 | 2654 | ||
| 2611 | (defun ediff-maybe-save-and-delete-merge (&optional save-and-continue) | 2655 | (defun ediff-maybe-save-and-delete-merge (&optional save-and-continue) |
| 2612 | "Default hook to run on quitting a merge job. | 2656 | "Default hook to run on quitting a merge job. |
| @@ -2625,7 +2669,7 @@ only if this merge job is part of a group, i.e., was invoked from within | |||
| 2625 | (ediff-autostore-merges ; fake ediff-autostore-merges, if necessary | 2669 | (ediff-autostore-merges ; fake ediff-autostore-merges, if necessary |
| 2626 | (if save-and-continue t ediff-autostore-merges))) | 2670 | (if save-and-continue t ediff-autostore-merges))) |
| 2627 | (if ediff-autostore-merges | 2671 | (if ediff-autostore-merges |
| 2628 | (cond ((stringp ediff-merge-store-file) | 2672 | (cond ((stringp merge-store-file) |
| 2629 | ;; store, ask to delete | 2673 | ;; store, ask to delete |
| 2630 | (ediff-write-merge-buffer-and-maybe-kill | 2674 | (ediff-write-merge-buffer-and-maybe-kill |
| 2631 | ediff-buffer-C merge-store-file 'show-file save-and-continue)) | 2675 | ediff-buffer-C merge-store-file 'show-file save-and-continue)) |
| @@ -2647,20 +2691,36 @@ only if this merge job is part of a group, i.e., was invoked from within | |||
| 2647 | (defun ediff-write-merge-buffer-and-maybe-kill (buf file | 2691 | (defun ediff-write-merge-buffer-and-maybe-kill (buf file |
| 2648 | &optional | 2692 | &optional |
| 2649 | show-file save-and-continue) | 2693 | show-file save-and-continue) |
| 2650 | (ediff-with-current-buffer buf | 2694 | (if (not (eq (find-buffer-visiting file) buf)) |
| 2651 | (if (or (not (file-exists-p file)) | 2695 | (let ((warn-message |
| 2652 | (y-or-n-p (format "File %s exists, overwrite? " file))) | 2696 | (format "Another buffer is visiting file %s. Too dangerous to save the merge buffer" |
| 2653 | (progn | 2697 | file))) |
| 2654 | (write-region (point-min) (point-max) file) | 2698 | (beep) |
| 2655 | (if show-file | 2699 | (message warn-message) |
| 2656 | (progn | 2700 | (with-output-to-temp-buffer ediff-msg-buffer |
| 2657 | (message "Merge buffer saved in: %s" file) | 2701 | (princ "\n\n") |
| 2658 | (set-buffer-modified-p nil) | 2702 | (princ warn-message) |
| 2659 | (sit-for 3))) | 2703 | (princ "\n\n") |
| 2660 | (if (and | 2704 | ) |
| 2661 | (not save-and-continue) | 2705 | (sit-for 2)) |
| 2662 | (y-or-n-p "Merge buffer saved. Now kill the buffer? ")) | 2706 | (ediff-with-current-buffer buf |
| 2663 | (ediff-kill-buffer-carefully buf)))))) | 2707 | (if (or (not (file-exists-p file)) |
| 2708 | (y-or-n-p (format "File %s exists, overwrite? " file))) | ||
| 2709 | (progn | ||
| 2710 | ;;(write-region (point-min) (point-max) file) | ||
| 2711 | (ediff-with-current-buffer buf | ||
| 2712 | (set-visited-file-name file) | ||
| 2713 | (save-buffer)) | ||
| 2714 | (if show-file | ||
| 2715 | (progn | ||
| 2716 | (message "Merge buffer saved in: %s" file) | ||
| 2717 | (set-buffer-modified-p nil) | ||
| 2718 | (sit-for 3))) | ||
| 2719 | (if (and | ||
| 2720 | (not save-and-continue) | ||
| 2721 | (y-or-n-p "Merge buffer saved. Now kill the buffer? ")) | ||
| 2722 | (ediff-kill-buffer-carefully buf))))) | ||
| 2723 | )) | ||
| 2664 | 2724 | ||
| 2665 | ;; The default way of suspending Ediff. | 2725 | ;; The default way of suspending Ediff. |
| 2666 | ;; Buries Ediff buffers, kills all windows. | 2726 | ;; Buries Ediff buffers, kills all windows. |
| @@ -2926,13 +2986,102 @@ Hit \\[ediff-recenter] to reset the windows afterward." | |||
| 2926 | ))) | 2986 | ))) |
| 2927 | 2987 | ||
| 2928 | 2988 | ||
| 2989 | |||
| 2990 | (defun ediff-highlight-diff-in-one-buffer (n buf-type) | ||
| 2991 | (if (ediff-buffer-live-p (ediff-get-buffer buf-type)) | ||
| 2992 | (let* ((buff (ediff-get-buffer buf-type)) | ||
| 2993 | (last (ediff-with-current-buffer buff (point-max))) | ||
| 2994 | (begin (ediff-get-diff-posn buf-type 'beg n)) | ||
| 2995 | (end (ediff-get-diff-posn buf-type 'end n)) | ||
| 2996 | (xtra (if (equal begin end) 1 0)) | ||
| 2997 | (end-hilit (min last (+ end xtra))) | ||
| 2998 | (current-diff-overlay | ||
| 2999 | (symbol-value | ||
| 3000 | (ediff-get-symbol-from-alist | ||
| 3001 | buf-type ediff-current-diff-overlay-alist)))) | ||
| 3002 | |||
| 3003 | (if ediff-xemacs-p | ||
| 3004 | (ediff-move-overlay current-diff-overlay begin end-hilit) | ||
| 3005 | (ediff-move-overlay current-diff-overlay begin end-hilit buff)) | ||
| 3006 | (ediff-overlay-put current-diff-overlay 'priority | ||
| 3007 | (ediff-highest-priority begin end-hilit buff)) | ||
| 3008 | (ediff-overlay-put current-diff-overlay 'ediff-diff-num n) | ||
| 3009 | |||
| 3010 | ;; unhighlight the background overlay for diff n so it won't | ||
| 3011 | ;; interfere with the current diff overlay | ||
| 3012 | (ediff-set-overlay-face (ediff-get-diff-overlay n buf-type) nil) | ||
| 3013 | ))) | ||
| 3014 | |||
| 3015 | |||
| 3016 | (defun ediff-unhighlight-diff-in-one-buffer (buf-type) | ||
| 3017 | (if (ediff-buffer-live-p (ediff-get-buffer buf-type)) | ||
| 3018 | (let ((current-diff-overlay | ||
| 3019 | (symbol-value | ||
| 3020 | (ediff-get-symbol-from-alist | ||
| 3021 | buf-type ediff-current-diff-overlay-alist))) | ||
| 3022 | (overlay | ||
| 3023 | (ediff-get-diff-overlay ediff-current-difference buf-type)) | ||
| 3024 | ) | ||
| 3025 | |||
| 3026 | (ediff-move-overlay current-diff-overlay 1 1) | ||
| 3027 | |||
| 3028 | ;; rehighlight the overlay in the background of the | ||
| 3029 | ;; current difference region | ||
| 3030 | (ediff-set-overlay-face | ||
| 3031 | overlay | ||
| 3032 | (if (and (ediff-has-face-support-p) | ||
| 3033 | ediff-use-faces ediff-highlight-all-diffs) | ||
| 3034 | (ediff-background-face buf-type ediff-current-difference))) | ||
| 3035 | ))) | ||
| 3036 | |||
| 3037 | (defun ediff-unhighlight-diffs-totally-in-one-buffer (buf-type) | ||
| 3038 | (ediff-unselect-and-select-difference -1) | ||
| 3039 | (if (and (ediff-has-face-support-p) ediff-use-faces) | ||
| 3040 | (let* ((inhibit-quit t) | ||
| 3041 | (current-diff-overlay-var | ||
| 3042 | (ediff-get-symbol-from-alist | ||
| 3043 | buf-type ediff-current-diff-overlay-alist)) | ||
| 3044 | (current-diff-overlay (symbol-value current-diff-overlay-var))) | ||
| 3045 | (ediff-paint-background-regions 'unhighlight) | ||
| 3046 | (if (ediff-overlayp current-diff-overlay) | ||
| 3047 | (ediff-delete-overlay current-diff-overlay)) | ||
| 3048 | (set current-diff-overlay-var nil) | ||
| 3049 | ))) | ||
| 3050 | |||
| 3051 | |||
| 3052 | (defsubst ediff-highlight-diff (n) | ||
| 3053 | "Put face on diff N. Invoked for X displays only." | ||
| 3054 | (ediff-highlight-diff-in-one-buffer n 'A) | ||
| 3055 | (ediff-highlight-diff-in-one-buffer n 'B) | ||
| 3056 | (ediff-highlight-diff-in-one-buffer n 'C) | ||
| 3057 | (ediff-highlight-diff-in-one-buffer n 'Ancestor) | ||
| 3058 | ) | ||
| 3059 | |||
| 3060 | |||
| 3061 | (defsubst ediff-unhighlight-diff () | ||
| 3062 | "Remove overlays from buffers A, B, and C." | ||
| 3063 | (ediff-unhighlight-diff-in-one-buffer 'A) | ||
| 3064 | (ediff-unhighlight-diff-in-one-buffer 'B) | ||
| 3065 | (ediff-unhighlight-diff-in-one-buffer 'C) | ||
| 3066 | (ediff-unhighlight-diff-in-one-buffer 'Ancestor) | ||
| 3067 | ) | ||
| 3068 | |||
| 3069 | ;; delete highlighting overlays, restore faces to their original form | ||
| 3070 | (defsubst ediff-unhighlight-diffs-totally () | ||
| 3071 | (ediff-unhighlight-diffs-totally-in-one-buffer 'A) | ||
| 3072 | (ediff-unhighlight-diffs-totally-in-one-buffer 'B) | ||
| 3073 | (ediff-unhighlight-diffs-totally-in-one-buffer 'C) | ||
| 3074 | (ediff-unhighlight-diffs-totally-in-one-buffer 'Ancestor) | ||
| 3075 | ) | ||
| 3076 | |||
| 3077 | |||
| 2929 | ;; This is adapted from a similar function in `emerge.el'. | 3078 | ;; This is adapted from a similar function in `emerge.el'. |
| 2930 | ;; PROMPT should not have a trailing ': ', so that it can be modified | 3079 | ;; PROMPT should not have a trailing ': ', so that it can be modified |
| 2931 | ;; according to context. | 3080 | ;; according to context. |
| 2932 | ;; If DEFAULT-FILE is set, it should be used as the default value. | 3081 | ;; If DEFAULT-FILE is set, it should be used as the default value. |
| 2933 | ;; If DEFAULT-DIR is non-nil, use it as the default directory. | 3082 | ;; If DEFAULT-DIR is non-nil, use it as the default directory. |
| 2934 | ;; Otherwise, use the value of Emacs' variable `default-directory.' | 3083 | ;; Otherwise, use the value of Emacs' variable `default-directory.' |
| 2935 | (defun ediff-read-file-name (prompt default-dir default-file) | 3084 | (defun ediff-read-file-name (prompt default-dir default-file &optional no-dirs) |
| 2936 | ;; hack default-dir if it is not set | 3085 | ;; hack default-dir if it is not set |
| 2937 | (setq default-dir | 3086 | (setq default-dir |
| 2938 | (file-name-as-directory | 3087 | (file-name-as-directory |
| @@ -2963,13 +3112,15 @@ Hit \\[ediff-recenter] to reset the windows afterward." | |||
| 2963 | ) | 3112 | ) |
| 2964 | default-dir | 3113 | default-dir |
| 2965 | )) | 3114 | )) |
| 2966 | ;; If user enters a directory name, expand the default file in that | 3115 | ;; If user entered a directory name, expand the default file in that |
| 2967 | ;; directory. This allows the user to enter a directory name for the | 3116 | ;; directory. This allows the user to enter a directory name for the |
| 2968 | ;; B-file and diff against the default-file in that directory instead | 3117 | ;; B-file and diff against the default-file in that directory instead |
| 2969 | ;; of a DIRED listing! | 3118 | ;; of a DIRED listing! |
| 2970 | (if (and (file-directory-p f) default-file) | 3119 | (if (and (file-directory-p f) default-file) |
| 2971 | (setq f (expand-file-name | 3120 | (setq f (expand-file-name |
| 2972 | (file-name-nondirectory default-file) f))) | 3121 | (file-name-nondirectory default-file) f))) |
| 3122 | (if (and no-dirs (file-directory-p f)) | ||
| 3123 | (error "File %s is a directory" f)) | ||
| 2973 | f)) | 3124 | f)) |
| 2974 | 3125 | ||
| 2975 | ;; If PREFIX is given, then it is used as a prefix for the temp file | 3126 | ;; If PREFIX is given, then it is used as a prefix for the temp file |
| @@ -3031,7 +3182,13 @@ Hit \\[ediff-recenter] to reset the windows afterward." | |||
| 3031 | (progn | 3182 | (progn |
| 3032 | (if (or (file-exists-p file) (not keep-proposed-name)) | 3183 | (if (or (file-exists-p file) (not keep-proposed-name)) |
| 3033 | (setq file (make-temp-name proposed-name))) | 3184 | (setq file (make-temp-name proposed-name))) |
| 3034 | (write-region "" nil file nil 'silent nil 'excl) | 3185 | ;; the with-temp-buffer thing is a workaround for an XEmacs |
| 3186 | ;; bug: write-region complains that we are trying to visit a | ||
| 3187 | ;; file in an indirect buffer, failing to notice that the | ||
| 3188 | ;; VISIT flag is unset and that we are actually writing from a | ||
| 3189 | ;; string and not from any buffer. | ||
| 3190 | (with-temp-buffer | ||
| 3191 | (write-region "" nil file nil 'silent nil 'excl)) | ||
| 3035 | nil) | 3192 | nil) |
| 3036 | (file-already-exists t)) | 3193 | (file-already-exists t)) |
| 3037 | ;; the file was somehow created by someone else between | 3194 | ;; the file was somehow created by someone else between |
| @@ -3064,7 +3221,8 @@ Hit \\[ediff-recenter] to reset the windows afterward." | |||
| 3064 | (if (buffer-modified-p) | 3221 | (if (buffer-modified-p) |
| 3065 | ;; If buffer is not obsolete and is modified, offer to save | 3222 | ;; If buffer is not obsolete and is modified, offer to save |
| 3066 | (if (yes-or-no-p | 3223 | (if (yes-or-no-p |
| 3067 | (format "Buffer out of sync with visited file. Save file %s? " | 3224 | (format "Buffer %s has been modified. Save it in file %s? " |
| 3225 | (buffer-name) | ||
| 3068 | buffer-file-name)) | 3226 | buffer-file-name)) |
| 3069 | (condition-case nil | 3227 | (condition-case nil |
| 3070 | (save-buffer) | 3228 | (save-buffer) |
| @@ -3076,7 +3234,9 @@ Hit \\[ediff-recenter] to reset the windows afterward." | |||
| 3076 | nil) | 3234 | nil) |
| 3077 | ;; If buffer is obsolete, offer to revert | 3235 | ;; If buffer is obsolete, offer to revert |
| 3078 | (if (yes-or-no-p | 3236 | (if (yes-or-no-p |
| 3079 | (format "Buffer is out of sync with visited file. REVERT file %s? " | 3237 | (format "File %s was modified since visited by buffer %s. REVERT file %s? " |
| 3238 | buffer-file-name | ||
| 3239 | (buffer-name) | ||
| 3080 | buffer-file-name)) | 3240 | buffer-file-name)) |
| 3081 | (progn | 3241 | (progn |
| 3082 | (if file-magic | 3242 | (if file-magic |
| @@ -3084,6 +3244,29 @@ Hit \\[ediff-recenter] to reset the windows afterward." | |||
| 3084 | (revert-buffer t t)) | 3244 | (revert-buffer t t)) |
| 3085 | (error "Buffer out of sync for file %s" buffer-file-name)))) | 3245 | (error "Buffer out of sync for file %s" buffer-file-name)))) |
| 3086 | 3246 | ||
| 3247 | ;; if there is another buffer visiting the file of the merge buffer, offer to | ||
| 3248 | ;; save and delete the buffer; else bark | ||
| 3249 | (defun ediff-verify-file-merge-buffer (file) | ||
| 3250 | (let ((buff (if (stringp file) (find-buffer-visiting file))) | ||
| 3251 | warn-message) | ||
| 3252 | (or (null buff) | ||
| 3253 | (progn | ||
| 3254 | (setq warn-message | ||
| 3255 | (format "Buffer %s is visiting %s. Save and kill the buffer? " | ||
| 3256 | (buffer-name buff) file)) | ||
| 3257 | (with-output-to-temp-buffer ediff-msg-buffer | ||
| 3258 | (princ "\n\n") | ||
| 3259 | (princ warn-message) | ||
| 3260 | (princ "\n\n")) | ||
| 3261 | (if (y-or-n-p | ||
| 3262 | (message warn-message)) | ||
| 3263 | (with-current-buffer buff | ||
| 3264 | (save-buffer) | ||
| 3265 | (kill-buffer (current-buffer))) | ||
| 3266 | (error "Too dangerous to merge versions of a file visited by another buffer")))) | ||
| 3267 | )) | ||
| 3268 | |||
| 3269 | |||
| 3087 | 3270 | ||
| 3088 | (defun ediff-filename-magic-p (file) | 3271 | (defun ediff-filename-magic-p (file) |
| 3089 | (or (ediff-file-compressed-p file) | 3272 | (or (ediff-file-compressed-p file) |
| @@ -3387,6 +3570,40 @@ Ediff Control Panel to restore highlighting." | |||
| 3387 | (ediff-overlay-put curr-overl 'after-string flag)) | 3570 | (ediff-overlay-put curr-overl 'after-string flag)) |
| 3388 | )) | 3571 | )) |
| 3389 | 3572 | ||
| 3573 | |||
| 3574 | ;;; Some diff region tests | ||
| 3575 | |||
| 3576 | ;; t if diff region is empty. | ||
| 3577 | ;; In case of buffer C, t also if it is not a 3way | ||
| 3578 | ;; comparison job (merging jobs return t as well). | ||
| 3579 | (defun ediff-empty-diff-region-p (n buf-type) | ||
| 3580 | (if (eq buf-type 'C) | ||
| 3581 | (or (not ediff-3way-comparison-job) | ||
| 3582 | (= (ediff-get-diff-posn 'C 'beg n) | ||
| 3583 | (ediff-get-diff-posn 'C 'end n))) | ||
| 3584 | (= (ediff-get-diff-posn buf-type 'beg n) | ||
| 3585 | (ediff-get-diff-posn buf-type 'end n)))) | ||
| 3586 | |||
| 3587 | ;; Test if diff region is white space only. | ||
| 3588 | ;; If 2-way job and buf-type = C, then returns t. | ||
| 3589 | (defun ediff-whitespace-diff-region-p (n buf-type) | ||
| 3590 | (or (and (eq buf-type 'C) (not ediff-3way-job)) | ||
| 3591 | (ediff-empty-diff-region-p n buf-type) | ||
| 3592 | (let ((beg (ediff-get-diff-posn buf-type 'beg n)) | ||
| 3593 | (end (ediff-get-diff-posn buf-type 'end n))) | ||
| 3594 | (ediff-with-current-buffer (ediff-get-buffer buf-type) | ||
| 3595 | (save-excursion | ||
| 3596 | (goto-char beg) | ||
| 3597 | (skip-chars-forward ediff-whitespace) | ||
| 3598 | (>= (point) end)))))) | ||
| 3599 | |||
| 3600 | |||
| 3601 | (defsubst ediff-get-region-contents (n buf-type ctrl-buf &optional start end) | ||
| 3602 | (ediff-with-current-buffer | ||
| 3603 | (ediff-with-current-buffer ctrl-buf (ediff-get-buffer buf-type)) | ||
| 3604 | (buffer-substring | ||
| 3605 | (or start (ediff-get-diff-posn buf-type 'beg n ctrl-buf)) | ||
| 3606 | (or end (ediff-get-diff-posn buf-type 'end n ctrl-buf))))) | ||
| 3390 | 3607 | ||
| 3391 | ;; Returns positions of difference sectors in the BUF-TYPE buffer. | 3608 | ;; Returns positions of difference sectors in the BUF-TYPE buffer. |
| 3392 | ;; BUF-TYPE should be a symbol -- `A', `B', or `C'. | 3609 | ;; BUF-TYPE should be a symbol -- `A', `B', or `C'. |
| @@ -3467,10 +3684,11 @@ Ediff Control Panel to restore highlighting." | |||
| 3467 | (or (number-or-marker-p end) | 3684 | (or (number-or-marker-p end) |
| 3468 | (setq end (eval end))) | 3685 | (setq end (eval end))) |
| 3469 | (setq overl | 3686 | (setq overl |
| 3470 | (if ediff-xemacs-p | 3687 | (ediff-cond-compile-for-xemacs-or-emacs |
| 3471 | (make-extent beg end buff) | 3688 | (make-extent beg end buff) ; xemacs |
| 3472 | ;; advance front and rear of the overlay | 3689 | ;; advance front and rear of the overlay |
| 3473 | (make-overlay beg end buff nil 'rear-advance))) | 3690 | (make-overlay beg end buff nil 'rear-advance) ; emacs |
| 3691 | )) | ||
| 3474 | 3692 | ||
| 3475 | ;; never detach | 3693 | ;; never detach |
| 3476 | (ediff-overlay-put | 3694 | (ediff-overlay-put |
| @@ -3483,6 +3701,22 @@ Ediff Control Panel to restore highlighting." | |||
| 3483 | (ediff-overlay-put overl 'end-open nil))) | 3701 | (ediff-overlay-put overl 'end-open nil))) |
| 3484 | (ediff-overlay-put overl 'ediff-diff-num 0) | 3702 | (ediff-overlay-put overl 'ediff-diff-num 0) |
| 3485 | overl)))) | 3703 | overl)))) |
| 3704 | |||
| 3705 | |||
| 3706 | (defun ediff-make-current-diff-overlay (type) | ||
| 3707 | (if (ediff-has-face-support-p) | ||
| 3708 | (let ((overlay (ediff-get-symbol-from-alist | ||
| 3709 | type ediff-current-diff-overlay-alist)) | ||
| 3710 | (buffer (ediff-get-buffer type)) | ||
| 3711 | (face (face-name | ||
| 3712 | (symbol-value | ||
| 3713 | (ediff-get-symbol-from-alist | ||
| 3714 | type ediff-current-diff-face-alist))))) | ||
| 3715 | (set overlay | ||
| 3716 | (ediff-make-bullet-proof-overlay (point-max) (point-max) buffer)) | ||
| 3717 | (ediff-set-overlay-face (symbol-value overlay) face) | ||
| 3718 | (ediff-overlay-put (symbol-value overlay) 'ediff ediff-control-buffer)) | ||
| 3719 | )) | ||
| 3486 | 3720 | ||
| 3487 | 3721 | ||
| 3488 | ;; Like other-buffer, but prefers visible buffers and ignores temporary or | 3722 | ;; Like other-buffer, but prefers visible buffers and ignores temporary or |
| @@ -3695,7 +3929,7 @@ Mail anyway? (y or n) ") | |||
| 3695 | (set-buffer ctl-buf)) | 3929 | (set-buffer ctl-buf)) |
| 3696 | (setq buffer-name (buffer-name)) | 3930 | (setq buffer-name (buffer-name)) |
| 3697 | (require 'reporter) | 3931 | (require 'reporter) |
| 3698 | (reporter-submit-bug-report "kifer@cs.sunysb.edu" | 3932 | (reporter-submit-bug-report "kifer@cs.stonybrook.edu" |
| 3699 | (ediff-version) | 3933 | (ediff-version) |
| 3700 | varlist | 3934 | varlist |
| 3701 | nil | 3935 | nil |
| @@ -3729,13 +3963,15 @@ Mail anyway? (y or n) ") | |||
| 3729 | 3963 | ||
| 3730 | 3964 | ||
| 3731 | (defun ediff-deactivate-mark () | 3965 | (defun ediff-deactivate-mark () |
| 3732 | (if ediff-xemacs-p | 3966 | (ediff-cond-compile-for-xemacs-or-emacs |
| 3733 | (zmacs-deactivate-region) | 3967 | (zmacs-deactivate-region) ; xemacs |
| 3734 | (deactivate-mark))) | 3968 | (deactivate-mark) ; emacs |
| 3969 | )) | ||
| 3735 | (defun ediff-activate-mark () | 3970 | (defun ediff-activate-mark () |
| 3736 | (if ediff-emacs-p | 3971 | (ediff-cond-compile-for-xemacs-or-emacs |
| 3737 | (setq mark-active t) | 3972 | (zmacs-activate-region) ; xemacs |
| 3738 | (zmacs-activate-region))) | 3973 | (setq mark-active t) ; emacs |
| 3974 | )) | ||
| 3739 | 3975 | ||
| 3740 | (cond ((fboundp 'nuke-selective-display) | 3976 | (cond ((fboundp 'nuke-selective-display) |
| 3741 | ;; XEmacs 19.12 has nuke-selective-display | 3977 | ;; XEmacs 19.12 has nuke-selective-display |
| @@ -3848,8 +4084,10 @@ Mail anyway? (y or n) ") | |||
| 3848 | (interactive) | 4084 | (interactive) |
| 3849 | (ediff-barf-if-not-control-buffer) | 4085 | (ediff-barf-if-not-control-buffer) |
| 3850 | 4086 | ||
| 3851 | (if ediff-xemacs-p | 4087 | (ediff-cond-compile-for-xemacs-or-emacs |
| 3852 | (make-local-hook 'post-command-hook)) | 4088 | (make-local-hook 'post-command-hook) ; xemacs form |
| 4089 | nil ; emacs form | ||
| 4090 | ) | ||
| 3853 | 4091 | ||
| 3854 | (let ((pre-hook 'pre-command-hook) | 4092 | (let ((pre-hook 'pre-command-hook) |
| 3855 | (post-hook 'post-command-hook)) | 4093 | (post-hook 'post-command-hook)) |
| @@ -3910,6 +4148,16 @@ Mail anyway? (y or n) ") | |||
| 3910 | (setq lis (cdr lis))) | 4148 | (setq lis (cdr lis))) |
| 3911 | lis) | 4149 | lis) |
| 3912 | 4150 | ||
| 4151 | ;; Make a readable representation of the invocation sequence for FUNC-DEF. | ||
| 4152 | ;; It would either be a key or M-x something. | ||
| 4153 | (defun ediff-format-bindings-of (func-def) | ||
| 4154 | (let ((desc (car (where-is-internal func-def | ||
| 4155 | overriding-local-map | ||
| 4156 | nil nil)))) | ||
| 4157 | (if desc | ||
| 4158 | (key-description desc) | ||
| 4159 | (format "M-x %s" func-def)))) | ||
| 4160 | |||
| 3913 | ;; this uses comparison-func to decide who is a member, and this determines how | 4161 | ;; this uses comparison-func to decide who is a member, and this determines how |
| 3914 | ;; intersection looks like | 4162 | ;; intersection looks like |
| 3915 | (defun ediff-intersection (lis1 lis2 comparison-func) | 4163 | (defun ediff-intersection (lis1 lis2 comparison-func) |
| @@ -3945,7 +4193,7 @@ Mail anyway? (y or n) ") | |||
| 3945 | (cdr result))) | 4193 | (cdr result))) |
| 3946 | 4194 | ||
| 3947 | (if (fboundp 'copy-sequence) | 4195 | (if (fboundp 'copy-sequence) |
| 3948 | (defalias 'ediff-copy-list 'copy-sequence) | 4196 | (fset 'ediff-copy-list (symbol-function 'copy-sequence)) |
| 3949 | (defun ediff-copy-list (list) | 4197 | (defun ediff-copy-list (list) |
| 3950 | (if (consp list) | 4198 | (if (consp list) |
| 3951 | ;;;(let ((res nil)) | 4199 | ;;;(let ((res nil)) |
diff --git a/lisp/ediff-vers.el b/lisp/ediff-vers.el index 4c502813c1d..88d4ea16d7b 100644 --- a/lisp/ediff-vers.el +++ b/lisp/ediff-vers.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; ediff-vers.el --- version control interface to Ediff | 1 | ;;; ediff-vers.el --- version control interface to Ediff |
| 2 | 2 | ||
| 3 | ;;; Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. | 3 | ;;; Copyright (C) 1995, 96, 97, 2002 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 5 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 6 | 6 | ||
| 7 | ;; This file is part of GNU Emacs. | 7 | ;; This file is part of GNU Emacs. |
| 8 | 8 | ||
| @@ -35,16 +35,20 @@ | |||
| 35 | 35 | ||
| 36 | (and noninteractive | 36 | (and noninteractive |
| 37 | (eval-when-compile | 37 | (eval-when-compile |
| 38 | (load "pcl-cvs" 'noerror) | 38 | (let ((load-path (cons (expand-file-name ".") load-path))) |
| 39 | (load "rcs" 'noerror) | 39 | (load "pcl-cvs" 'noerror) |
| 40 | ;; On 8+3 MS-DOS filesystems, generic-x.el is loaded | 40 | (load "rcs" 'noerror) |
| 41 | ;; instead of (the missing) generic-sc.el. Since the | 41 | ;; On 8+3 MS-DOS filesystems, generic-x.el is loaded |
| 42 | ;; version of Emacs which supports MS-DOS doesn't have | 42 | ;; instead of (the missing) generic-sc.el. Since the |
| 43 | ;; generic-sc, we simply avoid loading it. | 43 | ;; version of Emacs which supports MS-DOS doesn't have |
| 44 | (or (and (fboundp 'msdos-long-file-names) | 44 | ;; generic-sc, we simply avoid loading it. |
| 45 | (not (msdos-long-file-names))) | 45 | (or (and (fboundp 'msdos-long-file-names) |
| 46 | (load "generic-sc" 'noerror)) | 46 | (not (msdos-long-file-names))) |
| 47 | (load "vc" 'noerror))) | 47 | (load "generic-sc" 'noerror)) |
| 48 | ;; (load "vc" 'noerror) ; this sometimes causes compiler error | ||
| 49 | (or (featurep 'ediff-init) | ||
| 50 | (load "ediff-init.el" nil nil 'nosuffix)) | ||
| 51 | ))) | ||
| 48 | ;; end pacifier | 52 | ;; end pacifier |
| 49 | 53 | ||
| 50 | ;; VC.el support | 54 | ;; VC.el support |
| @@ -246,7 +250,7 @@ | |||
| 246 | 250 | ||
| 247 | ;; PCL-CVS.el support | 251 | ;; PCL-CVS.el support |
| 248 | 252 | ||
| 249 | 253 | ;; MK: Check. This function doesn't seem to be used any more by pcvs or pcl-cvs | |
| 250 | (defun cvs-run-ediff-on-file-descriptor (tin) | 254 | (defun cvs-run-ediff-on-file-descriptor (tin) |
| 251 | ;; This is a replacement for cvs-emerge-mode | 255 | ;; This is a replacement for cvs-emerge-mode |
| 252 | ;; Runs after cvs-update. | 256 | ;; Runs after cvs-update. |
diff --git a/lisp/ediff-wind.el b/lisp/ediff-wind.el index 4a0928997bd..ede3e569ae0 100644 --- a/lisp/ediff-wind.el +++ b/lisp/ediff-wind.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; ediff-wind.el --- window manipulation utilities | 1 | ;;; ediff-wind.el --- window manipulation utilities |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994, 95, 96, 97, 2000, 01, 02 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 5 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 6 | 6 | ||
| 7 | ;; This file is part of GNU Emacs. | 7 | ;; This file is part of GNU Emacs. |
| 8 | 8 | ||
| @@ -36,6 +36,7 @@ | |||
| 36 | (defvar left-toolbar-width) | 36 | (defvar left-toolbar-width) |
| 37 | (defvar right-toolbar-width) | 37 | (defvar right-toolbar-width) |
| 38 | (defvar default-menubar) | 38 | (defvar default-menubar) |
| 39 | (defvar top-gutter) | ||
| 39 | (defvar frame-icon-title-format) | 40 | (defvar frame-icon-title-format) |
| 40 | (defvar ediff-diff-status) | 41 | (defvar ediff-diff-status) |
| 41 | (defvar ediff-emacs-p) | 42 | (defvar ediff-emacs-p) |
| @@ -271,35 +272,39 @@ into icons, regardless of the window manager." | |||
| 271 | (beep 1)) | 272 | (beep 1)) |
| 272 | (message "Please click on Window %d " wind-number)) | 273 | (message "Please click on Window %d " wind-number)) |
| 273 | (ediff-read-event) ; discard event | 274 | (ediff-read-event) ; discard event |
| 274 | (setq wind (if ediff-xemacs-p | 275 | (setq wind (ediff-cond-compile-for-xemacs-or-emacs |
| 275 | (event-window event) | 276 | (event-window event) ; xemacs |
| 276 | (posn-window (event-start event)))) | 277 | (posn-window (event-start event)) ; emacs |
| 278 | ) | ||
| 279 | ) | ||
| 277 | )) | 280 | )) |
| 278 | 281 | ||
| 279 | 282 | ||
| 280 | ;; Select the lowest window on the frame. | 283 | ;; Select the lowest window on the frame. |
| 281 | (defun ediff-select-lowest-window () | 284 | (defun ediff-select-lowest-window () |
| 282 | (if ediff-xemacs-p | 285 | (ediff-cond-compile-for-xemacs-or-emacs |
| 283 | (select-window (frame-lowest-window)) | 286 | (select-window (frame-lowest-window)) ; xemacs |
| 284 | (let* ((lowest-window (selected-window)) | 287 | ;; emacs |
| 285 | (bottom-edge (car (cdr (cdr (cdr (window-edges)))))) | 288 | (let* ((lowest-window (selected-window)) |
| 286 | (last-window (save-excursion | 289 | (bottom-edge (car (cdr (cdr (cdr (window-edges)))))) |
| 287 | (other-window -1) (selected-window))) | 290 | (last-window (save-excursion |
| 288 | (window-search t)) | 291 | (other-window -1) (selected-window))) |
| 289 | (while window-search | 292 | (window-search t)) |
| 290 | (let* ((this-window (next-window)) | 293 | (while window-search |
| 291 | (next-bottom-edge | 294 | (let* ((this-window (next-window)) |
| 292 | (car (cdr (cdr (cdr (window-edges this-window))))))) | 295 | (next-bottom-edge |
| 293 | (if (< bottom-edge next-bottom-edge) | 296 | (car (cdr (cdr (cdr (window-edges this-window))))))) |
| 294 | (progn | 297 | (if (< bottom-edge next-bottom-edge) |
| 295 | (setq bottom-edge next-bottom-edge) | 298 | (progn |
| 296 | (setq lowest-window this-window))) | 299 | (setq bottom-edge next-bottom-edge) |
| 297 | 300 | (setq lowest-window this-window))) | |
| 298 | (select-window this-window) | 301 | |
| 299 | (if (eq last-window this-window) | 302 | (select-window this-window) |
| 300 | (progn | 303 | (if (eq last-window this-window) |
| 301 | (select-window lowest-window) | 304 | (progn |
| 302 | (setq window-search nil)))))))) | 305 | (select-window lowest-window) |
| 306 | (setq window-search nil)))))) | ||
| 307 | )) | ||
| 303 | 308 | ||
| 304 | 309 | ||
| 305 | ;;; Common window setup routines | 310 | ;;; Common window setup routines |
| @@ -845,7 +850,7 @@ into icons, regardless of the window manager." | |||
| 845 | (ediff-frame-has-dedicated-windows (selected-frame)) | 850 | (ediff-frame-has-dedicated-windows (selected-frame)) |
| 846 | (ediff-frame-iconified-p (selected-frame)) | 851 | (ediff-frame-iconified-p (selected-frame)) |
| 847 | ;; skip small windows | 852 | ;; skip small windows |
| 848 | (< (window-height (selected-window)) | 853 | (< (frame-height (selected-frame)) |
| 849 | (* 3 window-min-height)) | 854 | (* 3 window-min-height)) |
| 850 | (if ok-unsplittable | 855 | (if ok-unsplittable |
| 851 | nil | 856 | nil |
| @@ -896,7 +901,10 @@ into icons, regardless of the window manager." | |||
| 896 | fheight fwidth adjusted-parameters) | 901 | fheight fwidth adjusted-parameters) |
| 897 | 902 | ||
| 898 | (ediff-with-current-buffer ctl-buffer | 903 | (ediff-with-current-buffer ctl-buffer |
| 899 | (if ediff-xemacs-p (set-buffer-menubar nil)) | 904 | (ediff-cond-compile-for-xemacs-or-emacs |
| 905 | (set-buffer-menubar nil) ; xemacs | ||
| 906 | nil ; emacs | ||
| 907 | ) | ||
| 900 | ;;(setq user-grabbed-mouse (ediff-user-grabbed-mouse)) | 908 | ;;(setq user-grabbed-mouse (ediff-user-grabbed-mouse)) |
| 901 | (run-hooks 'ediff-before-setup-control-frame-hook)) | 909 | (run-hooks 'ediff-before-setup-control-frame-hook)) |
| 902 | 910 | ||
| @@ -908,8 +916,11 @@ into icons, regardless of the window manager." | |||
| 908 | ediff-control-frame ctl-frame) | 916 | ediff-control-frame ctl-frame) |
| 909 | ;; protect against undefined face-attribute | 917 | ;; protect against undefined face-attribute |
| 910 | (condition-case nil | 918 | (condition-case nil |
| 911 | (when (and ediff-emacs-p (face-attribute 'mode-line :box)) | 919 | (ediff-cond-compile-for-xemacs-or-emacs |
| 912 | (set-face-attribute 'mode-line ctl-frame :box nil)) | 920 | nil ; xemacs |
| 921 | (when (face-attribute 'mode-line :box) | ||
| 922 | (set-face-attribute 'mode-line ctl-frame :box nil)) | ||
| 923 | ) | ||
| 913 | (error)) | 924 | (error)) |
| 914 | ) | 925 | ) |
| 915 | 926 | ||
| @@ -955,14 +966,19 @@ into icons, regardless of the window manager." | |||
| 955 | ;; In XEmacs, buffer menubar needs to be killed before frame parameters | 966 | ;; In XEmacs, buffer menubar needs to be killed before frame parameters |
| 956 | ;; are changed. | 967 | ;; are changed. |
| 957 | (if (ediff-has-toolbar-support-p) | 968 | (if (ediff-has-toolbar-support-p) |
| 958 | (progn | 969 | (ediff-cond-compile-for-xemacs-or-emacs |
| 959 | (set-specifier top-toolbar-height (list ctl-frame 2)) | 970 | (progn ; xemacs |
| 960 | (sit-for 0) | 971 | (set-specifier top-toolbar-height (list ctl-frame 2)) |
| 961 | (set-specifier top-toolbar-height (list ctl-frame 0)) | 972 | (set-specifier top-gutter (list ctl-frame nil)) |
| 962 | ;;(set-specifier bottom-toolbar-height (list ctl-frame 0)) | 973 | (sit-for 0) |
| 963 | (set-specifier left-toolbar-width (list ctl-frame 0)) | 974 | (set-specifier top-toolbar-height (list ctl-frame 0)) |
| 964 | (set-specifier right-toolbar-width (list ctl-frame 0)) | 975 | ;;(set-specifier bottom-toolbar-height (list ctl-frame 0)) |
| 965 | )) | 976 | (set-specifier left-toolbar-width (list ctl-frame 0)) |
| 977 | (set-specifier right-toolbar-width (list ctl-frame 0)) | ||
| 978 | ) | ||
| 979 | nil ; emacs | ||
| 980 | ) | ||
| 981 | ) | ||
| 966 | 982 | ||
| 967 | ;; Under OS/2 (emx) we have to call modify frame parameters twice, in order | 983 | ;; Under OS/2 (emx) we have to call modify frame parameters twice, in order |
| 968 | ;; to make sure that at least once we do it for non-iconified frame. If | 984 | ;; to make sure that at least once we do it for non-iconified frame. If |
| @@ -1018,8 +1034,10 @@ into icons, regardless of the window manager." | |||
| 1018 | 1034 | ||
| 1019 | (if ediff-xemacs-p | 1035 | (if ediff-xemacs-p |
| 1020 | (ediff-with-current-buffer ctl-buffer | 1036 | (ediff-with-current-buffer ctl-buffer |
| 1021 | (if ediff-xemacs-p | 1037 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1022 | (make-local-hook 'select-frame-hook)) | 1038 | (make-local-hook 'select-frame-hook) ; xemacs |
| 1039 | nil ; emacs | ||
| 1040 | ) | ||
| 1023 | (add-hook | 1041 | (add-hook |
| 1024 | 'select-frame-hook 'ediff-xemacs-select-frame-hook nil 'local) | 1042 | 'select-frame-hook 'ediff-xemacs-select-frame-hook nil 'local) |
| 1025 | )) | 1043 | )) |
| @@ -1033,8 +1051,10 @@ into icons, regardless of the window manager." | |||
| 1033 | (ediff-with-current-buffer ctl-buffer | 1051 | (ediff-with-current-buffer ctl-buffer |
| 1034 | (if (and (ediff-window-display-p) (frame-live-p ediff-control-frame)) | 1052 | (if (and (ediff-window-display-p) (frame-live-p ediff-control-frame)) |
| 1035 | (let ((ctl-frame ediff-control-frame)) | 1053 | (let ((ctl-frame ediff-control-frame)) |
| 1036 | (if ediff-xemacs-p | 1054 | (ediff-cond-compile-for-xemacs-or-emacs |
| 1037 | (set-buffer-menubar default-menubar)) | 1055 | (set-buffer-menubar default-menubar) ; xemacs |
| 1056 | nil ; emacs | ||
| 1057 | ) | ||
| 1038 | (setq ediff-control-frame nil) | 1058 | (setq ediff-control-frame nil) |
| 1039 | (delete-frame ctl-frame) | 1059 | (delete-frame ctl-frame) |
| 1040 | ))) | 1060 | ))) |
diff --git a/lisp/ediff.el b/lisp/ediff.el index a170d4b1a99..24698441c08 100644 --- a/lisp/ediff.el +++ b/lisp/ediff.el | |||
| @@ -1,13 +1,13 @@ | |||
| 1 | ;;; ediff.el --- a comprehensive visual interface to diff & patch | 1 | ;;; ediff.el --- a comprehensive visual interface to diff & patch |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 5 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 6 | ;; Created: February 2, 1994 | 6 | ;; Created: February 2, 1994 |
| 7 | ;; Keywords: comparing, merging, patching, tools, unix | 7 | ;; Keywords: comparing, merging, patching, tools, unix |
| 8 | 8 | ||
| 9 | (defconst ediff-version "2.76" "The current version of Ediff") | 9 | (defconst ediff-version "2.76.1" "The current version of Ediff") |
| 10 | (defconst ediff-date "July 18, 2001" "Date of last update") | 10 | (defconst ediff-date "January 4, 2002" "Date of last update") |
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | ;; This file is part of GNU Emacs. | 13 | ;; This file is part of GNU Emacs. |
| @@ -172,7 +172,7 @@ | |||
| 172 | (let ((current (dired-get-filename nil 'no-error)) | 172 | (let ((current (dired-get-filename nil 'no-error)) |
| 173 | (marked (condition-case nil | 173 | (marked (condition-case nil |
| 174 | (dired-get-marked-files 'no-dir) | 174 | (dired-get-marked-files 'no-dir) |
| 175 | (error))) | 175 | (error nil))) |
| 176 | aux-list choices result) | 176 | aux-list choices result) |
| 177 | (or (integerp fileno) (setq fileno 0)) | 177 | (or (integerp fileno) (setq fileno 0)) |
| 178 | (if (stringp default) | 178 | (if (stringp default) |
| @@ -199,8 +199,10 @@ | |||
| 199 | default-directory)) | 199 | default-directory)) |
| 200 | dir-B f) | 200 | dir-B f) |
| 201 | (list (setq f (ediff-read-file-name | 201 | (list (setq f (ediff-read-file-name |
| 202 | "File A to compare" dir-A | 202 | "File A to compare" |
| 203 | (ediff-get-default-file-name))) | 203 | dir-A |
| 204 | (ediff-get-default-file-name) | ||
| 205 | 'no-dirs)) | ||
| 204 | (ediff-read-file-name "File B to compare" | 206 | (ediff-read-file-name "File B to compare" |
| 205 | (setq dir-B | 207 | (setq dir-B |
| 206 | (if ediff-use-last-dir | 208 | (if ediff-use-last-dir |
| @@ -233,8 +235,10 @@ | |||
| 233 | default-directory)) | 235 | default-directory)) |
| 234 | dir-B dir-C f ff) | 236 | dir-B dir-C f ff) |
| 235 | (list (setq f (ediff-read-file-name | 237 | (list (setq f (ediff-read-file-name |
| 236 | "File A to compare" dir-A | 238 | "File A to compare" |
| 237 | (ediff-get-default-file-name))) | 239 | dir-A |
| 240 | (ediff-get-default-file-name) | ||
| 241 | 'no-dirs)) | ||
| 238 | (setq ff (ediff-read-file-name "File B to compare" | 242 | (setq ff (ediff-read-file-name "File B to compare" |
| 239 | (setq dir-B | 243 | (setq dir-B |
| 240 | (if ediff-use-last-dir | 244 | (if ediff-use-last-dir |
| @@ -332,6 +336,11 @@ | |||
| 332 | (defun ediff-files-internal (file-A file-B file-C startup-hooks job-name | 336 | (defun ediff-files-internal (file-A file-B file-C startup-hooks job-name |
| 333 | &optional merge-buffer-file) | 337 | &optional merge-buffer-file) |
| 334 | (let (buf-A buf-B buf-C) | 338 | (let (buf-A buf-B buf-C) |
| 339 | (if (string= file-A file-B) | ||
| 340 | (error "Files A and B are the same")) | ||
| 341 | (if (stringp file-C) | ||
| 342 | (or (and (string= file-A file-C) (error "Files A and C are the same")) | ||
| 343 | (and (string= file-B file-C) (error "Files B and C are the same")))) | ||
| 335 | (message "Reading file %s ... " file-A) | 344 | (message "Reading file %s ... " file-A) |
| 336 | ;;(sit-for 0) | 345 | ;;(sit-for 0) |
| 337 | (ediff-find-file 'file-A 'buf-A 'ediff-last-dir-A 'startup-hooks) | 346 | (ediff-find-file 'file-A 'buf-A 'ediff-last-dir-A 'startup-hooks) |
| @@ -828,14 +837,59 @@ If WIND-B is nil, use window next to WIND-A." | |||
| 828 | (select-window wind-B) | 837 | (select-window wind-B) |
| 829 | (setq beg-B (window-start) | 838 | (setq beg-B (window-start) |
| 830 | end-B (window-end)))) | 839 | end-B (window-end)))) |
| 840 | (setq buffer-A | ||
| 841 | (ediff-clone-buffer-for-window-comparison | ||
| 842 | buffer-A wind-A "-Window1-") | ||
| 843 | buffer-B | ||
| 844 | (ediff-clone-buffer-for-window-comparison | ||
| 845 | buffer-B wind-B "-Window2-")) | ||
| 831 | (ediff-regions-internal | 846 | (ediff-regions-internal |
| 832 | buffer-A beg-A end-A buffer-B beg-B end-B | 847 | buffer-A beg-A end-A buffer-B beg-B end-B |
| 833 | startup-hooks job-name word-mode nil))) | 848 | startup-hooks job-name word-mode nil))) |
| 834 | 849 | ||
| 850 | ;; Suggested by Hannu Koivisto <azure@iki.fi> | ||
| 851 | (defun ediff-clone-buffer-for-region-comparison (buff-name region-name) | ||
| 852 | (let ((cloned-buff (ediff-make-indirect-buffer | ||
| 853 | buff-name | ||
| 854 | (concat buff-name region-name | ||
| 855 | (symbol-name (gensym))))) | ||
| 856 | (wind (ediff-get-visible-buffer-window buff-name))) | ||
| 857 | (ediff-with-current-buffer cloned-buff | ||
| 858 | (setq ediff-temp-indirect-buffer t)) | ||
| 859 | (if (window-live-p wind) | ||
| 860 | (set-window-buffer wind cloned-buff)) | ||
| 861 | (pop-to-buffer cloned-buff) | ||
| 862 | (message | ||
| 863 | "Mark a region in buffer %s; then type %s. Use %s to abort." | ||
| 864 | (buffer-name cloned-buff) | ||
| 865 | (ediff-format-bindings-of 'exit-recursive-edit) | ||
| 866 | (ediff-format-bindings-of 'abort-recursive-edit)) | ||
| 867 | (recursive-edit) | ||
| 868 | cloned-buff)) | ||
| 869 | |||
| 870 | (defun ediff-clone-buffer-for-window-comparison (buff wind region-name) | ||
| 871 | (let ((cloned-buff (ediff-make-indirect-buffer | ||
| 872 | buff | ||
| 873 | (concat (buffer-name buff) | ||
| 874 | region-name (symbol-name (gensym)))))) | ||
| 875 | (ediff-with-current-buffer cloned-buff | ||
| 876 | (setq ediff-temp-indirect-buffer t)) | ||
| 877 | (set-window-buffer wind cloned-buff) | ||
| 878 | cloned-buff)) | ||
| 879 | |||
| 880 | (defun ediff-make-indirect-buffer (base-buf indirect-buf-name) | ||
| 881 | (ediff-cond-compile-for-xemacs-or-emacs | ||
| 882 | (make-indirect-buffer base-buf indirect-buf-name) ; xemacs | ||
| 883 | (make-indirect-buffer base-buf indirect-buf-name 'clone) ; emacs | ||
| 884 | )) | ||
| 885 | |||
| 835 | ;;;###autoload | 886 | ;;;###autoload |
| 836 | (defun ediff-regions-wordwise (buffer-A buffer-B &optional startup-hooks) | 887 | (defun ediff-regions-wordwise (buffer-A buffer-B &optional startup-hooks) |
| 837 | "Run Ediff on a pair of regions in two different buffers. | 888 | "Run Ediff on a pair of regions in specified buffers. |
| 838 | Regions \(i.e., point and mark\) are assumed to be set in advance. | 889 | Regions \(i.e., point and mark\) are assumed to be set in advance except |
| 890 | for the second region in the case both regions are from the same buffer. | ||
| 891 | In such a case the user is asked to interactively establish the second | ||
| 892 | region. | ||
| 839 | This function is effective only for relatively small regions, up to 200 | 893 | This function is effective only for relatively small regions, up to 200 |
| 840 | lines. For large regions, use `ediff-regions-linewise'." | 894 | lines. For large regions, use `ediff-regions-linewise'." |
| 841 | (interactive | 895 | (interactive |
| @@ -855,7 +909,11 @@ lines. For large regions, use `ediff-regions-linewise'." | |||
| 855 | (error "Buffer %S doesn't exist" buffer-B)) | 909 | (error "Buffer %S doesn't exist" buffer-B)) |
| 856 | 910 | ||
| 857 | 911 | ||
| 858 | (let (reg-A-beg reg-A-end reg-B-beg reg-B-end) | 912 | (let ((buffer-A |
| 913 | (ediff-clone-buffer-for-region-comparison buffer-A "-Region1-")) | ||
| 914 | (buffer-B | ||
| 915 | (ediff-clone-buffer-for-region-comparison buffer-B "-Region2-")) | ||
| 916 | reg-A-beg reg-A-end reg-B-beg reg-B-end) | ||
| 859 | (save-excursion | 917 | (save-excursion |
| 860 | (set-buffer buffer-A) | 918 | (set-buffer buffer-A) |
| 861 | (setq reg-A-beg (region-beginning) | 919 | (setq reg-A-beg (region-beginning) |
| @@ -871,8 +929,11 @@ lines. For large regions, use `ediff-regions-linewise'." | |||
| 871 | 929 | ||
| 872 | ;;;###autoload | 930 | ;;;###autoload |
| 873 | (defun ediff-regions-linewise (buffer-A buffer-B &optional startup-hooks) | 931 | (defun ediff-regions-linewise (buffer-A buffer-B &optional startup-hooks) |
| 874 | "Run Ediff on a pair of regions in two different buffers. | 932 | "Run Ediff on a pair of regions in specified buffers. |
| 875 | Regions \(i.e., point and mark\) are assumed to be set in advance. | 933 | Regions \(i.e., point and mark\) are assumed to be set in advance except |
| 934 | for the second region in the case both regions are from the same buffer. | ||
| 935 | In such a case the user is asked to interactively establish the second | ||
| 936 | region. | ||
| 876 | Each region is enlarged to contain full lines. | 937 | Each region is enlarged to contain full lines. |
| 877 | This function is effective for large regions, over 100-200 | 938 | This function is effective for large regions, over 100-200 |
| 878 | lines. For small regions, use `ediff-regions-wordwise'." | 939 | lines. For small regions, use `ediff-regions-wordwise'." |
| @@ -892,7 +953,11 @@ lines. For small regions, use `ediff-regions-wordwise'." | |||
| 892 | (if (not (ediff-buffer-live-p buffer-B)) | 953 | (if (not (ediff-buffer-live-p buffer-B)) |
| 893 | (error "Buffer %S doesn't exist" buffer-B)) | 954 | (error "Buffer %S doesn't exist" buffer-B)) |
| 894 | 955 | ||
| 895 | (let (reg-A-beg reg-A-end reg-B-beg reg-B-end) | 956 | (let ((buffer-A |
| 957 | (ediff-clone-buffer-for-region-comparison buffer-A "-Region1-")) | ||
| 958 | (buffer-B | ||
| 959 | (ediff-clone-buffer-for-region-comparison buffer-B "-Region2-")) | ||
| 960 | reg-A-beg reg-A-end reg-B-beg reg-B-end) | ||
| 896 | (save-excursion | 961 | (save-excursion |
| 897 | (set-buffer buffer-A) | 962 | (set-buffer buffer-A) |
| 898 | (setq reg-A-beg (region-beginning) | 963 | (setq reg-A-beg (region-beginning) |
| @@ -941,25 +1006,6 @@ lines. For small regions, use `ediff-regions-wordwise'." | |||
| 941 | (setq beg-B (move-marker (make-marker) beg-B) | 1006 | (setq beg-B (move-marker (make-marker) beg-B) |
| 942 | end-B (move-marker (make-marker) end-B))) | 1007 | end-B (move-marker (make-marker) end-B))) |
| 943 | 1008 | ||
| 944 | (if (and (eq buffer-A buffer-B) | ||
| 945 | (or (and (< beg-A end-B) (<= beg-B beg-A)) ; b-B b-A e-B | ||
| 946 | (and (< beg-B end-A) (<= end-A end-B)))) ; b-B e-A e-B | ||
| 947 | (progn | ||
| 948 | (with-output-to-temp-buffer ediff-msg-buffer | ||
| 949 | (ediff-with-current-buffer standard-output | ||
| 950 | (fundamental-mode)) | ||
| 951 | (princ " | ||
| 952 | You have requested to compare overlapping regions of the same buffer. | ||
| 953 | |||
| 954 | In this case, Ediff's highlighting may be confusing---in the same window, | ||
| 955 | you may see highlighted regions that belong to different regions. | ||
| 956 | |||
| 957 | Continue anyway? (y/n) ")) | ||
| 958 | |||
| 959 | (if (y-or-n-p "Continue anyway? ") | ||
| 960 | () | ||
| 961 | (error "%S aborted" job-name)))) | ||
| 962 | |||
| 963 | ;; make file-A | 1009 | ;; make file-A |
| 964 | (if word-mode | 1010 | (if word-mode |
| 965 | (ediff-wordify beg-A end-A buffer-A tmp-buffer) | 1011 | (ediff-wordify beg-A end-A buffer-A tmp-buffer) |
| @@ -1011,8 +1057,10 @@ Continue anyway? (y/n) ")) | |||
| 1011 | default-directory)) | 1057 | default-directory)) |
| 1012 | dir-B f) | 1058 | dir-B f) |
| 1013 | (list (setq f (ediff-read-file-name | 1059 | (list (setq f (ediff-read-file-name |
| 1014 | "File A to merge" dir-A | 1060 | "File A to merge" |
| 1015 | (ediff-get-default-file-name))) | 1061 | dir-A |
| 1062 | (ediff-get-default-file-name) | ||
| 1063 | 'no-dirs)) | ||
| 1016 | (ediff-read-file-name "File B to merge" | 1064 | (ediff-read-file-name "File B to merge" |
| 1017 | (setq dir-B | 1065 | (setq dir-B |
| 1018 | (if ediff-use-last-dir | 1066 | (if ediff-use-last-dir |
| @@ -1053,8 +1101,10 @@ Continue anyway? (y/n) ")) | |||
| 1053 | default-directory)) | 1101 | default-directory)) |
| 1054 | dir-B dir-ancestor f ff) | 1102 | dir-B dir-ancestor f ff) |
| 1055 | (list (setq f (ediff-read-file-name | 1103 | (list (setq f (ediff-read-file-name |
| 1056 | "File A to merge" dir-A | 1104 | "File A to merge" |
| 1057 | (ediff-get-default-file-name))) | 1105 | dir-A |
| 1106 | (ediff-get-default-file-name) | ||
| 1107 | 'no-dirs)) | ||
| 1058 | (setq ff (ediff-read-file-name "File B to merge" | 1108 | (setq ff (ediff-read-file-name "File B to merge" |
| 1059 | (setq dir-B | 1109 | (setq dir-B |
| 1060 | (if ediff-use-last-dir | 1110 | (if ediff-use-last-dir |
| @@ -1221,6 +1271,7 @@ buffer." | |||
| 1221 | (intern (format "ediff-%S-merge-internal" ediff-version-control-package)) | 1271 | (intern (format "ediff-%S-merge-internal" ediff-version-control-package)) |
| 1222 | rev1 rev2 ancestor-rev startup-hooks merge-buffer-file))) | 1272 | rev1 rev2 ancestor-rev startup-hooks merge-buffer-file))) |
| 1223 | 1273 | ||
| 1274 | ;; MK: Check. This function doesn't seem to be used any more by pcvs or pcl-cvs | ||
| 1224 | ;;;###autoload | 1275 | ;;;###autoload |
| 1225 | (defun run-ediff-from-cvs-buffer (pos) | 1276 | (defun run-ediff-from-cvs-buffer (pos) |
| 1226 | "Run Ediff-merge on appropriate revisions of the selected file. | 1277 | "Run Ediff-merge on appropriate revisions of the selected file. |
| @@ -1306,7 +1357,8 @@ Uses `vc.el' or `rcs.el' depending on `ediff-version-control-package'." | |||
| 1306 | (if ediff-use-last-dir | 1357 | (if ediff-use-last-dir |
| 1307 | ediff-last-dir-A | 1358 | ediff-last-dir-A |
| 1308 | default-directory) | 1359 | default-directory) |
| 1309 | (ediff-get-default-file-name)))) | 1360 | (ediff-get-default-file-name) |
| 1361 | 'no-dirs))) | ||
| 1310 | (find-file file) | 1362 | (find-file file) |
| 1311 | (if (and (buffer-modified-p) | 1363 | (if (and (buffer-modified-p) |
| 1312 | (y-or-n-p (message "Buffer %s is modified. Save buffer? " | 1364 | (y-or-n-p (message "Buffer %s is modified. Save buffer? " |
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index 70347ce2aee..e92359eb2df 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; viper-cmd.el --- Vi command support for Viper | 1 | ;;; viper-cmd.el --- Vi command support for Viper |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1997 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1997, 98, 99, 2000, 01, 02 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 5 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 6 | 6 | ||
| 7 | ;; This file is part of GNU Emacs. | 7 | ;; This file is part of GNU Emacs. |
| 8 | 8 | ||
| @@ -41,6 +41,8 @@ | |||
| 41 | (defvar quail-current-str) | 41 | (defvar quail-current-str) |
| 42 | (defvar zmacs-region-stays) | 42 | (defvar zmacs-region-stays) |
| 43 | (defvar mark-even-if-inactive) | 43 | (defvar mark-even-if-inactive) |
| 44 | (defvar init-message) | ||
| 45 | (defvar initial) | ||
| 44 | 46 | ||
| 45 | ;; loading happens only in non-interactive compilation | 47 | ;; loading happens only in non-interactive compilation |
| 46 | ;; in order to spare non-viperized emacs from being viperized | 48 | ;; in order to spare non-viperized emacs from being viperized |
| @@ -145,6 +147,10 @@ | |||
| 145 | ;; Where viper saves mark. This mark is resurrected by m^ | 147 | ;; Where viper saves mark. This mark is resurrected by m^ |
| 146 | (defvar viper-saved-mark nil) | 148 | (defvar viper-saved-mark nil) |
| 147 | 149 | ||
| 150 | ;; Contains user settings for vars affected by viper-set-expert-level function. | ||
| 151 | ;; Not a user option. | ||
| 152 | (defvar viper-saved-user-settings nil) | ||
| 153 | |||
| 148 | 154 | ||
| 149 | 155 | ||
| 150 | ;;; CODE | 156 | ;;; CODE |
| @@ -298,12 +304,15 @@ | |||
| 298 | ;; desirable that viper-pre-command-sentinel is the last hook and | 304 | ;; desirable that viper-pre-command-sentinel is the last hook and |
| 299 | ;; viper-post-command-sentinel is the first hook. | 305 | ;; viper-post-command-sentinel is the first hook. |
| 300 | 306 | ||
| 301 | (if viper-xemacs-p | 307 | (viper-cond-compile-for-xemacs-or-emacs |
| 302 | (progn | 308 | ;; xemacs |
| 303 | (make-local-hook 'viper-after-change-functions) | 309 | (progn |
| 304 | (make-local-hook 'viper-before-change-functions) | 310 | (make-local-hook 'viper-after-change-functions) |
| 305 | (make-local-hook 'viper-post-command-hooks) | 311 | (make-local-hook 'viper-before-change-functions) |
| 306 | (make-local-hook 'viper-pre-command-hooks))) | 312 | (make-local-hook 'viper-post-command-hooks) |
| 313 | (make-local-hook 'viper-pre-command-hooks)) | ||
| 314 | nil ; emacs | ||
| 315 | ) | ||
| 307 | 316 | ||
| 308 | (remove-hook 'post-command-hook 'viper-post-command-sentinel) | 317 | (remove-hook 'post-command-hook 'viper-post-command-sentinel) |
| 309 | (add-hook 'post-command-hook 'viper-post-command-sentinel) | 318 | (add-hook 'post-command-hook 'viper-post-command-sentinel) |
| @@ -744,14 +753,16 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to | |||
| 744 | 753 | ||
| 745 | ;; this-command, last-command-char, last-command-event | 754 | ;; this-command, last-command-char, last-command-event |
| 746 | (setq this-command com) | 755 | (setq this-command com) |
| 747 | (if viper-xemacs-p ; XEmacs represents key sequences as vectors | 756 | (viper-cond-compile-for-xemacs-or-emacs |
| 748 | (setq last-command-event | 757 | ;; XEmacs represents key sequences as vectors |
| 749 | (viper-copy-event (viper-seq-last-elt key)) | 758 | (setq last-command-event |
| 750 | last-command-char (event-to-character last-command-event)) | 759 | (viper-copy-event (viper-seq-last-elt key)) |
| 751 | ;; Emacs represents them as sequences (str or vec) | 760 | last-command-char (event-to-character last-command-event)) |
| 752 | (setq last-command-event | 761 | ;; Emacs represents them as sequences (str or vec) |
| 753 | (viper-copy-event (viper-seq-last-elt key)) | 762 | (setq last-command-event |
| 754 | last-command-char last-command-event)) | 763 | (viper-copy-event (viper-seq-last-elt key)) |
| 764 | last-command-char last-command-event) | ||
| 765 | ) | ||
| 755 | 766 | ||
| 756 | (if (commandp com) | 767 | (if (commandp com) |
| 757 | (progn | 768 | (progn |
| @@ -850,7 +861,7 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to | |||
| 850 | (viper-copy-event (if viper-xemacs-p | 861 | (viper-copy-event (if viper-xemacs-p |
| 851 | (character-to-event ch) ch))) | 862 | (character-to-event ch) ch))) |
| 852 | ) ; let | 863 | ) ; let |
| 853 | (error) | 864 | (error nil) |
| 854 | ) ; condition-case | 865 | ) ; condition-case |
| 855 | 866 | ||
| 856 | (viper-set-input-method nil) | 867 | (viper-set-input-method nil) |
| @@ -1766,13 +1777,14 @@ invokes the command before that, etc." | |||
| 1766 | (message " `.' runs %s%s" | 1777 | (message " `.' runs %s%s" |
| 1767 | (concat "`" (viper-array-to-string keys) "'") | 1778 | (concat "`" (viper-array-to-string keys) "'") |
| 1768 | (viper-abbreviate-string | 1779 | (viper-abbreviate-string |
| 1769 | (if viper-xemacs-p | 1780 | (viper-cond-compile-for-xemacs-or-emacs |
| 1770 | (replace-in-string | 1781 | (replace-in-string ; xemacs |
| 1771 | (cond ((characterp text) (char-to-string text)) | 1782 | (cond ((characterp text) (char-to-string text)) |
| 1772 | ((stringp text) text) | 1783 | ((stringp text) text) |
| 1773 | (t "")) | 1784 | (t "")) |
| 1774 | "\n" "^J") | 1785 | "\n" "^J") |
| 1775 | text) | 1786 | text ; emacs |
| 1787 | ) | ||
| 1776 | max-text-len | 1788 | max-text-len |
| 1777 | " inserting `" "'" " .......")) | 1789 | " inserting `" "'" " .......")) |
| 1778 | )) | 1790 | )) |
| @@ -2059,9 +2071,10 @@ To turn this feature off, set this variable to nil." | |||
| 2059 | (setq cmd | 2071 | (setq cmd |
| 2060 | (key-binding (setq key (read-key-sequence nil)))) | 2072 | (key-binding (setq key (read-key-sequence nil)))) |
| 2061 | (cond ((eq cmd 'self-insert-command) | 2073 | (cond ((eq cmd 'self-insert-command) |
| 2062 | (if viper-xemacs-p | 2074 | (viper-cond-compile-for-xemacs-or-emacs |
| 2063 | (insert (events-to-keys key)) | 2075 | (insert (events-to-keys key)) ; xemacs |
| 2064 | (insert key))) | 2076 | (insert key) ; emacs |
| 2077 | )) | ||
| 2065 | ((memq cmd '(exit-minibuffer viper-exit-minibuffer)) | 2078 | ((memq cmd '(exit-minibuffer viper-exit-minibuffer)) |
| 2066 | nil) | 2079 | nil) |
| 2067 | (t (command-execute cmd))) | 2080 | (t (command-execute cmd))) |
| @@ -2642,7 +2655,7 @@ On reaching beginning of line, stop and signal error." | |||
| 2642 | (let ((pt (point))) | 2655 | (let ((pt (point))) |
| 2643 | (condition-case nil | 2656 | (condition-case nil |
| 2644 | (forward-char arg) | 2657 | (forward-char arg) |
| 2645 | (error)) | 2658 | (error nil)) |
| 2646 | (if (< (point) pt) ; arg was negative | 2659 | (if (< (point) pt) ; arg was negative |
| 2647 | (- (viper-chars-in-region pt (point))) | 2660 | (- (viper-chars-in-region pt (point))) |
| 2648 | (viper-chars-in-region pt (point))))) | 2661 | (viper-chars-in-region pt (point))))) |
| @@ -2656,7 +2669,7 @@ On reaching beginning of line, stop and signal error." | |||
| 2656 | (let ((pt (point))) | 2669 | (let ((pt (point))) |
| 2657 | (condition-case nil | 2670 | (condition-case nil |
| 2658 | (backward-char arg) | 2671 | (backward-char arg) |
| 2659 | (error)) | 2672 | (error nil)) |
| 2660 | (if (> (point) pt) ; arg was negative | 2673 | (if (> (point) pt) ; arg was negative |
| 2661 | (viper-chars-in-region pt (point)) | 2674 | (viper-chars-in-region pt (point)) |
| 2662 | (- (viper-chars-in-region pt (point)))))) | 2675 | (- (viper-chars-in-region pt (point)))))) |
| @@ -3323,9 +3336,11 @@ controlled by the sign of prefix numeric value." | |||
| 3323 | ;; (which is called from viper-search-forward/backward/next). If the value of | 3336 | ;; (which is called from viper-search-forward/backward/next). If the value of |
| 3324 | ;; viper-search-scroll-threshold is negative - don't scroll. | 3337 | ;; viper-search-scroll-threshold is negative - don't scroll. |
| 3325 | (defun viper-adjust-window () | 3338 | (defun viper-adjust-window () |
| 3326 | (let ((win-height (if viper-emacs-p | 3339 | (let ((win-height (viper-cond-compile-for-xemacs-or-emacs |
| 3327 | (1- (window-height)) ; adjust for modeline | 3340 | (window-displayed-height) ; xemacs |
| 3328 | (window-displayed-height))) | 3341 | ;; emacs |
| 3342 | (1- (window-height)) ; adjust for modeline | ||
| 3343 | )) | ||
| 3329 | (pt (point)) | 3344 | (pt (point)) |
| 3330 | at-top-p at-bottom-p | 3345 | at-top-p at-bottom-p |
| 3331 | min-scroll direction) | 3346 | min-scroll direction) |
| @@ -4575,8 +4590,6 @@ One can use `` and '' to temporarily jump 1 step back." | |||
| 4575 | (t (error viper-InvalidTextmarker reg))))) | 4590 | (t (error viper-InvalidTextmarker reg))))) |
| 4576 | 4591 | ||
| 4577 | 4592 | ||
| 4578 | |||
| 4579 | ;; commands in insertion mode | ||
| 4580 | 4593 | ||
| 4581 | (defun viper-delete-backward-word (arg) | 4594 | (defun viper-delete-backward-word (arg) |
| 4582 | "Delete previous word." | 4595 | "Delete previous word." |
| @@ -4587,6 +4600,17 @@ One can use `` and '' to temporarily jump 1 step back." | |||
| 4587 | (delete-region (point) (mark t)) | 4600 | (delete-region (point) (mark t)) |
| 4588 | (pop-mark))) | 4601 | (pop-mark))) |
| 4589 | 4602 | ||
| 4603 | |||
| 4604 | |||
| 4605 | ;; Get viper standard value of SYMBOL. If symbol is customized, get its | ||
| 4606 | ;; standard value. Otherwise, get the value saved in the alist STORAGE. If | ||
| 4607 | ;; STORAGE is nil, use viper-saved-user-settings. | ||
| 4608 | (defun viper-standard-value (symbol &optional storage) | ||
| 4609 | (or (eval (car (get symbol 'customized-value))) | ||
| 4610 | (eval (car (get symbol 'saved-value))) | ||
| 4611 | (nth 1 (assoc symbol (or storage viper-saved-user-settings))))) | ||
| 4612 | |||
| 4613 | |||
| 4590 | 4614 | ||
| 4591 | (defun viper-set-expert-level (&optional dont-change-unless) | 4615 | (defun viper-set-expert-level (&optional dont-change-unless) |
| 4592 | "Sets the expert level for a Viper user. | 4616 | "Sets the expert level for a Viper user. |
| @@ -4913,7 +4937,7 @@ Mail anyway (y or n)? ") | |||
| 4913 | (require 'reporter) | 4937 | (require 'reporter) |
| 4914 | (set-window-configuration window-config) | 4938 | (set-window-configuration window-config) |
| 4915 | 4939 | ||
| 4916 | (reporter-submit-bug-report "kifer@cs.sunysb.edu" | 4940 | (reporter-submit-bug-report "kifer@cs.stonybrook.edu" |
| 4917 | (viper-version) | 4941 | (viper-version) |
| 4918 | varlist | 4942 | varlist |
| 4919 | nil 'delete-other-windows | 4943 | nil 'delete-other-windows |
| @@ -4921,54 +4945,6 @@ Mail anyway (y or n)? ") | |||
| 4921 | )) | 4945 | )) |
| 4922 | 4946 | ||
| 4923 | 4947 | ||
| 4924 | |||
| 4925 | ;; Smoothes out the difference between Emacs' unread-command-events | ||
| 4926 | ;; and XEmacs unread-command-event. Arg is a character, an event, a list of | ||
| 4927 | ;; events or a sequence of keys. | ||
| 4928 | ;; | ||
| 4929 | ;; Due to the way unread-command-events in Emacs (not XEmacs), a non-event | ||
| 4930 | ;; symbol in unread-command-events list may cause Emacs to turn this symbol | ||
| 4931 | ;; into an event. Below, we delete nil from event lists, since nil is the most | ||
| 4932 | ;; common symbol that might appear in this wrong context. | ||
| 4933 | (defun viper-set-unread-command-events (arg) | ||
| 4934 | (if viper-emacs-p | ||
| 4935 | (setq | ||
| 4936 | unread-command-events | ||
| 4937 | (let ((new-events | ||
| 4938 | (cond ((eventp arg) (list arg)) | ||
| 4939 | ((listp arg) arg) | ||
| 4940 | ((sequencep arg) | ||
| 4941 | (listify-key-sequence arg)) | ||
| 4942 | (t (error | ||
| 4943 | "viper-set-unread-command-events: Invalid argument, %S" | ||
| 4944 | arg))))) | ||
| 4945 | (if (not (eventp nil)) | ||
| 4946 | (setq new-events (delq nil new-events))) | ||
| 4947 | (append new-events unread-command-events))) | ||
| 4948 | ;; XEmacs | ||
| 4949 | (setq | ||
| 4950 | unread-command-events | ||
| 4951 | (append | ||
| 4952 | (cond ((viper-characterp arg) (list (character-to-event arg))) | ||
| 4953 | ((eventp arg) (list arg)) | ||
| 4954 | ((stringp arg) (mapcar 'character-to-event arg)) | ||
| 4955 | ((vectorp arg) (append arg nil)) ; turn into list | ||
| 4956 | ((listp arg) (viper-eventify-list-xemacs arg)) | ||
| 4957 | (t (error | ||
| 4958 | "viper-set-unread-command-events: Invalid argument, %S" arg))) | ||
| 4959 | unread-command-events)))) | ||
| 4960 | |||
| 4961 | ;; list is assumed to be a list of events of characters | ||
| 4962 | (defun viper-eventify-list-xemacs (lis) | ||
| 4963 | (mapcar | ||
| 4964 | (lambda (elt) | ||
| 4965 | (cond ((viper-characterp elt) (character-to-event elt)) | ||
| 4966 | ((eventp elt) elt) | ||
| 4967 | (t (error | ||
| 4968 | "viper-eventify-list-xemacs: can't convert to event, %S" | ||
| 4969 | elt)))) | ||
| 4970 | lis)) | ||
| 4971 | |||
| 4972 | 4948 | ||
| 4973 | 4949 | ||
| 4974 | ;;; viper-cmd.el ends here | 4950 | ;;; viper-cmd.el ends here |
diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el index 9b26f468600..cb2f472af5e 100644 --- a/lisp/emulation/viper-ex.el +++ b/lisp/emulation/viper-ex.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; viper-ex.el --- functions implementing the Ex commands for Viper | 1 | ;;; viper-ex.el --- functions implementing the Ex commands for Viper |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994, 95, 96, 97, 98, 2000, 01, 02 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 5 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 6 | 6 | ||
| 7 | ;; This file is part of GNU Emacs. | 7 | ;; This file is part of GNU Emacs. |
| 8 | 8 | ||
| @@ -39,6 +39,7 @@ | |||
| 39 | (defvar viper-custom-file-name) | 39 | (defvar viper-custom-file-name) |
| 40 | (defvar viper-case-fold-search) | 40 | (defvar viper-case-fold-search) |
| 41 | (defvar explicit-shell-file-name) | 41 | (defvar explicit-shell-file-name) |
| 42 | (defvar compile-command) | ||
| 42 | 43 | ||
| 43 | ;; loading happens only in non-interactive compilation | 44 | ;; loading happens only in non-interactive compilation |
| 44 | ;; in order to spare non-viperized emacs from being viperized | 45 | ;; in order to spare non-viperized emacs from being viperized |
| @@ -2016,9 +2017,9 @@ Please contact your system administrator. " | |||
| 2016 | (let ((end (car ex-addresses)) | 2017 | (let ((end (car ex-addresses)) |
| 2017 | (beg (car (cdr ex-addresses))) | 2018 | (beg (car (cdr ex-addresses))) |
| 2018 | (orig-buf (current-buffer)) | 2019 | (orig-buf (current-buffer)) |
| 2019 | (orig-buf-file-name (buffer-file-name)) | 2020 | ;;(orig-buf-file-name (buffer-file-name)) |
| 2020 | (orig-buf-name (buffer-name)) | 2021 | ;;(orig-buf-name (buffer-name)) |
| 2021 | (buff-changed-p (buffer-modified-p)) | 2022 | ;;(buff-changed-p (buffer-modified-p)) |
| 2022 | temp-buf writing-same-file region | 2023 | temp-buf writing-same-file region |
| 2023 | file-exists writing-whole-file) | 2024 | file-exists writing-whole-file) |
| 2024 | (if (> beg end) (error viper-FirstAddrExceedsSecond)) | 2025 | (if (> beg end) (error viper-FirstAddrExceedsSecond)) |
| @@ -2072,9 +2073,10 @@ Please contact your system administrator. " | |||
| 2072 | ;; create temp buffer for the region | 2073 | ;; create temp buffer for the region |
| 2073 | (setq temp-buf (get-buffer-create " *ex-write*")) | 2074 | (setq temp-buf (get-buffer-create " *ex-write*")) |
| 2074 | (set-buffer temp-buf) | 2075 | (set-buffer temp-buf) |
| 2075 | (if viper-xemacs-p | 2076 | (viper-cond-compile-for-xemacs-or-emacs |
| 2076 | (set-visited-file-name ex-file) | 2077 | (set-visited-file-name ex-file) ; xemacs |
| 2077 | (set-visited-file-name ex-file 'noquerry)) | 2078 | (set-visited-file-name ex-file 'noquerry) ; emacs |
| 2079 | ) | ||
| 2078 | (erase-buffer) | 2080 | (erase-buffer) |
| 2079 | (if (and file-exists ex-append) | 2081 | (if (and file-exists ex-append) |
| 2080 | (insert-file-contents ex-file)) | 2082 | (insert-file-contents ex-file)) |
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el index babb5083076..889bb61b4d4 100644 --- a/lisp/emulation/viper-init.el +++ b/lisp/emulation/viper-init.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; viper-init.el --- some common definitions for Viper | 1 | ;;; viper-init.el --- some common definitions for Viper |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1997 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1997, 98, 99, 2000, 01, 02 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 5 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 6 | 6 | ||
| 7 | ;; This file is part of GNU Emacs. | 7 | ;; This file is part of GNU Emacs. |
| 8 | 8 | ||
| @@ -37,6 +37,9 @@ | |||
| 37 | (defvar current-input-method) | 37 | (defvar current-input-method) |
| 38 | (defvar default-input-method) | 38 | (defvar default-input-method) |
| 39 | (defvar describe-current-input-method-function) | 39 | (defvar describe-current-input-method-function) |
| 40 | (defvar bar-cursor) | ||
| 41 | (defvar default-cursor-type) | ||
| 42 | (defvar cursor-type) | ||
| 40 | ;; end pacifier | 43 | ;; end pacifier |
| 41 | 44 | ||
| 42 | 45 | ||
| @@ -50,10 +53,23 @@ | |||
| 50 | ;; Is it Emacs? | 53 | ;; Is it Emacs? |
| 51 | (defconst viper-emacs-p (not viper-xemacs-p)) | 54 | (defconst viper-emacs-p (not viper-xemacs-p)) |
| 52 | ;; Tell whether we are running as a window application or on a TTY | 55 | ;; Tell whether we are running as a window application or on a TTY |
| 56 | |||
| 57 | ;; This is used to avoid compilation warnings. When emacs/xemacs forms can | ||
| 58 | ;; generate compile time warnings, we use this macro. | ||
| 59 | ;; In this case, the macro will expand into the form that is appropriate to the | ||
| 60 | ;; compiler at hand. | ||
| 61 | ;; Suggested by rms. | ||
| 62 | (defmacro viper-cond-compile-for-xemacs-or-emacs (xemacs-form emacs-form) | ||
| 63 | (if (string-match "XEmacs" emacs-version) | ||
| 64 | xemacs-form emacs-form)) | ||
| 65 | |||
| 66 | |||
| 53 | (defsubst viper-device-type () | 67 | (defsubst viper-device-type () |
| 54 | (if viper-emacs-p | 68 | (viper-cond-compile-for-xemacs-or-emacs |
| 55 | window-system | 69 | (device-type (selected-device)) |
| 56 | (device-type (selected-device)))) | 70 | window-system |
| 71 | )) | ||
| 72 | |||
| 57 | ;; in XEmacs: device-type is tty on tty and stream in batch. | 73 | ;; in XEmacs: device-type is tty on tty and stream in batch. |
| 58 | (defun viper-window-display-p () | 74 | (defun viper-window-display-p () |
| 59 | (and (viper-device-type) (not (memq (viper-device-type) '(tty stream pc))))) | 75 | (and (viper-device-type) (not (memq (viper-device-type) '(tty stream pc))))) |
| @@ -434,15 +450,18 @@ color displays. By default, the delimiters are used only on TTYs." | |||
| 434 | :group 'viper) | 450 | :group 'viper) |
| 435 | 451 | ||
| 436 | ;; XEmacs requires glyphs | 452 | ;; XEmacs requires glyphs |
| 437 | (if viper-xemacs-p | 453 | (viper-cond-compile-for-xemacs-or-emacs |
| 438 | (progn | 454 | (progn ; xemacs |
| 439 | (or (glyphp viper-replace-region-end-delimiter) | 455 | (or (glyphp viper-replace-region-end-delimiter) |
| 440 | (setq viper-replace-region-end-delimiter | 456 | (setq viper-replace-region-end-delimiter |
| 441 | (make-glyph viper-replace-region-end-delimiter))) | 457 | (make-glyph viper-replace-region-end-delimiter))) |
| 442 | (or (glyphp viper-replace-region-start-delimiter) | 458 | (or (glyphp viper-replace-region-start-delimiter) |
| 443 | (setq viper-replace-region-start-delimiter | 459 | (setq viper-replace-region-start-delimiter |
| 444 | (make-glyph viper-replace-region-start-delimiter))) | 460 | (make-glyph viper-replace-region-start-delimiter))) |
| 445 | )) | 461 | ) |
| 462 | nil ; emacs | ||
| 463 | ) | ||
| 464 | |||
| 446 | 465 | ||
| 447 | 466 | ||
| 448 | ;; These are local marker that must be initialized to nil and moved with | 467 | ;; These are local marker that must be initialized to nil and moved with |
| @@ -978,7 +997,7 @@ Should be set in `~/.viper' file." | |||
| 978 | (if viper-xemacs-p | 997 | (if viper-xemacs-p |
| 979 | (setq bar-cursor nil) | 998 | (setq bar-cursor nil) |
| 980 | (setq cursor-type default-cursor-type)) | 999 | (setq cursor-type default-cursor-type)) |
| 981 | (error))) | 1000 | (error nil))) |
| 982 | 1001 | ||
| 983 | (defun viper-set-insert-cursor-type () | 1002 | (defun viper-set-insert-cursor-type () |
| 984 | (if viper-xemacs-p | 1003 | (if viper-xemacs-p |
diff --git a/lisp/emulation/viper-keym.el b/lisp/emulation/viper-keym.el index cad5f34389f..0b978d97e8f 100644 --- a/lisp/emulation/viper-keym.el +++ b/lisp/emulation/viper-keym.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; viper-keym.el --- Viper keymaps | 1 | ;;; viper-keym.el --- Viper keymaps |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994, 95, 96, 97, 2000, 01, 02 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 5 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 6 | 6 | ||
| 7 | ;; This file is part of GNU Emacs. | 7 | ;; This file is part of GNU Emacs. |
| 8 | 8 | ||
| @@ -616,11 +616,14 @@ Arguments: (major-mode viper-state keymap)" | |||
| 616 | 616 | ||
| 617 | (defun viper-add-keymap (mapsrc mapdst) | 617 | (defun viper-add-keymap (mapsrc mapdst) |
| 618 | "Add contents of mapsrc to mapdst. It is assumed that mapsrc is sparse." | 618 | "Add contents of mapsrc to mapdst. It is assumed that mapsrc is sparse." |
| 619 | (if viper-xemacs-p | 619 | (viper-cond-compile-for-xemacs-or-emacs |
| 620 | (map-keymap (lambda (key binding) (define-key mapdst key binding)) | 620 | ;; xemacs |
| 621 | mapsrc) | 621 | (map-keymap (lambda (key binding) (define-key mapdst key binding)) |
| 622 | (mapcar (lambda (p) (define-key mapdst (vector (car p)) (cdr p))) | 622 | mapsrc) |
| 623 | (cdr mapsrc)))) | 623 | ;; emacs |
| 624 | (mapcar (lambda (p) (define-key mapdst (vector (car p)) (cdr p))) | ||
| 625 | (cdr mapsrc)) | ||
| 626 | )) | ||
| 624 | 627 | ||
| 625 | (defun viper-modify-keymap (map alist) | 628 | (defun viper-modify-keymap (map alist) |
| 626 | "Modifies MAP with bindings specified in the ALIST. The alist has the | 629 | "Modifies MAP with bindings specified in the ALIST. The alist has the |
diff --git a/lisp/emulation/viper-macs.el b/lisp/emulation/viper-macs.el index f438dc0613b..69d1a42b2eb 100644 --- a/lisp/emulation/viper-macs.el +++ b/lisp/emulation/viper-macs.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; viper-macs.el --- functions implementing keyboard macros for Viper | 1 | ;;; viper-macs.el --- functions implementing keyboard macros for Viper |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994, 95, 96, 97, 2000, 01, 02 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 5 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 6 | 6 | ||
| 7 | ;; This file is part of GNU Emacs. | 7 | ;; This file is part of GNU Emacs. |
| 8 | 8 | ||
| @@ -855,30 +855,10 @@ name from there." | |||
| 855 | (error "Wrong type macro component, symbol-or-listp, %S" elt) | 855 | (error "Wrong type macro component, symbol-or-listp, %S" elt) |
| 856 | macro))) | 856 | macro))) |
| 857 | 857 | ||
| 858 | (defun viper-char-array-p (array) | ||
| 859 | (eval (cons 'and (mapcar 'viper-characterp array)))) | ||
| 860 | |||
| 861 | (defun viper-macro-to-events (macro-body) | 858 | (defun viper-macro-to-events (macro-body) |
| 862 | (vconcat (mapcar 'viper-key-to-emacs-key macro-body))) | 859 | (vconcat (mapcar 'viper-key-to-emacs-key macro-body))) |
| 863 | 860 | ||
| 864 | |||
| 865 | ;; check if vec is a vector of character symbols | ||
| 866 | (defun viper-char-symbol-sequence-p (vec) | ||
| 867 | (and | ||
| 868 | (sequencep vec) | ||
| 869 | (eval | ||
| 870 | (cons 'and | ||
| 871 | (mapcar (lambda (elt) | ||
| 872 | (and (symbolp elt) (= (length (symbol-name elt)) 1))) | ||
| 873 | vec))))) | ||
| 874 | 861 | ||
| 875 | |||
| 876 | ;; Check if vec is a vector of key-press events representing characters | ||
| 877 | ;; XEmacs only | ||
| 878 | (defun viper-event-vector-p (vec) | ||
| 879 | (and (vectorp vec) | ||
| 880 | (eval (cons 'and (mapcar '(lambda (elt) (if (eventp elt) t)) vec))))) | ||
| 881 | |||
| 882 | 862 | ||
| 883 | ;;; Reading fast key sequences | 863 | ;;; Reading fast key sequences |
| 884 | 864 | ||
diff --git a/lisp/emulation/viper-mous.el b/lisp/emulation/viper-mous.el index cb9ad3ee8d9..330f93fc49f 100644 --- a/lisp/emulation/viper-mous.el +++ b/lisp/emulation/viper-mous.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; viper-mous.el --- mouse support for Viper | 1 | ;;; viper-mous.el --- mouse support for Viper |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994, 95, 96, 97, 2001, 02 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 5 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 6 | 6 | ||
| 7 | ;; This file is part of GNU Emacs. | 7 | ;; This file is part of GNU Emacs. |
| 8 | 8 | ||
| @@ -121,9 +121,10 @@ considered related." | |||
| 121 | 121 | ||
| 122 | ;; Returns window where click occurs | 122 | ;; Returns window where click occurs |
| 123 | (defun viper-mouse-click-window (click) | 123 | (defun viper-mouse-click-window (click) |
| 124 | (let ((win (if viper-xemacs-p | 124 | (let ((win (viper-cond-compile-for-xemacs-or-emacs |
| 125 | (event-window click) | 125 | (event-window click) ; xemacs |
| 126 | (posn-window (event-start click))))) | 126 | (posn-window (event-start click)) ; emacs |
| 127 | ))) | ||
| 127 | (if (window-live-p win) | 128 | (if (window-live-p win) |
| 128 | win | 129 | win |
| 129 | (error "Click was not over a live window")))) | 130 | (error "Click was not over a live window")))) |
| @@ -142,9 +143,10 @@ considered related." | |||
| 142 | 143 | ||
| 143 | ;; Returns position of a click | 144 | ;; Returns position of a click |
| 144 | (defsubst viper-mouse-click-posn (click) | 145 | (defsubst viper-mouse-click-posn (click) |
| 145 | (if viper-xemacs-p | 146 | (viper-cond-compile-for-xemacs-or-emacs |
| 146 | (event-point click) | 147 | (event-point click) ; xemacs |
| 147 | (posn-point (event-start click)))) | 148 | (posn-point (event-start click)) ; emacs |
| 149 | )) | ||
| 148 | 150 | ||
| 149 | 151 | ||
| 150 | (defun viper-surrounding-word (count click-count) | 152 | (defun viper-surrounding-word (count click-count) |
| @@ -317,29 +319,33 @@ See `viper-surrounding-word' for the definition of a word in this case." | |||
| 317 | ;; XEmacs has no double-click events. So, we must simulate. | 319 | ;; XEmacs has no double-click events. So, we must simulate. |
| 318 | ;; So, we have to simulate event-click-count. | 320 | ;; So, we have to simulate event-click-count. |
| 319 | (defun viper-event-click-count (click) | 321 | (defun viper-event-click-count (click) |
| 320 | (if viper-xemacs-p | 322 | (viper-cond-compile-for-xemacs-or-emacs |
| 321 | (viper-event-click-count-xemacs click) | 323 | (viper-event-click-count-xemacs click) ; xemacs |
| 322 | (event-click-count click))) | 324 | (event-click-count click) ; emacs |
| 325 | )) | ||
| 323 | 326 | ||
| 324 | ;; kind of semaphore for updating viper-current-click-count | 327 | ;; kind of semaphore for updating viper-current-click-count |
| 325 | (defvar viper-counting-clicks-p nil) | 328 | (defvar viper-counting-clicks-p nil) |
| 326 | (defun viper-event-click-count-xemacs (click) | 329 | (viper-cond-compile-for-xemacs-or-emacs |
| 327 | (let ((time-delta (- (event-timestamp click) | 330 | (defun viper-event-click-count-xemacs (click) |
| 328 | viper-last-click-event-timestamp)) | 331 | (let ((time-delta (- (event-timestamp click) |
| 329 | inhibit-quit) | 332 | viper-last-click-event-timestamp)) |
| 330 | (while viper-counting-clicks-p | 333 | inhibit-quit) |
| 331 | (ignore)) | 334 | (while viper-counting-clicks-p |
| 332 | (setq viper-counting-clicks-p t) | 335 | (ignore)) |
| 333 | (if (> time-delta viper-multiclick-timeout) | 336 | (setq viper-counting-clicks-p t) |
| 334 | (setq viper-current-click-count 0)) | 337 | (if (> time-delta viper-multiclick-timeout) |
| 335 | (discard-input) | 338 | (setq viper-current-click-count 0)) |
| 336 | (setq viper-current-click-count (1+ viper-current-click-count) | 339 | (discard-input) |
| 337 | viper-last-click-event-timestamp (event-timestamp click)) | 340 | (setq viper-current-click-count (1+ viper-current-click-count) |
| 338 | (setq viper-counting-clicks-p nil) | 341 | viper-last-click-event-timestamp (event-timestamp click)) |
| 339 | (if (viper-sit-for-short viper-multiclick-timeout t) | 342 | (setq viper-counting-clicks-p nil) |
| 340 | viper-current-click-count | 343 | (if (viper-sit-for-short viper-multiclick-timeout t) |
| 341 | 0) | 344 | viper-current-click-count |
| 342 | )) | 345 | 0) |
| 346 | )) | ||
| 347 | nil ; emacs | ||
| 348 | ) | ||
| 343 | 349 | ||
| 344 | 350 | ||
| 345 | (defun viper-mouse-click-search-word (click arg) | 351 | (defun viper-mouse-click-search-word (click arg) |
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el index ab63232d849..817db016ef4 100644 --- a/lisp/emulation/viper-util.el +++ b/lisp/emulation/viper-util.el | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | ;;; viper-util.el --- Utilities used by viper.el | 1 | ;;; viper-util.el --- Utilities used by viper.el |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994, 95, 96, 97, 99, 2000, 01, 02 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 5 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 6 | 6 | ||
| 7 | ;; This file is part of GNU Emacs. | 7 | ;; This file is part of GNU Emacs. |
| 8 | 8 | ||
| @@ -39,6 +39,7 @@ | |||
| 39 | (defvar ex-unix-type-shell-options) | 39 | (defvar ex-unix-type-shell-options) |
| 40 | (defvar viper-ex-tmp-buf-name) | 40 | (defvar viper-ex-tmp-buf-name) |
| 41 | (defvar viper-syntax-preference) | 41 | (defvar viper-syntax-preference) |
| 42 | (defvar viper-saved-mark) | ||
| 42 | 43 | ||
| 43 | (require 'cl) | 44 | (require 'cl) |
| 44 | (require 'ring) | 45 | (require 'ring) |
| @@ -66,48 +67,46 @@ | |||
| 66 | ;;; XEmacs support | 67 | ;;; XEmacs support |
| 67 | 68 | ||
| 68 | 69 | ||
| 69 | (if viper-xemacs-p | 70 | (viper-cond-compile-for-xemacs-or-emacs |
| 70 | (progn | 71 | (progn ; xemacs |
| 71 | (fset 'viper-read-event (symbol-function 'next-command-event)) | 72 | (fset 'viper-overlay-p (symbol-function 'extentp)) |
| 72 | (fset 'viper-make-overlay (symbol-function 'make-extent)) | 73 | (fset 'viper-make-overlay (symbol-function 'make-extent)) |
| 73 | (fset 'viper-overlay-start (symbol-function 'extent-start-position)) | 74 | (fset 'viper-overlay-live-p (symbol-function 'extent-live-p)) |
| 74 | (fset 'viper-overlay-end (symbol-function 'extent-end-position)) | 75 | (fset 'viper-move-overlay (symbol-function 'set-extent-endpoints)) |
| 75 | (fset 'viper-overlay-put (symbol-function 'set-extent-property)) | 76 | (fset 'viper-overlay-start (symbol-function 'extent-start-position)) |
| 76 | (fset 'viper-overlay-p (symbol-function 'extentp)) | 77 | (fset 'viper-overlay-end (symbol-function 'extent-end-position)) |
| 77 | (fset 'viper-overlay-get (symbol-function 'extent-property)) | 78 | (fset 'viper-overlay-get (symbol-function 'extent-property)) |
| 78 | (fset 'viper-move-overlay (symbol-function 'set-extent-endpoints)) | 79 | (fset 'viper-overlay-put (symbol-function 'set-extent-property)) |
| 79 | (fset 'viper-overlay-live-p (symbol-function 'extent-live-p)) | 80 | (fset 'viper-read-event (symbol-function 'next-command-event)) |
| 80 | (if (viper-window-display-p) | 81 | (fset 'viper-characterp (symbol-function 'characterp)) |
| 81 | (fset 'viper-iconify (symbol-function 'iconify-frame))) | 82 | (fset 'viper-int-to-char (symbol-function 'int-to-char)) |
| 82 | (cond ((viper-has-face-support-p) | 83 | (if (viper-window-display-p) |
| 83 | (fset 'viper-get-face (symbol-function 'get-face)) | 84 | (fset 'viper-iconify (symbol-function 'iconify-frame))) |
| 84 | (fset 'viper-color-defined-p | 85 | (cond ((viper-has-face-support-p) |
| 85 | (symbol-function 'valid-color-name-p)) | 86 | (fset 'viper-get-face (symbol-function 'get-face)) |
| 86 | ))) | 87 | (fset 'viper-color-defined-p (symbol-function 'valid-color-name-p)) |
| 87 | (fset 'viper-read-event (symbol-function 'read-event)) | 88 | ))) |
| 88 | (fset 'viper-make-overlay (symbol-function 'make-overlay)) | 89 | (progn ; emacs |
| 89 | (fset 'viper-overlay-start (symbol-function 'overlay-start)) | 90 | (fset 'viper-overlay-p (symbol-function 'overlayp)) |
| 90 | (fset 'viper-overlay-end (symbol-function 'overlay-end)) | 91 | (fset 'viper-make-overlay (symbol-function 'make-overlay)) |
| 91 | (fset 'viper-overlay-put (symbol-function 'overlay-put)) | 92 | (fset 'viper-overlay-live-p (symbol-function 'overlayp)) |
| 92 | (fset 'viper-overlay-p (symbol-function 'overlayp)) | 93 | (fset 'viper-move-overlay (symbol-function 'move-overlay)) |
| 93 | (fset 'viper-overlay-get (symbol-function 'overlay-get)) | 94 | (fset 'viper-overlay-start (symbol-function 'overlay-start)) |
| 94 | (fset 'viper-move-overlay (symbol-function 'move-overlay)) | 95 | (fset 'viper-overlay-end (symbol-function 'overlay-end)) |
| 95 | (fset 'viper-overlay-live-p (symbol-function 'overlayp)) | 96 | (fset 'viper-overlay-get (symbol-function 'overlay-get)) |
| 96 | (if (viper-window-display-p) | 97 | (fset 'viper-overlay-put (symbol-function 'overlay-put)) |
| 97 | (fset 'viper-iconify (symbol-function 'iconify-or-deiconify-frame))) | 98 | (fset 'viper-read-event (symbol-function 'read-event)) |
| 98 | (cond ((viper-has-face-support-p) | 99 | (fset 'viper-characterp (symbol-function 'integerp)) |
| 99 | (fset 'viper-get-face (symbol-function 'internal-get-face)) | 100 | (fset 'viper-int-to-char (symbol-function 'identity)) |
| 100 | (fset 'viper-color-defined-p (symbol-function 'x-color-defined-p)) | 101 | (if (viper-window-display-p) |
| 101 | ))) | 102 | (fset 'viper-iconify (symbol-function 'iconify-or-deiconify-frame))) |
| 102 | 103 | (cond ((viper-has-face-support-p) | |
| 103 | 104 | (fset 'viper-get-face (symbol-function 'internal-get-face)) | |
| 104 | (fset 'viper-characterp | 105 | (fset 'viper-color-defined-p (symbol-function 'x-color-defined-p)) |
| 105 | (symbol-function | 106 | ))) |
| 106 | (if viper-xemacs-p 'characterp 'integerp))) | 107 | ) |
| 107 | 108 | ||
| 108 | (fset 'viper-int-to-char | 109 | |
| 109 | (symbol-function | ||
| 110 | (if viper-xemacs-p 'int-to-char 'identity))) | ||
| 111 | 110 | ||
| 112 | ;; CHAR is supposed to be a char or an integer (positive or negative) | 111 | ;; CHAR is supposed to be a char or an integer (positive or negative) |
| 113 | ;; LIST is a list of chars, nil, and negative numbers | 112 | ;; LIST is a list of chars, nil, and negative numbers |
| @@ -133,14 +132,17 @@ | |||
| 133 | (t nil))) | 132 | (t nil))) |
| 134 | 133 | ||
| 135 | (defsubst viper-color-display-p () | 134 | (defsubst viper-color-display-p () |
| 136 | (if viper-emacs-p | 135 | (viper-cond-compile-for-xemacs-or-emacs |
| 137 | (x-display-color-p) | 136 | (eq (device-class (selected-device)) 'color) ; xemacs |
| 138 | (eq (device-class (selected-device)) 'color))) | 137 | (x-display-color-p) ; emacs |
| 138 | )) | ||
| 139 | 139 | ||
| 140 | (defsubst viper-get-cursor-color () | 140 | (defsubst viper-get-cursor-color () |
| 141 | (if viper-emacs-p | 141 | (viper-cond-compile-for-xemacs-or-emacs |
| 142 | (cdr (assoc 'cursor-color (frame-parameters))) | 142 | ;; xemacs |
| 143 | (color-instance-name (frame-property (selected-frame) 'cursor-color)))) | 143 | (color-instance-name (frame-property (selected-frame) 'cursor-color)) |
| 144 | (cdr (assoc 'cursor-color (frame-parameters))) ; emacs | ||
| 145 | )) | ||
| 144 | 146 | ||
| 145 | 147 | ||
| 146 | ;; OS/2 | 148 | ;; OS/2 |
| @@ -154,11 +156,12 @@ | |||
| 154 | (if (and (viper-window-display-p) (viper-color-display-p) | 156 | (if (and (viper-window-display-p) (viper-color-display-p) |
| 155 | (stringp new-color) (viper-color-defined-p new-color) | 157 | (stringp new-color) (viper-color-defined-p new-color) |
| 156 | (not (string= new-color (viper-get-cursor-color)))) | 158 | (not (string= new-color (viper-get-cursor-color)))) |
| 157 | (if viper-emacs-p | 159 | (viper-cond-compile-for-xemacs-or-emacs |
| 158 | (modify-frame-parameters | 160 | (set-frame-property |
| 159 | (selected-frame) (list (cons 'cursor-color new-color))) | 161 | (selected-frame) 'cursor-color (make-color-instance new-color)) |
| 160 | (set-frame-property | 162 | (modify-frame-parameters |
| 161 | (selected-frame) 'cursor-color (make-color-instance new-color))) | 163 | (selected-frame) (list (cons 'cursor-color new-color))) |
| 164 | ) | ||
| 162 | )) | 165 | )) |
| 163 | 166 | ||
| 164 | ;; By default, saves current frame cursor color in the | 167 | ;; By default, saves current frame cursor color in the |
| @@ -824,14 +827,20 @@ | |||
| 824 | ))) | 827 | ))) |
| 825 | 828 | ||
| 826 | (defun viper-check-minibuffer-overlay () | 829 | (defun viper-check-minibuffer-overlay () |
| 827 | (or (viper-overlay-p viper-minibuffer-overlay) | 830 | (if (viper-overlay-live-p viper-minibuffer-overlay) |
| 828 | (setq viper-minibuffer-overlay | 831 | (viper-move-overlay |
| 829 | (if viper-xemacs-p | 832 | viper-minibuffer-overlay |
| 830 | (viper-make-overlay 1 (1+ (buffer-size)) (current-buffer)) | 833 | (if (fboundp 'minibuffer-prompt-end) (minibuffer-prompt-end) 1) |
| 831 | ;; make overlay open-ended | 834 | (1+ (buffer-size))) |
| 832 | (viper-make-overlay | 835 | (setq viper-minibuffer-overlay |
| 833 | 1 (1+ (buffer-size)) (current-buffer) nil 'rear-advance))) | 836 | (if viper-xemacs-p |
| 834 | )) | 837 | (viper-make-overlay 1 (1+ (buffer-size)) (current-buffer)) |
| 838 | ;; make overlay open-ended | ||
| 839 | (viper-make-overlay | ||
| 840 | (if (fboundp 'minibuffer-prompt-end) (minibuffer-prompt-end) 1) | ||
| 841 | (1+ (buffer-size)) | ||
| 842 | (current-buffer) nil 'rear-advance))) | ||
| 843 | )) | ||
| 835 | 844 | ||
| 836 | 845 | ||
| 837 | (defsubst viper-is-in-minibuffer () | 846 | (defsubst viper-is-in-minibuffer () |
| @@ -843,10 +852,12 @@ | |||
| 843 | ;;; XEmacs compatibility | 852 | ;;; XEmacs compatibility |
| 844 | 853 | ||
| 845 | (defun viper-abbreviate-file-name (file) | 854 | (defun viper-abbreviate-file-name (file) |
| 846 | (if viper-emacs-p | 855 | (viper-cond-compile-for-xemacs-or-emacs |
| 847 | (abbreviate-file-name file) | 856 | ;; XEmacs requires addl argument |
| 848 | ;; XEmacs requires addl argument | 857 | (abbreviate-file-name file t) |
| 849 | (abbreviate-file-name file t))) | 858 | ;; emacs |
| 859 | (abbreviate-file-name file) | ||
| 860 | )) | ||
| 850 | 861 | ||
| 851 | ;; Sit for VAL milliseconds. XEmacs doesn't support the millisecond arg | 862 | ;; Sit for VAL milliseconds. XEmacs doesn't support the millisecond arg |
| 852 | ;; in sit-for, so this function smoothes out the differences. | 863 | ;; in sit-for, so this function smoothes out the differences. |
| @@ -871,9 +882,10 @@ | |||
| 871 | (and (<= pos (point-max)) (<= (point-min) pos)))))) | 882 | (and (<= pos (point-max)) (<= (point-min) pos)))))) |
| 872 | 883 | ||
| 873 | (defsubst viper-mark-marker () | 884 | (defsubst viper-mark-marker () |
| 874 | (if viper-xemacs-p | 885 | (viper-cond-compile-for-xemacs-or-emacs |
| 875 | (mark-marker t) | 886 | (mark-marker t) ; xemacs |
| 876 | (mark-marker))) | 887 | (mark-marker) ; emacs |
| 888 | )) | ||
| 877 | 889 | ||
| 878 | ;; like (set-mark-command nil) but doesn't push twice, if (car mark-ring) | 890 | ;; like (set-mark-command nil) but doesn't push twice, if (car mark-ring) |
| 879 | ;; is the same as (mark t). | 891 | ;; is the same as (mark t). |
| @@ -886,13 +898,16 @@ | |||
| 886 | ;; highlighted due to Viper's pushing marks. So, we deactivate marks, unless | 898 | ;; highlighted due to Viper's pushing marks. So, we deactivate marks, unless |
| 887 | ;; the user explicitly wants highlighting, e.g., by hitting '' or `` | 899 | ;; the user explicitly wants highlighting, e.g., by hitting '' or `` |
| 888 | (defun viper-deactivate-mark () | 900 | (defun viper-deactivate-mark () |
| 889 | (if viper-xemacs-p | 901 | (viper-cond-compile-for-xemacs-or-emacs |
| 890 | (zmacs-deactivate-region) | 902 | (zmacs-deactivate-region) |
| 891 | (deactivate-mark))) | 903 | (deactivate-mark) |
| 904 | )) | ||
| 892 | 905 | ||
| 893 | (defsubst viper-leave-region-active () | 906 | (defsubst viper-leave-region-active () |
| 894 | (if viper-xemacs-p | 907 | (viper-cond-compile-for-xemacs-or-emacs |
| 895 | (setq zmacs-region-stays t))) | 908 | (setq zmacs-region-stays t) |
| 909 | nil | ||
| 910 | )) | ||
| 896 | 911 | ||
| 897 | ;; Check if arg is a valid character for register | 912 | ;; Check if arg is a valid character for register |
| 898 | ;; TYPE is a list that can contain `letter', `Letter', and `digit'. | 913 | ;; TYPE is a list that can contain `letter', `Letter', and `digit'. |
| @@ -911,27 +926,61 @@ | |||
| 911 | 926 | ||
| 912 | 927 | ||
| 913 | (defsubst viper-events-to-keys (events) | 928 | (defsubst viper-events-to-keys (events) |
| 914 | (cond (viper-xemacs-p (events-to-keys events)) | 929 | (viper-cond-compile-for-xemacs-or-emacs |
| 915 | (t events))) | 930 | (events-to-keys events) ; xemacs |
| 931 | events ; emacs | ||
| 932 | )) | ||
| 916 | 933 | ||
| 917 | 934 | ||
| 918 | ;; it is suggested that an event must be copied before it is assigned to | 935 | ;; it is suggested that an event must be copied before it is assigned to |
| 919 | ;; last-command-event in XEmacs | 936 | ;; last-command-event in XEmacs |
| 920 | (defun viper-copy-event (event) | 937 | (defun viper-copy-event (event) |
| 921 | (if viper-xemacs-p | 938 | (viper-cond-compile-for-xemacs-or-emacs |
| 922 | (copy-event event) | 939 | (copy-event event) ; xemacs |
| 923 | event)) | 940 | event ; emacs |
| 941 | )) | ||
| 942 | |||
| 943 | ;; Uses different timeouts for ESC-sequences and others | ||
| 944 | (defsubst viper-fast-keysequence-p () | ||
| 945 | (not (viper-sit-for-short | ||
| 946 | (if (viper-ESC-event-p last-input-event) | ||
| 947 | viper-ESC-keyseq-timeout | ||
| 948 | viper-fast-keyseq-timeout) | ||
| 949 | t))) | ||
| 924 | 950 | ||
| 925 | ;; like read-event, but in XEmacs also try to convert to char, if possible | 951 | ;; like read-event, but in XEmacs also try to convert to char, if possible |
| 926 | (defun viper-read-event-convert-to-char () | 952 | (defun viper-read-event-convert-to-char () |
| 927 | (let (event) | 953 | (let (event) |
| 928 | (if viper-emacs-p | 954 | (viper-cond-compile-for-xemacs-or-emacs |
| 929 | (read-event) | 955 | (progn |
| 930 | (setq event (next-command-event)) | 956 | (setq event (next-command-event)) |
| 931 | (or (event-to-character event) | 957 | (or (event-to-character event) |
| 932 | event)) | 958 | event)) |
| 959 | (read-event) | ||
| 960 | ) | ||
| 933 | )) | 961 | )) |
| 934 | 962 | ||
| 963 | ;; Viperized read-key-sequence | ||
| 964 | (defun viper-read-key-sequence (prompt &optional continue-echo) | ||
| 965 | (let (inhibit-quit event keyseq) | ||
| 966 | (setq keyseq (read-key-sequence prompt continue-echo)) | ||
| 967 | (setq event (if viper-xemacs-p | ||
| 968 | (elt keyseq 0) ; XEmacs returns vector of events | ||
| 969 | (elt (listify-key-sequence keyseq) 0))) | ||
| 970 | (if (viper-ESC-event-p event) | ||
| 971 | (let (unread-command-events) | ||
| 972 | (viper-set-unread-command-events keyseq) | ||
| 973 | (if (viper-fast-keysequence-p) | ||
| 974 | (let ((viper-vi-global-user-minor-mode nil) | ||
| 975 | (viper-vi-local-user-minor-mode nil) | ||
| 976 | (viper-replace-minor-mode nil) ; actually unnecessary | ||
| 977 | (viper-insert-global-user-minor-mode nil) | ||
| 978 | (viper-insert-local-user-minor-mode nil)) | ||
| 979 | (setq keyseq (read-key-sequence prompt continue-echo))) | ||
| 980 | (setq keyseq (read-key-sequence prompt continue-echo))))) | ||
| 981 | keyseq)) | ||
| 982 | |||
| 983 | |||
| 935 | ;; This function lets function-key-map convert key sequences into logical | 984 | ;; This function lets function-key-map convert key sequences into logical |
| 936 | ;; keys. This does a better job than viper-read-event when it comes to kbd | 985 | ;; keys. This does a better job than viper-read-event when it comes to kbd |
| 937 | ;; macros, since it enables certain macros to be shared between X and TTY modes | 986 | ;; macros, since it enables certain macros to be shared between X and TTY modes |
| @@ -954,44 +1003,45 @@ | |||
| 954 | (defun viper-event-key (event) | 1003 | (defun viper-event-key (event) |
| 955 | (or (and event (eventp event)) | 1004 | (or (and event (eventp event)) |
| 956 | (error "viper-event-key: Wrong type argument, eventp, %S" event)) | 1005 | (error "viper-event-key: Wrong type argument, eventp, %S" event)) |
| 957 | (when (cond (viper-xemacs-p (or (key-press-event-p event) | 1006 | (when (viper-cond-compile-for-xemacs-or-emacs |
| 958 | (mouse-event-p event))) | 1007 | (or (key-press-event-p event) (mouse-event-p event)) ; xemacs |
| 959 | (t t)) | 1008 | t ; emacs |
| 1009 | ) | ||
| 960 | (let ((mod (event-modifiers event)) | 1010 | (let ((mod (event-modifiers event)) |
| 961 | basis) | 1011 | basis) |
| 962 | (setq basis | 1012 | (setq basis |
| 963 | (cond | 1013 | (viper-cond-compile-for-xemacs-or-emacs |
| 964 | (viper-xemacs-p | 1014 | ;; XEmacs |
| 965 | (cond ((key-press-event-p event) | 1015 | (cond ((key-press-event-p event) |
| 966 | (event-key event)) | 1016 | (event-key event)) |
| 967 | ((button-event-p event) | 1017 | ((button-event-p event) |
| 968 | (concat "mouse-" (prin1-to-string (event-button event)))) | 1018 | (concat "mouse-" (prin1-to-string (event-button event)))) |
| 969 | (t | 1019 | (t |
| 970 | (error "viper-event-key: Unknown event, %S" event)))) | 1020 | (error "viper-event-key: Unknown event, %S" event))) |
| 971 | (t | 1021 | ;; Emacs doesn't handle capital letters correctly, since |
| 972 | ;; Emacs doesn't handle capital letters correctly, since | 1022 | ;; \S-a isn't considered the same as A (it behaves as |
| 973 | ;; \S-a isn't considered the same as A (it behaves as | 1023 | ;; plain `a' instead). So we take care of this here |
| 974 | ;; plain `a' instead). So we take care of this here | 1024 | (cond ((and (viper-characterp event) (<= ?A event) (<= event ?Z)) |
| 975 | (cond ((and (viper-characterp event) (<= ?A event) (<= event ?Z)) | 1025 | (setq mod nil |
| 976 | (setq mod nil | 1026 | event event)) |
| 977 | event event)) | 1027 | ;; Emacs has the oddity whereby characters 128+char |
| 978 | ;; Emacs has the oddity whereby characters 128+char | 1028 | ;; represent M-char *if* this appears inside a string. |
| 979 | ;; represent M-char *if* this appears inside a string. | 1029 | ;; So, we convert them manually to (meta char). |
| 980 | ;; So, we convert them manually to (meta char). | 1030 | ((and (viper-characterp event) |
| 981 | ((and (viper-characterp event) | 1031 | (< ?\C-? event) (<= event 255)) |
| 982 | (< ?\C-? event) (<= event 255)) | 1032 | (setq mod '(meta) |
| 983 | (setq mod '(meta) | 1033 | event (- event ?\C-? 1))) |
| 984 | event (- event ?\C-? 1))) | 1034 | ((and (null mod) (eq event 'return)) |
| 985 | ((and (null mod) (eq event 'return)) | 1035 | (setq event ?\C-m)) |
| 986 | (setq event ?\C-m)) | 1036 | ((and (null mod) (eq event 'space)) |
| 987 | ((and (null mod) (eq event 'space)) | 1037 | (setq event ?\ )) |
| 988 | (setq event ?\ )) | 1038 | ((and (null mod) (eq event 'delete)) |
| 989 | ((and (null mod) (eq event 'delete)) | 1039 | (setq event ?\C-?)) |
| 990 | (setq event ?\C-?)) | 1040 | ((and (null mod) (eq event 'backspace)) |
| 991 | ((and (null mod) (eq event 'backspace)) | 1041 | (setq event ?\C-h)) |
| 992 | (setq event ?\C-h)) | 1042 | (t (event-basic-type event))) |
| 993 | (t (event-basic-type event))) | 1043 | ) ; viper-cond-compile-for-xemacs-or-emacs |
| 994 | ))) | 1044 | ) |
| 995 | (if (viper-characterp basis) | 1045 | (if (viper-characterp basis) |
| 996 | (setq basis | 1046 | (setq basis |
| 997 | (if (viper= basis ?\C-?) | 1047 | (if (viper= basis ?\C-?) |
| @@ -1046,6 +1096,77 @@ | |||
| 1046 | )) | 1096 | )) |
| 1047 | 1097 | ||
| 1048 | 1098 | ||
| 1099 | ;; LIS is assumed to be a list of events of characters | ||
| 1100 | (defun viper-eventify-list-xemacs (lis) | ||
| 1101 | (mapcar | ||
| 1102 | (lambda (elt) | ||
| 1103 | (cond ((viper-characterp elt) (character-to-event elt)) | ||
| 1104 | ((eventp elt) elt) | ||
| 1105 | (t (error | ||
| 1106 | "viper-eventify-list-xemacs: can't convert to event, %S" | ||
| 1107 | elt)))) | ||
| 1108 | lis)) | ||
| 1109 | |||
| 1110 | |||
| 1111 | ;; Smoothes out the difference between Emacs' unread-command-events | ||
| 1112 | ;; and XEmacs unread-command-event. Arg is a character, an event, a list of | ||
| 1113 | ;; events or a sequence of keys. | ||
| 1114 | ;; | ||
| 1115 | ;; Due to the way unread-command-events in Emacs (not XEmacs), a non-event | ||
| 1116 | ;; symbol in unread-command-events list may cause Emacs to turn this symbol | ||
| 1117 | ;; into an event. Below, we delete nil from event lists, since nil is the most | ||
| 1118 | ;; common symbol that might appear in this wrong context. | ||
| 1119 | (defun viper-set-unread-command-events (arg) | ||
| 1120 | (if viper-emacs-p | ||
| 1121 | (setq | ||
| 1122 | unread-command-events | ||
| 1123 | (let ((new-events | ||
| 1124 | (cond ((eventp arg) (list arg)) | ||
| 1125 | ((listp arg) arg) | ||
| 1126 | ((sequencep arg) | ||
| 1127 | (listify-key-sequence arg)) | ||
| 1128 | (t (error | ||
| 1129 | "viper-set-unread-command-events: Invalid argument, %S" | ||
| 1130 | arg))))) | ||
| 1131 | (if (not (eventp nil)) | ||
| 1132 | (setq new-events (delq nil new-events))) | ||
| 1133 | (append new-events unread-command-events))) | ||
| 1134 | ;; XEmacs | ||
| 1135 | (setq | ||
| 1136 | unread-command-events | ||
| 1137 | (append | ||
| 1138 | (cond ((viper-characterp arg) (list (character-to-event arg))) | ||
| 1139 | ((eventp arg) (list arg)) | ||
| 1140 | ((stringp arg) (mapcar 'character-to-event arg)) | ||
| 1141 | ((vectorp arg) (append arg nil)) ; turn into list | ||
| 1142 | ((listp arg) (viper-eventify-list-xemacs arg)) | ||
| 1143 | (t (error | ||
| 1144 | "viper-set-unread-command-events: Invalid argument, %S" arg))) | ||
| 1145 | unread-command-events)))) | ||
| 1146 | |||
| 1147 | |||
| 1148 | ;; Check if vec is a vector of key-press events representing characters | ||
| 1149 | ;; XEmacs only | ||
| 1150 | (defun viper-event-vector-p (vec) | ||
| 1151 | (and (vectorp vec) | ||
| 1152 | (eval (cons 'and (mapcar '(lambda (elt) (if (eventp elt) t)) vec))))) | ||
| 1153 | |||
| 1154 | |||
| 1155 | ;; check if vec is a vector of character symbols | ||
| 1156 | (defun viper-char-symbol-sequence-p (vec) | ||
| 1157 | (and | ||
| 1158 | (sequencep vec) | ||
| 1159 | (eval | ||
| 1160 | (cons 'and | ||
| 1161 | (mapcar (lambda (elt) | ||
| 1162 | (and (symbolp elt) (= (length (symbol-name elt)) 1))) | ||
| 1163 | vec))))) | ||
| 1164 | |||
| 1165 | |||
| 1166 | (defun viper-char-array-p (array) | ||
| 1167 | (eval (cons 'and (mapcar 'viper-characterp array)))) | ||
| 1168 | |||
| 1169 | |||
| 1049 | ;; Args can be a sequence of events, a string, or a Viper macro. Will try to | 1170 | ;; Args can be a sequence of events, a string, or a Viper macro. Will try to |
| 1050 | ;; convert events to keys and, if all keys are regular printable | 1171 | ;; convert events to keys and, if all keys are regular printable |
| 1051 | ;; characters, will return a string. Otherwise, will return a string | 1172 | ;; characters, will return a string. Otherwise, will return a string |
| @@ -1071,21 +1192,14 @@ | |||
| 1071 | (t (prin1-to-string event-seq))))) | 1192 | (t (prin1-to-string event-seq))))) |
| 1072 | 1193 | ||
| 1073 | (defun viper-key-press-events-to-chars (events) | 1194 | (defun viper-key-press-events-to-chars (events) |
| 1074 | (mapconcat (if viper-emacs-p | 1195 | (mapconcat (viper-cond-compile-for-xemacs-or-emacs |
| 1075 | 'char-to-string | 1196 | (lambda (elt) (char-to-string (event-to-character elt))) ; xemacs |
| 1076 | (lambda (elt) (char-to-string (event-to-character elt)))) | 1197 | 'char-to-string ; emacs |
| 1198 | ) | ||
| 1077 | events | 1199 | events |
| 1078 | "")) | 1200 | "")) |
| 1079 | 1201 | ||
| 1080 | 1202 | ||
| 1081 | ;; Uses different timeouts for ESC-sequences and others | ||
| 1082 | (defsubst viper-fast-keysequence-p () | ||
| 1083 | (not (viper-sit-for-short | ||
| 1084 | (if (viper-ESC-event-p last-input-event) | ||
| 1085 | viper-ESC-keyseq-timeout | ||
| 1086 | viper-fast-keyseq-timeout) | ||
| 1087 | t))) | ||
| 1088 | |||
| 1089 | (defun viper-read-char-exclusive () | 1203 | (defun viper-read-char-exclusive () |
| 1090 | (let (char | 1204 | (let (char |
| 1091 | (echo-keystrokes 1)) | 1205 | (echo-keystrokes 1)) |
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el index a76dedd3f08..7e1f47d3728 100644 --- a/lisp/emulation/viper.el +++ b/lisp/emulation/viper.el | |||
| @@ -3,12 +3,12 @@ | |||
| 3 | ;; and a venomous VI PERil. | 3 | ;; and a venomous VI PERil. |
| 4 | ;; Viper Is also a Package for Emacs Rebels. | 4 | ;; Viper Is also a Package for Emacs Rebels. |
| 5 | 5 | ||
| 6 | ;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01 Free Software Foundation, Inc. | 6 | ;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc. |
| 7 | 7 | ||
| 8 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | 8 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
| 9 | ;; Keywords: emulations | 9 | ;; Keywords: emulations |
| 10 | 10 | ||
| 11 | (defconst viper-version "3.11.1 of September 9, 2001" | 11 | (defconst viper-version "3.11.2 of January 4, 2002" |
| 12 | "The current version of Viper") | 12 | "The current version of Viper") |
| 13 | 13 | ||
| 14 | ;; This file is part of GNU Emacs. | 14 | ;; This file is part of GNU Emacs. |
| @@ -353,9 +353,6 @@ user decide when to invoke Viper in a major mode." | |||
| 353 | ;; Non-viper variables that need to be saved in case the user decides to | 353 | ;; Non-viper variables that need to be saved in case the user decides to |
| 354 | ;; de-viperize emacs. | 354 | ;; de-viperize emacs. |
| 355 | (defvar viper-saved-non-viper-variables nil) | 355 | (defvar viper-saved-non-viper-variables nil) |
| 356 | ;; Contains user settings for vars affected by viper-set-expert-level function. | ||
| 357 | ;; Not a user option. | ||
| 358 | (defvar viper-saved-user-settings nil) | ||
| 359 | 356 | ||
| 360 | (defcustom viper-mode (cond (noninteractive nil) | 357 | (defcustom viper-mode (cond (noninteractive nil) |
| 361 | (t 'ask)) | 358 | (t 'ask)) |
| @@ -1056,26 +1053,6 @@ remains buffer-local." | |||
| 1056 | 1053 | ||
| 1057 | ) ; end viper-non-hook-settings | 1054 | ) ; end viper-non-hook-settings |
| 1058 | 1055 | ||
| 1059 | ;; Viperized read-key-sequence | ||
| 1060 | (defun viper-read-key-sequence (prompt &optional continue-echo) | ||
| 1061 | (let (inhibit-quit event keyseq) | ||
| 1062 | (setq keyseq (read-key-sequence prompt continue-echo)) | ||
| 1063 | (setq event (if viper-xemacs-p | ||
| 1064 | (elt keyseq 0) ; XEmacs returns vector of events | ||
| 1065 | (elt (listify-key-sequence keyseq) 0))) | ||
| 1066 | (if (viper-ESC-event-p event) | ||
| 1067 | (let (unread-command-events) | ||
| 1068 | (viper-set-unread-command-events keyseq) | ||
| 1069 | (if (viper-fast-keysequence-p) | ||
| 1070 | (let ((viper-vi-global-user-minor-mode nil) | ||
| 1071 | (viper-vi-local-user-minor-mode nil) | ||
| 1072 | (viper-replace-minor-mode nil) ; actually unnecessary | ||
| 1073 | (viper-insert-global-user-minor-mode nil) | ||
| 1074 | (viper-insert-local-user-minor-mode nil)) | ||
| 1075 | (setq keyseq (read-key-sequence prompt continue-echo))) | ||
| 1076 | (setq keyseq (read-key-sequence prompt continue-echo))))) | ||
| 1077 | keyseq)) | ||
| 1078 | |||
| 1079 | 1056 | ||
| 1080 | 1057 | ||
| 1081 | ;; Ask only if this-command/last-command are nil, i.e., when loading | 1058 | ;; Ask only if this-command/last-command are nil, i.e., when loading |
| @@ -1122,14 +1099,6 @@ These two lines must come in the order given. | |||
| 1122 | 1099 | ||
| 1123 | 1100 | ||
| 1124 | 1101 | ||
| 1125 | ;; Get viper standard value of SYMBOL. If symbol is customized, get its | ||
| 1126 | ;; standard value. Otherwise, get the value saved in the alist STORAGE. If | ||
| 1127 | ;; STORAGE is nil, use viper-saved-user-settings. | ||
| 1128 | (defun viper-standard-value (symbol &optional storage) | ||
| 1129 | (or (eval (car (get symbol 'customized-value))) | ||
| 1130 | (eval (car (get symbol 'saved-value))) | ||
| 1131 | (nth 1 (assoc symbol (or storage viper-saved-user-settings))))) | ||
| 1132 | |||
| 1133 | 1102 | ||
| 1134 | 1103 | ||
| 1135 | ;; save non-viper vars that Viper might change | 1104 | ;; save non-viper vars that Viper might change |
diff --git a/man/ediff.texi b/man/ediff.texi index 63cbaf53ee6..1747a9bc3c5 100644 --- a/man/ediff.texi +++ b/man/ediff.texi | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | This file documents Ediff, a comprehensive visual interface to Unix diff | 30 | This file documents Ediff, a comprehensive visual interface to Unix diff |
| 31 | and patch utilities. | 31 | and patch utilities. |
| 32 | 32 | ||
| 33 | Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. | 33 | Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. |
| 34 | 34 | ||
| 35 | Permission is granted to copy, distribute and/or modify this document | 35 | Permission is granted to copy, distribute and/or modify this document |
| 36 | under the terms of the GNU Free Documentation License, Version 1.1 or | 36 | under the terms of the GNU Free Documentation License, Version 1.1 or |
| @@ -54,16 +54,16 @@ license to the document, as described in section 6 of the license. | |||
| 54 | @titlepage | 54 | @titlepage |
| 55 | @title Ediff User's Manual | 55 | @title Ediff User's Manual |
| 56 | @sp 4 | 56 | @sp 4 |
| 57 | @subtitle Ediff version 2.70 | 57 | @subtitle Ediff version 2.76.1 |
| 58 | @sp 1 | 58 | @sp 1 |
| 59 | @subtitle March 1998 | 59 | @subtitle January 2002 |
| 60 | @sp 5 | 60 | @sp 5 |
| 61 | @author Michael Kifer | 61 | @author Michael Kifer |
| 62 | @page | 62 | @page |
| 63 | 63 | ||
| 64 | @vskip 0pt plus 1filll | 64 | @vskip 0pt plus 1filll |
| 65 | @noindent | 65 | @noindent |
| 66 | Copyright @copyright{} 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. | 66 | Copyright @copyright{} 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. |
| 67 | 67 | ||
| 68 | Permission is granted to copy, distribute and/or modify this document | 68 | Permission is granted to copy, distribute and/or modify this document |
| 69 | under the terms of the GNU Free Documentation License, Version 1.1 or | 69 | under the terms of the GNU Free Documentation License, Version 1.1 or |
| @@ -225,11 +225,16 @@ Compare windows line-by-line. | |||
| 225 | 225 | ||
| 226 | @item ediff-regions-wordwise | 226 | @item ediff-regions-wordwise |
| 227 | @findex ediff-regions-wordwise | 227 | @findex ediff-regions-wordwise |
| 228 | Compare regions word-by-word. | 228 | Compare regions word-by-word. The regions can come from the same buffer |
| 229 | and they can even overlap. You will be asked to specify the buffers that | ||
| 230 | contain the regions, which you want to compare. For each buffer, you will | ||
| 231 | also be asked to mark the regions to be compared. Pay attention to the | ||
| 232 | messages that appear in the minibuffer. | ||
| 229 | 233 | ||
| 230 | @item ediff-regions-linewise | 234 | @item ediff-regions-linewise |
| 231 | @findex ediff-regions-linewise | 235 | @findex ediff-regions-linewise |
| 232 | Compare regions line-by-line. | 236 | Similar to @code{ediff-windows-linewise}, but compares the regions |
| 237 | line-by-line. See @code{ediff-windows-linewise} for more details. | ||
| 233 | 238 | ||
| 234 | @item ediff-revision | 239 | @item ediff-revision |
| 235 | @findex ediff-revision | 240 | @findex ediff-revision |
| @@ -384,15 +389,14 @@ On a color display, fine differences are highlighted with color; on a | |||
| 384 | monochrome display, they are underlined. @xref{Highlighting Difference | 389 | monochrome display, they are underlined. @xref{Highlighting Difference |
| 385 | Regions}, for information on how to customize this. | 390 | Regions}, for information on how to customize this. |
| 386 | 391 | ||
| 387 | The functions @code{ediff-windows-wordwise}, | 392 | The commands @code{ediff-windows-wordwise}, |
| 388 | @code{ediff-windows-linewise}, @code{ediff-regions-wordwise} and | 393 | @code{ediff-windows-linewise}, @code{ediff-regions-wordwise} and |
| 389 | @code{ediff-regions-linewise} do comparison on parts of existing Emacs | 394 | @code{ediff-regions-linewise} do comparison on parts of existing Emacs |
| 390 | buffers. Since @code{ediff-windows-wordwise} and | 395 | buffers. The commands @code{ediff-windows-wordwise} and |
| 391 | @code{ediff-regions-wordwise} are intended for relatively small segments | 396 | @code{ediff-regions-wordwise} are intended for relatively small segments |
| 392 | of buffers, comparison is done on the basis of words rather than lines. | 397 | of buffers (e.g., up to 100 lines, depending on the speed of your machine), |
| 393 | No refinement is necessary in this case. These commands are recommended | 398 | as they perform comparison on the basis of words rather than lines. |
| 394 | only for relatively small regions (perhaps, up to 100 lines), because | 399 | (Word-wise comparison of large chunks of text can be slow.) |
| 395 | these functions have a relatively slow startup. | ||
| 396 | 400 | ||
| 397 | To compare large regions, use @code{ediff-regions-linewise}. This | 401 | To compare large regions, use @code{ediff-regions-linewise}. This |
| 398 | command displays differences much like @code{ediff-files} and | 402 | command displays differences much like @code{ediff-files} and |
| @@ -949,6 +953,21 @@ This function can also be invoked from the Menubar. However, in some | |||
| 949 | cases, the change will take place only after you execute one of the Ediff | 953 | cases, the change will take place only after you execute one of the Ediff |
| 950 | commands, such as going to the next difference or redisplaying. | 954 | commands, such as going to the next difference or redisplaying. |
| 951 | 955 | ||
| 956 | @item ediff-toggle-use-toolbar | ||
| 957 | @findex ediff-toggle-use-toolbar | ||
| 958 | Available in XEmacs only. The Ediff toolbar provides quick access to some | ||
| 959 | of the common Ediff functions. This function toggles the display of the | ||
| 960 | toolbar. If invoked from the menubar, the function may take sometimes | ||
| 961 | effect only after you execute an Ediff command, such as going to the next | ||
| 962 | difference. | ||
| 963 | |||
| 964 | @item ediff-use-toolbar-p | ||
| 965 | @vindex ediff-use-toolbar-p | ||
| 966 | The use of the toolbar can also be specified via the variable | ||
| 967 | @code{ediff-use-toolbar-p} (default is @code{t}). This variable can be set | ||
| 968 | only in @file{.emacs} --- do @strong{not} change it interactively. Use the | ||
| 969 | function @code{ediff-toggle-use-toolbar} instead. | ||
| 970 | |||
| 952 | @item ediff-revert-buffers-then-recompute-diffs | 971 | @item ediff-revert-buffers-then-recompute-diffs |
| 953 | @findex ediff-revert-buffers-then-recompute-diffs | 972 | @findex ediff-revert-buffers-then-recompute-diffs |
| 954 | This command reverts the buffers you are comparing and recomputes their | 973 | This command reverts the buffers you are comparing and recomputes their |
| @@ -2347,7 +2366,7 @@ control buffer is in its own frame. | |||
| 2347 | @node Credits, Index, Customization, Top | 2366 | @node Credits, Index, Customization, Top |
| 2348 | @chapter Credits | 2367 | @chapter Credits |
| 2349 | 2368 | ||
| 2350 | Ediff was written by Michael Kifer <kifer@@cs.sunysb.edu>. It was inspired | 2369 | Ediff was written by Michael Kifer <kifer@@cs.stonybrook.edu>. It was inspired |
| 2351 | by emerge.el written by Dale R.@: Worley <drw@@math.mit.edu>. An idea due to | 2370 | by emerge.el written by Dale R.@: Worley <drw@@math.mit.edu>. An idea due to |
| 2352 | Boris Goldowsky <boris@@cs.rochester.edu> made it possible to highlight | 2371 | Boris Goldowsky <boris@@cs.rochester.edu> made it possible to highlight |
| 2353 | fine differences in Ediff buffers. Alastair Burt <burt@@dfki.uni-kl.de> | 2372 | fine differences in Ediff buffers. Alastair Burt <burt@@dfki.uni-kl.de> |
| @@ -2396,7 +2415,6 @@ Karl Heuer (kwzh@@gnu.org), | |||
| 2396 | (jaffe@@chipmunk.cita.utoronto.ca), | 2415 | (jaffe@@chipmunk.cita.utoronto.ca), |
| 2397 | David Karr (dkarr@@nmo.gtegsc.com), | 2416 | David Karr (dkarr@@nmo.gtegsc.com), |
| 2398 | Norbert Kiesel (norbert@@i3.informatik.rwth-aachen.de), | 2417 | Norbert Kiesel (norbert@@i3.informatik.rwth-aachen.de), |
| 2399 | Sam Steingold (sds@@goems.com), | ||
| 2400 | Leigh L Klotz (klotz@@adoc.xerox.com), | 2418 | Leigh L Klotz (klotz@@adoc.xerox.com), |
| 2401 | Fritz Knabe (Fritz.Knabe@@ecrc.de), | 2419 | Fritz Knabe (Fritz.Knabe@@ecrc.de), |
| 2402 | Heinz Knutzen (hk@@informatik.uni-kiel.d400.de), | 2420 | Heinz Knutzen (hk@@informatik.uni-kiel.d400.de), |
| @@ -2406,6 +2424,7 @@ Ken Laprade (laprade@@dw3f.ess.harris.com), | |||
| 2406 | Will C Lauer (wcl@@cadre.com), | 2424 | Will C Lauer (wcl@@cadre.com), |
| 2407 | Richard Levitte (levitte@@e.kth.se), | 2425 | Richard Levitte (levitte@@e.kth.se), |
| 2408 | Mike Long (mike.long@@analog.com), | 2426 | Mike Long (mike.long@@analog.com), |
| 2427 | Dave Love (d.love@@dl.ac.uk), | ||
| 2409 | Martin Maechler (maechler@@stat.math.ethz.ch), | 2428 | Martin Maechler (maechler@@stat.math.ethz.ch), |
| 2410 | Simon Marshall (simon@@gnu.org), | 2429 | Simon Marshall (simon@@gnu.org), |
| 2411 | Paul C. Meuse (pmeuse@@delcomsys.com), | 2430 | Paul C. Meuse (pmeuse@@delcomsys.com), |
| @@ -2432,6 +2451,7 @@ Vin Shelton (acs@@xemacs.org), | |||
| 2432 | Scott O. Sherman (Scott.Sherman@@mci.com), | 2451 | Scott O. Sherman (Scott.Sherman@@mci.com), |
| 2433 | Richard Stallman (rms@@gnu.org), | 2452 | Richard Stallman (rms@@gnu.org), |
| 2434 | Richard Stanton (stanton@@haas.berkeley.edu), | 2453 | Richard Stanton (stanton@@haas.berkeley.edu), |
| 2454 | Sam Steingold (sds@@goems.com), | ||
| 2435 | Ake Stenhoff (etxaksf@@aom.ericsson.se), | 2455 | Ake Stenhoff (etxaksf@@aom.ericsson.se), |
| 2436 | Stig (stig@@hackvan.com), | 2456 | Stig (stig@@hackvan.com), |
| 2437 | Peter Stout (Peter_Stout@@cs.cmu.edu), | 2457 | Peter Stout (Peter_Stout@@cs.cmu.edu), |
diff --git a/man/viper.texi b/man/viper.texi index d0201645871..29495783bf0 100644 --- a/man/viper.texi +++ b/man/viper.texi | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | @titlepage | 20 | @titlepage |
| 21 | @title Viper Is a Package for Emacs Rebels | 21 | @title Viper Is a Package for Emacs Rebels |
| 22 | @subtitle a Vi emulator for Emacs | 22 | @subtitle a Vi emulator for Emacs |
| 23 | @subtitle October 2000, Viper Version 3.09 | 23 | @subtitle January 2002, Viper Version 3.11.2 |
| 24 | 24 | ||
| 25 | @author Michael Kifer (Viper) | 25 | @author Michael Kifer (Viper) |
| 26 | @author Aamod Sane (VIP 4.4) | 26 | @author Aamod Sane (VIP 4.4) |
| @@ -33,7 +33,7 @@ | |||
| 33 | @unnumbered Distribution | 33 | @unnumbered Distribution |
| 34 | 34 | ||
| 35 | @noindent | 35 | @noindent |
| 36 | Copyright @copyright{} 1995, 1996, 1997, 2001 Free Software Foundation, Inc. | 36 | Copyright @copyright{} 1995, 1996, 1997, 2001, 2002 Free Software Foundation, Inc. |
| 37 | 37 | ||
| 38 | Permission is granted to copy, distribute and/or modify this document | 38 | Permission is granted to copy, distribute and/or modify this document |
| 39 | under the terms of the GNU Free Documentation License, Version 1.1 or | 39 | under the terms of the GNU Free Documentation License, Version 1.1 or |
| @@ -58,7 +58,7 @@ license to the document, as described in section 6 of the license. | |||
| 58 | @unnumbered Viper | 58 | @unnumbered Viper |
| 59 | 59 | ||
| 60 | We believe that one or more of the following statements are adequate | 60 | We believe that one or more of the following statements are adequate |
| 61 | descriptions: | 61 | descriptions of Viper: |
| 62 | 62 | ||
| 63 | @example | 63 | @example |
| 64 | Viper Is a Package for Emacs Rebels; | 64 | Viper Is a Package for Emacs Rebels; |
| @@ -80,7 +80,7 @@ new features of Viper. | |||
| 80 | 80 | ||
| 81 | Viper, formerly known as VIP-19, was written by Michael Kifer. It is based | 81 | Viper, formerly known as VIP-19, was written by Michael Kifer. It is based |
| 82 | on VIP version 3.5 by Masahiko Sato and VIP version 4.4 by Aamod Sane. | 82 | on VIP version 3.5 by Masahiko Sato and VIP version 4.4 by Aamod Sane. |
| 83 | Viper tries to be compatible with these packages. | 83 | About 15% of the code still comes from those older packages. |
| 84 | 84 | ||
| 85 | Viper is intended to be usable without reading this manual --- the defaults | 85 | Viper is intended to be usable without reading this manual --- the defaults |
| 86 | are set to make Viper as close to Vi as possible. At startup, Viper will | 86 | are set to make Viper as close to Vi as possible. At startup, Viper will |
| @@ -89,19 +89,19 @@ your familiarity with Emacs. It will also tell you the basic GNU Emacs window | |||
| 89 | management commands to help you start immediately. | 89 | management commands to help you start immediately. |
| 90 | 90 | ||
| 91 | Although this manual explains how to customize Viper, some basic | 91 | Although this manual explains how to customize Viper, some basic |
| 92 | familiarity with Emacs Lisp would be a plus. | 92 | familiarity with Emacs Lisp is a plus. |
| 93 | 93 | ||
| 94 | It is recommended that you read the Overview node. The other nodes may | 94 | It is recommended that you read the Overview node. The other nodes may |
| 95 | be visited as needed. | 95 | be visited as needed. |
| 96 | 96 | ||
| 97 | Comments and bug reports are welcome. | 97 | Comments and bug reports are welcome. |
| 98 | @code{kifer@@cs.sunysb.edu} is the current address for Viper bug reports. | 98 | @code{kifer@@cs.stonybrook.edu} is the current address for Viper bug reports. |
| 99 | Please use the Ex command @kbd{:submitReport} for this purpose.@refill | 99 | Please use the Ex command @kbd{:submitReport} for this purpose.@refill |
| 100 | 100 | ||
| 101 | @end ifinfo | 101 | @end ifinfo |
| 102 | 102 | ||
| 103 | @menu | 103 | @menu |
| 104 | * Overview:: Must read to get started | 104 | * Overview:: Read for a smoother start |
| 105 | * Improvements over Vi:: New features, Improvements | 105 | * Improvements over Vi:: New features, Improvements |
| 106 | * Customization:: How to customize Viper | 106 | * Customization:: How to customize Viper |
| 107 | * Commands:: Vi and Ex Commands | 107 | * Commands:: Vi and Ex Commands |
| @@ -118,7 +118,7 @@ Please use the Ex command @kbd{:submitReport} for this purpose.@refill | |||
| 118 | @unnumbered Introduction | 118 | @unnumbered Introduction |
| 119 | 119 | ||
| 120 | We believe that one or more of the following statements are adequate | 120 | We believe that one or more of the following statements are adequate |
| 121 | descriptions: | 121 | descriptions of Viper: |
| 122 | 122 | ||
| 123 | @example | 123 | @example |
| 124 | Viper Is a Package for Emacs Rebels; | 124 | Viper Is a Package for Emacs Rebels; |
| @@ -134,8 +134,8 @@ This manual describes Viper, concentrating on the differences from Vi | |||
| 134 | and on the new features of Viper. | 134 | and on the new features of Viper. |
| 135 | 135 | ||
| 136 | Viper was written by Michael Kifer. It is based on VIP version 3.5 by | 136 | Viper was written by Michael Kifer. It is based on VIP version 3.5 by |
| 137 | Masahiko Sato and VIP version 4.4 by Aamod Sane. Viper tries to be | 137 | Masahiko Sato and VIP version 4.4 by Aamod Sane. About 15% of the code |
| 138 | compatible with these packages. | 138 | still comes from those older packages. |
| 139 | 139 | ||
| 140 | Viper is intended to be usable out of the box, without reading this manual | 140 | Viper is intended to be usable out of the box, without reading this manual |
| 141 | --- the defaults are set to make Viper as close to Vi as possible. At | 141 | --- the defaults are set to make Viper as close to Vi as possible. At |
| @@ -144,7 +144,7 @@ for you, based on your familiarity with Emacs. It will also tell you the | |||
| 144 | basic GNU Emacs window management commands to help you start immediately. | 144 | basic GNU Emacs window management commands to help you start immediately. |
| 145 | 145 | ||
| 146 | Although this manual explains how to customize Viper, some basic | 146 | Although this manual explains how to customize Viper, some basic |
| 147 | familiarity with Emacs Lisp would be a plus. | 147 | familiarity with Emacs Lisp is a plus. |
| 148 | 148 | ||
| 149 | It is recommended that you read the chapter Overview. The other chapters | 149 | It is recommended that you read the chapter Overview. The other chapters |
| 150 | will be useful for customization and advanced usage. | 150 | will be useful for customization and advanced usage. |
| @@ -154,7 +154,7 @@ comes with Emacs. This manual can be read as an Info file. Try the command | |||
| 154 | @kbd{@key{ESC} x info} with vanilla Emacs sometime. | 154 | @kbd{@key{ESC} x info} with vanilla Emacs sometime. |
| 155 | 155 | ||
| 156 | Comments and bug reports are welcome. | 156 | Comments and bug reports are welcome. |
| 157 | @code{kifer@@cs.sunysb.edu} is the current address for Viper bug reports. | 157 | @code{kifer@@cs.stonybrook.edu} is the current address for Viper bug reports. |
| 158 | Please use the Ex command @kbd{:submitReport} for this purpose.@refill | 158 | Please use the Ex command @kbd{:submitReport} for this purpose.@refill |
| 159 | 159 | ||
| 160 | @end iftex | 160 | @end iftex |
| @@ -179,12 +179,9 @@ enables additional Emacs bindings under Viper. These customizations can be | |||
| 179 | included in your @file{~/.viper} file and are found at the following URL: | 179 | included in your @file{~/.viper} file and are found at the following URL: |
| 180 | @file{http://www.eecs.umich.edu/~jshawkin/viper-sample}. | 180 | @file{http://www.eecs.umich.edu/~jshawkin/viper-sample}. |
| 181 | 181 | ||
| 182 | Viper was formerly known as VIP-19, which was | ||
| 183 | a descendant of VIP 3.5 by Masahiko Sato and VIP 4.4 by Aamod Sane. | ||
| 184 | |||
| 185 | @menu | 182 | @menu |
| 186 | * Emacs Preliminaries:: Basic concepts in Emacs. | 183 | * Emacs Preliminaries:: Basic concepts in Emacs. |
| 187 | * Loading Viper:: Loading and Preliminary Configuration. | 184 | * Loading Viper:: Loading and Preliminary Configuration. |
| 188 | * States in Viper:: Viper has four states orthogonal to Emacs | 185 | * States in Viper:: Viper has four states orthogonal to Emacs |
| 189 | modes. | 186 | modes. |
| 190 | * The Minibuffer:: Command line in Emacs. | 187 | * The Minibuffer:: Command line in Emacs. |
| @@ -339,14 +336,6 @@ version 20.0, Emacsen have an interactive interface, which simplifies the | |||
| 339 | job of customization significantly. | 336 | job of customization significantly. |
| 340 | 337 | ||
| 341 | Viper also uses the file @file{~/.viper} for Viper-specific customization. | 338 | Viper also uses the file @file{~/.viper} for Viper-specific customization. |
| 342 | If you wish to be in Vi command state whenever this is deemed appropriate | ||
| 343 | by the author, you can include the following line in your @file{.viper}: | ||
| 344 | @lisp | ||
| 345 | (setq viper-always t) | ||
| 346 | @end lisp | ||
| 347 | @noindent | ||
| 348 | (@xref{Vi State}, for the explanation of Vi command state.) | ||
| 349 | |||
| 350 | The location of Viper customization file can be changed by setting the | 339 | The location of Viper customization file can be changed by setting the |
| 351 | variable @code{viper-custom-file-name} in @file{.emacs} @emph{prior} to loading | 340 | variable @code{viper-custom-file-name} in @file{.emacs} @emph{prior} to loading |
| 352 | Viper. | 341 | Viper. |
| @@ -362,8 +351,8 @@ whenever this makes sense. | |||
| 362 | @xref{Packages that Change Keymaps}, to find out when forcing Vi command state | 351 | @xref{Packages that Change Keymaps}, to find out when forcing Vi command state |
| 363 | on a buffer may be counter-productive. | 352 | on a buffer may be counter-productive. |
| 364 | 353 | ||
| 365 | Even if your @file{.emacs} and @file{.viper} files do not contain any of the | 354 | Even if your @file{.emacs} file does not invoke Viper automatically, |
| 366 | above lines, you can still load Viper and enter Vi command state by typing the | 355 | you can still load Viper and enter the Vi command state by typing the |
| 367 | following from within Emacs: | 356 | following from within Emacs: |
| 368 | 357 | ||
| 369 | @lisp | 358 | @lisp |
| @@ -378,7 +367,7 @@ editing files by using @kbd{:e}, @kbd{:vi}, or @kbd{v} commands. | |||
| 378 | new commands that, in many cases, are more convenient than @kbd{:e}, | 367 | new commands that, in many cases, are more convenient than @kbd{:e}, |
| 379 | @kbd{:vi}, and similar old-style Vi commands.)@refill | 368 | @kbd{:vi}, and similar old-style Vi commands.)@refill |
| 380 | 369 | ||
| 381 | Finally, if at some point you would want to get de-Viperize your running | 370 | Finally, if at some point you would want to de-Viperize your running |
| 382 | copy of Emacs after Viper has been loaded, the command @kbd{M-x | 371 | copy of Emacs after Viper has been loaded, the command @kbd{M-x |
| 383 | viper-go-away} will do it for you. The function @code{toggle-viper-mode} | 372 | viper-go-away} will do it for you. The function @code{toggle-viper-mode} |
| 384 | toggles Viperization of Emacs on and off. | 373 | toggles Viperization of Emacs on and off. |
| @@ -476,7 +465,7 @@ Insert state, you cannot do many interesting things, like language | |||
| 476 | sensitive editing. For the novice user (at Viper level 1), all major mode | 465 | sensitive editing. For the novice user (at Viper level 1), all major mode |
| 477 | bindings are turned off in Vi state as well. This includes the bindings for | 466 | bindings are turned off in Vi state as well. This includes the bindings for |
| 478 | key sequences that start with @kbd{C-c}, which practically means that all | 467 | key sequences that start with @kbd{C-c}, which practically means that all |
| 479 | major mode bindings are supported. @xref{Customization}, to find out how | 468 | major mode bindings are unsupported. @xref{Customization}, to find out how |
| 480 | to allow Emacs keys in Insert state. | 469 | to allow Emacs keys in Insert state. |
| 481 | 470 | ||
| 482 | @menu | 471 | @menu |
| @@ -571,7 +560,8 @@ Viper uses @key{ESC} as a switch between Insert and Vi states. Emacs uses | |||
| 571 | functions are accessible only via that key as @kbd{M-x function-name}. | 560 | functions are accessible only via that key as @kbd{M-x function-name}. |
| 572 | Therefore, we need to simulate it somehow. In Viper's Vi, Insert, and | 561 | Therefore, we need to simulate it somehow. In Viper's Vi, Insert, and |
| 573 | Replace states, the meta key is set to be @kbd{C-\}. Thus, to get | 562 | Replace states, the meta key is set to be @kbd{C-\}. Thus, to get |
| 574 | @kbd{M-x}, you should type @kbd{C-\ x} (if the keyboard has no Meta key). | 563 | @kbd{M-x}, you should type @kbd{C-\ x} (if the keyboard has no Meta key, |
| 564 | which is rare these days). | ||
| 575 | This works both in the Vi command state and in the Insert and Replace | 565 | This works both in the Vi command state and in the Insert and Replace |
| 576 | states. In Vi command state, you can also use @kbd{\ @key{ESC}} as the | 566 | states. In Vi command state, you can also use @kbd{\ @key{ESC}} as the |
| 577 | meta key. | 567 | meta key. |
| @@ -900,9 +890,9 @@ Unimplemented features include: | |||
| 900 | 890 | ||
| 901 | @itemize @bullet | 891 | @itemize @bullet |
| 902 | @item | 892 | @item |
| 903 | @kbd{:ab} and @kbd{:una} are not implemented. | 893 | @kbd{:ab} and @kbd{:una} are not implemented, since |
| 904 | Both @kbd{:map} and @kbd{:ab} are considered obsolete, since Emacs has much | 894 | @kbd{:ab} is considered obsolete, since Emacs has much |
| 905 | more powerful facilities for defining keyboard macros and abbreviations. | 895 | more powerful facilities for defining abbreviations. |
| 906 | @item | 896 | @item |
| 907 | @kbd{:set option?} is not implemented. The current | 897 | @kbd{:set option?} is not implemented. The current |
| 908 | @kbd{:set} can also be used to set Emacs variables. | 898 | @kbd{:set} can also be used to set Emacs variables. |
| @@ -1202,7 +1192,8 @@ will have to change @code{viper-search-face} to your liking. The easiest | |||
| 1202 | way to do this is to use Emacs customization widget, which is accessible | 1192 | way to do this is to use Emacs customization widget, which is accessible |
| 1203 | from the menubar. Viper customization group is located under the | 1193 | from the menubar. Viper customization group is located under the |
| 1204 | @emph{Emulations} customization group, which in turn is under the | 1194 | @emph{Emulations} customization group, which in turn is under the |
| 1205 | @emph{Editing} group. All Viper faces are grouped together under Viper's | 1195 | @emph{Editing} group (or simply by typing @kbd{:customize}). All Viper |
| 1196 | faces are grouped together under Viper's | ||
| 1206 | @emph{Highlighting} group. | 1197 | @emph{Highlighting} group. |
| 1207 | 1198 | ||
| 1208 | Try it: it is really simple! | 1199 | Try it: it is really simple! |
| @@ -1583,28 +1574,30 @@ Customization can be done in 2 ways. | |||
| 1583 | @cindex .viper | 1574 | @cindex .viper |
| 1584 | Elisp code in a @file{.viper} file in your home directory. Viper | 1575 | Elisp code in a @file{.viper} file in your home directory. Viper |
| 1585 | loads @file{.viper} just before it does the binding for mode | 1576 | loads @file{.viper} just before it does the binding for mode |
| 1586 | hooks. This is the recommended method. | 1577 | hooks. This is recommended for experts only. |
| 1587 | @item | 1578 | @item |
| 1588 | @cindex .emacs | 1579 | @cindex .emacs |
| 1589 | Elisp code in your @file{.emacs} file before and after the @code{(require | 1580 | Elisp code in your @file{.emacs} file before and after the @code{(require |
| 1590 | 'viper)} line. This method is not recommended, unless you know what you are | 1581 | 'viper)} line. This method is @emph{not} recommended, unless you know what |
| 1591 | doing. Only two variables, @code{viper-mode} and | 1582 | you are doing. Only two variables, @code{viper-mode} and |
| 1592 | @code{viper-custom-file-name} are supposed to be customized in @file{.emacs}, | 1583 | @code{viper-custom-file-name}, are supposed to be customized in @file{.emacs}, |
| 1593 | prior to loading Viper.@refill | 1584 | prior to loading Viper (i.e., prior to @code{(require 'viper)} command.@refill |
| 1594 | @end itemize | 1585 | @item |
| 1595 | 1586 | @cindex :customize | |
| 1596 | @noindent | 1587 | By executing the @kbd{:customize} Ex command. This takes you to the Emacs |
| 1597 | Most of Viper's behavior can be customized via the interactive Emacs user | 1588 | customization widget, which lets you change the values of Viper |
| 1598 | interface. Choose "Customize" from the menubar, click on "Editing", then on | 1589 | customizable variables easily. This method is good for novice and |
| 1599 | "Emulations". The customization widget is self-explanatory. Once you are | 1590 | experts alike. The customization code in the form of Lisp commands will be |
| 1600 | satisfied with your changes, save them into a file and then include the | 1591 | placed in @file{~/.emacs} or some other customization file depending on the |
| 1601 | contents of that file in the Viper customization repository, @file{.viper} | 1592 | version of Emacs that you use. Still, it is recommended to separate |
| 1602 | (except for @code{viper-mode} and @code{viper-custom-file-name}, which are | 1593 | Viper-related customization produced by the Emacs customization widget |
| 1603 | supposed to go into @code{.emacs}). | 1594 | and keep in in the @file{.viper} file. |
| 1604 | 1595 | ||
| 1605 | Some advanced customization cannot be accomplished this way, however, and | 1596 | Some advanced customization cannot be accomplished this way, however, and |
| 1606 | has to be done in Emacs Lisp. For the common cases, examples are provided | 1597 | has to be done in Emacs Lisp in the @file{.viper} file. For the common |
| 1607 | that you can use directly. | 1598 | cases, examples are provided that you can use directly. |
| 1599 | @end itemize | ||
| 1600 | |||
| 1608 | 1601 | ||
| 1609 | @menu | 1602 | @menu |
| 1610 | * Rudimentary Changes:: Simple constant definitions. | 1603 | * Rudimentary Changes:: Simple constant definitions. |
| @@ -2002,8 +1995,8 @@ so you can just type | |||
| 2002 | @end lisp | 1995 | @end lisp |
| 2003 | 1996 | ||
| 2004 | @noindent | 1997 | @noindent |
| 2005 | to bind L1 so it will invoke the Emacs Calendar and to bind L4 so it will | 1998 | to bind L1 (a key that exists on some SUN workstations) so it will invoke |
| 2006 | undo changes. | 1999 | the Emacs Calendar and to bind L4 so it will undo changes. |
| 2007 | However, on a dumb terminal or in an Xterm window, even the standard arrow | 2000 | However, on a dumb terminal or in an Xterm window, even the standard arrow |
| 2008 | keys may | 2001 | keys may |
| 2009 | not emit the right signals for Emacs to understand. To let Emacs know about | 2002 | not emit the right signals for Emacs to understand. To let Emacs know about |
| @@ -2144,9 +2137,9 @@ buffer switches to some other Viper state and then back to Emacs state). To | |||
| 2144 | avoid this, one should add @code{viper-change-state-to-emacs} to an | 2137 | avoid this, one should add @code{viper-change-state-to-emacs} to an |
| 2145 | appropriate hook of that major mode. (Check the function | 2138 | appropriate hook of that major mode. (Check the function |
| 2146 | @code{viper-set-hooks} in @file{viper.el} for examples.) However, if you | 2139 | @code{viper-set-hooks} in @file{viper.el} for examples.) However, if you |
| 2147 | have set @code{viper-always} to @code{t}, chances are that you won't need to | 2140 | did not set @code{viper-always} to @code{nil}, chances are that you won't |
| 2148 | perform the above procedure, because Viper will take care of most useful | 2141 | need to perform the above procedure, because Viper will take care of most |
| 2149 | defaults. | 2142 | useful defaults. |
| 2150 | 2143 | ||
| 2151 | 2144 | ||
| 2152 | Finally, Viper has a facility that lets the user define per-buffer | 2145 | Finally, Viper has a facility that lets the user define per-buffer |
| @@ -2224,7 +2217,8 @@ means that bindings set by those modes are generally available with Viper | |||
| 2224 | (unless you explicitly prohibit them by setting | 2217 | (unless you explicitly prohibit them by setting |
| 2225 | @code{viper-want-emacs-keys-in-vi} and @code{viper-want-emacs-keys-in-insert} to | 2218 | @code{viper-want-emacs-keys-in-vi} and @code{viper-want-emacs-keys-in-insert} to |
| 2226 | @code{nil}). | 2219 | @code{nil}). |
| 2227 | If @code{viper-always} is set to @code{t}, Viper will try to bring each buffer | 2220 | If @code{viper-always} is set to @code{t} (which is the default), Viper |
| 2221 | will try to bring each buffer | ||
| 2228 | in the Viper state that is most appropriate for that buffer. | 2222 | in the Viper state that is most appropriate for that buffer. |
| 2229 | Usually, this would be the Vi state, but sometimes it could be the Insert | 2223 | Usually, this would be the Vi state, but sometimes it could be the Insert |
| 2230 | state or the Emacs state. | 2224 | state or the Emacs state. |
| @@ -2611,8 +2605,7 @@ command in @code{~/.viper} after setting @code{viper-mouse-search-key}: | |||
| 2611 | @end lisp | 2605 | @end lisp |
| 2612 | 2606 | ||
| 2613 | You can also change this setting interactively, through the customization | 2607 | You can also change this setting interactively, through the customization |
| 2614 | widget of Emacs (choose option "Customize.Customize Group" from the | 2608 | widget of Emacs (type @kbd{:customize}). |
| 2615 | menubar). | ||
| 2616 | 2609 | ||
| 2617 | The region that is chosen as a pattern to search for is determined as | 2610 | The region that is chosen as a pattern to search for is determined as |
| 2618 | follows. If search is invoked via a single click, Viper chooses the region | 2611 | follows. If search is invoked via a single click, Viper chooses the region |
| @@ -2727,7 +2720,8 @@ register (a lowercase letter); such macros can then be executed by typing | |||
| 2727 | If, however, you need to use a macro regularly, it must be given a | 2720 | If, however, you need to use a macro regularly, it must be given a |
| 2728 | permanent name and saved. Emacs manual explains how to do this, but | 2721 | permanent name and saved. Emacs manual explains how to do this, but |
| 2729 | invocation of named Emacs macros is quite different from Vi's. First, | 2722 | invocation of named Emacs macros is quite different from Vi's. First, |
| 2730 | invocation of permanent Emacs macros takes time because of the extra keys. | 2723 | invocation of permanent Emacs macros takes time because it requires typing |
| 2724 | too many keys (to a Vi user's taste, anyway). | ||
| 2731 | Second, binding such macros to function keys, for | 2725 | Second, binding such macros to function keys, for |
| 2732 | fast access, hogs valuable real estate on the keyboard. | 2726 | fast access, hogs valuable real estate on the keyboard. |
| 2733 | 2727 | ||
| @@ -2735,8 +2729,9 @@ Vi-style macros are better in that respect, since Vi lets the user overload | |||
| 2735 | the meaning of key sequences: keys typed in fast succession are treated | 2729 | the meaning of key sequences: keys typed in fast succession are treated |
| 2736 | specially, if this key sequence is bound to a macro. | 2730 | specially, if this key sequence is bound to a macro. |
| 2737 | 2731 | ||
| 2738 | Viper provides keyboard macros through the usual Ex commands, @kbd{:map} and | 2732 | Viper provides Vi-style keyboard macros through the usual Ex commands, |
| 2739 | @kbd{:map!}. Vi-style macros are much more powerful in Viper than | 2733 | @kbd{:map} and |
| 2734 | @kbd{:map!}. These macros are much more powerful in Viper than | ||
| 2740 | they are in the original Vi and in other emulators. This is because Viper | 2735 | they are in the original Vi and in other emulators. This is because Viper |
| 2741 | implements an enhanced vi-style | 2736 | implements an enhanced vi-style |
| 2742 | interface to the powerful Emacs keyboard macro facility. | 2737 | interface to the powerful Emacs keyboard macro facility. |
| @@ -4481,7 +4476,7 @@ martin@@xemacs.org (Martin Buchholz), | |||
| 4481 | mbutler@@redfernnetworks.com (Malcolm Butler), | 4476 | mbutler@@redfernnetworks.com (Malcolm Butler), |
| 4482 | mveiga@@dit.upm.es (Marcelino Veiga Tuimil), | 4477 | mveiga@@dit.upm.es (Marcelino Veiga Tuimil), |
| 4483 | paulk@@summit.esg.apertus.com (Paul Keusemann), | 4478 | paulk@@summit.esg.apertus.com (Paul Keusemann), |
| 4484 | pfister@@cs.sunysb.edu (Hanspeter Pfister), | 4479 | pfister@@cs.stonybrook.edu (Hanspeter Pfister), |
| 4485 | phil_brooks@@MENTORG.COM (Phil Brooks), | 4480 | phil_brooks@@MENTORG.COM (Phil Brooks), |
| 4486 | pogrell@@informatik.hu-berlin.de (Lutz Pogrell), | 4481 | pogrell@@informatik.hu-berlin.de (Lutz Pogrell), |
| 4487 | pradyut@@cs.uchicago.edu (Pradyut Shah), | 4482 | pradyut@@cs.uchicago.edu (Pradyut Shah), |