-;;; 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.
;;; Code:
-(provide 'ediff-diff)
-
(require 'ediff-init)
(require 'ediff-util)
(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.
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)
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.
(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 "")
(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
(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 "")
"^\\([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)
)
(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))
))
(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))))
;;; 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"
(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)))))
;; 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))
(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.
(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
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)
(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.
;; 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
["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
(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]
(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")))
: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.
;; 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)
;; 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
(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)
;; 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)
(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)
(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.
(provide 'ediff-merg)
-
-
-;; Local Variables:
-;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
-;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
-;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
-;; End:
-
;;; ediff-merg.el ends here
-;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff -*- lexical-binding: nil; -*-
+;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff -*- lexical-binding:t -*-
;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
;;; Code:
-(provide 'ediff-mult)
-
(defgroup ediff-mult nil
"Multi-file and multi-buffer processing in Ediff."
:prefix "ediff-"
(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.")
"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
(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??
(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 "")
(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'
`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.
(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)
(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))
(ediff-make-new-meta-list-header regexp
auxdir1 auxdir2 auxdir3
merge-autostore-dir
- comparison-func)
+ #'string=)
difflist))
(setq common-part
(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
;; 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
;; 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)))
(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
;; 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
;; 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.
(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)
(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)
"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
(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))
))
))
))
-
-
-;; 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
-;;; 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.
(require 'diff-mode) ; For `diff-file-junk-re'.
-(provide 'ediff-ptch)
(defgroup ediff-ptch nil
"Ediff patch support."
(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.
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.")
(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
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
"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 "")
;; 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)
;; 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.
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
(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
;; 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))
(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))
(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
)
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
;;; Code:
-(provide 'ediff-util)
+(provide 'ediff-util) ;FIXME: Break cyclic dependencies and move to the end!
;; Compiler pacifier
(defvar ediff-use-toolbar-p)
;; 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
(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)))
(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
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)
(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 '-)))
(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 '-)))
(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)
(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)
))
(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
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
(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)
(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))))
(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)
(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
(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.
;; 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
(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)
(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
-;;; 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.
(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
(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)))))
(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
(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
-;;; 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.
(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
: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.
: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")
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.
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.
`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.
`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
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
(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.
;; 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))
-;;; 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.
;;; Code:
-(provide 'ediff)
-
(require 'ediff-util)
;; end pacifier
(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)
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
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
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
;;;###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))
(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)))
(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))
(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
(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
(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
))
)))
(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
))
(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)
(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)
(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)
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
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
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
(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