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
This diff is collapsed.
;;; ediff-ptch.el --- Ediff's patch support -*- lexical-binding: nil; -*-
;;; ediff-ptch.el --- Ediff's patch support -*- lexical-binding:t -*-
;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
......@@ -27,7 +27,6 @@
(require 'diff-mode) ; For `diff-file-junk-re'.
(provide 'ediff-ptch)
(defgroup ediff-ptch nil
"Ediff patch support."
......@@ -37,12 +36,12 @@
(require 'ediff-init)
(require 'ediff-util)
(require 'ediff)
(defcustom ediff-patch-program "patch"
"Name of the program that applies patches.
It is recommended to use GNU-compatible versions."
:type 'string
:group 'ediff-ptch)
:type 'string)
(defcustom ediff-patch-options "-f"
"Options to pass to ediff-patch-program.
......@@ -51,8 +50,7 @@ Note: the `-b' option should be specified in `ediff-backup-specs'.
It is recommended to pass the `-f' option to the patch program, so it won't ask
questions. However, some implementations don't accept this option, in which
case the default value for this variable should be changed."
:type 'string
:group 'ediff-ptch)
:type 'string)
(defvar ediff-last-dir-patch nil
"Last directory used by an Ediff command for file to patch.")
......@@ -66,8 +64,7 @@ case the default value for this variable should be changed."
(defcustom ediff-backup-extension ediff-default-backup-extension
"Backup extension used by the patch program.
See also `ediff-backup-specs'."
:type 'string
:group 'ediff-ptch)
:type 'string)
(defun ediff-test-patch-utility ()
(condition-case nil
......@@ -110,14 +107,12 @@ still be set so Ediff will know which extension to use.
Ediff tries to guess the appropriate value for this variables. It is believed
to be working for `traditional' patch, all versions of GNU patch, and for POSIX
patch. So, don't change these variables, unless the default doesn't work."
:type 'string
:group 'ediff-ptch)
:type 'string)
(defcustom ediff-patch-default-directory nil
"Default directory to look for patches."
:type '(choice (const nil) string)
:group 'ediff-ptch)
:type '(choice (const nil) string))
;; This context diff does not recognize spaces inside files, but removing ' '
;; from [^ \t] breaks normal patches for some reason
......@@ -131,8 +126,7 @@ patch. So, don't change these variables, unless the default doesn't work."
"Regexp matching filename 2-liners at the start of each context diff.
You probably don't want to change that, unless you are using an obscure patch
program."
:type 'regexp
:group 'ediff-ptch)
:type 'regexp)
;; The buffer of the patch file. Local to control buffer.
(ediff-defvar-local ediff-patchbufer nil "")
......@@ -687,7 +681,8 @@ optional argument, then use it."
;; encoding that Emacs thinks is right for that type of text
(coding-system-for-write
(if (boundp 'buffer-file-coding-system) buffer-file-coding-system))
target-buf buf-to-patch file-name-magic-p
(ediff--startup-hook startup-hooks)
target-buf buf-to-patch magic-file-name
patch-return-code ctl-buf backup-style aux-wind)
(if (string-match-p "V" ediff-patch-options)
......@@ -698,15 +693,14 @@ optional argument, then use it."
;; it is handled via auto-mode-alist and similar magic).
;; Check if there is a buffer visiting source-filename and if they are in
;; sync; arrange for the deletion of temp file.
(ediff-find-file 'true-source-filename 'buf-to-patch
'ediff-last-dir-patch 'startup-hooks)
(setq buf-to-patch (ediff-find-file true-source-filename
'ediff-last-dir-patch))
(setq startup-hooks ediff--startup-hook)
;; Check if source file name has triggered black magic, such as file name
;; handlers or auto mode alist, and make a note of it.
;; true-source-filename should be either the original name or a
;; temporary file where we put the after-product of the file name handler.
(setq file-name-magic-p (not (equal (file-truename true-source-filename)
(file-truename source-filename))))
(setq magic-file-name
(with-current-buffer buf-to-patch ediff--magic-file-name))
;; Checkout orig file, if necessary, so that the patched file
;; could be checked back in.
......@@ -730,7 +724,7 @@ optional argument, then use it."
ediff-patch-program
ediff-patch-options
ediff-backup-specs
(expand-file-name true-source-filename))
(ediff--buffer-file-name buf-to-patch))
))
;; restore environment for gnu patch
......@@ -744,7 +738,8 @@ optional argument, then use it."
(or (and (ediff-patch-return-code-ok patch-return-code)
(file-exists-p
(concat true-source-filename ediff-backup-extension)))
(concat (ediff--buffer-file-name buf-to-patch)
ediff-backup-extension)))
(progn
(with-output-to-temp-buffer ediff-msg-buffer
(ediff-with-current-buffer standard-output
......@@ -789,7 +784,7 @@ you can still examine the changes via M-x ediff-files"
;; Without magic, the original file is renamed (usually into
;; old-name_orig) and the result of patching will have the same name as
;; the original.
(if (not file-name-magic-p)
(if (not magic-file-name)
(ediff-with-current-buffer buf-to-patch
(set-visited-file-name
(concat source-filename ediff-backup-extension))
......@@ -802,19 +797,19 @@ you can still examine the changes via M-x ediff-files"
(setq target-filename
(concat
(if (ediff-file-remote-p (file-truename source-filename))
true-source-filename
magic-file-name
source-filename)
"_patched"))
(rename-file true-source-filename target-filename t)
(rename-file magic-file-name target-filename t)
;; arrange that the temp copy of orig will be deleted
(rename-file (concat true-source-filename ediff-backup-extension)
true-source-filename t))
(rename-file (concat magic-file-name
ediff-backup-extension)
magic-file-name t))
;; make orig buffer read-only
(setq startup-hooks
(cons 'ediff-set-read-only-in-buf-A startup-hooks))
(push #'ediff-set-read-only-in-buf-A startup-hooks)
;; set up a buf for the patched file
(setq target-buf (find-file-noselect target-filename))
......@@ -833,17 +828,16 @@ you can still examine the changes via M-x ediff-files"
(defun ediff-multi-patch-internal (patch-buf &optional startup-hooks)
(let (meta-buf)
(setq startup-hooks
;; this sets various vars in the meta buffer inside
;; ediff-prepare-meta-buffer
(cons (lambda ()
;; tell what to do if the user clicks on a session record
(setq ediff-session-action-function
'ediff-patch-file-form-meta
ediff-meta-patchbufer patch-buf) )
startup-hooks))
;; this sets various vars in the meta buffer inside
;; ediff-prepare-meta-buffer
(push (lambda ()
;; tell what to do if the user clicks on a session record
(setq ediff-session-action-function
'ediff-patch-file-form-meta
ediff-meta-patchbufer patch-buf) )
startup-hooks)
(setq meta-buf (ediff-prepare-meta-buffer
'ediff-filegroup-action
#'ediff-filegroup-action
(ediff-with-current-buffer patch-buf
(cons (ediff-make-new-meta-list-header
nil ; regexp
......@@ -854,19 +848,11 @@ you can still examine the changes via M-x ediff-files"
)
ediff-patch-map))
"*Ediff Session Group Panel"
'ediff-redraw-directory-group-buffer
#'ediff-redraw-directory-group-buffer
'ediff-multifile-patch
startup-hooks))
(ediff-show-meta-buffer meta-buf)
))
;; 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-ptch)
;;; ediff-ptch.el ends here
......@@ -25,7 +25,7 @@
;;; Code:
(provide 'ediff-util)
(provide 'ediff-util) ;FIXME: Break cyclic dependencies and move to the end!
;; Compiler pacifier
(defvar ediff-use-toolbar-p)
......@@ -390,8 +390,8 @@ to invocation.")
;; parameters are processed.
(setq ediff-setup-diff-regions-function
(if ediff-diff3-job
'ediff-setup-diff-regions3
'ediff-setup-diff-regions))
#'ediff-setup-diff-regions3
#'ediff-setup-diff-regions))
(setq ediff-wide-bounds
(list (ediff-make-bullet-proof-overlay
......@@ -885,8 +885,8 @@ Does nothing if file-A and file-B are in different frames."
(eq frame-A frame-C) (eq frame-B frame-C))))
(setq ediff-split-window-function
(if (eq ediff-split-window-function 'split-window-vertically)
'split-window-horizontally
'split-window-vertically))
#'split-window-horizontally
#'split-window-vertically))
(message "Buffers being compared are in different frames"))
(ediff-recenter 'no-rehighlight)))
......@@ -1300,25 +1300,25 @@ which see."
(user-error "%sEmacs is not running as a window application"
(if (featurep 'emacs) "" "X")))
(cond ((eq ediff-window-setup-function 'ediff-setup-windows-multiframe)
(cond ((eq ediff-window-setup-function #'ediff-setup-windows-multiframe)
(setq ediff-multiframe nil)
(setq window-setup-func 'ediff-setup-windows-plain)
(setq window-setup-func #'ediff-setup-windows-plain)
(message "ediff is now in 'plain' mode"))
((eq ediff-window-setup-function 'ediff-setup-windows-plain)
((eq ediff-window-setup-function #'ediff-setup-windows-plain)
(if (ediff-in-control-buffer-p)
(ediff-kill-bottom-toolbar))
(if (and (ediff-buffer-live-p ediff-control-buffer)
(window-live-p ediff-control-window))
(set-window-dedicated-p ediff-control-window nil))
(setq ediff-multiframe t)
(setq window-setup-func 'ediff-setup-windows-multiframe)
(setq window-setup-func #'ediff-setup-windows-multiframe)
(message "ediff is now in 'multiframe' mode"))
(t
(if (and (ediff-buffer-live-p ediff-control-buffer)
(window-live-p ediff-control-window))
(set-window-dedicated-p ediff-control-window nil))
(setq ediff-multiframe t)
(setq window-setup-func 'ediff-setup-windows-multiframe))
(setq window-setup-func #'ediff-setup-windows-multiframe))
(message "ediff is now in 'multiframe' mode"))
;; change default
......@@ -1340,6 +1340,7 @@ which see."
Works only in versions of Emacs that support toolbars.
To change the default, set the variable `ediff-use-toolbar-p', which see."
(interactive)
;; FIXME: Make it work in Emacs!
(if (featurep 'ediff-tbar)
(progn
(or (ediff-window-display-p)
......@@ -1544,8 +1545,8 @@ the one half of the height of window-A."
(ediff-operate-on-windows
(if (memq (ediff-last-command-char) '(?v ?\C-v))
'scroll-up
'scroll-down)
#'scroll-up
#'scroll-down)
;; calculate argument to scroll-up/down
;; if there is an explicit argument
(if (and arg (not (equal arg '-)))
......@@ -1601,10 +1602,10 @@ the width of the A/B/C windows."
(if (= (ediff-last-command-char) ?<)
(lambda (arg)
(let ((prefix-arg arg))
(call-interactively 'scroll-left)))
(call-interactively #'scroll-left)))