Commit 869cf5cb authored by Stefan Monnier's avatar Stefan Monnier

* lisp/vc/ediff-*.el: Use lexical-binding, plus misc cleanup

Re-enable lexical-binding in ediff.  For that, change ediff-find-file
so as not to rely on dynamic scoping in its calling convention.

* lisp/vc/ediff-diff.el: Move `provide` to the end.
Remove redundant :group.
(ediff-exec-process): Disregard current directory.
(ediff-forward-word-function): Use defvar-local.

* lisp/vc/ediff-help.el (ediff-set-help-message): Use functionp.

* lisp/vc/ediff-hook.el (menu-bar-ediff-misc-menu): Make a toggle, as
in the XEmacs menu.

* lisp/vc/ediff-init.el (ediff-defvar-local): Add `doc-string` prop.
(ediff-check-version): Delete function, unused.

* lisp/vc/ediff-mult.el: Move `provide` to the end.
Remove redundant :groups.
(ediff-dir-diffs-buffer-map):
Move initialization into declaration.
(ediff-meta-mode): Use define-derived-mode.
(ediff-intersect-directories): Remove `comparison-func`, unused.
(ediff-prepare-meta-buffer): Fix use of `startup-hooks`.

* lisp/vc/ediff-ptch.el: Move `provide` to the end.

* lisp/vc/ediff-util.el (ediff-add-to-history): Use add-to-history instead.

* lisp/vc/ediff-vers.el (ediff-vc-internal, ediff-vc-merge-internal):
Use push and closures.

* lisp/vc/ediff-wind.el: Remove redundant :groups.

* lisp/vc/ediff.el: Move `provide` to the end.
Remove redundant :groups.
(ediff--magic-file-name, ediff--startup-hook): New vars.
(ediff-find-file): Change calling convention so as not to use
symbols as value cells.
(ediff--buffer-file-name): New function.
(ediff-files-internal): Adjust to new calling convention of ediff-find-file.
(ediff-directories-internal, ediff-directory-revisions-internal)
(ediff-regions-internal): Use push and closures.
parent d63bfbca
Pipeline #2194 failed with stage
in 51 minutes and 19 seconds
;;; ediff-diff.el --- diff-related utilities -*- lexical-binding: nil; -*-
;;; ediff-diff.el --- diff-related utilities -*- lexical-binding:t -*-
;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
......@@ -25,8 +25,6 @@
;;; Code:
(provide 'ediff-diff)
(require 'ediff-init)
(require 'ediff-util)
......@@ -37,13 +35,11 @@
(defcustom ediff-diff-program "diff"
"Program to use for generating the differential of the two files."
:type 'string
:group 'ediff-diff)
:type 'string)
(defcustom ediff-diff3-program "diff3"
"Program to be used for three-way comparison.
Must produce output compatible with Unix's diff3 program."
:type 'string
:group 'ediff-diff)
:type 'string)
;; The following functions must precede all defcustom-defined variables.
......@@ -60,21 +56,18 @@ will do. However, some people set $prompt or other things
incorrectly, which leads to undesirable output messages. These may
cause Ediff to fail. In such a case, set `ediff-shell' to a shell that
you are not using or, better, fix your shell's startup file."
:type 'string
:group 'ediff-diff)
:type 'string)
(defcustom ediff-cmp-program "cmp"
"Utility to use to determine if two files are identical.
It must return code 0, if its arguments are identical files."
:type 'string
:group 'ediff-diff)
:type 'string)
(defcustom ediff-cmp-options nil
"Options to pass to `ediff-cmp-program'.
If GNU diff is used as `ediff-cmp-program', then the most useful options
are `-I REGEXP', to ignore changes whose lines match the REGEXP."
:type '(repeat string)
:group 'ediff-diff)
:type '(repeat string))
(defun ediff-set-diff-options (symbol value)
(set symbol value)
......@@ -95,8 +88,7 @@ This variable is not for customizing the look of the differences produced by
the command \\[ediff-show-diff-output]. Use the variable
`ediff-custom-diff-options' for that."
:set 'ediff-set-diff-options
:type 'string
:group 'ediff-diff)
:type 'string)
(ediff-defvar-local ediff-ignore-case nil
"If t, skip over difference regions that differ only in letter case.
......@@ -105,14 +97,12 @@ Use `setq-default' if setting it in .emacs")
(defcustom ediff-ignore-case-option "-i"
"Option that causes the diff program to ignore case of letters."
:type 'string
:group 'ediff-diff)
:type 'string)
(defcustom ediff-ignore-case-option3 ""
"Option that causes the diff3 program to ignore case of letters.
GNU diff3 doesn't have such an option."
:type 'string
:group 'ediff-diff)
:type 'string)
;; the actual options used in comparison
(ediff-defvar-local ediff-actual-diff-options ediff-diff-options "")
......@@ -120,12 +110,10 @@ GNU diff3 doesn't have such an option."
(defcustom ediff-custom-diff-program ediff-diff-program
"Program to use for generating custom diff output for saving it in a file.
This output is not used by Ediff internally."
:type 'string
:group 'ediff-diff)
:type 'string)
(defcustom ediff-custom-diff-options "-c"
"Options to pass to `ediff-custom-diff-program'."
:type 'string
:group 'ediff-diff)
:type 'string)
;;; Support for diff3
......@@ -134,8 +122,7 @@ This output is not used by Ediff internally."
(defcustom ediff-diff3-options ""
"Options to pass to `ediff-diff3-program'."
:set 'ediff-set-diff-options
:type 'string
:group 'ediff-diff)
:type 'string)
;; the actual options used in comparison
(ediff-defvar-local ediff-actual-diff3-options ediff-diff3-options "")
......@@ -144,8 +131,7 @@ This output is not used by Ediff internally."
"^\\([1-3]:\\|====\\| \\|.*Warning *:\\|.*No newline\\|.*missing newline\\|^\C-m$\\)"
"Regexp that matches normal output lines from `ediff-diff3-program'.
Lines that do not match are assumed to be error messages."
:type 'regexp
:group 'ediff-diff)
:type 'regexp)
;; keeps the status of the current diff in 3-way jobs.
;; the status can be =diff(A), =diff(B), or =diff(A+B)
......@@ -842,7 +828,7 @@ delimiter regions"))
)
(setq overlay-list (reverse overlay-list))
(ediff-set-fine-diff-vector
reg-num 'C (apply 'vector overlay-list))
reg-num 'C (apply #'vector overlay-list))
))
......@@ -1170,30 +1156,30 @@ are ignored."
(eq buffer ediff-fine-diff-buffer)
(setq args (delete "--binary" args)))
(unwind-protect
(let ((directory default-directory)
proc)
(with-current-buffer buffer
(erase-buffer)
(setq default-directory directory)
(if (or (memq system-type '(ms-dos windows-nt))
synch)
;; In Windows do it synchronously, since Windows doesn't let us
;; delete files used by other processes. Thus, in ediff-buffers
;; and similar functions, we can't delete temp files because
;; they might be used by the asynch process that computes
;; custom diffs. So, we have to wait till custom diff
;; subprocess is done.
;; In DOS, must synchronize because DOS doesn't have
;; asynchronous processes.
(apply 'call-process program nil buffer nil args)
;; On other systems, do it asynchronously.
(setq proc (get-buffer-process buffer))
(if proc (kill-process proc))
(setq proc
(apply 'start-process "Custom Diff" buffer program args))
(with-current-buffer buffer
(erase-buffer)
;; default-directory may be on some remote machine
;; (e.g. accessed via Tramp or url-handler) or a non-existing dir.
(setq default-directory "/")
(if (or (memq system-type '(ms-dos windows-nt))
synch)
;; In Windows do it synchronously, since Windows doesn't let us
;; delete files used by other processes. Thus, in ediff-buffers
;; and similar functions, we can't delete temp files because
;; they might be used by the asynch process that computes
;; custom diffs. So, we have to wait till custom diff
;; subprocess is done.
;; In DOS, must synchronize because DOS doesn't have
;; asynchronous processes.
(apply #'call-process program nil buffer nil args)
;; On other systems, do it asynchronously.
(let ((proc (get-buffer-process buffer)))
(if proc (kill-process proc)))
(let ((proc
(apply #'start-process "Custom Diff" buffer program args)))
(setq mode-line-process '(":%s"))
(set-process-sentinel proc 'ediff-process-sentinel)
(set-process-filter proc 'ediff-process-filter)
(set-process-sentinel proc #'ediff-process-sentinel)
(set-process-filter proc #'ediff-process-filter)
)))
(store-match-data data))))
......@@ -1235,10 +1221,9 @@ are ignored."
;;; Word functions used to refine the current diff
(defvar ediff-forward-word-function 'ediff-forward-word
(defvar-local ediff-forward-word-function #'ediff-forward-word
"Function to call to move to the next word.
Used for splitting difference regions into individual words.")
(make-variable-buffer-local 'ediff-forward-word-function)
;; \240 is Unicode symbol for nonbreakable whitespace
(defvar ediff-whitespace " \n\t\f\r\240"
......@@ -1358,7 +1343,7 @@ arguments to `skip-chars-forward'."
(let ((res
;; In the remote case, this works only if F1 and F2 are
;; located on the same remote host.
(apply 'process-file ediff-cmp-program nil nil nil
(apply #'process-file ediff-cmp-program nil nil nil
(append ediff-cmp-options
(list (expand-file-name (file-local-name f1))
(expand-file-name (file-local-name f2)))))
......@@ -1418,8 +1403,8 @@ affects only files whose names match the expression."
;; First, check only the names (works quickly and ensures a
;; precondition for subsequent code)
(if (and (= (length entries-1) (length entries-2))
(equal (mapcar 'file-name-nondirectory entries-1)
(mapcar 'file-name-nondirectory entries-2)))
(equal (mapcar #'file-name-nondirectory entries-1)
(mapcar #'file-name-nondirectory entries-2)))
;; With name equality established, compare the entries
;; through recursion.
(let ((continue t))
......@@ -1482,12 +1467,5 @@ affects only files whose names match the expression."
(ediff-update-diffs)))
)
;; Local Variables:
;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
;; End:
(provide 'ediff-diff)
;;; ediff-diff.el ends here
;;; ediff-help.el --- Code related to the contents of Ediff help buffers -*- lexical-binding: nil; -*-
;;; ediff-help.el --- Code related to the contents of Ediff help buffers -*- lexical-binding:t -*-
;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
......@@ -270,8 +270,7 @@ the value of this variable and the variables `ediff-help-message-*' in
(defun ediff-set-help-message ()
(setq ediff-long-help-message
(cond ((and ediff-long-help-message-function
(or (symbolp ediff-long-help-message-function)
(consp ediff-long-help-message-function)))
(functionp ediff-long-help-message-function))
(funcall ediff-long-help-message-function))
(ediff-word-mode
(concat ediff-long-help-message-head
......@@ -295,8 +294,7 @@ the value of this variable and the variables `ediff-help-message-*' in
ediff-long-help-message-tail))))
(setq ediff-brief-help-message
(cond ((and ediff-brief-help-message-function
(or (symbolp ediff-brief-help-message-function)
(consp ediff-brief-help-message-function)))
(functionp ediff-brief-help-message-function))
(funcall ediff-brief-help-message-function))
((stringp ediff-brief-help-message-function)
ediff-brief-help-message-function)
......@@ -316,6 +314,4 @@ the value of this variable and the variables `ediff-help-message-*' in
(provide 'ediff-help)
;;; ediff-help.el ends here
;;; ediff-hook.el --- setup for Ediff's menus and autoloads -*- lexical-binding: nil; -*-
;;; ediff-hook.el --- setup for Ediff's menus and autoloads -*- lexical-binding:t -*-
;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
......@@ -43,7 +43,6 @@
;; end pacifier
;; allow menus to be set up without ediff-wind.el being loaded
(defvar ediff-window-setup-function)
;; This autoload is useless in Emacs because ediff-hook.el is dumped with
;; emacs, but it is needed in XEmacs
......@@ -114,10 +113,8 @@
["Use separate frame for Ediff control buffer"
ediff-toggle-multiframe
:style toggle
:selected (if (and (featurep 'ediff-util)
(boundp 'ediff-window-setup-function))
(eq ediff-window-setup-function
'ediff-setup-windows-multiframe))]
:selected (eq (bound-and-true-p ediff-window-setup-function)
#'ediff-setup-windows-multiframe)]
["Use a toolbar with Ediff control buffer"
ediff-toggle-use-toolbar
:style toggle
......@@ -133,14 +130,14 @@
(defvar menu-bar-ediff-misc-menu
(make-sparse-keymap "Ediff Miscellanea"))
(fset 'menu-bar-ediff-misc-menu
(symbol-value 'menu-bar-ediff-misc-menu))
menu-bar-ediff-misc-menu)
(defvar menu-bar-epatch-menu (make-sparse-keymap "Apply Patch"))
(fset 'menu-bar-epatch-menu (symbol-value 'menu-bar-epatch-menu))
(fset 'menu-bar-epatch-menu menu-bar-epatch-menu)
(defvar menu-bar-ediff-merge-menu (make-sparse-keymap "Merge"))
(fset 'menu-bar-ediff-merge-menu
(symbol-value 'menu-bar-ediff-merge-menu))
menu-bar-ediff-merge-menu)
(defvar menu-bar-ediff-menu (make-sparse-keymap "Compare"))
(fset 'menu-bar-ediff-menu (symbol-value 'menu-bar-ediff-menu))
(fset 'menu-bar-ediff-menu menu-bar-ediff-menu)
;; define ediff compare menu
(define-key menu-bar-ediff-menu [ediff-misc]
......@@ -245,7 +242,15 @@
(define-key menu-bar-ediff-misc-menu [emultiframe]
`(menu-item ,(purecopy "Use separate control buffer frame")
ediff-toggle-multiframe
:help ,(purecopy "Switch between the single-frame presentation mode and the multi-frame mode")))
:help ,(purecopy "Switch between the single-frame presentation mode and the multi-frame mode")
:button (:toggle . (eq (bound-and-true-p ediff-window-setup-function)
#'ediff-setup-windows-multiframe))))
;; FIXME: Port XEmacs's toolbar support!
;; ["Use a toolbar with Ediff control buffer"
;; ediff-toggle-use-toolbar
;; :style toggle
;; :selected (if (featurep 'ediff-tbar)
;; (ediff-use-toolbar-p))]
(define-key menu-bar-ediff-misc-menu [eregistry]
`(menu-item ,(purecopy "List Ediff Sessions") ediff-show-registry
:help ,(purecopy "List all active Ediff sessions; it is a convenient way to find and resume such a session")))
......@@ -257,6 +262,4 @@
:help ,(purecopy "Bring up the Ediff manual"))))
(provide 'ediff-hook)
;;; ediff-hook.el ends here
;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff -*- lexical-binding: nil; -*-
;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff -*- lexical-binding:t -*-
;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
......@@ -86,7 +86,7 @@ that Ediff doesn't know about.")
;; Plagiarized from `emerge-defvar-local' for XEmacs.
(defmacro ediff-defvar-local (var value doc)
"Defines VAR as a local variable."
(declare (indent defun))
(declare (indent defun) (doc-string 3))
`(progn
(defvar ,var ,value ,doc)
(make-variable-buffer-local ',var)
......@@ -502,7 +502,7 @@ set local variables that determine how the display looks like."
;; Selective browsing
(ediff-defvar-local ediff-skip-diff-region-function 'ediff-show-all-diffs
(ediff-defvar-local ediff-skip-diff-region-function #'ediff-show-all-diffs
"Function that determines the next/previous diff region to show.
Should return t for regions to be ignored and nil otherwise.
This function gets a region number as an argument. The region number
......@@ -740,26 +740,6 @@ to temp files in buffer jobs and when Ediff needs to find fine differences."
(defalias 'ediff-delete-overlay
(if (featurep 'xemacs) 'delete-extent 'delete-overlay))
;; Assumes that emacs-major-version and emacs-minor-version are defined.
(defun ediff-check-version (op major minor &optional type-of-emacs)
"Check the current version against MAJOR and MINOR version numbers.
The comparison uses operator OP, which may be any of: =, >, >=, <, <=.
TYPE-OF-EMACS is either `emacs' or `xemacs'."
(declare (obsolete version< "23.1"))
(and (cond ((eq type-of-emacs 'xemacs) (featurep 'xemacs))
((eq type-of-emacs 'emacs) (featurep 'emacs))
(t))
(cond ((eq op '=) (and (= emacs-minor-version minor)
(= emacs-major-version major)))
((memq op '(> >= < <=))
(and (or (funcall op emacs-major-version major)
(= emacs-major-version major))
(if (= emacs-major-version major)
(funcall op emacs-minor-version minor)
t)))
(t
(user-error "%S: Invalid op in ediff-check-version" op)))))
(defun ediff-color-display-p ()
(condition-case nil
(if (featurep 'xemacs)
......@@ -1508,7 +1488,7 @@ This default should work without changes."
;; this record is itself a vector
(defsubst ediff-clear-fine-diff-vector (diff-record)
(if diff-record
(mapc 'ediff-delete-overlay
(mapc #'ediff-delete-overlay
(ediff-get-fine-diff-vector-from-diff-record diff-record))))
(defsubst ediff-clear-fine-differences-in-one-buffer (n buf-type)
......@@ -1779,7 +1759,7 @@ Unless optional argument INPLACE is non-nil, return a new string."
(defsubst ediff-message-if-verbose (string &rest args)
(if ediff-verbose-p
(apply 'message string args)))
(apply #'message string args)))
(defun ediff-file-attributes (filename attr-number)
(if (ediff-listable-file filename)
......@@ -1818,13 +1798,4 @@ Unless optional argument INPLACE is non-nil, return a new string."
(provide 'ediff-init)
;; Local Variables:
;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
;; End:
;;; ediff-init.el ends here
;;; ediff-merg.el --- merging utilities -*- lexical-binding: nil; -*-
;;; ediff-merg.el --- merging utilities -*- lexical-binding:t -*-
;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
......@@ -382,12 +382,4 @@ Combining is done according to the specifications in variable
(provide 'ediff-merg)
;; Local Variables:
;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
;; End:
;;; ediff-merg.el ends here
;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff -*- lexical-binding: nil; -*-
;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff -*- lexical-binding:t -*-
;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
......@@ -103,8 +103,6 @@
;;; Code:
(provide 'ediff-mult)
(defgroup ediff-mult nil
"Multi-file and multi-buffer processing in Ediff."
:prefix "ediff-"
......@@ -147,7 +145,20 @@ Useful commands (type ? to hide them and free up screen):
(ediff-defvar-local ediff-meta-buffer-map nil
"The keymap for the meta buffer.")
(defvar ediff-dir-diffs-buffer-map (make-sparse-keymap)
(defvar ediff-dir-diffs-buffer-map
(let ((map (make-sparse-keymap)))
(suppress-keymap map)
(define-key map "q" 'ediff-bury-dir-diffs-buffer)
(define-key map " " 'next-line)
(define-key map "n" 'next-line)
(define-key map "\C-?" 'previous-line)
(define-key map "p" 'previous-line)
(define-key map "C" 'ediff-dir-diff-copy-file)
(define-key map (if (featurep 'emacs) [mouse-2] [button2])
'ediff-dir-diff-copy-file)
(define-key map [delete] 'previous-line)
(define-key map [backspace] 'previous-line)
map)
"The keymap to be installed in the buffer showing differences between
directories.")
......@@ -175,8 +186,7 @@ directories.")
"The default regular expression used as a filename filter in multifile comparisons.
Should be a sexp. For instance (car ediff-filtering-regexp-history) or nil."
:type 'sexp ; yuck - why not just a regexp?
:risky t
:group 'ediff-mult)
:risky t)
;; This has the form ((meta-buf regexp dir1 dir2 dir3 merge-auto-store-dir)
;; (ctl-buf session-status (file1 . eq-status) (file2 . eq-status) (file3
......@@ -202,18 +212,15 @@ Should be a sexp. For instance (car ediff-filtering-regexp-history) or nil."
(defcustom ediff-meta-truncate-filenames t
"If non-nil, truncate long file names in the session group buffers.
This can be toggled with `ediff-toggle-filename-truncation'."
:type 'boolean
:group 'ediff-mult)
:type 'boolean)
(defcustom ediff-meta-mode-hook nil
"Hooks run just after setting up meta mode."
:type 'hook
:group 'ediff-mult)
:type 'hook)
(defcustom ediff-registry-setup-hook nil
"Hooks run just after the registry control panel is set up."
:type 'hook
:group 'ediff-mult)
:type 'hook)
(defcustom ediff-before-session-group-setup-hooks
nil ;FIXME: Bad name (should be -hook or -functions) and never run??
......@@ -226,27 +233,22 @@ on `ediff-quit', `ediff-suspend', or `ediff-quit-session-group-hook'."
(defcustom ediff-after-session-group-setup-hook nil
"Hooks run just after a meta-buffer controlling a session group, such as
ediff-directories, is run."
:type 'hook
:group 'ediff-mult)
:type 'hook)
(defcustom ediff-quit-session-group-hook nil
"Hooks run just before exiting a session group."
:type 'hook
:group 'ediff-mult)
:type 'hook)
(defcustom ediff-show-registry-hook nil
"Hooks run just after the registry buffer is shown."
:type 'hook
:group 'ediff-mult)
:type 'hook)
(defcustom ediff-show-session-group-hook '(delete-other-windows)
"Hooks run just after a session group buffer is shown."
:type 'hook
:group 'ediff-mult)
:type 'hook)
(defcustom ediff-meta-buffer-keymap-setup-hook nil
"Hooks run just after setting up the `ediff-meta-buffer-map'.
This keymap controls key bindings in the meta buffer and is a local variable.
This means that you can set different bindings for different kinds of meta
buffers."
:type 'hook
:group 'ediff-mult)
:type 'hook)
;; Buffer holding the multi-file patch. Local to the meta buffer
(ediff-defvar-local ediff-meta-patchbufer nil "")
......@@ -436,7 +438,7 @@ Toggled by ediff-toggle-verbose-help-meta-buffer" )
(run-hooks 'ediff-meta-buffer-keymap-setup-hook))
(defun ediff-meta-mode ()
(define-derived-mode ediff-meta-mode nil "MetaEdiff"
"This mode controls all operations on Ediff session groups.
It is entered through one of the following commands:
`ediff-directories'
......@@ -455,28 +457,7 @@ It is entered through one of the following commands:
`edir-merge-revisions-with-ancestor'
Commands:
\\{ediff-meta-buffer-map}"
;; FIXME: Use define-derived-mode.
(kill-all-local-variables)
(setq major-mode 'ediff-meta-mode)
(setq mode-name "MetaEdiff")
;; don't use run-mode-hooks here!
(run-hooks 'ediff-meta-mode-hook))
;; the keymap for the buffer showing directory differences
(suppress-keymap ediff-dir-diffs-buffer-map)
(define-key ediff-dir-diffs-buffer-map "q" 'ediff-bury-dir-diffs-buffer)
(define-key ediff-dir-diffs-buffer-map " " 'next-line)
(define-key ediff-dir-diffs-buffer-map "n" 'next-line)
(define-key ediff-dir-diffs-buffer-map "\C-?" 'previous-line)
(define-key ediff-dir-diffs-buffer-map "p" 'previous-line)
(define-key ediff-dir-diffs-buffer-map "C" 'ediff-dir-diff-copy-file)
(if (featurep 'emacs)
(define-key ediff-dir-diffs-buffer-map [mouse-2] 'ediff-dir-diff-copy-file)
(define-key ediff-dir-diffs-buffer-map [button2] 'ediff-dir-diff-copy-file))
(define-key ediff-dir-diffs-buffer-map [delete] 'previous-line)
(define-key ediff-dir-diffs-buffer-map [backspace] 'previous-line)
\\{ediff-meta-buffer-map}")
(defun ediff-next-meta-item (count)
"Move to the next item in Ediff registry or session group buffer.
......@@ -598,8 +579,7 @@ behavior."
(defun ediff-intersect-directories (jobname
regexp dir1 dir2
&optional
dir3 merge-autostore-dir comparison-func)
(setq comparison-func (or comparison-func 'string=))
dir3 merge-autostore-dir)
(let (lis1 lis2 lis3 common auxdir1 auxdir2 auxdir3 common-part difflist)
(setq auxdir1 (file-name-as-directory dir1)
......@@ -632,24 +612,24 @@ behavior."
(if (ediff-nonempty-string-p merge-autostore-dir)
(setq merge-autostore-dir
(file-name-as-directory merge-autostore-dir)))
(setq common (ediff-intersection lis1 lis2 comparison-func))
(setq common (ediff-intersection lis1 lis2 #'string=))
;; In merge with ancestor jobs, we don't intersect with lis3.
;; If there is no ancestor, we'll offer to merge without the ancestor.
;; So, we intersect with lis3 only when we are doing 3-way file comparison
(if (and lis3 (ediff-comparison-metajob3 jobname))
(setq common (ediff-intersection common lis3 comparison-func)))
(setq common (ediff-intersection common lis3 #'string=)))
;; copying is needed because sort sorts via side effects
(setq common (sort (ediff-copy-list common) 'string-lessp))
;; compute difference list
(setq difflist (ediff-set-difference
(ediff-union (ediff-union lis1 lis2 comparison-func)
(ediff-union (ediff-union lis1 lis2 #'string=)
lis3
comparison-func)
#'string=)
common
comparison-func)
#'string=)
difflist (delete "." difflist)
;; copying is needed because sort sorts via side effects
difflist (sort (ediff-copy-list (delete ".." difflist))
......@@ -679,7 +659,7 @@ behavior."
(ediff-make-new-meta-list-header regexp
auxdir1 auxdir2 auxdir3
merge-autostore-dir
comparison-func)
#'string=)
difflist))
(setq common-part
......@@ -688,7 +668,7 @@ behavior."
(ediff-make-new-meta-list-header regexp
auxdir1 auxdir2 auxdir3
merge-autostore-dir
comparison-func)
#'string=)
(mapcar
(lambda (elt)
(ediff-make-new-meta-list-element
......@@ -767,9 +747,9 @@ behavior."
;; If file groups selected by patterns will ever be implemented, this
;; comparison function might become useful.
;;;; uses external variables PAT1 PAT2 to compare str1/2
;;;; patterns must be of the form ???*???? where ??? are strings of chars
;;;; containing no *.
;; ;; uses external variables PAT1 PAT2 to compare str1/2
;; ;; patterns must be of the form ???*???? where ??? are strings of chars
;; ;; containing no *.
;;(defun ediff-pattern= (str1 str2)
;; (let (pos11 pos12 pos21 pos22 len1 len2)
;; (setq pos11 0
......@@ -799,7 +779,7 @@ behavior."
;; redraw-function. Must return the created meta-buffer.
(defun ediff-prepare-meta-buffer (action-func meta-list
meta-buffer-name redraw-function
jobname &optional _startup-hooks)
jobname &optional startup-hooks)
(let* ((meta-buffer-name
(ediff-unique-buffer-name meta-buffer-name "*"))
(meta-buffer (get-buffer-create meta-buffer-name)))
......@@ -841,7 +821,7 @@ behavior."
(setq buffer-read-only t)
(set-buffer-modified-p nil)
(run-hooks 'startup-hooks)
(mapc #'funcall startup-hooks)
;; Arrange to show directory contents differences
;; Must be after run startup-hooks, since ediff-dir-difference-list is
......@@ -1009,7 +989,7 @@ behavior."
;; was redrawn
(if (featurep 'xemacs)
(map-extents 'delete-extent)
(mapc 'delete-overlay (overlays-in 1 1)))
(mapc #'delete-overlay (overlays-in 1 1)))
(setq regexp (ediff-get-group-regexp meta-list)
merge-autostore-dir
......@@ -1455,7 +1435,7 @@ Useful commands:
;; was redrawn
(if (featurep 'xemacs)
(map-extents 'delete-extent)
(mapc 'delete-overlay (overlays-in 1 1)))
(mapc #'delete-overlay (overlays-in 1 1)))
(insert (substitute-command-keys "\
This is a registry of all active Ediff sessions.
......@@ -1757,7 +1737,7 @@ all marked sessions must be active."