* 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.
This commit is contained in:
parent
d63bfbcae4
commit
869cf5cbc0
11 changed files with 306 additions and 457 deletions
|
@ -1,4 +1,4 @@
|
|||
;;; 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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;;; 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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;;; 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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;;; 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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;;; 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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;;; 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."
|
|||
(ediff-with-current-buffer ediff-meta-diff-buffer
|
||||
(setq buffer-read-only nil)
|
||||
(erase-buffer))
|
||||
(if (> (ediff-operate-on-marked-sessions 'ediff-append-custom-diff) 0)
|
||||
(if (> (ediff-operate-on-marked-sessions #'ediff-append-custom-diff) 0)
|
||||
;; did something
|
||||
(progn
|
||||
(display-buffer ediff-meta-diff-buffer 'not-this-window)
|
||||
|
@ -1812,7 +1792,7 @@ all marked sessions must be active."
|
|||
(info (ediff-get-meta-info meta-buf pos))
|
||||
(session-buf (ediff-get-session-buffer info))
|
||||
(session-number (ediff-get-session-number-at-pos pos meta-buf))
|
||||
(default-regexp (eval ediff-default-filtering-regexp))
|
||||
(default-regexp (eval ediff-default-filtering-regexp t))
|
||||
merge-autostore-dir file1 file2 file3 regexp)
|
||||
|
||||
(setq file1 (ediff-get-session-objA-name info)
|
||||
|
@ -1850,7 +1830,7 @@ all marked sessions must be active."
|
|||
"Filter filenames through regular expression: ")
|
||||
nil
|
||||
'ediff-filtering-regexp-history
|
||||
(eval ediff-default-filtering-regexp)))
|
||||
(eval ediff-default-filtering-regexp t)))
|
||||
(ediff-directories-internal
|
||||
file1 file2 file3 regexp
|
||||
ediff-session-action-function
|
||||
|
@ -2198,10 +2178,10 @@ all marked sessions must be active."
|
|||
(if (ediff-buffer-live-p ediff-registry-buffer)
|
||||
(ediff-redraw-registry-buffer)
|
||||
(ediff-prepare-meta-buffer
|
||||
'ediff-registry-action
|
||||
#'ediff-registry-action
|
||||
ediff-session-registry
|
||||
"*Ediff Registry"
|
||||
'ediff-redraw-registry-buffer
|
||||
#'ediff-redraw-registry-buffer
|
||||
'ediff-registry))
|
||||
))
|
||||
|
||||
|
@ -2474,12 +2454,5 @@ for operation, or simply indicate which are equal files. If it is nil, then
|
|||
))
|
||||
))
|
||||
|
||||
|
||||
|
||||
;; 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-mult)
|
||||
;;; ediff-mult.el ends here
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;;; 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)))
|
||||
(lambda (arg)
|
||||
(let ((prefix-arg arg))
|
||||
(call-interactively 'scroll-right))))
|
||||
(call-interactively #'scroll-right))))
|
||||
;; calculate argument to scroll-left/right
|
||||
;; if there is an explicit argument
|
||||
(if (and arg (not (equal arg '-)))
|
||||
|
@ -1718,9 +1719,9 @@ the width of the A/B/C windows."
|
|||
(ediff-with-current-buffer (or ctl-buf ediff-control-buffer)
|
||||
(if (ediff-valid-difference-p n)
|
||||
(let* ((func (cond ((eq op 'scroll-down)
|
||||
'ediff-get-lines-to-region-start)
|
||||
#'ediff-get-lines-to-region-start)
|
||||
((eq op 'scroll-up)
|
||||
'ediff-get-lines-to-region-end)
|
||||
#'ediff-get-lines-to-region-end)
|
||||
(t (lambda (_a _b _c) 0))))
|
||||
(max-lines (max (funcall func 'A n ctl-buf)
|
||||
(funcall func 'B n ctl-buf)
|
||||
|
@ -2077,7 +2078,7 @@ ARG is a prefix argument. If nil, copy the current difference region."
|
|||
(ediff-save-diff-region n to-buf-type reg-to-delete))))
|
||||
(error (message "ediff-copy-diff: %s %s"
|
||||
(car conds)
|
||||
(mapconcat 'prin1-to-string (cdr conds) " "))
|
||||
(mapconcat #'prin1-to-string (cdr conds) " "))
|
||||
(beep 1)
|
||||
(sit-for 2) ; let the user see the error msg
|
||||
(setq saved-p nil)
|
||||
|
@ -2178,7 +2179,7 @@ ARG is a prefix argument. If nil, copy the current difference region."
|
|||
))
|
||||
(error (message "ediff-pop-diff: %s %s"
|
||||
(car conds)
|
||||
(mapconcat 'prin1-to-string (cdr conds) " "))
|
||||
(mapconcat #'prin1-to-string (cdr conds) " "))
|
||||
(beep 1)))
|
||||
|
||||
;; Clearing fine diffs is necessary for
|
||||
|
@ -2241,7 +2242,7 @@ a regular expression typed in by the user."
|
|||
ediff-hide-regexp-matches-function)
|
||||
(eq (ediff-last-command-char) ?h)))
|
||||
(message "Selective browsing by regexp turned off")
|
||||
(setq ediff-skip-diff-region-function 'ediff-show-all-diffs))
|
||||
(setq ediff-skip-diff-region-function #'ediff-show-all-diffs))
|
||||
((eq (ediff-last-command-char) ?h)
|
||||
(setq ediff-skip-diff-region-function ediff-hide-regexp-matches-function
|
||||
regexp-A
|
||||
|
@ -2929,7 +2930,7 @@ Hit \\[ediff-recenter] to reset the windows afterward."
|
|||
(princ
|
||||
"\nSkipping merge regions that differ from default setting"))
|
||||
|
||||
(cond ((eq ediff-skip-diff-region-function 'ediff-show-all-diffs)
|
||||
(cond ((eq ediff-skip-diff-region-function #'ediff-show-all-diffs)
|
||||
(princ "\nSelective browsing by regexp is off\n"))
|
||||
((eq ediff-skip-diff-region-function
|
||||
ediff-hide-regexp-matches-function)
|
||||
|
@ -3314,7 +3315,7 @@ Hit \\[ediff-recenter] to reset the windows afterward."
|
|||
(buffer-name)
|
||||
buffer-file-name))
|
||||
(progn
|
||||
(if file-magic
|
||||
(if file-magic ;FIXME: Why?
|
||||
(erase-buffer))
|
||||
(revert-buffer t t))
|
||||
(user-error "Buffer out of sync for file %s" buffer-file-name))))
|
||||
|
@ -3573,12 +3574,12 @@ Ediff Control Panel to restore highlighting."
|
|||
(t (beep 1)
|
||||
(message
|
||||
"Valid values are %s"
|
||||
(mapconcat 'char-to-string possibilities " or "))
|
||||
(mapconcat #'char-to-string possibilities " or "))
|
||||
(sit-for 2)
|
||||
t))
|
||||
(let ((cursor-in-echo-area t))
|
||||
(message "Enter the 1st buffer you want to compare (%s): "
|
||||
(mapconcat 'char-to-string possibilities " or "))
|
||||
(mapconcat #'char-to-string possibilities " or "))
|
||||
(setq answer (capitalize (read-char-exclusive)))))
|
||||
(setq answer "") ; silence error msg
|
||||
(while (cond ((memq answer possibilities)
|
||||
|
@ -3592,12 +3593,12 @@ Ediff Control Panel to restore highlighting."
|
|||
(t (beep 1)
|
||||
(message
|
||||
"Valid values are %s"
|
||||
(mapconcat 'char-to-string possibilities " or "))
|
||||
(mapconcat #'char-to-string possibilities " or "))
|
||||
(sit-for 2)
|
||||
t))
|
||||
(let ((cursor-in-echo-area t))
|
||||
(message "Enter the 2nd buffer you want to compare (%s): "
|
||||
(mapconcat 'char-to-string possibilities "/"))
|
||||
(mapconcat #'char-to-string possibilities "/"))
|
||||
(setq answer (capitalize (read-char-exclusive))))))
|
||||
(t ; 2way comparison
|
||||
(setq bufA ediff-buffer-A
|
||||
|
@ -4110,27 +4111,12 @@ Mail anyway? (y or n) ")
|
|||
(if (featurep 'xemacs)
|
||||
(zmacs-activate-region)
|
||||
(make-local-variable 'transient-mark-mode)
|
||||
(setq mark-active t transient-mark-mode t)))
|
||||
(setq mark-active 'ediff-util transient-mark-mode t)))
|
||||
|
||||
(defun ediff-nuke-selective-display ()
|
||||
(if (featurep 'xemacs)
|
||||
(nuke-selective-display)
|
||||
(save-excursion
|
||||
(save-restriction
|
||||
(widen)
|
||||
(goto-char (point-min))
|
||||
(let ((mod-p (buffer-modified-p))
|
||||
buffer-read-only end)
|
||||
(and (eq t selective-display)
|
||||
(while (search-forward "\^M" nil t)
|
||||
(end-of-line)
|
||||
(setq end (point))
|
||||
(beginning-of-line)
|
||||
(while (search-forward "\^M" end t)
|
||||
(delete-char -1)
|
||||
(insert "\^J"))))
|
||||
(set-buffer-modified-p mod-p)
|
||||
(setq selective-display nil))))))
|
||||
))
|
||||
|
||||
|
||||
;; The next two are modified versions from emerge.el.
|
||||
|
@ -4244,7 +4230,7 @@ Mail anyway? (y or n) ")
|
|||
;; fine-diff-vector
|
||||
(if (= (length (aref overl-vec 1)) 0)
|
||||
"none\n"
|
||||
(mapconcat 'prin1-to-string
|
||||
(mapconcat #'prin1-to-string
|
||||
(aref overl-vec 1) "\n\t\t\t "))
|
||||
(aref overl-vec 2) ; no fine diff flag
|
||||
(aref overl-vec 3) ; state-of-diff
|
||||
|
@ -4320,10 +4306,7 @@ Mail anyway? (y or n) ")
|
|||
(setq lis1 (cdr lis1)))
|
||||
(cdr result)))
|
||||
|
||||
(defun ediff-add-to-history (history-var newelt)
|
||||
(if (fboundp 'add-to-history)
|
||||
(add-to-history history-var newelt)
|
||||
(set history-var (cons newelt (symbol-value history-var)))))
|
||||
(define-obsolete-function-alias 'ediff-add-to-history #'add-to-history "27.1")
|
||||
|
||||
(defalias 'ediff-copy-list 'copy-sequence)
|
||||
|
||||
|
@ -4333,11 +4316,4 @@ Mail anyway? (y or n) ")
|
|||
|
||||
(run-hooks 'ediff-load-hook)
|
||||
|
||||
|
||||
;; 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-util.el ends here
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;;; ediff-vers.el --- version control interface to Ediff -*- lexical-binding: nil; -*-
|
||||
;;; ediff-vers.el --- version control interface to Ediff -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 1995-1997, 2001-2019 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -96,11 +96,10 @@ comparison or merge operations are being performed."
|
|||
(ediff-vc-revision-other-window rev2))
|
||||
(setq rev2buf (current-buffer)
|
||||
file2 (buffer-file-name)))
|
||||
(setq startup-hooks
|
||||
(cons `(lambda ()
|
||||
(ediff-delete-version-file ,file1)
|
||||
(or ,(string= rev2 "") (ediff-delete-version-file ,file2)))
|
||||
startup-hooks)))
|
||||
(push (lambda ()
|
||||
(ediff-delete-version-file file1)
|
||||
(or (string= rev2 "") (ediff-delete-version-file file2)))
|
||||
startup-hooks))
|
||||
(ediff-buffers
|
||||
rev1buf rev2buf
|
||||
startup-hooks
|
||||
|
@ -124,7 +123,7 @@ comparison or merge operations are being performed."
|
|||
(let ((output-buffer (ediff-rcs-get-output-buffer filename buff)))
|
||||
(delete-windows-on output-buffer)
|
||||
(with-current-buffer output-buffer
|
||||
(apply 'call-process "co" nil t nil
|
||||
(apply #'call-process "co" nil t nil
|
||||
;; -q: quiet (no diagnostics)
|
||||
(append switches rcs-default-co-switches
|
||||
(list "-q" filename)))))
|
||||
|
@ -175,20 +174,20 @@ comparison or merge operations are being performed."
|
|||
(if ancestor-rev
|
||||
(save-excursion
|
||||
(if (string= ancestor-rev "")
|
||||
(setq ancestor-rev (ediff-vc-working-revision buffer-file-name)))
|
||||
(setq ancestor-rev (ediff-vc-working-revision
|
||||
buffer-file-name)))
|
||||
(ediff-vc-revision-other-window ancestor-rev)
|
||||
(setq ancestor-buf (current-buffer))))
|
||||
(setq startup-hooks
|
||||
(cons
|
||||
`(lambda ()
|
||||
(ediff-delete-version-file ,(buffer-file-name buf1))
|
||||
(or ,(string= rev2 "")
|
||||
(ediff-delete-version-file ,(buffer-file-name buf2)))
|
||||
(or ,(string= ancestor-rev "")
|
||||
,(not ancestor-rev)
|
||||
(ediff-delete-version-file ,(buffer-file-name ancestor-buf)))
|
||||
)
|
||||
startup-hooks)))
|
||||
(push (let ((f1 (buffer-file-name buf1))
|
||||
(f2 (unless (string= rev2 "") (buffer-file-name buf2)))
|
||||
(fa (unless (or (string= ancestor-rev "")
|
||||
(not ancestor-rev))
|
||||
(buffer-file-name ancestor-buf))))
|
||||
(lambda ()
|
||||
(ediff-delete-version-file f1)
|
||||
(if f2 (ediff-delete-version-file f2))
|
||||
(if fa (ediff-delete-version-file fa))))
|
||||
startup-hooks))
|
||||
(if ancestor-rev
|
||||
(ediff-merge-buffers-with-ancestor
|
||||
buf1 buf2 ancestor-buf
|
||||
|
@ -227,12 +226,4 @@ comparison or merge operations are being performed."
|
|||
|
||||
|
||||
(provide 'ediff-vers)
|
||||
|
||||
|
||||
;; 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-vers.el ends here
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;;; ediff-wind.el --- window manipulation utilities -*- lexical-binding: nil; -*-
|
||||
;;; ediff-wind.el --- window manipulation utilities -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 1994-1997, 2000-2019 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -94,7 +94,6 @@ provided functions are written."
|
|||
(const :tag "Multi Frame" ediff-setup-windows-multiframe)
|
||||
(const :tag "Single Frame" ediff-setup-windows-plain)
|
||||
(function :tag "Other function"))
|
||||
:group 'ediff-window
|
||||
:version "24.3")
|
||||
|
||||
;; indicates if we are in a multiframe setup
|
||||
|
@ -138,8 +137,7 @@ In this case, Ediff will use those frames to display these buffers."
|
|||
:type '(choice
|
||||
(const :tag "Split vertically" split-window-vertically)
|
||||
(const :tag "Split horizontally" split-window-horizontally)
|
||||
function)
|
||||
:group 'ediff-window)
|
||||
function))
|
||||
|
||||
(defcustom ediff-merge-split-window-function #'split-window-horizontally
|
||||
"The function used to split the main window between buffer-A and buffer-B.
|
||||
|
@ -151,8 +149,7 @@ In this case, Ediff will use those frames to display these buffers."
|
|||
:type '(choice
|
||||
(const :tag "Split vertically" split-window-vertically)
|
||||
(const :tag "Split horizontally" split-window-horizontally)
|
||||
function)
|
||||
:group 'ediff-window)
|
||||
function))
|
||||
|
||||
;; Definitions hidden from the compiler by compat wrappers.
|
||||
(declare-function ediff-display-pixel-width "ediff-init")
|
||||
|
@ -205,16 +202,14 @@ Used internally---not a user option.")
|
|||
If `maybe', Ediff will do it sometimes, but not after operations that require
|
||||
relatively long time. If nil, the mouse will be entirely user's
|
||||
responsibility."
|
||||
:type 'boolean
|
||||
:group 'ediff-window)
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom ediff-control-frame-position-function #'ediff-make-frame-position
|
||||
"Function to call to determine the desired location for the control panel.
|
||||
Expects three parameters: the control buffer, the desired width and height
|
||||
of the control frame. It returns an association list
|
||||
of the form \((top . <position>) \(left . <position>))"
|
||||
:type 'function
|
||||
:group 'ediff-window)
|
||||
:type 'function)
|
||||
|
||||
(defcustom ediff-control-frame-upward-shift 42
|
||||
"The upward shift of control frame from the top of buffer A's frame.
|
||||
|
@ -222,8 +217,7 @@ Measured in pixels.
|
|||
This is used by the default control frame positioning function,
|
||||
`ediff-make-frame-position'. This variable is provided for easy
|
||||
customization of the default control frame positioning."
|
||||
:type 'integer
|
||||
:group 'ediff-window)
|
||||
:type 'integer)
|
||||
|
||||
(defcustom ediff-narrow-control-frame-leftward-shift (if (featurep 'xemacs) 7 3)
|
||||
"The leftward shift of control frame from the right edge of buf A's frame.
|
||||
|
@ -232,8 +226,7 @@ This is used by the default control frame positioning function,
|
|||
`ediff-make-frame-position' to adjust the position of the control frame
|
||||
when it shows the short menu. This variable is provided for easy
|
||||
customization of the default."
|
||||
:type 'integer
|
||||
:group 'ediff-window)
|
||||
:type 'integer)
|
||||
|
||||
(defcustom ediff-wide-control-frame-rightward-shift 7
|
||||
"The rightward shift of control frame from the left edge of buf A's frame.
|
||||
|
@ -242,8 +235,7 @@ This is used by the default control frame positioning function,
|
|||
`ediff-make-frame-position' to adjust the position of the control frame
|
||||
when it shows the full menu. This variable is provided for easy
|
||||
customization of the default."
|
||||
:type 'integer
|
||||
:group 'ediff-window)
|
||||
:type 'integer)
|
||||
|
||||
|
||||
;; Wide frame display
|
||||
|
@ -276,8 +268,7 @@ This is only useful in Emacs and only for certain kinds of window managers,
|
|||
such as TWM and its derivatives, since the window manager must permit
|
||||
keyboard input to go into icons. XEmacs completely ignores keyboard input
|
||||
into icons, regardless of the window manager."
|
||||
:type 'boolean
|
||||
:group 'ediff-window)
|
||||
:type 'boolean)
|
||||
|
||||
;;; Functions
|
||||
|
||||
|
@ -342,8 +333,8 @@ into icons, regardless of the window manager."
|
|||
|
||||
(defun ediff-setup-windows-default (buffer-A buffer-B buffer-C control-buffer)
|
||||
(funcall (if (display-graphic-p)
|
||||
'ediff-setup-windows-multiframe
|
||||
'ediff-setup-windows-plain)
|
||||
#'ediff-setup-windows-multiframe
|
||||
#'ediff-setup-windows-plain)
|
||||
buffer-A buffer-B buffer-C control-buffer))
|
||||
|
||||
;; Just set up 3 windows.
|
||||
|
@ -524,7 +515,7 @@ into icons, regardless of the window manager."
|
|||
|
||||
;; Skip dedicated or iconified frames.
|
||||
;; Unsplittable frames are taken care of later.
|
||||
(ediff-skip-unsuitable-frames 'ok-unsplittable)
|
||||
;; (ediff-skip-unsuitable-frames 'ok-unsplittable)
|
||||
|
||||
(let* ((window-min-height 1)
|
||||
(wind-A (ediff-get-visible-buffer-window buf-A))
|
||||
|
|
200
lisp/vc/ediff.el
200
lisp/vc/ediff.el
|
@ -1,4 +1,4 @@
|
|||
;;; ediff.el --- a comprehensive visual interface to diff & patch -*- lexical-binding: nil; -*-
|
||||
;;; ediff.el --- a comprehensive visual interface to diff & patch -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -107,8 +107,6 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(provide 'ediff)
|
||||
|
||||
(require 'ediff-util)
|
||||
;; end pacifier
|
||||
|
||||
|
@ -123,8 +121,7 @@
|
|||
|
||||
(defcustom ediff-use-last-dir nil
|
||||
"If t, Ediff will use previous directory as default when reading file name."
|
||||
:type 'boolean
|
||||
:group 'ediff)
|
||||
:type 'boolean)
|
||||
|
||||
;; Last directory used by an Ediff command for file-A.
|
||||
(defvar ediff-last-dir-A nil)
|
||||
|
@ -197,7 +194,7 @@ arguments after setting up the Ediff buffers."
|
|||
ediff-last-dir-B
|
||||
(file-name-directory f)))
|
||||
(progn
|
||||
(ediff-add-to-history
|
||||
(add-to-history
|
||||
'file-name-history
|
||||
(ediff-abbreviate-file-name
|
||||
(expand-file-name
|
||||
|
@ -235,7 +232,7 @@ arguments after setting up the Ediff buffers."
|
|||
ediff-last-dir-B
|
||||
(file-name-directory f)))
|
||||
(progn
|
||||
(ediff-add-to-history
|
||||
(add-to-history
|
||||
'file-name-history
|
||||
(ediff-abbreviate-file-name
|
||||
(expand-file-name
|
||||
|
@ -247,7 +244,7 @@ arguments after setting up the Ediff buffers."
|
|||
ediff-last-dir-C
|
||||
(file-name-directory ff)))
|
||||
(progn
|
||||
(ediff-add-to-history
|
||||
(add-to-history
|
||||
'file-name-history
|
||||
(ediff-abbreviate-file-name
|
||||
(expand-file-name
|
||||
|
@ -270,20 +267,24 @@ arguments after setting up the Ediff buffers."
|
|||
;;;###autoload
|
||||
(defalias 'ediff3 'ediff-files3)
|
||||
|
||||
(defvar-local ediff--magic-file-name nil
|
||||
"Name of file where buffer's content was saved.
|
||||
Only non-nil in \"magic\" buffers such as those of remote files.")
|
||||
|
||||
(defun ediff-find-file (file-var buffer-name &optional last-dir hooks-var)
|
||||
(defvar ediff--startup-hook nil)
|
||||
|
||||
(defun ediff-find-file (file &optional last-dir)
|
||||
"Visit FILE and arrange its buffer to Ediff's liking.
|
||||
FILE-VAR is actually a variable symbol whose value must contain a true
|
||||
file name.
|
||||
BUFFER-NAME is a variable symbol, which will get the buffer object into
|
||||
which FILE is read.
|
||||
FILE is the file name.
|
||||
LAST-DIR is the directory variable symbol where FILE's
|
||||
directory name should be returned. HOOKS-VAR is a variable symbol that will
|
||||
be assigned the hook to be executed after `ediff-startup' is finished.
|
||||
directory name should be returned. May push to `ediff--startup-hook'
|
||||
functions to be executed after `ediff-startup' is finished.
|
||||
`ediff-find-file' arranges that the temp files it might create will be
|
||||
deleted."
|
||||
(let* ((file (symbol-value file-var))
|
||||
(file-magic (ediff-filename-magic-p file))
|
||||
deleted.
|
||||
Returns the buffer into which the file is visited.
|
||||
Also sets `ediff--magic-file-name' to indicate where the file's content
|
||||
has been saved (if not in `buffer-file-name')."
|
||||
(let* ((file-magic (ediff-filename-magic-p file))
|
||||
(temp-file-name-prefix (file-name-nondirectory file)))
|
||||
(cond ((not (file-readable-p file))
|
||||
(user-error "File `%s' does not exist or is not readable" file))
|
||||
|
@ -298,58 +299,61 @@ deleted."
|
|||
(set last-dir (expand-file-name (file-name-directory file))))
|
||||
|
||||
;; Setup the buffer
|
||||
(set buffer-name (find-file-noselect file))
|
||||
|
||||
(ediff-with-current-buffer (symbol-value buffer-name)
|
||||
(widen) ; Make sure the entire file is seen
|
||||
(cond (file-magic ; file has a handler, such as jka-compr-handler or
|
||||
;;; ange-ftp-hook-function--arrange for temp file
|
||||
(with-current-buffer (find-file-noselect file)
|
||||
(widen) ; Make sure the entire file is seen
|
||||
(setq ediff--magic-file-name nil)
|
||||
(cond (file-magic ; File has a handler, such as jka-compr-handler or
|
||||
; ange-ftp-hook-function--arrange for temp file
|
||||
(ediff-verify-file-buffer 'magic)
|
||||
(setq file
|
||||
(ediff-make-temp-file
|
||||
(current-buffer) temp-file-name-prefix))
|
||||
(set hooks-var (cons `(lambda () (delete-file ,file))
|
||||
(symbol-value hooks-var))))
|
||||
(let ((file
|
||||
(ediff-make-temp-file
|
||||
(current-buffer) temp-file-name-prefix)))
|
||||
(add-hook 'ediff--startup-hook (lambda () (delete-file file)))
|
||||
(setq ediff--magic-file-name file)))
|
||||
;; file processed via auto-mode-alist, a la uncompress.el
|
||||
((not (equal (file-truename file)
|
||||
(file-truename (buffer-file-name))))
|
||||
(setq file
|
||||
(ediff-make-temp-file
|
||||
(current-buffer) temp-file-name-prefix))
|
||||
(set hooks-var (cons `(lambda () (delete-file ,file))
|
||||
(symbol-value hooks-var))))
|
||||
(file-truename buffer-file-name)))
|
||||
(let ((file
|
||||
(ediff-make-temp-file
|
||||
(current-buffer) temp-file-name-prefix)))
|
||||
(add-hook 'ediff--startup-hook (lambda () (delete-file file)))
|
||||
(setq ediff--magic-file-name file)))
|
||||
(t ;; plain file---just check that the file matches the buffer
|
||||
(ediff-verify-file-buffer))))
|
||||
(set file-var file)))
|
||||
(ediff-verify-file-buffer)))
|
||||
(current-buffer))))
|
||||
|
||||
(defun ediff--buffer-file-name (buf)
|
||||
(when buf
|
||||
(with-current-buffer buf (or ediff--magic-file-name buffer-file-name))))
|
||||
|
||||
;; MERGE-BUFFER-FILE is the file to be associated with the merge buffer
|
||||
(defun ediff-files-internal (file-A file-B file-C startup-hooks job-name
|
||||
&optional merge-buffer-file)
|
||||
(let (buf-A buf-B buf-C)
|
||||
(if (string= file-A file-B)
|
||||
(error "Files A and B are the same"))
|
||||
(if (stringp file-C)
|
||||
(or (and (string= file-A file-C) (error "Files A and C are the same"))
|
||||
(and (string= file-B file-C) (error "Files B and C are the same"))))
|
||||
(if (string= file-A file-B)
|
||||
(error "Files A and B are the same"))
|
||||
(if (stringp file-C)
|
||||
(or (and (string= file-A file-C) (error "Files A and C are the same"))
|
||||
(and (string= file-B file-C) (error "Files B and C are the same"))))
|
||||
(let ((ediff--startup-hook startup-hooks)
|
||||
buf-A buf-B buf-C)
|
||||
|
||||
(message "Reading file %s ... " file-A)
|
||||
;;(sit-for 0)
|
||||
(ediff-find-file 'file-A 'buf-A 'ediff-last-dir-A 'startup-hooks)
|
||||
(setq buf-A (ediff-find-file file-A 'ediff-last-dir-A))
|
||||
(message "Reading file %s ... " file-B)
|
||||
;;(sit-for 0)
|
||||
(ediff-find-file 'file-B 'buf-B 'ediff-last-dir-B 'startup-hooks)
|
||||
(if (stringp file-C)
|
||||
(progn
|
||||
(message "Reading file %s ... " file-C)
|
||||
;;(sit-for 0)
|
||||
(ediff-find-file
|
||||
'file-C 'buf-C
|
||||
(if (eq job-name 'ediff-merge-files-with-ancestor)
|
||||
'ediff-last-dir-ancestor 'ediff-last-dir-C)
|
||||
'startup-hooks)))
|
||||
(ediff-setup buf-A file-A
|
||||
buf-B file-B
|
||||
buf-C file-C
|
||||
startup-hooks
|
||||
(setq buf-B (ediff-find-file file-B 'ediff-last-dir-B))
|
||||
(when (stringp file-C)
|
||||
(message "Reading file %s ... " file-C)
|
||||
;;(sit-for 0)
|
||||
(setq buf-C (ediff-find-file
|
||||
file-C
|
||||
(if (eq job-name 'ediff-merge-files-with-ancestor)
|
||||
'ediff-last-dir-ancestor 'ediff-last-dir-C))))
|
||||
(ediff-setup buf-A (ediff--buffer-file-name buf-A)
|
||||
buf-B (ediff--buffer-file-name buf-B)
|
||||
buf-C (ediff--buffer-file-name buf-C)
|
||||
ediff--startup-hook
|
||||
(list (cons 'ediff-job-name job-name))
|
||||
merge-buffer-file)))
|
||||
|
||||
|
@ -515,10 +519,10 @@ symbol describing the Ediff job type; it defaults to
|
|||
(get-buffer buf-B) file-B
|
||||
(if buf-C-is-alive (get-buffer buf-C))
|
||||
file-C
|
||||
(cons `(lambda ()
|
||||
(delete-file ,file-A)
|
||||
(delete-file ,file-B)
|
||||
(if (stringp ,file-C) (delete-file ,file-C)))
|
||||
(cons (lambda ()
|
||||
(delete-file file-A)
|
||||
(delete-file file-B)
|
||||
(if (stringp file-C) (delete-file file-C)))
|
||||
startup-hooks)
|
||||
(list (cons 'ediff-job-name job-name))
|
||||
merge-buffer-file))
|
||||
|
@ -572,7 +576,7 @@ expression; only file names that match the regexp are considered."
|
|||
(eval ediff-default-filtering-regexp))
|
||||
)))
|
||||
(ediff-directories-internal
|
||||
dir1 dir2 nil regexp 'ediff-files 'ediff-directories
|
||||
dir1 dir2 nil regexp #'ediff-files 'ediff-directories
|
||||
))
|
||||
|
||||
;;;###autoload
|
||||
|
@ -638,7 +642,7 @@ regular expression; only file names that match the regexp are considered."
|
|||
(eval ediff-default-filtering-regexp))
|
||||
)))
|
||||
(ediff-directories-internal
|
||||
dir1 dir2 dir3 regexp 'ediff-files3 'ediff-directories3
|
||||
dir1 dir2 dir3 regexp #'ediff-files3 'ediff-directories3
|
||||
))
|
||||
|
||||
;;;###autoload
|
||||
|
@ -671,7 +675,7 @@ MERGE-AUTOSTORE-DIR is the directory in which to store merged files."
|
|||
(eval ediff-default-filtering-regexp))
|
||||
)))
|
||||
(ediff-directories-internal
|
||||
dir1 dir2 nil regexp 'ediff-merge-files 'ediff-merge-directories
|
||||
dir1 dir2 nil regexp #'ediff-merge-files 'ediff-merge-directories
|
||||
nil merge-autostore-dir
|
||||
))
|
||||
|
||||
|
@ -714,7 +718,7 @@ MERGE-AUTOSTORE-DIR is the directory in which to store merged files."
|
|||
)))
|
||||
(ediff-directories-internal
|
||||
dir1 dir2 ancestor-dir regexp
|
||||
'ediff-merge-files-with-ancestor 'ediff-merge-directories-with-ancestor
|
||||
#'ediff-merge-files-with-ancestor 'ediff-merge-directories-with-ancestor
|
||||
nil merge-autostore-dir
|
||||
))
|
||||
|
||||
|
@ -844,21 +848,20 @@ MERGE-AUTOSTORE-DIR is the directory in which to store merged files."
|
|||
(setq dir-diff-struct (ediff-intersect-directories
|
||||
jobname
|
||||
regexp dir1 dir2 dir3 merge-autostore-dir))
|
||||
(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 (quote ,action))
|
||||
;; set ediff-dir-difference-list
|
||||
(setq ediff-dir-difference-list
|
||||
(cdr (quote ,dir-diff-struct))))
|
||||
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 action)
|
||||
;; set ediff-dir-difference-list
|
||||
(setq ediff-dir-difference-list
|
||||
(cdr dir-diff-struct)))
|
||||
startup-hooks)
|
||||
(setq meta-buf (ediff-prepare-meta-buffer
|
||||
'ediff-filegroup-action
|
||||
#'ediff-filegroup-action
|
||||
(car dir-diff-struct)
|
||||
"*Ediff Session Group Panel"
|
||||
'ediff-redraw-directory-group-buffer
|
||||
#'ediff-redraw-directory-group-buffer
|
||||
jobname
|
||||
startup-hooks))
|
||||
(ediff-show-meta-buffer meta-buf)
|
||||
|
@ -897,18 +900,17 @@ MERGE-AUTOSTORE-DIR is the directory in which to store merged files."
|
|||
(setq file-list
|
||||
(ediff-get-directory-files-under-revision
|
||||
jobname regexp dir1 merge-autostore-dir))
|
||||
(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 (quote ,action)))
|
||||
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 action))
|
||||
startup-hooks)
|
||||
(setq meta-buf (ediff-prepare-meta-buffer
|
||||
'ediff-filegroup-action
|
||||
#'ediff-filegroup-action
|
||||
file-list
|
||||
"*Ediff Session Group Panel"
|
||||
'ediff-redraw-directory-group-buffer
|
||||
#'ediff-redraw-directory-group-buffer
|
||||
jobname
|
||||
startup-hooks))
|
||||
(ediff-show-meta-buffer meta-buf)
|
||||
|
@ -1121,9 +1123,9 @@ arguments after setting up the Ediff buffers."
|
|||
(ediff-setup buffer-A file-A
|
||||
buffer-B file-B
|
||||
nil nil ; buffer & file C
|
||||
(cons `(lambda ()
|
||||
(delete-file ,file-A)
|
||||
(delete-file ,file-B))
|
||||
(cons (lambda ()
|
||||
(delete-file file-A)
|
||||
(delete-file file-B))
|
||||
startup-hooks)
|
||||
(append
|
||||
(list (cons 'ediff-word-mode word-mode)
|
||||
|
@ -1176,7 +1178,7 @@ is the name of the file to be associated with the merge buffer.."
|
|||
ediff-last-dir-B
|
||||
(file-name-directory f)))
|
||||
(progn
|
||||
(ediff-add-to-history
|
||||
(add-to-history
|
||||
'file-name-history
|
||||
(ediff-abbreviate-file-name
|
||||
(expand-file-name
|
||||
|
@ -1225,7 +1227,7 @@ the file to be associated with the merge buffer."
|
|||
ediff-last-dir-B
|
||||
(file-name-directory f)))
|
||||
(progn
|
||||
(ediff-add-to-history
|
||||
(add-to-history
|
||||
'file-name-history
|
||||
(ediff-abbreviate-file-name
|
||||
(expand-file-name
|
||||
|
@ -1238,7 +1240,7 @@ the file to be associated with the merge buffer."
|
|||
ediff-last-dir-ancestor
|
||||
(file-name-directory ff)))
|
||||
(progn
|
||||
(ediff-add-to-history
|
||||
(add-to-history
|
||||
'file-name-history
|
||||
(ediff-abbreviate-file-name
|
||||
(expand-file-name
|
||||
|
@ -1650,17 +1652,7 @@ With optional NODE, goes to that node."
|
|||
(setq command-line-args-left (nthcdr 4 command-line-args-left))
|
||||
(ediff-merge-directories-with-ancestor file-a file-b ancestor regexp)))
|
||||
|
||||
|
||||
|
||||
(require 'ediff-util)
|
||||
|
||||
(run-hooks 'ediff-load-hook)
|
||||
|
||||
|
||||
;; 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)
|
||||
;;; ediff.el ends here
|
||||
|
|
Loading…
Add table
Reference in a new issue