diff options
| author | Thien-Thi Nguyen | 2000-10-31 18:05:59 +0000 |
|---|---|---|
| committer | Thien-Thi Nguyen | 2000-10-31 18:05:59 +0000 |
| commit | acce6d21f9561b9ae93624d60ddb892c8c05f44b (patch) | |
| tree | 596d54dc1ac026ed59303a647477256db0c91b58 | |
| parent | 26dcb81b5223f5bd8e880080ab64c61e6d8d7bc9 (diff) | |
| download | emacs-acce6d21f9561b9ae93624d60ddb892c8c05f44b.tar.gz emacs-acce6d21f9561b9ae93624d60ddb892c8c05f44b.zip | |
(ediff-prepare-buffer-hook): Expand docstring, no functional change.
| -rw-r--r-- | lisp/ediff-init.el | 221 |
1 files changed, 111 insertions, 110 deletions
diff --git a/lisp/ediff-init.el b/lisp/ediff-init.el index a3e3bcd1569..de8bed967db 100644 --- a/lisp/ediff-init.el +++ b/lisp/ediff-init.el | |||
| @@ -77,19 +77,19 @@ that Ediff doesn't know about.") | |||
| 77 | (boundp 'ediff-use-toolbar-p) | 77 | (boundp 'ediff-use-toolbar-p) |
| 78 | ediff-use-toolbar-p)) ;Does the user want it ? | 78 | ediff-use-toolbar-p)) ;Does the user want it ? |
| 79 | 79 | ||
| 80 | ;; Defines SYMBOL as an advertised local variable. | 80 | ;; Defines SYMBOL as an advertised local variable. |
| 81 | ;; Performs a defvar, then executes `make-variable-buffer-local' on | 81 | ;; Performs a defvar, then executes `make-variable-buffer-local' on |
| 82 | ;; the variable. Also sets the `permanent-local' property, | 82 | ;; the variable. Also sets the `permanent-local' property, |
| 83 | ;; so that `kill-all-local-variables' (called by major-mode setting | 83 | ;; so that `kill-all-local-variables' (called by major-mode setting |
| 84 | ;; commands) won't destroy Ediff control variables. | 84 | ;; commands) won't destroy Ediff control variables. |
| 85 | ;; | 85 | ;; |
| 86 | ;; Plagiarised from `emerge-defvar-local' for XEmacs. | 86 | ;; Plagiarised from `emerge-defvar-local' for XEmacs. |
| 87 | (defmacro ediff-defvar-local (var value doc) | 87 | (defmacro ediff-defvar-local (var value doc) |
| 88 | `(progn | 88 | `(progn |
| 89 | (defvar ,var ,value ,doc) | 89 | (defvar ,var ,value ,doc) |
| 90 | (make-variable-buffer-local ',var) | 90 | (make-variable-buffer-local ',var) |
| 91 | (put ',var 'permanent-local t))) | 91 | (put ',var 'permanent-local t))) |
| 92 | 92 | ||
| 93 | 93 | ||
| 94 | 94 | ||
| 95 | ;; Variables that control each Ediff session---local to the control buffer. | 95 | ;; Variables that control each Ediff session---local to the control buffer. |
| @@ -126,13 +126,13 @@ that Ediff doesn't know about.") | |||
| 126 | ((eq ,arg 'C) ediff-buffer-C) | 126 | ((eq ,arg 'C) ediff-buffer-C) |
| 127 | ((eq ,arg 'Ancestor) ediff-ancestor-buffer) | 127 | ((eq ,arg 'Ancestor) ediff-ancestor-buffer) |
| 128 | )) | 128 | )) |
| 129 | 129 | ||
| 130 | (defmacro ediff-get-value-according-to-buffer-type (buf-type list) | 130 | (defmacro ediff-get-value-according-to-buffer-type (buf-type list) |
| 131 | `(cond ((eq ,buf-type 'A) (nth 0 ,list)) | 131 | `(cond ((eq ,buf-type 'A) (nth 0 ,list)) |
| 132 | ((eq ,buf-type 'B) (nth 1 ,list)) | 132 | ((eq ,buf-type 'B) (nth 1 ,list)) |
| 133 | ((eq ,buf-type 'C) (nth 2 ,list)) | 133 | ((eq ,buf-type 'C) (nth 2 ,list)) |
| 134 | )) | 134 | )) |
| 135 | 135 | ||
| 136 | (defmacro ediff-char-to-buftype (arg) | 136 | (defmacro ediff-char-to-buftype (arg) |
| 137 | `(cond ((memq ,arg '(?a ?A)) 'A) | 137 | `(cond ((memq ,arg '(?a ?A)) 'A) |
| 138 | ((memq ,arg '(?b ?B)) 'B) | 138 | ((memq ,arg '(?b ?B)) 'B) |
| @@ -146,7 +146,7 @@ that Ediff doesn't know about.") | |||
| 146 | ;; symbol. This is used to avoid using `intern' | 146 | ;; symbol. This is used to avoid using `intern' |
| 147 | (defsubst ediff-get-symbol-from-alist (buf-type alist) | 147 | (defsubst ediff-get-symbol-from-alist (buf-type alist) |
| 148 | (cdr (assoc buf-type alist))) | 148 | (cdr (assoc buf-type alist))) |
| 149 | 149 | ||
| 150 | (defconst ediff-difference-vector-alist | 150 | (defconst ediff-difference-vector-alist |
| 151 | '((A . ediff-difference-vector-A) | 151 | '((A . ediff-difference-vector-A) |
| 152 | (B . ediff-difference-vector-B) | 152 | (B . ediff-difference-vector-B) |
| @@ -159,7 +159,7 @@ that Ediff doesn't know about.") | |||
| 159 | (ediff-get-symbol-from-alist | 159 | (ediff-get-symbol-from-alist |
| 160 | ,buf-type ediff-difference-vector-alist)) | 160 | ,buf-type ediff-difference-vector-alist)) |
| 161 | ,n)) | 161 | ,n)) |
| 162 | 162 | ||
| 163 | ;; Tell if it has been previously determined that the region has | 163 | ;; Tell if it has been previously determined that the region has |
| 164 | ;; no diffs other than the white space and newlines | 164 | ;; no diffs other than the white space and newlines |
| 165 | ;; The argument, N, is the diff region number used by Ediff to index the | 165 | ;; The argument, N, is the diff region number used by Ediff to index the |
| @@ -183,20 +183,20 @@ that Ediff doesn't know about.") | |||
| 183 | ;; different from the other two (used only in 3-way jobs). | 183 | ;; different from the other two (used only in 3-way jobs). |
| 184 | (defmacro ediff-no-fine-diffs-p (n) | 184 | (defmacro ediff-no-fine-diffs-p (n) |
| 185 | `(aref (ediff-get-difference ,n 'A) 2)) | 185 | `(aref (ediff-get-difference ,n 'A) 2)) |
| 186 | 186 | ||
| 187 | (defmacro ediff-get-diff-overlay-from-diff-record (diff-rec) | 187 | (defmacro ediff-get-diff-overlay-from-diff-record (diff-rec) |
| 188 | `(aref ,diff-rec 0)) | 188 | `(aref ,diff-rec 0)) |
| 189 | 189 | ||
| 190 | (defmacro ediff-get-diff-overlay (n buf-type) | 190 | (defmacro ediff-get-diff-overlay (n buf-type) |
| 191 | `(ediff-get-diff-overlay-from-diff-record | 191 | `(ediff-get-diff-overlay-from-diff-record |
| 192 | (ediff-get-difference ,n ,buf-type))) | 192 | (ediff-get-difference ,n ,buf-type))) |
| 193 | 193 | ||
| 194 | (defmacro ediff-get-fine-diff-vector-from-diff-record (diff-rec) | 194 | (defmacro ediff-get-fine-diff-vector-from-diff-record (diff-rec) |
| 195 | `(aref ,diff-rec 1)) | 195 | `(aref ,diff-rec 1)) |
| 196 | 196 | ||
| 197 | (defmacro ediff-set-fine-diff-vector (n buf-type fine-vec) | 197 | (defmacro ediff-set-fine-diff-vector (n buf-type fine-vec) |
| 198 | `(aset (ediff-get-difference ,n ,buf-type) 1 ,fine-vec)) | 198 | `(aset (ediff-get-difference ,n ,buf-type) 1 ,fine-vec)) |
| 199 | 199 | ||
| 200 | (defmacro ediff-get-state-of-diff (n buf-type) | 200 | (defmacro ediff-get-state-of-diff (n buf-type) |
| 201 | `(if (ediff-buffer-live-p ediff-buffer-C) | 201 | `(if (ediff-buffer-live-p ediff-buffer-C) |
| 202 | (aref (ediff-get-difference ,n ,buf-type) 3))) | 202 | (aref (ediff-get-difference ,n ,buf-type) 3))) |
| @@ -214,17 +214,17 @@ that Ediff doesn't know about.") | |||
| 214 | `(if ediff-state-of-merge | 214 | `(if ediff-state-of-merge |
| 215 | (aref (aref ediff-state-of-merge ,n) 1))) | 215 | (aref (aref ediff-state-of-merge ,n) 1))) |
| 216 | 216 | ||
| 217 | ;; if flag is t, puts a mark on diff region saying that | 217 | ;; if flag is t, puts a mark on diff region saying that |
| 218 | ;; the differences are in white space only. If flag is nil, | 218 | ;; the differences are in white space only. If flag is nil, |
| 219 | ;; the region is marked as essential (i.e., differences are | 219 | ;; the region is marked as essential (i.e., differences are |
| 220 | ;; not just in the white space and newlines.) | 220 | ;; not just in the white space and newlines.) |
| 221 | (defmacro ediff-mark-diff-as-space-only (n flag) | 221 | (defmacro ediff-mark-diff-as-space-only (n flag) |
| 222 | `(aset (ediff-get-difference ,n 'A) 2 ,flag)) | 222 | `(aset (ediff-get-difference ,n 'A) 2 ,flag)) |
| 223 | 223 | ||
| 224 | (defmacro ediff-get-fine-diff-vector (n buf-type) | 224 | (defmacro ediff-get-fine-diff-vector (n buf-type) |
| 225 | `(ediff-get-fine-diff-vector-from-diff-record | 225 | `(ediff-get-fine-diff-vector-from-diff-record |
| 226 | (ediff-get-difference ,n ,buf-type))) | 226 | (ediff-get-difference ,n ,buf-type))) |
| 227 | 227 | ||
| 228 | ;; Macro to switch to BUFFER, evaluate BODY, returns to original buffer. | 228 | ;; Macro to switch to BUFFER, evaluate BODY, returns to original buffer. |
| 229 | ;; Doesn't save the point and mark. | 229 | ;; Doesn't save the point and mark. |
| 230 | ;; This is `with-current-buffer' with the added test for live buffers." | 230 | ;; This is `with-current-buffer' with the added test for live buffers." |
| @@ -236,21 +236,21 @@ that Ediff doesn't know about.") | |||
| 236 | (or (eq this-command 'ediff-quit) | 236 | (or (eq this-command 'ediff-quit) |
| 237 | (error ediff-KILLED-VITAL-BUFFER)) | 237 | (error ediff-KILLED-VITAL-BUFFER)) |
| 238 | )) | 238 | )) |
| 239 | 239 | ||
| 240 | 240 | ||
| 241 | (defsubst ediff-multiframe-setup-p () | 241 | (defsubst ediff-multiframe-setup-p () |
| 242 | (and (ediff-window-display-p) ediff-multiframe)) | 242 | (and (ediff-window-display-p) ediff-multiframe)) |
| 243 | 243 | ||
| 244 | (defmacro ediff-narrow-control-frame-p () | 244 | (defmacro ediff-narrow-control-frame-p () |
| 245 | `(and (ediff-multiframe-setup-p) | 245 | `(and (ediff-multiframe-setup-p) |
| 246 | (equal ediff-help-message ediff-brief-message-string))) | 246 | (equal ediff-help-message ediff-brief-message-string))) |
| 247 | 247 | ||
| 248 | (defmacro ediff-3way-comparison-job () | 248 | (defmacro ediff-3way-comparison-job () |
| 249 | `(memq | 249 | `(memq |
| 250 | ediff-job-name | 250 | ediff-job-name |
| 251 | '(ediff-files3 ediff-buffers3))) | 251 | '(ediff-files3 ediff-buffers3))) |
| 252 | (ediff-defvar-local ediff-3way-comparison-job nil "") | 252 | (ediff-defvar-local ediff-3way-comparison-job nil "") |
| 253 | 253 | ||
| 254 | (defmacro ediff-merge-job () | 254 | (defmacro ediff-merge-job () |
| 255 | `(memq | 255 | `(memq |
| 256 | ediff-job-name | 256 | ediff-job-name |
| @@ -280,7 +280,7 @@ that Ediff doesn't know about.") | |||
| 280 | `(or ediff-3way-comparison-job | 280 | `(or ediff-3way-comparison-job |
| 281 | ediff-merge-with-ancestor-job)) | 281 | ediff-merge-with-ancestor-job)) |
| 282 | (ediff-defvar-local ediff-diff3-job nil "") | 282 | (ediff-defvar-local ediff-diff3-job nil "") |
| 283 | 283 | ||
| 284 | (defmacro ediff-windows-job () | 284 | (defmacro ediff-windows-job () |
| 285 | `(memq ediff-job-name '(ediff-windows-wordwise ediff-windows-linewise))) | 285 | `(memq ediff-job-name '(ediff-windows-wordwise ediff-windows-linewise))) |
| 286 | (ediff-defvar-local ediff-windows-job nil "") | 286 | (ediff-defvar-local ediff-windows-job nil "") |
| @@ -304,7 +304,7 @@ that Ediff doesn't know about.") | |||
| 304 | ediff-merge-filegroups-with-ancestor))) | 304 | ediff-merge-filegroups-with-ancestor))) |
| 305 | (defsubst ediff-revision-metajob (&optional metajob) | 305 | (defsubst ediff-revision-metajob (&optional metajob) |
| 306 | (memq (or metajob ediff-metajob-name) | 306 | (memq (or metajob ediff-metajob-name) |
| 307 | '(ediff-directory-revisions | 307 | '(ediff-directory-revisions |
| 308 | ediff-merge-directory-revisions | 308 | ediff-merge-directory-revisions |
| 309 | ediff-merge-directory-revisions-with-ancestor))) | 309 | ediff-merge-directory-revisions-with-ancestor))) |
| 310 | (defsubst ediff-patch-metajob (&optional metajob) | 310 | (defsubst ediff-patch-metajob (&optional metajob) |
| @@ -333,14 +333,14 @@ that Ediff doesn't know about.") | |||
| 333 | ediff-merge-directories-with-ancestor | 333 | ediff-merge-directories-with-ancestor |
| 334 | ediff-merge-directory-revisions | 334 | ediff-merge-directory-revisions |
| 335 | ediff-merge-directory-revisions-with-ancestor | 335 | ediff-merge-directory-revisions-with-ancestor |
| 336 | ediff-merge-filegroups-with-ancestor | 336 | ediff-merge-filegroups-with-ancestor |
| 337 | ;; add more here | 337 | ;; add more here |
| 338 | ))) | 338 | ))) |
| 339 | 339 | ||
| 340 | (defsubst ediff-metajob3 (&optional metajob) | 340 | (defsubst ediff-metajob3 (&optional metajob) |
| 341 | (memq (or metajob ediff-metajob-name) | 341 | (memq (or metajob ediff-metajob-name) |
| 342 | '(ediff-merge-directories-with-ancestor | 342 | '(ediff-merge-directories-with-ancestor |
| 343 | ediff-merge-filegroups-with-ancestor | 343 | ediff-merge-filegroups-with-ancestor |
| 344 | ediff-directories3 | 344 | ediff-directories3 |
| 345 | ediff-filegroups3))) | 345 | ediff-filegroups3))) |
| 346 | (defsubst ediff-comparison-metajob3 (&optional metajob) | 346 | (defsubst ediff-comparison-metajob3 (&optional metajob) |
| @@ -370,7 +370,7 @@ that Ediff doesn't know about.") | |||
| 370 | :group 'ediff) | 370 | :group 'ediff) |
| 371 | 371 | ||
| 372 | (defgroup ediff-hook nil | 372 | (defgroup ediff-hook nil |
| 373 | "Hooks called by Ediff" | 373 | "Hooks run by Ediff" |
| 374 | :prefix "ediff-" | 374 | :prefix "ediff-" |
| 375 | :group 'ediff) | 375 | :group 'ediff) |
| 376 | 376 | ||
| @@ -381,16 +381,16 @@ that Ediff doesn't know about.") | |||
| 381 | This hook can be used to save the previous window config, which can be restored | 381 | This hook can be used to save the previous window config, which can be restored |
| 382 | on ediff-quit or ediff-suspend." | 382 | on ediff-quit or ediff-suspend." |
| 383 | :type 'hook | 383 | :type 'hook |
| 384 | :group 'ediff-hook) | 384 | :group 'ediff-hook) |
| 385 | (defcustom ediff-before-setup-windows-hook nil | 385 | (defcustom ediff-before-setup-windows-hook nil |
| 386 | "*Hooks to run before Ediff sets its window configuration. | 386 | "*Hooks to run before Ediff sets its window configuration. |
| 387 | This hook is called every time when Ediff arranges its windows. | 387 | This hook is run every time when Ediff arranges its windows. |
| 388 | This happens each time Ediff detects that the windows were messed up by the | 388 | This happens each time Ediff detects that the windows were messed up by the |
| 389 | user." | 389 | user." |
| 390 | :type 'hook | 390 | :type 'hook |
| 391 | :group 'ediff-hook) | 391 | :group 'ediff-hook) |
| 392 | (defcustom ediff-after-setup-windows-hook nil | 392 | (defcustom ediff-after-setup-windows-hook nil |
| 393 | "*Hooks to run after Ediff sets its window configuration. | 393 | "*Hooks to run after Ediff sets its window configuration. |
| 394 | This can be used to set up control window or icon in a desired place." | 394 | This can be used to set up control window or icon in a desired place." |
| 395 | :type 'hook | 395 | :type 'hook |
| 396 | :group 'ediff-hook) | 396 | :group 'ediff-hook) |
| @@ -418,16 +418,17 @@ Can be used to move the frame where it is desired." | |||
| 418 | :type 'hook | 418 | :type 'hook |
| 419 | :group 'ediff-hook) | 419 | :group 'ediff-hook) |
| 420 | (defcustom ediff-prepare-buffer-hook nil | 420 | (defcustom ediff-prepare-buffer-hook nil |
| 421 | "*Hooks called after buffers A, B, and C are set up." | 421 | "*Hooks run after buffers A, B, and C are set up. |
| 422 | For each buffer, the hooks are run with that buffer made current." | ||
| 422 | :type 'hook | 423 | :type 'hook |
| 423 | :group 'ediff-hook) | 424 | :group 'ediff-hook) |
| 424 | (defcustom ediff-load-hook nil | 425 | (defcustom ediff-load-hook nil |
| 425 | "*Hook run after Ediff is loaded. Can be used to change defaults." | 426 | "*Hook run after Ediff is loaded. Can be used to change defaults." |
| 426 | :type 'hook | 427 | :type 'hook |
| 427 | :group 'ediff-hook) | 428 | :group 'ediff-hook) |
| 428 | 429 | ||
| 429 | (defcustom ediff-mode-hook nil | 430 | (defcustom ediff-mode-hook nil |
| 430 | "*Hook run just after ediff-mode is set up in the control buffer. | 431 | "*Hook run just after ediff-mode is set up in the control buffer. |
| 431 | This is done before any windows or frames are created. One can use it to | 432 | This is done before any windows or frames are created. One can use it to |
| 432 | set local variables that determine how the display looks like." | 433 | set local variables that determine how the display looks like." |
| 433 | :type 'hook | 434 | :type 'hook |
| @@ -436,7 +437,7 @@ set local variables that determine how the display looks like." | |||
| 436 | "*Hook run just after the default bindings in Ediff keymap are set up." | 437 | "*Hook run just after the default bindings in Ediff keymap are set up." |
| 437 | :type 'hook | 438 | :type 'hook |
| 438 | :group 'ediff-hook) | 439 | :group 'ediff-hook) |
| 439 | 440 | ||
| 440 | (defcustom ediff-display-help-hook nil | 441 | (defcustom ediff-display-help-hook nil |
| 441 | "*Hooks run after preparing the help message." | 442 | "*Hooks run after preparing the help message." |
| 442 | :type 'hook | 443 | :type 'hook |
| @@ -449,7 +450,7 @@ set local variables that determine how the display looks like." | |||
| 449 | (defcustom ediff-quit-hook (list 'ediff-cleanup-mess) | 450 | (defcustom ediff-quit-hook (list 'ediff-cleanup-mess) |
| 450 | "*Hooks to run in the Ediff control buffer after finishing Ediff." | 451 | "*Hooks to run in the Ediff control buffer after finishing Ediff." |
| 451 | :type 'hook | 452 | :type 'hook |
| 452 | :group 'ediff-hook) | 453 | :group 'ediff-hook) |
| 453 | (defcustom ediff-cleanup-hook nil | 454 | (defcustom ediff-cleanup-hook nil |
| 454 | "*Hooks to run on exiting Ediff but before killing the control and variant buffers." | 455 | "*Hooks to run on exiting Ediff but before killing the control and variant buffers." |
| 455 | :type 'hook | 456 | :type 'hook |
| @@ -466,10 +467,10 @@ set local variables that determine how the display looks like." | |||
| 466 | (defconst ediff-BAD-INFO (format " | 467 | (defconst ediff-BAD-INFO (format " |
| 467 | *** The Info file for Ediff, a part of the standard distribution | 468 | *** The Info file for Ediff, a part of the standard distribution |
| 468 | *** of %sEmacs, does not seem to be properly installed. | 469 | *** of %sEmacs, does not seem to be properly installed. |
| 469 | *** | 470 | *** |
| 470 | *** Please contact your system administrator. " | 471 | *** Please contact your system administrator. " |
| 471 | (if ediff-xemacs-p "X" ""))) | 472 | (if ediff-xemacs-p "X" ""))) |
| 472 | 473 | ||
| 473 | ;; Selective browsing | 474 | ;; Selective browsing |
| 474 | 475 | ||
| 475 | (ediff-defvar-local ediff-skip-diff-region-function 'ediff-show-all-diffs | 476 | (ediff-defvar-local ediff-skip-diff-region-function 'ediff-show-all-diffs |
| @@ -480,7 +481,7 @@ is the one used internally by Ediff. It is 1 less than the number seen | |||
| 480 | by the user.") | 481 | by the user.") |
| 481 | 482 | ||
| 482 | (ediff-defvar-local ediff-hide-regexp-matches-function | 483 | (ediff-defvar-local ediff-hide-regexp-matches-function |
| 483 | 'ediff-hide-regexp-matches | 484 | 'ediff-hide-regexp-matches |
| 484 | "Function to use in determining which regions to hide. | 485 | "Function to use in determining which regions to hide. |
| 485 | See the documentation string of `ediff-hide-regexp-matches' for details.") | 486 | See the documentation string of `ediff-hide-regexp-matches' for details.") |
| 486 | (ediff-defvar-local ediff-focus-on-regexp-matches-function | 487 | (ediff-defvar-local ediff-focus-on-regexp-matches-function |
| @@ -497,7 +498,7 @@ See the documentation string of `ediff-focus-on-regexp-matches' for details.") | |||
| 497 | ;; connective that determines whether to focus regions that match both or | 498 | ;; connective that determines whether to focus regions that match both or |
| 498 | ;; one of the regexps | 499 | ;; one of the regexps |
| 499 | (ediff-defvar-local ediff-focus-regexp-connective 'and "") | 500 | (ediff-defvar-local ediff-focus-regexp-connective 'and "") |
| 500 | 501 | ||
| 501 | ;; Regexp that determines buf A regions to ignore when skipping to diff | 502 | ;; Regexp that determines buf A regions to ignore when skipping to diff |
| 502 | (ediff-defvar-local ediff-regexp-hide-A "" "") | 503 | (ediff-defvar-local ediff-regexp-hide-A "" "") |
| 503 | ;; Regexp that determines buf B regions to ignore when skipping to diff | 504 | ;; Regexp that determines buf B regions to ignore when skipping to diff |
| @@ -507,11 +508,11 @@ See the documentation string of `ediff-focus-on-regexp-matches' for details.") | |||
| 507 | ;; connective that determines whether to hide regions that match both or | 508 | ;; connective that determines whether to hide regions that match both or |
| 508 | ;; one of the regexps | 509 | ;; one of the regexps |
| 509 | (ediff-defvar-local ediff-hide-regexp-connective 'and "") | 510 | (ediff-defvar-local ediff-hide-regexp-connective 'and "") |
| 510 | |||
| 511 | |||
| 512 | ;;; Copying difference regions between buffers. | ||
| 513 | 511 | ||
| 514 | ;; A list of killed diffs. | 512 | |
| 513 | ;;; Copying difference regions between buffers. | ||
| 514 | |||
| 515 | ;; A list of killed diffs. | ||
| 515 | ;; A diff is saved here if it is replaced by a diff | 516 | ;; A diff is saved here if it is replaced by a diff |
| 516 | ;; from another buffer. This alist has the form: | 517 | ;; from another buffer. This alist has the form: |
| 517 | ;; \((num (buff-object . diff) (buff-object . diff) (buff-object . diff)) ...), | 518 | ;; \((num (buff-object . diff) (buff-object . diff) (buff-object . diff)) ...), |
| @@ -543,9 +544,9 @@ See the documentation string of `ediff-focus-on-regexp-matches' for details.") | |||
| 543 | :tag "Region after-flag in the middle of line" | 544 | :tag "Region after-flag in the middle of line" |
| 544 | :group 'ediff) | 545 | :group 'ediff) |
| 545 | 546 | ||
| 546 | 547 | ||
| 547 | (ediff-defvar-local ediff-use-faces t "") | 548 | (ediff-defvar-local ediff-use-faces t "") |
| 548 | (defcustom ediff-use-faces t | 549 | (defcustom ediff-use-faces t |
| 549 | "If t, differences are highlighted using faces, if device supports faces. | 550 | "If t, differences are highlighted using faces, if device supports faces. |
| 550 | If nil, differences are highlighted using ASCII flags, ediff-before-flag | 551 | If nil, differences are highlighted using ASCII flags, ediff-before-flag |
| 551 | and ediff-after-flag. On a non-window system, differences are always | 552 | and ediff-after-flag. On a non-window system, differences are always |
| @@ -601,10 +602,10 @@ shown in brighter colors." | |||
| 601 | ;; unhighlighted, `off' -- turned off \(on a dumb terminal only\). | 602 | ;; unhighlighted, `off' -- turned off \(on a dumb terminal only\). |
| 602 | (ediff-defvar-local ediff-highlighting-style nil "") | 603 | (ediff-defvar-local ediff-highlighting-style nil "") |
| 603 | 604 | ||
| 604 | 605 | ||
| 605 | ;; The suffix of the control buffer name. | 606 | ;; The suffix of the control buffer name. |
| 606 | (ediff-defvar-local ediff-control-buffer-suffix nil "") | 607 | (ediff-defvar-local ediff-control-buffer-suffix nil "") |
| 607 | ;; Same as ediff-control-buffer-suffix, but without <,>. | 608 | ;; Same as ediff-control-buffer-suffix, but without <,>. |
| 608 | ;; It's a number rather than string. | 609 | ;; It's a number rather than string. |
| 609 | (ediff-defvar-local ediff-control-buffer-number nil "") | 610 | (ediff-defvar-local ediff-control-buffer-number nil "") |
| 610 | 611 | ||
| @@ -627,7 +628,7 @@ shown in brighter colors." | |||
| 627 | 628 | ||
| 628 | ;; Buffer-local variables to be saved then restored during Ediff sessions | 629 | ;; Buffer-local variables to be saved then restored during Ediff sessions |
| 629 | (defconst ediff-protected-variables '( | 630 | (defconst ediff-protected-variables '( |
| 630 | ;;buffer-read-only | 631 | ;;buffer-read-only |
| 631 | mode-line-format)) | 632 | mode-line-format)) |
| 632 | 633 | ||
| 633 | ;; Vector of differences between the variants. Each difference is | 634 | ;; Vector of differences between the variants. Each difference is |
| @@ -668,7 +669,7 @@ shown in brighter colors." | |||
| 668 | (ediff-defvar-local ediff-current-difference -1 "") | 669 | (ediff-defvar-local ediff-current-difference -1 "") |
| 669 | ;; Number of differences found. | 670 | ;; Number of differences found. |
| 670 | (ediff-defvar-local ediff-number-of-differences nil "") | 671 | (ediff-defvar-local ediff-number-of-differences nil "") |
| 671 | 672 | ||
| 672 | ;; Buffer containing the output of diff, which is used by Ediff to step | 673 | ;; Buffer containing the output of diff, which is used by Ediff to step |
| 673 | ;; through files. | 674 | ;; through files. |
| 674 | (ediff-defvar-local ediff-diff-buffer nil "") | 675 | (ediff-defvar-local ediff-diff-buffer nil "") |
| @@ -693,7 +694,7 @@ shown in brighter colors." | |||
| 693 | ;; to be deleted in due time | 694 | ;; to be deleted in due time |
| 694 | ;; List of difference overlays disturbed by working with the current diff. | 695 | ;; List of difference overlays disturbed by working with the current diff. |
| 695 | (defvar ediff-disturbed-overlays nil "") | 696 | (defvar ediff-disturbed-overlays nil "") |
| 696 | 697 | ||
| 697 | ;; Priority of non-selected overlays. | 698 | ;; Priority of non-selected overlays. |
| 698 | (defvar ediff-shadow-overlay-priority 100 "") | 699 | (defvar ediff-shadow-overlay-priority 100 "") |
| 699 | 700 | ||
| @@ -717,7 +718,7 @@ appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire." | |||
| 717 | (fset 'ediff-overlayp (symbol-function 'overlayp)) | 718 | (fset 'ediff-overlayp (symbol-function 'overlayp)) |
| 718 | (fset 'ediff-make-overlay (symbol-function 'make-overlay)) | 719 | (fset 'ediff-make-overlay (symbol-function 'make-overlay)) |
| 719 | (fset 'ediff-delete-overlay (symbol-function 'delete-overlay))) | 720 | (fset 'ediff-delete-overlay (symbol-function 'delete-overlay))) |
| 720 | 721 | ||
| 721 | ;; Check the current version against the major and minor version numbers | 722 | ;; Check the current version against the major and minor version numbers |
| 722 | ;; using op: cur-vers op major.minor If emacs-major-version or | 723 | ;; using op: cur-vers op major.minor If emacs-major-version or |
| 723 | ;; emacs-minor-version are not defined, we assume that the current version | 724 | ;; emacs-minor-version are not defined, we assume that the current version |
| @@ -744,8 +745,8 @@ appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire." | |||
| 744 | (error "%S: Invalid op in ediff-check-version" op)))) | 745 | (error "%S: Invalid op in ediff-check-version" op)))) |
| 745 | (cond ((memq op '(= > >=)) nil) | 746 | (cond ((memq op '(= > >=)) nil) |
| 746 | ((memq op '(< <=)) t)))) | 747 | ((memq op '(< <=)) t)))) |
| 747 | 748 | ||
| 748 | 749 | ||
| 749 | (defun ediff-color-display-p () | 750 | (defun ediff-color-display-p () |
| 750 | (condition-case nil | 751 | (condition-case nil |
| 751 | (if ediff-emacs-p | 752 | (if ediff-emacs-p |
| @@ -756,7 +757,7 @@ appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire." | |||
| 756 | (error | 757 | (error |
| 757 | nil))) | 758 | nil))) |
| 758 | 759 | ||
| 759 | 760 | ||
| 760 | (if (ediff-has-face-support-p) | 761 | (if (ediff-has-face-support-p) |
| 761 | (if ediff-xemacs-p | 762 | (if ediff-xemacs-p |
| 762 | (progn | 763 | (progn |
| @@ -783,21 +784,21 @@ appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire." | |||
| 783 | (if (fboundp 'display-pixel-height) | 784 | (if (fboundp 'display-pixel-height) |
| 784 | 'display-pixel-height | 785 | 'display-pixel-height |
| 785 | 'x-display-pixel-height))))) | 786 | 'x-display-pixel-height))))) |
| 786 | 787 | ||
| 787 | ;; A-list of current-diff-overlay symbols associated with buf types | 788 | ;; A-list of current-diff-overlay symbols associated with buf types |
| 788 | (defconst ediff-current-diff-overlay-alist | 789 | (defconst ediff-current-diff-overlay-alist |
| 789 | '((A . ediff-current-diff-overlay-A) | 790 | '((A . ediff-current-diff-overlay-A) |
| 790 | (B . ediff-current-diff-overlay-B) | 791 | (B . ediff-current-diff-overlay-B) |
| 791 | (C . ediff-current-diff-overlay-C) | 792 | (C . ediff-current-diff-overlay-C) |
| 792 | (Ancestor . ediff-current-diff-overlay-Ancestor))) | 793 | (Ancestor . ediff-current-diff-overlay-Ancestor))) |
| 793 | 794 | ||
| 794 | ;; A-list of current-diff-face-* symbols associated with buf types | 795 | ;; A-list of current-diff-face-* symbols associated with buf types |
| 795 | (defconst ediff-current-diff-face-alist | 796 | (defconst ediff-current-diff-face-alist |
| 796 | '((A . ediff-current-diff-face-A) | 797 | '((A . ediff-current-diff-face-A) |
| 797 | (B . ediff-current-diff-face-B) | 798 | (B . ediff-current-diff-face-B) |
| 798 | (C . ediff-current-diff-face-C) | 799 | (C . ediff-current-diff-face-C) |
| 799 | (Ancestor . ediff-current-diff-face-Ancestor))) | 800 | (Ancestor . ediff-current-diff-face-Ancestor))) |
| 800 | 801 | ||
| 801 | 802 | ||
| 802 | (defun ediff-make-current-diff-overlay (type) | 803 | (defun ediff-make-current-diff-overlay (type) |
| 803 | (if (ediff-has-face-support-p) | 804 | (if (ediff-has-face-support-p) |
| @@ -817,7 +818,7 @@ appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire." | |||
| 817 | (defun ediff-set-overlay-face (extent face) | 818 | (defun ediff-set-overlay-face (extent face) |
| 818 | (ediff-overlay-put extent 'face face) | 819 | (ediff-overlay-put extent 'face face) |
| 819 | (ediff-overlay-put extent 'help-echo 'ediff-region-help-echo)) | 820 | (ediff-overlay-put extent 'help-echo 'ediff-region-help-echo)) |
| 820 | 821 | ||
| 821 | (defun ediff-region-help-echo (extent-or-window &optional overlay point) | 822 | (defun ediff-region-help-echo (extent-or-window &optional overlay point) |
| 822 | (unless overlay | 823 | (unless overlay |
| 823 | (setq overlay extent-or-window)) | 824 | (setq overlay extent-or-window)) |
| @@ -852,7 +853,7 @@ appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire." | |||
| 852 | (defun ediff-hide-face (face) | 853 | (defun ediff-hide-face (face) |
| 853 | (if (and (ediff-has-face-support-p) ediff-emacs-p) | 854 | (if (and (ediff-has-face-support-p) ediff-emacs-p) |
| 854 | (add-to-list 'facemenu-unlisted-faces face))) | 855 | (add-to-list 'facemenu-unlisted-faces face))) |
| 855 | 856 | ||
| 856 | 857 | ||
| 857 | 858 | ||
| 858 | (defface ediff-current-diff-face-A | 859 | (defface ediff-current-diff-face-A |
| @@ -872,7 +873,7 @@ this variable represents.") | |||
| 872 | ;; This means that some user customization may be trashed. | 873 | ;; This means that some user customization may be trashed. |
| 873 | (if (and ediff-xemacs-p | 874 | (if (and ediff-xemacs-p |
| 874 | (ediff-has-face-support-p) | 875 | (ediff-has-face-support-p) |
| 875 | (not (ediff-color-display-p))) | 876 | (not (ediff-color-display-p))) |
| 876 | (copy-face 'modeline 'ediff-current-diff-face-A)) | 877 | (copy-face 'modeline 'ediff-current-diff-face-A)) |
| 877 | 878 | ||
| 878 | 879 | ||
| @@ -894,7 +895,7 @@ this variable represents.") | |||
| 894 | ;; This means that some user customization may be trashed. | 895 | ;; This means that some user customization may be trashed. |
| 895 | (if (and ediff-xemacs-p | 896 | (if (and ediff-xemacs-p |
| 896 | (ediff-has-face-support-p) | 897 | (ediff-has-face-support-p) |
| 897 | (not (ediff-color-display-p))) | 898 | (not (ediff-color-display-p))) |
| 898 | (copy-face 'modeline 'ediff-current-diff-face-B)) | 899 | (copy-face 'modeline 'ediff-current-diff-face-B)) |
| 899 | 900 | ||
| 900 | 901 | ||
| @@ -915,7 +916,7 @@ this variable represents.") | |||
| 915 | ;; This means that some user customization may be trashed. | 916 | ;; This means that some user customization may be trashed. |
| 916 | (if (and ediff-xemacs-p | 917 | (if (and ediff-xemacs-p |
| 917 | (ediff-has-face-support-p) | 918 | (ediff-has-face-support-p) |
| 918 | (not (ediff-color-display-p))) | 919 | (not (ediff-color-display-p))) |
| 919 | (copy-face 'modeline 'ediff-current-diff-face-C)) | 920 | (copy-face 'modeline 'ediff-current-diff-face-C)) |
| 920 | 921 | ||
| 921 | 922 | ||
| @@ -936,7 +937,7 @@ this variable represents.") | |||
| 936 | ;; This means that some user customization may be trashed. | 937 | ;; This means that some user customization may be trashed. |
| 937 | (if (and ediff-xemacs-p | 938 | (if (and ediff-xemacs-p |
| 938 | (ediff-has-face-support-p) | 939 | (ediff-has-face-support-p) |
| 939 | (not (ediff-color-display-p))) | 940 | (not (ediff-color-display-p))) |
| 940 | (copy-face 'modeline 'ediff-current-diff-face-Ancestor)) | 941 | (copy-face 'modeline 'ediff-current-diff-face-Ancestor)) |
| 941 | 942 | ||
| 942 | 943 | ||
| @@ -1133,7 +1134,7 @@ this variable represents.") | |||
| 1133 | (B . ediff-odd-diff-face-B) | 1134 | (B . ediff-odd-diff-face-B) |
| 1134 | (C . ediff-odd-diff-face-C) | 1135 | (C . ediff-odd-diff-face-C) |
| 1135 | (Ancestor . ediff-odd-diff-face-Ancestor))) | 1136 | (Ancestor . ediff-odd-diff-face-Ancestor))) |
| 1136 | 1137 | ||
| 1137 | ;; A-list of fine-diff face symbols associated with buffer types | 1138 | ;; A-list of fine-diff face symbols associated with buffer types |
| 1138 | (defconst ediff-fine-diff-face-alist | 1139 | (defconst ediff-fine-diff-face-alist |
| 1139 | '((A . ediff-fine-diff-face-A) | 1140 | '((A . ediff-fine-diff-face-A) |
| @@ -1181,8 +1182,8 @@ this variable represents.") | |||
| 1181 | ovr-list) | 1182 | ovr-list) |
| 1182 | )) | 1183 | )) |
| 1183 | )))) | 1184 | )))) |
| 1184 | 1185 | ||
| 1185 | 1186 | ||
| 1186 | (defvar ediff-toggle-read-only-function nil | 1187 | (defvar ediff-toggle-read-only-function nil |
| 1187 | "*Specifies the function to be used to toggle read-only. | 1188 | "*Specifies the function to be used to toggle read-only. |
| 1188 | If nil, Ediff tries to deduce the function from the binding of C-x C-q. | 1189 | If nil, Ediff tries to deduce the function from the binding of C-x C-q. |
| @@ -1217,21 +1218,21 @@ as `ediff-merge-directory' or `ediff-merge-directory-revisions'." | |||
| 1217 | "*Prefix to be attached to saved merge buffers." | 1218 | "*Prefix to be attached to saved merge buffers." |
| 1218 | :type 'string | 1219 | :type 'string |
| 1219 | :group 'ediff-merge) | 1220 | :group 'ediff-merge) |
| 1220 | 1221 | ||
| 1221 | (defcustom ediff-no-emacs-help-in-control-buffer nil | 1222 | (defcustom ediff-no-emacs-help-in-control-buffer nil |
| 1222 | "*Non-nil means C-h should not invoke Emacs help in control buffer. | 1223 | "*Non-nil means C-h should not invoke Emacs help in control buffer. |
| 1223 | Instead, C-h would jump to previous difference." | 1224 | Instead, C-h would jump to previous difference." |
| 1224 | :type 'boolean | 1225 | :type 'boolean |
| 1225 | :group 'ediff) | 1226 | :group 'ediff) |
| 1226 | 1227 | ||
| 1227 | ;; This is the same as temporary-file-directory from Emacs 20.3. | 1228 | ;; This is the same as temporary-file-directory from Emacs 20.3. |
| 1228 | ;; Copied over here because XEmacs doesn't have this variable. | 1229 | ;; Copied over here because XEmacs doesn't have this variable. |
| 1229 | (defcustom ediff-temp-file-prefix | 1230 | (defcustom ediff-temp-file-prefix |
| 1230 | (file-name-as-directory | 1231 | (file-name-as-directory |
| 1231 | (cond ((boundp 'temporary-file-directory) temporary-file-directory) | 1232 | (cond ((boundp 'temporary-file-directory) temporary-file-directory) |
| 1232 | ((fboundp 'temp-directory) (temp-directory)) | 1233 | ((fboundp 'temp-directory) (temp-directory)) |
| 1233 | (t "/tmp/"))) | 1234 | (t "/tmp/"))) |
| 1234 | ;;; (file-name-as-directory | 1235 | ;;; (file-name-as-directory |
| 1235 | ;;; (cond ((memq system-type '(ms-dos windows-nt)) | 1236 | ;;; (cond ((memq system-type '(ms-dos windows-nt)) |
| 1236 | ;;; (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP") "c:/temp")) | 1237 | ;;; (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP") "c:/temp")) |
| 1237 | ;;; ((memq system-type '(vax-vms axp-vms)) | 1238 | ;;; ((memq system-type '(vax-vms axp-vms)) |
| @@ -1247,7 +1248,7 @@ Do not start with `~/' or `~USERNAME/'." | |||
| 1247 | "*Mode for Ediff temporary files." | 1248 | "*Mode for Ediff temporary files." |
| 1248 | :type 'integer | 1249 | :type 'integer |
| 1249 | :group 'ediff) | 1250 | :group 'ediff) |
| 1250 | 1251 | ||
| 1251 | ;; Metacharacters that have to be protected from the shell when executing | 1252 | ;; Metacharacters that have to be protected from the shell when executing |
| 1252 | ;; a diff/diff3 command. | 1253 | ;; a diff/diff3 command. |
| 1253 | (defcustom ediff-metachars "[ \t\n!\"#$&'()*;<=>?[\\^`{|~]" | 1254 | (defcustom ediff-metachars "[ \t\n!\"#$&'()*;<=>?[\\^`{|~]" |
| @@ -1259,7 +1260,7 @@ This default should work without changes." | |||
| 1259 | ;; needed to simulate frame-char-width in XEmacs. | 1260 | ;; needed to simulate frame-char-width in XEmacs. |
| 1260 | (defvar ediff-H-glyph (if ediff-xemacs-p (make-glyph "H"))) | 1261 | (defvar ediff-H-glyph (if ediff-xemacs-p (make-glyph "H"))) |
| 1261 | 1262 | ||
| 1262 | 1263 | ||
| 1263 | ;; Temporary file used for refining difference regions in buffer A. | 1264 | ;; Temporary file used for refining difference regions in buffer A. |
| 1264 | (ediff-defvar-local ediff-temp-file-A nil "") | 1265 | (ediff-defvar-local ediff-temp-file-A nil "") |
| 1265 | ;; Temporary file used for refining difference regions in buffer B. | 1266 | ;; Temporary file used for refining difference regions in buffer B. |
| @@ -1278,7 +1279,7 @@ This default should work without changes." | |||
| 1278 | ;; Can happen only in Emacs, since XEmacs has file-remote-p | 1279 | ;; Can happen only in Emacs, since XEmacs has file-remote-p |
| 1279 | (ange-ftp-ftp-name file-name)))))) | 1280 | (ange-ftp-ftp-name file-name)))))) |
| 1280 | 1281 | ||
| 1281 | 1282 | ||
| 1282 | (defsubst ediff-frame-unsplittable-p (frame) | 1283 | (defsubst ediff-frame-unsplittable-p (frame) |
| 1283 | (cdr (assq 'unsplittable (frame-parameters frame)))) | 1284 | (cdr (assq 'unsplittable (frame-parameters frame)))) |
| 1284 | 1285 | ||
| @@ -1306,7 +1307,7 @@ This default should work without changes." | |||
| 1306 | 1307 | ||
| 1307 | ;; activate faces on diff regions in buffer | 1308 | ;; activate faces on diff regions in buffer |
| 1308 | (defun ediff-paint-background-regions-in-one-buffer (buf-type unhighlight) | 1309 | (defun ediff-paint-background-regions-in-one-buffer (buf-type unhighlight) |
| 1309 | (let ((diff-vector | 1310 | (let ((diff-vector |
| 1310 | (eval (ediff-get-symbol-from-alist | 1311 | (eval (ediff-get-symbol-from-alist |
| 1311 | buf-type ediff-difference-vector-alist))) | 1312 | buf-type ediff-difference-vector-alist))) |
| 1312 | overl diff-num) | 1313 | overl diff-num) |
| @@ -1342,18 +1343,18 @@ This default should work without changes." | |||
| 1342 | (end (ediff-get-diff-posn buf-type 'end n)) | 1343 | (end (ediff-get-diff-posn buf-type 'end n)) |
| 1343 | (xtra (if (equal begin end) 1 0)) | 1344 | (xtra (if (equal begin end) 1 0)) |
| 1344 | (end-hilit (min last (+ end xtra))) | 1345 | (end-hilit (min last (+ end xtra))) |
| 1345 | (current-diff-overlay | 1346 | (current-diff-overlay |
| 1346 | (symbol-value | 1347 | (symbol-value |
| 1347 | (ediff-get-symbol-from-alist | 1348 | (ediff-get-symbol-from-alist |
| 1348 | buf-type ediff-current-diff-overlay-alist)))) | 1349 | buf-type ediff-current-diff-overlay-alist)))) |
| 1349 | 1350 | ||
| 1350 | (if ediff-xemacs-p | 1351 | (if ediff-xemacs-p |
| 1351 | (ediff-move-overlay current-diff-overlay begin end-hilit) | 1352 | (ediff-move-overlay current-diff-overlay begin end-hilit) |
| 1352 | (ediff-move-overlay current-diff-overlay begin end-hilit buff)) | 1353 | (ediff-move-overlay current-diff-overlay begin end-hilit buff)) |
| 1353 | (ediff-overlay-put current-diff-overlay 'priority | 1354 | (ediff-overlay-put current-diff-overlay 'priority |
| 1354 | (ediff-highest-priority begin end-hilit buff)) | 1355 | (ediff-highest-priority begin end-hilit buff)) |
| 1355 | (ediff-overlay-put current-diff-overlay 'ediff-diff-num n) | 1356 | (ediff-overlay-put current-diff-overlay 'ediff-diff-num n) |
| 1356 | 1357 | ||
| 1357 | ;; unhighlight the background overlay for diff n so it won't | 1358 | ;; unhighlight the background overlay for diff n so it won't |
| 1358 | ;; interfere with the current diff overlay | 1359 | ;; interfere with the current diff overlay |
| 1359 | (ediff-set-overlay-face (ediff-get-diff-overlay n buf-type) nil) | 1360 | (ediff-set-overlay-face (ediff-get-diff-overlay n buf-type) nil) |
| @@ -1362,16 +1363,16 @@ This default should work without changes." | |||
| 1362 | 1363 | ||
| 1363 | (defun ediff-unhighlight-diff-in-one-buffer (buf-type) | 1364 | (defun ediff-unhighlight-diff-in-one-buffer (buf-type) |
| 1364 | (if (ediff-buffer-live-p (ediff-get-buffer buf-type)) | 1365 | (if (ediff-buffer-live-p (ediff-get-buffer buf-type)) |
| 1365 | (let ((current-diff-overlay | 1366 | (let ((current-diff-overlay |
| 1366 | (symbol-value | 1367 | (symbol-value |
| 1367 | (ediff-get-symbol-from-alist | 1368 | (ediff-get-symbol-from-alist |
| 1368 | buf-type ediff-current-diff-overlay-alist))) | 1369 | buf-type ediff-current-diff-overlay-alist))) |
| 1369 | (overlay | 1370 | (overlay |
| 1370 | (ediff-get-diff-overlay ediff-current-difference buf-type)) | 1371 | (ediff-get-diff-overlay ediff-current-difference buf-type)) |
| 1371 | ) | 1372 | ) |
| 1372 | 1373 | ||
| 1373 | (ediff-move-overlay current-diff-overlay 1 1) | 1374 | (ediff-move-overlay current-diff-overlay 1 1) |
| 1374 | 1375 | ||
| 1375 | ;; rehighlight the overlay in the background of the | 1376 | ;; rehighlight the overlay in the background of the |
| 1376 | ;; current difference region | 1377 | ;; current difference region |
| 1377 | (ediff-set-overlay-face | 1378 | (ediff-set-overlay-face |
| @@ -1394,7 +1395,7 @@ This default should work without changes." | |||
| 1394 | (ediff-delete-overlay current-diff-overlay)) | 1395 | (ediff-delete-overlay current-diff-overlay)) |
| 1395 | (set current-diff-overlay-var nil) | 1396 | (set current-diff-overlay-var nil) |
| 1396 | ))) | 1397 | ))) |
| 1397 | 1398 | ||
| 1398 | 1399 | ||
| 1399 | (defsubst ediff-highlight-diff (n) | 1400 | (defsubst ediff-highlight-diff (n) |
| 1400 | "Put face on diff N. Invoked for X displays only." | 1401 | "Put face on diff N. Invoked for X displays only." |
| @@ -1412,7 +1413,7 @@ This default should work without changes." | |||
| 1412 | (ediff-unhighlight-diff-in-one-buffer 'C) | 1413 | (ediff-unhighlight-diff-in-one-buffer 'C) |
| 1413 | (ediff-unhighlight-diff-in-one-buffer 'Ancestor) | 1414 | (ediff-unhighlight-diff-in-one-buffer 'Ancestor) |
| 1414 | ) | 1415 | ) |
| 1415 | 1416 | ||
| 1416 | ;; delete highlighting overlays, restore faces to their original form | 1417 | ;; delete highlighting overlays, restore faces to their original form |
| 1417 | (defsubst ediff-unhighlight-diffs-totally () | 1418 | (defsubst ediff-unhighlight-diffs-totally () |
| 1418 | (ediff-unhighlight-diffs-totally-in-one-buffer 'A) | 1419 | (ediff-unhighlight-diffs-totally-in-one-buffer 'A) |
| @@ -1421,24 +1422,24 @@ This default should work without changes." | |||
| 1421 | (ediff-unhighlight-diffs-totally-in-one-buffer 'Ancestor) | 1422 | (ediff-unhighlight-diffs-totally-in-one-buffer 'Ancestor) |
| 1422 | ) | 1423 | ) |
| 1423 | 1424 | ||
| 1424 | 1425 | ||
| 1425 | ;; arg is a record for a given diff in a difference vector | 1426 | ;; arg is a record for a given diff in a difference vector |
| 1426 | ;; this record is itself a vector | 1427 | ;; this record is itself a vector |
| 1427 | (defsubst ediff-clear-fine-diff-vector (diff-record) | 1428 | (defsubst ediff-clear-fine-diff-vector (diff-record) |
| 1428 | (if diff-record | 1429 | (if diff-record |
| 1429 | (mapcar 'ediff-delete-overlay | 1430 | (mapcar 'ediff-delete-overlay |
| 1430 | (ediff-get-fine-diff-vector-from-diff-record diff-record)))) | 1431 | (ediff-get-fine-diff-vector-from-diff-record diff-record)))) |
| 1431 | 1432 | ||
| 1432 | (defsubst ediff-clear-fine-differences-in-one-buffer (n buf-type) | 1433 | (defsubst ediff-clear-fine-differences-in-one-buffer (n buf-type) |
| 1433 | (ediff-clear-fine-diff-vector (ediff-get-difference n buf-type)) | 1434 | (ediff-clear-fine-diff-vector (ediff-get-difference n buf-type)) |
| 1434 | (ediff-set-fine-diff-vector n buf-type nil)) | 1435 | (ediff-set-fine-diff-vector n buf-type nil)) |
| 1435 | 1436 | ||
| 1436 | (defsubst ediff-clear-fine-differences (n) | 1437 | (defsubst ediff-clear-fine-differences (n) |
| 1437 | (ediff-clear-fine-differences-in-one-buffer n 'A) | 1438 | (ediff-clear-fine-differences-in-one-buffer n 'A) |
| 1438 | (ediff-clear-fine-differences-in-one-buffer n 'B) | 1439 | (ediff-clear-fine-differences-in-one-buffer n 'B) |
| 1439 | (if ediff-3way-job | 1440 | (if ediff-3way-job |
| 1440 | (ediff-clear-fine-differences-in-one-buffer n 'C))) | 1441 | (ediff-clear-fine-differences-in-one-buffer n 'C))) |
| 1441 | 1442 | ||
| 1442 | 1443 | ||
| 1443 | (defsubst ediff-convert-fine-diffs-to-overlays (diff-list region-num) | 1444 | (defsubst ediff-convert-fine-diffs-to-overlays (diff-list region-num) |
| 1444 | (ediff-set-fine-overlays-in-one-buffer 'A diff-list region-num) | 1445 | (ediff-set-fine-overlays-in-one-buffer 'A diff-list region-num) |
| @@ -1446,7 +1447,7 @@ This default should work without changes." | |||
| 1446 | (if ediff-3way-job | 1447 | (if ediff-3way-job |
| 1447 | (ediff-set-fine-overlays-in-one-buffer 'C diff-list region-num) | 1448 | (ediff-set-fine-overlays-in-one-buffer 'C diff-list region-num) |
| 1448 | )) | 1449 | )) |
| 1449 | 1450 | ||
| 1450 | (defsubst ediff-mouse-event-p (event) | 1451 | (defsubst ediff-mouse-event-p (event) |
| 1451 | (if ediff-xemacs-p | 1452 | (if ediff-xemacs-p |
| 1452 | (button-event-p event) | 1453 | (button-event-p event) |
| @@ -1476,35 +1477,35 @@ This default should work without changes." | |||
| 1476 | ((ediff-key-press-event-p event) | 1477 | ((ediff-key-press-event-p event) |
| 1477 | (current-buffer)) | 1478 | (current-buffer)) |
| 1478 | (t (error)))) | 1479 | (t (error)))) |
| 1479 | 1480 | ||
| 1480 | 1481 | ||
| 1481 | (defsubst ediff-frame-iconified-p (frame) | 1482 | (defsubst ediff-frame-iconified-p (frame) |
| 1482 | (if (and (ediff-window-display-p) (frame-live-p frame)) | 1483 | (if (and (ediff-window-display-p) (frame-live-p frame)) |
| 1483 | (if ediff-xemacs-p | 1484 | (if ediff-xemacs-p |
| 1484 | (frame-iconified-p frame) | 1485 | (frame-iconified-p frame) |
| 1485 | (eq (frame-visible-p frame) 'icon)))) | 1486 | (eq (frame-visible-p frame) 'icon)))) |
| 1486 | 1487 | ||
| 1487 | (defsubst ediff-window-visible-p (wind) | 1488 | (defsubst ediff-window-visible-p (wind) |
| 1488 | ;; under TTY, window-live-p also means window is visible | 1489 | ;; under TTY, window-live-p also means window is visible |
| 1489 | (and (window-live-p wind) | 1490 | (and (window-live-p wind) |
| 1490 | (or (not (ediff-window-display-p)) | 1491 | (or (not (ediff-window-display-p)) |
| 1491 | (frame-visible-p (window-frame wind))))) | 1492 | (frame-visible-p (window-frame wind))))) |
| 1492 | 1493 | ||
| 1493 | 1494 | ||
| 1494 | (defsubst ediff-frame-char-width (frame) | 1495 | (defsubst ediff-frame-char-width (frame) |
| 1495 | (if ediff-xemacs-p | 1496 | (if ediff-xemacs-p |
| 1496 | (/ (frame-pixel-width frame) (frame-width frame)) | 1497 | (/ (frame-pixel-width frame) (frame-width frame)) |
| 1497 | (frame-char-width frame))) | 1498 | (frame-char-width frame))) |
| 1498 | 1499 | ||
| 1499 | (defun ediff-reset-mouse (&optional frame do-not-grab-mouse) | 1500 | (defun ediff-reset-mouse (&optional frame do-not-grab-mouse) |
| 1500 | (or frame (setq frame (selected-frame))) | 1501 | (or frame (setq frame (selected-frame))) |
| 1501 | (if (ediff-window-display-p) | 1502 | (if (ediff-window-display-p) |
| 1502 | (let ((frame-or-wind frame)) | 1503 | (let ((frame-or-wind frame)) |
| 1503 | (if ediff-xemacs-p | 1504 | (if ediff-xemacs-p |
| 1504 | (setq frame-or-wind (frame-selected-window frame))) | 1505 | (setq frame-or-wind (frame-selected-window frame))) |
| 1505 | (or do-not-grab-mouse | 1506 | (or do-not-grab-mouse |
| 1506 | ;; don't set mouse if the user said to never do this | 1507 | ;; don't set mouse if the user said to never do this |
| 1507 | (not ediff-grab-mouse) | 1508 | (not ediff-grab-mouse) |
| 1508 | ;; Don't grab on quit, if the user doesn't want to. | 1509 | ;; Don't grab on quit, if the user doesn't want to. |
| 1509 | ;; If ediff-grab-mouse = t, then mouse won't be grabbed for | 1510 | ;; If ediff-grab-mouse = t, then mouse won't be grabbed for |
| 1510 | ;; sessions that are not part of a group (this is done in | 1511 | ;; sessions that are not part of a group (this is done in |
| @@ -1537,12 +1538,12 @@ This default should work without changes." | |||
| 1537 | (cdr (cdr (mouse-pixel-position))))) | 1538 | (cdr (cdr (mouse-pixel-position))))) |
| 1538 | ediff-mouse-pixel-threshold)))) | 1539 | ediff-mouse-pixel-threshold)))) |
| 1539 | (t nil)))) | 1540 | (t nil)))) |
| 1540 | 1541 | ||
| 1541 | (defsubst ediff-frame-char-height (frame) | 1542 | (defsubst ediff-frame-char-height (frame) |
| 1542 | (if ediff-xemacs-p | 1543 | (if ediff-xemacs-p |
| 1543 | (glyph-height ediff-H-glyph (selected-window frame)) | 1544 | (glyph-height ediff-H-glyph (selected-window frame)) |
| 1544 | (frame-char-height frame))) | 1545 | (frame-char-height frame))) |
| 1545 | 1546 | ||
| 1546 | ;; Some overlay functions | 1547 | ;; Some overlay functions |
| 1547 | 1548 | ||
| 1548 | (defsubst ediff-overlay-start (overl) | 1549 | (defsubst ediff-overlay-start (overl) |
| @@ -1550,7 +1551,7 @@ This default should work without changes." | |||
| 1550 | (if ediff-emacs-p | 1551 | (if ediff-emacs-p |
| 1551 | (overlay-start overl) | 1552 | (overlay-start overl) |
| 1552 | (extent-start-position overl)))) | 1553 | (extent-start-position overl)))) |
| 1553 | 1554 | ||
| 1554 | (defsubst ediff-overlay-end (overl) | 1555 | (defsubst ediff-overlay-end (overl) |
| 1555 | (if (ediff-overlayp overl) | 1556 | (if (ediff-overlayp overl) |
| 1556 | (if ediff-emacs-p | 1557 | (if ediff-emacs-p |
| @@ -1588,7 +1589,7 @@ Checks if overlay's buffer exists before actually doing the move." | |||
| 1588 | ;; buffer's dead | 1589 | ;; buffer's dead |
| 1589 | (if overlay | 1590 | (if overlay |
| 1590 | (ediff-delete-overlay overlay))))) | 1591 | (ediff-delete-overlay overlay))))) |
| 1591 | 1592 | ||
| 1592 | (defun ediff-overlay-put (overlay prop value) | 1593 | (defun ediff-overlay-put (overlay prop value) |
| 1593 | "Calls `overlay-put' or `set-extent-property' depending on Emacs version. | 1594 | "Calls `overlay-put' or `set-extent-property' depending on Emacs version. |
| 1594 | Checks if overlay's buffer exists." | 1595 | Checks if overlay's buffer exists." |
| @@ -1599,7 +1600,7 @@ Checks if overlay's buffer exists." | |||
| 1599 | (ediff-delete-overlay overlay))) | 1600 | (ediff-delete-overlay overlay))) |
| 1600 | 1601 | ||
| 1601 | ;; Some diff region tests | 1602 | ;; Some diff region tests |
| 1602 | 1603 | ||
| 1603 | ;; t if diff region is empty. | 1604 | ;; t if diff region is empty. |
| 1604 | ;; In case of buffer C, t also if it is not a 3way | 1605 | ;; In case of buffer C, t also if it is not a 3way |
| 1605 | ;; comparison job (merging jobs return t as well). | 1606 | ;; comparison job (merging jobs return t as well). |
| @@ -1610,7 +1611,7 @@ Checks if overlay's buffer exists." | |||
| 1610 | (ediff-get-diff-posn 'C 'end n))) | 1611 | (ediff-get-diff-posn 'C 'end n))) |
| 1611 | (= (ediff-get-diff-posn buf-type 'beg n) | 1612 | (= (ediff-get-diff-posn buf-type 'beg n) |
| 1612 | (ediff-get-diff-posn buf-type 'end n)))) | 1613 | (ediff-get-diff-posn buf-type 'end n)))) |
| 1613 | 1614 | ||
| 1614 | ;; Test if diff region is white space only. | 1615 | ;; Test if diff region is white space only. |
| 1615 | ;; If 2-way job and buf-type = C, then returns t. | 1616 | ;; If 2-way job and buf-type = C, then returns t. |
| 1616 | (defun ediff-whitespace-diff-region-p (n buf-type) | 1617 | (defun ediff-whitespace-diff-region-p (n buf-type) |
| @@ -1623,7 +1624,7 @@ Checks if overlay's buffer exists." | |||
| 1623 | (goto-char beg) | 1624 | (goto-char beg) |
| 1624 | (skip-chars-forward ediff-whitespace) | 1625 | (skip-chars-forward ediff-whitespace) |
| 1625 | (>= (point) end)))))) | 1626 | (>= (point) end)))))) |
| 1626 | 1627 | ||
| 1627 | ;; temporarily uses DIR to abbreviate file name | 1628 | ;; temporarily uses DIR to abbreviate file name |
| 1628 | ;; if DIR is nil, use default-directory | 1629 | ;; if DIR is nil, use default-directory |
| 1629 | (defun ediff-abbreviate-file-name (file &optional dir) | 1630 | (defun ediff-abbreviate-file-name (file &optional dir) |
| @@ -1692,16 +1693,16 @@ Checks if overlay's buffer exists." | |||
| 1692 | (aset str pos ?\ )) | 1693 | (aset str pos ?\ )) |
| 1693 | (setq pos (1+ pos))) | 1694 | (setq pos (1+ pos))) |
| 1694 | str)))) | 1695 | str)))) |
| 1695 | |||
| 1696 | 1696 | ||
| 1697 | 1697 | ||
| 1698 | |||
| 1698 | (defsubst ediff-get-region-contents (n buf-type ctrl-buf &optional start end) | 1699 | (defsubst ediff-get-region-contents (n buf-type ctrl-buf &optional start end) |
| 1699 | (ediff-with-current-buffer | 1700 | (ediff-with-current-buffer |
| 1700 | (ediff-with-current-buffer ctrl-buf (ediff-get-buffer buf-type)) | 1701 | (ediff-with-current-buffer ctrl-buf (ediff-get-buffer buf-type)) |
| 1701 | (buffer-substring | 1702 | (buffer-substring |
| 1702 | (or start (ediff-get-diff-posn buf-type 'beg n ctrl-buf)) | 1703 | (or start (ediff-get-diff-posn buf-type 'beg n ctrl-buf)) |
| 1703 | (or end (ediff-get-diff-posn buf-type 'end n ctrl-buf))))) | 1704 | (or end (ediff-get-diff-posn buf-type 'end n ctrl-buf))))) |
| 1704 | 1705 | ||
| 1705 | ;; If ediff modified mode line, strip the modification | 1706 | ;; If ediff modified mode line, strip the modification |
| 1706 | (defsubst ediff-strip-mode-line-format () | 1707 | (defsubst ediff-strip-mode-line-format () |
| 1707 | (if (member (car mode-line-format) '(" A: " " B: " " C: " " Ancestor: ")) | 1708 | (if (member (car mode-line-format) '(" A: " " B: " " C: " " Ancestor: ")) |
| @@ -1711,7 +1712,7 @@ Checks if overlay's buffer exists." | |||
| 1711 | (defsubst ediff-valid-difference-p (&optional n) | 1712 | (defsubst ediff-valid-difference-p (&optional n) |
| 1712 | (or n (setq n ediff-current-difference)) | 1713 | (or n (setq n ediff-current-difference)) |
| 1713 | (and (>= n 0) (< n ediff-number-of-differences))) | 1714 | (and (>= n 0) (< n ediff-number-of-differences))) |
| 1714 | 1715 | ||
| 1715 | (defsubst ediff-show-all-diffs (n) | 1716 | (defsubst ediff-show-all-diffs (n) |
| 1716 | "Don't skip difference regions." | 1717 | "Don't skip difference regions." |
| 1717 | nil) | 1718 | nil) |
| @@ -1745,7 +1746,7 @@ Checks if overlay's buffer exists." | |||
| 1745 | ;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) | 1746 | ;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) |
| 1746 | ;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) | 1747 | ;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) |
| 1747 | ;;; End: | 1748 | ;;; End: |
| 1748 | 1749 | ||
| 1749 | (provide 'ediff-init) | 1750 | (provide 'ediff-init) |
| 1750 | 1751 | ||
| 1751 | 1752 | ||