comparison lisp/ediff-init.el @ 18839:1405083241e8

new version
author Michael Kifer <kifer@cs.stonybrook.edu>
date Thu, 17 Jul 1997 19:37:07 +0000
parents 0b9d9cbf3cd4
children f90d40b0bff5
comparison
equal deleted inserted replaced
18838:6f9fa4c8e92a 18839:1405083241e8
326 (error "%S: This command runs in Ediff Control Buffer only!" 326 (error "%S: This command runs in Ediff Control Buffer only!"
327 this-command))) 327 this-command)))
328 328
329 ;; Hook variables 329 ;; Hook variables
330 330
331 (defvar ediff-before-setup-windows-hook nil 331 (defcustom ediff-before-setup-windows-hook nil
332 "*Hooks to run before Ediff sets its window configuration. 332 "*Hooks to run before Ediff sets its window configuration.
333 This can be used to save the previous window config, which can be restored 333 This can be used to save the previous window config, which can be restored
334 on ediff-quit or ediff-suspend.") 334 on ediff-quit or ediff-suspend."
335 (defvar ediff-after-setup-windows-hook nil 335 :type 'hook
336 :group 'ediff)
337 (defcustom ediff-after-setup-windows-hook nil
336 "*Hooks to run after Ediff sets its window configuration. 338 "*Hooks to run after Ediff sets its window configuration.
337 This can be used to set up control window or icon in a desired place.") 339 This can be used to set up control window or icon in a desired place."
338 (defvar ediff-before-setup-control-frame-hook nil 340 :type 'hook
341 :group 'ediff)
342 (defcustom ediff-before-setup-control-frame-hook nil
339 "*Hooks run before setting up the frame to display Ediff Control Panel. 343 "*Hooks run before setting up the frame to display Ediff Control Panel.
340 Can be used to change control frame parameters to position it where it 344 Can be used to change control frame parameters to position it where it
341 is desirable.") 345 is desirable."
342 (defvar ediff-after-setup-control-frame-hook nil 346 :type 'hook
347 :group 'ediff)
348 (defcustom ediff-after-setup-control-frame-hook nil
343 "*Hooks run after setting up the frame to display Ediff Control Panel. 349 "*Hooks run after setting up the frame to display Ediff Control Panel.
344 Can be used to move the frame where it is desired.") 350 Can be used to move the frame where it is desired."
345 (defvar ediff-startup-hook nil 351 :type 'hook
346 "*Hooks to run in the control buffer after Ediff has been set up.") 352 :group 'ediff)
347 (defvar ediff-select-hook nil 353 (defcustom ediff-startup-hook nil
348 "*Hooks to run after a difference has been selected.") 354 "*Hooks to run in the control buffer after Ediff has been set up."
349 (defvar ediff-unselect-hook nil 355 :type 'hook
350 "*Hooks to run after a difference has been unselected.") 356 :group 'ediff)
351 (defvar ediff-prepare-buffer-hook nil 357 (defcustom ediff-select-hook nil
352 "*Hooks called after buffers A, B, and C are set up.") 358 "*Hooks to run after a difference has been selected."
353 (defvar ediff-load-hook nil 359 :type 'hook
354 "*Hook run after Ediff is loaded. Can be used to change defaults.") 360 :group 'ediff)
355 361 (defcustom ediff-unselect-hook nil
356 (defvar ediff-mode-hook nil 362 "*Hooks to run after a difference has been unselected."
363 :type 'hook
364 :group 'ediff)
365 (defcustom ediff-prepare-buffer-hook nil
366 "*Hooks called after buffers A, B, and C are set up."
367 :type 'hook
368 :group 'ediff)
369 (defcustom ediff-load-hook nil
370 "*Hook run after Ediff is loaded. Can be used to change defaults."
371 :type 'hook
372 :group 'ediff)
373
374 (defcustom ediff-mode-hook nil
357 "*Hook run just after ediff-mode is set up in the control buffer. 375 "*Hook run just after ediff-mode is set up in the control buffer.
358 This is done before any windows or frames are created. One can use it to 376 This is done before any windows or frames are created. One can use it to
359 set local variables that determine how the display looks like.") 377 set local variables that determine how the display looks like."
360 (defvar ediff-keymap-setup-hook nil 378 :type 'hook
361 "*Hook run just after the default bindings in Ediff keymap are set up.") 379 :group 'ediff)
362 380 (defcustom ediff-keymap-setup-hook nil
363 (defvar ediff-display-help-hook nil 381 "*Hook run just after the default bindings in Ediff keymap are set up."
364 "*Hooks run after preparing the help message.") 382 :type 'hook
365 383 :group 'ediff)
366 (defvar ediff-suspend-hook (list 'ediff-default-suspend-function) 384
367 "*Hooks to run in the Ediff control buffer when Ediff is suspended.") 385 (defcustom ediff-display-help-hook nil
368 (defvar ediff-quit-hook (list 'ediff-cleanup-mess) 386 "*Hooks run after preparing the help message."
369 "*Hooks to run in the Ediff control buffer after finishing Ediff.") 387 :type 'hook
370 (defvar ediff-cleanup-hook nil 388 :group 'ediff)
389
390 (defcustom ediff-suspend-hook (list 'ediff-default-suspend-function)
391 "*Hooks to run in the Ediff control buffer when Ediff is suspended."
392 :type 'hook
393 :group 'ediff)
394 (defcustom ediff-quit-hook (list 'ediff-cleanup-mess)
395 "*Hooks to run in the Ediff control buffer after finishing Ediff."
396 :type 'hook
397 :group 'ediff)
398 (defcustom ediff-cleanup-hook nil
371 "*Hooks to run on exiting Ediff but before killing the control buffer. 399 "*Hooks to run on exiting Ediff but before killing the control buffer.
372 This is a place to do various cleanups, such as deleting the variant buffers. 400 This is a place to do various cleanups, such as deleting the variant buffers.
373 Ediff provides a function, `ediff-janitor', as one such possible hook.") 401 Ediff provides a function, `ediff-janitor', as one such possible hook."
374 (defvar ediff-quit-merge-hook 'ediff-maybe-save-and-delete-merge 402 :type 'hook
375 "*Hooks to run before quitting a merge job. 403 :group 'ediff)
376 The most common use is to save and delete the merge buffer.")
377
378 404
379 ;; Error messages 405 ;; Error messages
380 (defconst ediff-KILLED-VITAL-BUFFER 406 (defconst ediff-KILLED-VITAL-BUFFER
381 "You have killed a vital Ediff buffer---you must leave Ediff now!") 407 "You have killed a vital Ediff buffer---you must leave Ediff now!")
382 (defconst ediff-NO-DIFFERENCES 408 (defconst ediff-NO-DIFFERENCES
428 ;; connective that determines whether to hide regions that match both or 454 ;; connective that determines whether to hide regions that match both or
429 ;; one of the regexps 455 ;; one of the regexps
430 (ediff-defvar-local ediff-hide-regexp-connective 'and "") 456 (ediff-defvar-local ediff-hide-regexp-connective 'and "")
431 457
432 458
433 ;; Copying difference regions between buffers. 459 ;;; Copying difference regions between buffers.
434 (ediff-defvar-local ediff-killed-diffs-alist nil 460
435 "A list of killed diffs. 461 ;; A list of killed diffs.
436 A diff is saved here if it is replaced by a diff 462 ;; A diff is saved here if it is replaced by a diff
437 from another buffer. This alist has the form: 463 ;; from another buffer. This alist has the form:
438 \((num (buff-object . diff) (buff-object . diff) (buff-object . diff)) ...), 464 ;; \((num (buff-object . diff) (buff-object . diff) (buff-object . diff)) ...),
439 where some buffer-objects may be missing.") 465 ;; where some buffer-objects may be missing.
466 (ediff-defvar-local ediff-killed-diffs-alist nil "")
440 467
441 468
442 ;; Highlighting 469 ;; Highlighting
443 ;;(defvar ediff-before-flag-bol (if ediff-emacs-p "->>\n" (make-glyph "->>\n")) 470 (defcustom ediff-before-flag-bol (if ediff-xemacs-p (make-glyph "->>") "->>")
444 (defvar ediff-before-flag-bol (if ediff-xemacs-p (make-glyph "->>") "->>") 471 "*Flag placed before a highlighted block of differences, if block starts at beginning of a line."
445 "*Flag placed above the highlighted block of differences. 472 :type 'string
446 Must end with newline.") 473 :tag "Region before-flag at beginning of line"
447 ;;(defvar ediff-after-flag-eol (if ediff-emacs-p "<<-\n" (make-glyph "<<-")) 474 :group 'ediff)
448 (defvar ediff-after-flag-eol (if ediff-xemacs-p (make-glyph "<<-") "<<-") 475
449 "*Flag placed below the highlighted block of differences. 476 (defcustom ediff-after-flag-eol (if ediff-xemacs-p (make-glyph "<<-") "<<-")
450 Must end with newline.") 477 "*Flag placed after a highlighted block of differences, if block ends at end of a line."
451 478 :type 'string
452 (defvar ediff-before-flag-mol (if ediff-xemacs-p (make-glyph "->>") "->>") 479 :tag "Region after-flag at end of line"
453 "*Like ediff-before-flag, used when a difference starts in mid-line.") 480 :group 'ediff)
454 (defvar ediff-after-flag-mol (if ediff-xemacs-p (make-glyph "<<-") "<<-") 481
455 "*Like ediff-after-flag, used when a difference starts in mid-line.") 482 (defcustom ediff-before-flag-mol (if ediff-xemacs-p (make-glyph "->>") "->>")
483 "*Flag placed before a highlighted block of differences, if block starts in mid-line."
484 :type 'string
485 :tag "Region before-flag in the middle of line"
486 :group 'ediff)
487 (defcustom ediff-after-flag-mol (if ediff-xemacs-p (make-glyph "<<-") "<<-")
488 "*Flag placed after a highlighted block of differences, if block ends in mid-line."
489 :type 'string
490 :tag "Region after-flag in the middle of line"
491 :group 'ediff)
456 492
457 493
458 (ediff-defvar-local ediff-use-faces t 494 (ediff-defvar-local ediff-use-faces t
459 "If t, differences are highlighted using faces, if device supports faces. 495 "If t, differences are highlighted using faces, if device supports faces.
460 If nil, differences are highlighted using ASCII flags, ediff-before-flag 496 If nil, differences are highlighted using ASCII flags, ediff-before-flag
488 (ediff-defvar-local ediff-start-narrowed t 524 (ediff-defvar-local ediff-start-narrowed t
489 "Non-nil means start narrowed, if doing ediff-windows-* or ediff-regions-*") 525 "Non-nil means start narrowed, if doing ediff-windows-* or ediff-regions-*")
490 (ediff-defvar-local ediff-quit-widened t 526 (ediff-defvar-local ediff-quit-widened t
491 "*Non-nil means: when finished, Ediff widens buffers A/B. 527 "*Non-nil means: when finished, Ediff widens buffers A/B.
492 Actually, Ediff restores the scope of visibility that existed at startup.") 528 Actually, Ediff restores the scope of visibility that existed at startup.")
493 (defvar ediff-keep-variants t 529
494 "*Nil means that non-modified variant buffers should be removed after some 530 (defcustom ediff-keep-variants t
495 interrogation. 531 "*Nil means that non-modified variant buffers should be removed at the end of the session after some interrogation.
496 Supplying a prefix argument to the quit command `q' temporarily reverses the 532 Supplying a prefix argument to the quit command `q' temporarily reverses the
497 meaning of this variable.") 533 meaning of this variable."
534 :type 'boolean
535 :group 'ediff)
498 536
499 (ediff-defvar-local ediff-highlight-all-diffs t 537 (ediff-defvar-local ediff-highlight-all-diffs t
500 "If nil, only the selected differences are highlighted. 538 "If nil, only the selected differences are highlighted.
501 This variable can be set either in .emacs or toggled interactively, using 539 This variable can be set either in .emacs or toggled interactively, using
502 ediff-toggle-hilit. Use `setq-default' to set it.") 540 ediff-toggle-hilit. Use `setq-default' to set it.")
520 (ediff-defvar-local ediff-buffer-values-orig-B nil "") 558 (ediff-defvar-local ediff-buffer-values-orig-B nil "")
521 ;; The original values of ediff-protected-variables for buffer C 559 ;; The original values of ediff-protected-variables for buffer C
522 (ediff-defvar-local ediff-buffer-values-orig-C nil "") 560 (ediff-defvar-local ediff-buffer-values-orig-C nil "")
523 ;; The original values of ediff-protected-variables for buffer Ancestor 561 ;; The original values of ediff-protected-variables for buffer Ancestor
524 (ediff-defvar-local ediff-buffer-values-orig-Ancestor nil "") 562 (ediff-defvar-local ediff-buffer-values-orig-Ancestor nil "")
525 ;; Buffer-local variables to be saved then restored during Ediff sessions 563
526 ;; Buffer-local variables to be saved then restored during Ediff sessions 564 ;; Buffer-local variables to be saved then restored during Ediff sessions
527 (defconst ediff-protected-variables '( 565 (defconst ediff-protected-variables '(
528 ;;buffer-read-only 566 ;;buffer-read-only
529 mode-line-format)) 567 mode-line-format))
530 568
587 (defvar ediff-disturbed-overlays nil "") 625 (defvar ediff-disturbed-overlays nil "")
588 626
589 ;; Priority of non-selected overlays. 627 ;; Priority of non-selected overlays.
590 (defvar ediff-shadow-overlay-priority 100 "") 628 (defvar ediff-shadow-overlay-priority 100 "")
591 629
592 (defvar ediff-version-control-package 'vc 630 (defcustom ediff-version-control-package 'vc
593 "Version control package used. 631 "Version control package used.
594 Currently, Ediff supports vc.el, rcs.el, pcl-cvs.el, and generic-sc.el. The 632 Currently, Ediff supports vc.el, rcs.el, pcl-cvs.el, and generic-sc.el. The
595 standard Emacs interface to RCS, CVS, SCCS, etc., is vc.el. However, some 633 standard Emacs interface to RCS, CVS, SCCS, etc., is vc.el. However, some
596 people find the other two packages more convenient. Set this variable to the 634 people find the other two packages more convenient. Set this variable to the
597 appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire.") 635 appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire."
636 :type 'symbol
637 :group 'ediff)
598 638
599 639
600 (if ediff-xemacs-p 640 (if ediff-xemacs-p
601 (progn 641 (progn
602 (fset 'ediff-read-event (symbol-function 'next-command-event)) 642 (fset 'ediff-read-event (symbol-function 'next-command-event))
1104 "*Specifies the function to be used to toggle read-only. 1144 "*Specifies the function to be used to toggle read-only.
1105 If nil, Ediff tries to deduce the function from the binding of C-x C-q. 1145 If nil, Ediff tries to deduce the function from the binding of C-x C-q.
1106 Normally, this is the `toggle-read-only' function, but, if version 1146 Normally, this is the `toggle-read-only' function, but, if version
1107 control is used, it could be `vc-toggle-read-only' or `rcs-toggle-read-only'.") 1147 control is used, it could be `vc-toggle-read-only' or `rcs-toggle-read-only'.")
1108 1148
1149 (defcustom ediff-make-buffers-readonly-at-startup nil
1150 "*Make all variant buffers read-only when Ediff starts up.
1151 This property can be toggled interactively."
1152 :type 'boolean
1153 :group 'ediff)
1154
1109 1155
1110 ;;; Misc 1156 ;;; Misc
1111 1157
1112 ;; if nil, this silences some messages 1158 ;; if nil, this silences some messages
1113 (defconst ediff-verbose-p t) 1159 (defconst ediff-verbose-p t)
1119 as `ediff-merge-directory' or `ediff-merge-directory-revisions'.") 1165 as `ediff-merge-directory' or `ediff-merge-directory-revisions'.")
1120 1166
1121 ;; file where the result of the merge is to be saved. used internally 1167 ;; file where the result of the merge is to be saved. used internally
1122 (ediff-defvar-local ediff-merge-store-file nil "") 1168 (ediff-defvar-local ediff-merge-store-file nil "")
1123 1169
1124 (defvar ediff-no-emacs-help-in-control-buffer nil 1170 (defcustom ediff-no-emacs-help-in-control-buffer nil
1125 "*Non-nil means C-h should not invoke Emacs help in control buffer. 1171 "*Non-nil means C-h should not invoke Emacs help in control buffer.
1126 Instead, C-h jumps to previous difference.") 1172 Instead, C-h would jump to previous difference."
1173 :type 'boolean
1174 :group 'ediff)
1127 1175
1128 (defvar ediff-temp-file-prefix 1176 (defvar ediff-temp-file-prefix
1129 (let ((env (or (getenv "TMPDIR") 1177 (let ((env (or (getenv "TMPDIR")
1130 (getenv "TMP") 1178 (getenv "TMP")
1131 (getenv "TEMP"))) 1179 (getenv "TEMP")))
1153 1201
1154 ;; needed to simulate frame-char-width in XEmacs. 1202 ;; needed to simulate frame-char-width in XEmacs.
1155 (defvar ediff-H-glyph (if ediff-xemacs-p (make-glyph "H"))) 1203 (defvar ediff-H-glyph (if ediff-xemacs-p (make-glyph "H")))
1156 1204
1157 1205
1158 (ediff-defvar-local ediff-temp-file-A nil 1206 ;; Temporary file used for refining difference regions in buffer A.
1159 "Temporary file used for refining difference regions in buffer A.") 1207 (ediff-defvar-local ediff-temp-file-A nil "")
1160 (ediff-defvar-local ediff-temp-file-B nil 1208 ;; Temporary file used for refining difference regions in buffer B.
1161 "Temporary file used for refining difference regions in buffer B.") 1209 (ediff-defvar-local ediff-temp-file-B nil "")
1162 (ediff-defvar-local ediff-temp-file-C nil 1210 ;; Temporary file used for refining difference regions in buffer C.
1163 "Temporary file used for refining difference regions in buffer C.") 1211 (ediff-defvar-local ediff-temp-file-C nil "")
1212
1164 1213
1165 ;;; In-line functions 1214 ;;; In-line functions
1166 1215
1167 (or (fboundp 'ediff-file-remote-p) ; user supplied his own function: use it 1216 (or (fboundp 'ediff-file-remote-p) ; user supplied his own function: use it
1168 (defun ediff-file-remote-p (file-name) 1217 (defun ediff-file-remote-p (file-name)