diff options
| author | Stefan Monnier | 2019-06-21 01:16:54 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2019-06-21 01:16:54 -0400 |
| commit | 869cf5cbc0721bbe9e4df557f4ed3633fb13c05f (patch) | |
| tree | acb96e2d8b0319faa745a8dcf789c2551b0df3e0 | |
| parent | d63bfbcae4a31560468e8800fe8381fda3b9d2ce (diff) | |
| download | emacs-869cf5cbc0721bbe9e4df557f4ed3633fb13c05f.tar.gz emacs-869cf5cbc0721bbe9e4df557f4ed3633fb13c05f.zip | |
* 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.
| -rw-r--r-- | lisp/vc/ediff-diff.el | 106 | ||||
| -rw-r--r-- | lisp/vc/ediff-help.el | 10 | ||||
| -rw-r--r-- | lisp/vc/ediff-hook.el | 29 | ||||
| -rw-r--r-- | lisp/vc/ediff-init.el | 39 | ||||
| -rw-r--r-- | lisp/vc/ediff-merg.el | 10 | ||||
| -rw-r--r-- | lisp/vc/ediff-mult.el | 121 | ||||
| -rw-r--r-- | lisp/vc/ediff-ptch.el | 86 | ||||
| -rw-r--r-- | lisp/vc/ediff-util.el | 84 | ||||
| -rw-r--r-- | lisp/vc/ediff-vers.el | 45 | ||||
| -rw-r--r-- | lisp/vc/ediff-wind.el | 33 | ||||
| -rw-r--r-- | lisp/vc/ediff.el | 200 |
11 files changed, 306 insertions, 457 deletions
diff --git a/lisp/vc/ediff-diff.el b/lisp/vc/ediff-diff.el index b79fde0d662..d22c9399ac1 100644 --- a/lisp/vc/ediff-diff.el +++ b/lisp/vc/ediff-diff.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; ediff-diff.el --- diff-related utilities -*- lexical-binding: nil; -*- | 1 | ;;; ediff-diff.el --- diff-related utilities -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994-2019 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -25,8 +25,6 @@ | |||
| 25 | ;;; Code: | 25 | ;;; Code: |
| 26 | 26 | ||
| 27 | 27 | ||
| 28 | (provide 'ediff-diff) | ||
| 29 | |||
| 30 | (require 'ediff-init) | 28 | (require 'ediff-init) |
| 31 | (require 'ediff-util) | 29 | (require 'ediff-util) |
| 32 | 30 | ||
| @@ -37,13 +35,11 @@ | |||
| 37 | 35 | ||
| 38 | (defcustom ediff-diff-program "diff" | 36 | (defcustom ediff-diff-program "diff" |
| 39 | "Program to use for generating the differential of the two files." | 37 | "Program to use for generating the differential of the two files." |
| 40 | :type 'string | 38 | :type 'string) |
| 41 | :group 'ediff-diff) | ||
| 42 | (defcustom ediff-diff3-program "diff3" | 39 | (defcustom ediff-diff3-program "diff3" |
| 43 | "Program to be used for three-way comparison. | 40 | "Program to be used for three-way comparison. |
| 44 | Must produce output compatible with Unix's diff3 program." | 41 | Must produce output compatible with Unix's diff3 program." |
| 45 | :type 'string | 42 | :type 'string) |
| 46 | :group 'ediff-diff) | ||
| 47 | 43 | ||
| 48 | 44 | ||
| 49 | ;; The following functions must precede all defcustom-defined variables. | 45 | ;; The following functions must precede all defcustom-defined variables. |
| @@ -60,21 +56,18 @@ will do. However, some people set $prompt or other things | |||
| 60 | incorrectly, which leads to undesirable output messages. These may | 56 | incorrectly, which leads to undesirable output messages. These may |
| 61 | cause Ediff to fail. In such a case, set `ediff-shell' to a shell that | 57 | cause Ediff to fail. In such a case, set `ediff-shell' to a shell that |
| 62 | you are not using or, better, fix your shell's startup file." | 58 | you are not using or, better, fix your shell's startup file." |
| 63 | :type 'string | 59 | :type 'string) |
| 64 | :group 'ediff-diff) | ||
| 65 | 60 | ||
| 66 | (defcustom ediff-cmp-program "cmp" | 61 | (defcustom ediff-cmp-program "cmp" |
| 67 | "Utility to use to determine if two files are identical. | 62 | "Utility to use to determine if two files are identical. |
| 68 | It must return code 0, if its arguments are identical files." | 63 | It must return code 0, if its arguments are identical files." |
| 69 | :type 'string | 64 | :type 'string) |
| 70 | :group 'ediff-diff) | ||
| 71 | 65 | ||
| 72 | (defcustom ediff-cmp-options nil | 66 | (defcustom ediff-cmp-options nil |
| 73 | "Options to pass to `ediff-cmp-program'. | 67 | "Options to pass to `ediff-cmp-program'. |
| 74 | If GNU diff is used as `ediff-cmp-program', then the most useful options | 68 | If GNU diff is used as `ediff-cmp-program', then the most useful options |
| 75 | are `-I REGEXP', to ignore changes whose lines match the REGEXP." | 69 | are `-I REGEXP', to ignore changes whose lines match the REGEXP." |
| 76 | :type '(repeat string) | 70 | :type '(repeat string)) |
| 77 | :group 'ediff-diff) | ||
| 78 | 71 | ||
| 79 | (defun ediff-set-diff-options (symbol value) | 72 | (defun ediff-set-diff-options (symbol value) |
| 80 | (set symbol value) | 73 | (set symbol value) |
| @@ -95,8 +88,7 @@ This variable is not for customizing the look of the differences produced by | |||
| 95 | the command \\[ediff-show-diff-output]. Use the variable | 88 | the command \\[ediff-show-diff-output]. Use the variable |
| 96 | `ediff-custom-diff-options' for that." | 89 | `ediff-custom-diff-options' for that." |
| 97 | :set 'ediff-set-diff-options | 90 | :set 'ediff-set-diff-options |
| 98 | :type 'string | 91 | :type 'string) |
| 99 | :group 'ediff-diff) | ||
| 100 | 92 | ||
| 101 | (ediff-defvar-local ediff-ignore-case nil | 93 | (ediff-defvar-local ediff-ignore-case nil |
| 102 | "If t, skip over difference regions that differ only in letter case. | 94 | "If t, skip over difference regions that differ only in letter case. |
| @@ -105,14 +97,12 @@ Use `setq-default' if setting it in .emacs") | |||
| 105 | 97 | ||
| 106 | (defcustom ediff-ignore-case-option "-i" | 98 | (defcustom ediff-ignore-case-option "-i" |
| 107 | "Option that causes the diff program to ignore case of letters." | 99 | "Option that causes the diff program to ignore case of letters." |
| 108 | :type 'string | 100 | :type 'string) |
| 109 | :group 'ediff-diff) | ||
| 110 | 101 | ||
| 111 | (defcustom ediff-ignore-case-option3 "" | 102 | (defcustom ediff-ignore-case-option3 "" |
| 112 | "Option that causes the diff3 program to ignore case of letters. | 103 | "Option that causes the diff3 program to ignore case of letters. |
| 113 | GNU diff3 doesn't have such an option." | 104 | GNU diff3 doesn't have such an option." |
| 114 | :type 'string | 105 | :type 'string) |
| 115 | :group 'ediff-diff) | ||
| 116 | 106 | ||
| 117 | ;; the actual options used in comparison | 107 | ;; the actual options used in comparison |
| 118 | (ediff-defvar-local ediff-actual-diff-options ediff-diff-options "") | 108 | (ediff-defvar-local ediff-actual-diff-options ediff-diff-options "") |
| @@ -120,12 +110,10 @@ GNU diff3 doesn't have such an option." | |||
| 120 | (defcustom ediff-custom-diff-program ediff-diff-program | 110 | (defcustom ediff-custom-diff-program ediff-diff-program |
| 121 | "Program to use for generating custom diff output for saving it in a file. | 111 | "Program to use for generating custom diff output for saving it in a file. |
| 122 | This output is not used by Ediff internally." | 112 | This output is not used by Ediff internally." |
| 123 | :type 'string | 113 | :type 'string) |
| 124 | :group 'ediff-diff) | ||
| 125 | (defcustom ediff-custom-diff-options "-c" | 114 | (defcustom ediff-custom-diff-options "-c" |
| 126 | "Options to pass to `ediff-custom-diff-program'." | 115 | "Options to pass to `ediff-custom-diff-program'." |
| 127 | :type 'string | 116 | :type 'string) |
| 128 | :group 'ediff-diff) | ||
| 129 | 117 | ||
| 130 | ;;; Support for diff3 | 118 | ;;; Support for diff3 |
| 131 | 119 | ||
| @@ -134,8 +122,7 @@ This output is not used by Ediff internally." | |||
| 134 | (defcustom ediff-diff3-options "" | 122 | (defcustom ediff-diff3-options "" |
| 135 | "Options to pass to `ediff-diff3-program'." | 123 | "Options to pass to `ediff-diff3-program'." |
| 136 | :set 'ediff-set-diff-options | 124 | :set 'ediff-set-diff-options |
| 137 | :type 'string | 125 | :type 'string) |
| 138 | :group 'ediff-diff) | ||
| 139 | 126 | ||
| 140 | ;; the actual options used in comparison | 127 | ;; the actual options used in comparison |
| 141 | (ediff-defvar-local ediff-actual-diff3-options ediff-diff3-options "") | 128 | (ediff-defvar-local ediff-actual-diff3-options ediff-diff3-options "") |
| @@ -144,8 +131,7 @@ This output is not used by Ediff internally." | |||
| 144 | "^\\([1-3]:\\|====\\| \\|.*Warning *:\\|.*No newline\\|.*missing newline\\|^\C-m$\\)" | 131 | "^\\([1-3]:\\|====\\| \\|.*Warning *:\\|.*No newline\\|.*missing newline\\|^\C-m$\\)" |
| 145 | "Regexp that matches normal output lines from `ediff-diff3-program'. | 132 | "Regexp that matches normal output lines from `ediff-diff3-program'. |
| 146 | Lines that do not match are assumed to be error messages." | 133 | Lines that do not match are assumed to be error messages." |
| 147 | :type 'regexp | 134 | :type 'regexp) |
| 148 | :group 'ediff-diff) | ||
| 149 | 135 | ||
| 150 | ;; keeps the status of the current diff in 3-way jobs. | 136 | ;; keeps the status of the current diff in 3-way jobs. |
| 151 | ;; the status can be =diff(A), =diff(B), or =diff(A+B) | 137 | ;; the status can be =diff(A), =diff(B), or =diff(A+B) |
| @@ -842,7 +828,7 @@ delimiter regions")) | |||
| 842 | ) | 828 | ) |
| 843 | (setq overlay-list (reverse overlay-list)) | 829 | (setq overlay-list (reverse overlay-list)) |
| 844 | (ediff-set-fine-diff-vector | 830 | (ediff-set-fine-diff-vector |
| 845 | reg-num 'C (apply 'vector overlay-list)) | 831 | reg-num 'C (apply #'vector overlay-list)) |
| 846 | )) | 832 | )) |
| 847 | 833 | ||
| 848 | 834 | ||
| @@ -1170,30 +1156,30 @@ are ignored." | |||
| 1170 | (eq buffer ediff-fine-diff-buffer) | 1156 | (eq buffer ediff-fine-diff-buffer) |
| 1171 | (setq args (delete "--binary" args))) | 1157 | (setq args (delete "--binary" args))) |
| 1172 | (unwind-protect | 1158 | (unwind-protect |
| 1173 | (let ((directory default-directory) | 1159 | (with-current-buffer buffer |
| 1174 | proc) | 1160 | (erase-buffer) |
| 1175 | (with-current-buffer buffer | 1161 | ;; default-directory may be on some remote machine |
| 1176 | (erase-buffer) | 1162 | ;; (e.g. accessed via Tramp or url-handler) or a non-existing dir. |
| 1177 | (setq default-directory directory) | 1163 | (setq default-directory "/") |
| 1178 | (if (or (memq system-type '(ms-dos windows-nt)) | 1164 | (if (or (memq system-type '(ms-dos windows-nt)) |
| 1179 | synch) | 1165 | synch) |
| 1180 | ;; In Windows do it synchronously, since Windows doesn't let us | 1166 | ;; In Windows do it synchronously, since Windows doesn't let us |
| 1181 | ;; delete files used by other processes. Thus, in ediff-buffers | 1167 | ;; delete files used by other processes. Thus, in ediff-buffers |
| 1182 | ;; and similar functions, we can't delete temp files because | 1168 | ;; and similar functions, we can't delete temp files because |
| 1183 | ;; they might be used by the asynch process that computes | 1169 | ;; they might be used by the asynch process that computes |
| 1184 | ;; custom diffs. So, we have to wait till custom diff | 1170 | ;; custom diffs. So, we have to wait till custom diff |
| 1185 | ;; subprocess is done. | 1171 | ;; subprocess is done. |
| 1186 | ;; In DOS, must synchronize because DOS doesn't have | 1172 | ;; In DOS, must synchronize because DOS doesn't have |
| 1187 | ;; asynchronous processes. | 1173 | ;; asynchronous processes. |
| 1188 | (apply 'call-process program nil buffer nil args) | 1174 | (apply #'call-process program nil buffer nil args) |
| 1189 | ;; On other systems, do it asynchronously. | 1175 | ;; On other systems, do it asynchronously. |
| 1190 | (setq proc (get-buffer-process buffer)) | 1176 | (let ((proc (get-buffer-process buffer))) |
| 1191 | (if proc (kill-process proc)) | 1177 | (if proc (kill-process proc))) |
| 1192 | (setq proc | 1178 | (let ((proc |
| 1193 | (apply 'start-process "Custom Diff" buffer program args)) | 1179 | (apply #'start-process "Custom Diff" buffer program args))) |
| 1194 | (setq mode-line-process '(":%s")) | 1180 | (setq mode-line-process '(":%s")) |
| 1195 | (set-process-sentinel proc 'ediff-process-sentinel) | 1181 | (set-process-sentinel proc #'ediff-process-sentinel) |
| 1196 | (set-process-filter proc 'ediff-process-filter) | 1182 | (set-process-filter proc #'ediff-process-filter) |
| 1197 | ))) | 1183 | ))) |
| 1198 | (store-match-data data)))) | 1184 | (store-match-data data)))) |
| 1199 | 1185 | ||
| @@ -1235,10 +1221,9 @@ are ignored." | |||
| 1235 | 1221 | ||
| 1236 | ;;; Word functions used to refine the current diff | 1222 | ;;; Word functions used to refine the current diff |
| 1237 | 1223 | ||
| 1238 | (defvar ediff-forward-word-function 'ediff-forward-word | 1224 | (defvar-local ediff-forward-word-function #'ediff-forward-word |
| 1239 | "Function to call to move to the next word. | 1225 | "Function to call to move to the next word. |
| 1240 | Used for splitting difference regions into individual words.") | 1226 | Used for splitting difference regions into individual words.") |
| 1241 | (make-variable-buffer-local 'ediff-forward-word-function) | ||
| 1242 | 1227 | ||
| 1243 | ;; \240 is Unicode symbol for nonbreakable whitespace | 1228 | ;; \240 is Unicode symbol for nonbreakable whitespace |
| 1244 | (defvar ediff-whitespace " \n\t\f\r\240" | 1229 | (defvar ediff-whitespace " \n\t\f\r\240" |
| @@ -1358,7 +1343,7 @@ arguments to `skip-chars-forward'." | |||
| 1358 | (let ((res | 1343 | (let ((res |
| 1359 | ;; In the remote case, this works only if F1 and F2 are | 1344 | ;; In the remote case, this works only if F1 and F2 are |
| 1360 | ;; located on the same remote host. | 1345 | ;; located on the same remote host. |
| 1361 | (apply 'process-file ediff-cmp-program nil nil nil | 1346 | (apply #'process-file ediff-cmp-program nil nil nil |
| 1362 | (append ediff-cmp-options | 1347 | (append ediff-cmp-options |
| 1363 | (list (expand-file-name (file-local-name f1)) | 1348 | (list (expand-file-name (file-local-name f1)) |
| 1364 | (expand-file-name (file-local-name f2))))) | 1349 | (expand-file-name (file-local-name f2))))) |
| @@ -1418,8 +1403,8 @@ affects only files whose names match the expression." | |||
| 1418 | ;; First, check only the names (works quickly and ensures a | 1403 | ;; First, check only the names (works quickly and ensures a |
| 1419 | ;; precondition for subsequent code) | 1404 | ;; precondition for subsequent code) |
| 1420 | (if (and (= (length entries-1) (length entries-2)) | 1405 | (if (and (= (length entries-1) (length entries-2)) |
| 1421 | (equal (mapcar 'file-name-nondirectory entries-1) | 1406 | (equal (mapcar #'file-name-nondirectory entries-1) |
| 1422 | (mapcar 'file-name-nondirectory entries-2))) | 1407 | (mapcar #'file-name-nondirectory entries-2))) |
| 1423 | ;; With name equality established, compare the entries | 1408 | ;; With name equality established, compare the entries |
| 1424 | ;; through recursion. | 1409 | ;; through recursion. |
| 1425 | (let ((continue t)) | 1410 | (let ((continue t)) |
| @@ -1482,12 +1467,5 @@ affects only files whose names match the expression." | |||
| 1482 | (ediff-update-diffs))) | 1467 | (ediff-update-diffs))) |
| 1483 | ) | 1468 | ) |
| 1484 | 1469 | ||
| 1485 | 1470 | (provide 'ediff-diff) | |
| 1486 | |||
| 1487 | ;; Local Variables: | ||
| 1488 | ;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | ||
| 1489 | ;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) | ||
| 1490 | ;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) | ||
| 1491 | ;; End: | ||
| 1492 | |||
| 1493 | ;;; ediff-diff.el ends here | 1471 | ;;; ediff-diff.el ends here |
diff --git a/lisp/vc/ediff-help.el b/lisp/vc/ediff-help.el index d44263b70b0..05f17acc1e7 100644 --- a/lisp/vc/ediff-help.el +++ b/lisp/vc/ediff-help.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; ediff-help.el --- Code related to the contents of Ediff help buffers -*- lexical-binding: nil; -*- | 1 | ;;; ediff-help.el --- Code related to the contents of Ediff help buffers -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1996-2019 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1996-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -270,8 +270,7 @@ the value of this variable and the variables `ediff-help-message-*' in | |||
| 270 | (defun ediff-set-help-message () | 270 | (defun ediff-set-help-message () |
| 271 | (setq ediff-long-help-message | 271 | (setq ediff-long-help-message |
| 272 | (cond ((and ediff-long-help-message-function | 272 | (cond ((and ediff-long-help-message-function |
| 273 | (or (symbolp ediff-long-help-message-function) | 273 | (functionp ediff-long-help-message-function)) |
| 274 | (consp ediff-long-help-message-function))) | ||
| 275 | (funcall ediff-long-help-message-function)) | 274 | (funcall ediff-long-help-message-function)) |
| 276 | (ediff-word-mode | 275 | (ediff-word-mode |
| 277 | (concat ediff-long-help-message-head | 276 | (concat ediff-long-help-message-head |
| @@ -295,8 +294,7 @@ the value of this variable and the variables `ediff-help-message-*' in | |||
| 295 | ediff-long-help-message-tail)))) | 294 | ediff-long-help-message-tail)))) |
| 296 | (setq ediff-brief-help-message | 295 | (setq ediff-brief-help-message |
| 297 | (cond ((and ediff-brief-help-message-function | 296 | (cond ((and ediff-brief-help-message-function |
| 298 | (or (symbolp ediff-brief-help-message-function) | 297 | (functionp ediff-brief-help-message-function)) |
| 299 | (consp ediff-brief-help-message-function))) | ||
| 300 | (funcall ediff-brief-help-message-function)) | 298 | (funcall ediff-brief-help-message-function)) |
| 301 | ((stringp ediff-brief-help-message-function) | 299 | ((stringp ediff-brief-help-message-function) |
| 302 | ediff-brief-help-message-function) | 300 | ediff-brief-help-message-function) |
| @@ -316,6 +314,4 @@ the value of this variable and the variables `ediff-help-message-*' in | |||
| 316 | 314 | ||
| 317 | 315 | ||
| 318 | (provide 'ediff-help) | 316 | (provide 'ediff-help) |
| 319 | |||
| 320 | |||
| 321 | ;;; ediff-help.el ends here | 317 | ;;; ediff-help.el ends here |
diff --git a/lisp/vc/ediff-hook.el b/lisp/vc/ediff-hook.el index 0b97120baf1..7a04249fc85 100644 --- a/lisp/vc/ediff-hook.el +++ b/lisp/vc/ediff-hook.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; ediff-hook.el --- setup for Ediff's menus and autoloads -*- lexical-binding: nil; -*- | 1 | ;;; ediff-hook.el --- setup for Ediff's menus and autoloads -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1995-2019 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1995-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -43,7 +43,6 @@ | |||
| 43 | ;; end pacifier | 43 | ;; end pacifier |
| 44 | 44 | ||
| 45 | ;; allow menus to be set up without ediff-wind.el being loaded | 45 | ;; allow menus to be set up without ediff-wind.el being loaded |
| 46 | (defvar ediff-window-setup-function) | ||
| 47 | 46 | ||
| 48 | ;; This autoload is useless in Emacs because ediff-hook.el is dumped with | 47 | ;; This autoload is useless in Emacs because ediff-hook.el is dumped with |
| 49 | ;; emacs, but it is needed in XEmacs | 48 | ;; emacs, but it is needed in XEmacs |
| @@ -114,10 +113,8 @@ | |||
| 114 | ["Use separate frame for Ediff control buffer" | 113 | ["Use separate frame for Ediff control buffer" |
| 115 | ediff-toggle-multiframe | 114 | ediff-toggle-multiframe |
| 116 | :style toggle | 115 | :style toggle |
| 117 | :selected (if (and (featurep 'ediff-util) | 116 | :selected (eq (bound-and-true-p ediff-window-setup-function) |
| 118 | (boundp 'ediff-window-setup-function)) | 117 | #'ediff-setup-windows-multiframe)] |
| 119 | (eq ediff-window-setup-function | ||
| 120 | 'ediff-setup-windows-multiframe))] | ||
| 121 | ["Use a toolbar with Ediff control buffer" | 118 | ["Use a toolbar with Ediff control buffer" |
| 122 | ediff-toggle-use-toolbar | 119 | ediff-toggle-use-toolbar |
| 123 | :style toggle | 120 | :style toggle |
| @@ -133,14 +130,14 @@ | |||
| 133 | (defvar menu-bar-ediff-misc-menu | 130 | (defvar menu-bar-ediff-misc-menu |
| 134 | (make-sparse-keymap "Ediff Miscellanea")) | 131 | (make-sparse-keymap "Ediff Miscellanea")) |
| 135 | (fset 'menu-bar-ediff-misc-menu | 132 | (fset 'menu-bar-ediff-misc-menu |
| 136 | (symbol-value 'menu-bar-ediff-misc-menu)) | 133 | menu-bar-ediff-misc-menu) |
| 137 | (defvar menu-bar-epatch-menu (make-sparse-keymap "Apply Patch")) | 134 | (defvar menu-bar-epatch-menu (make-sparse-keymap "Apply Patch")) |
| 138 | (fset 'menu-bar-epatch-menu (symbol-value 'menu-bar-epatch-menu)) | 135 | (fset 'menu-bar-epatch-menu menu-bar-epatch-menu) |
| 139 | (defvar menu-bar-ediff-merge-menu (make-sparse-keymap "Merge")) | 136 | (defvar menu-bar-ediff-merge-menu (make-sparse-keymap "Merge")) |
| 140 | (fset 'menu-bar-ediff-merge-menu | 137 | (fset 'menu-bar-ediff-merge-menu |
| 141 | (symbol-value 'menu-bar-ediff-merge-menu)) | 138 | menu-bar-ediff-merge-menu) |
| 142 | (defvar menu-bar-ediff-menu (make-sparse-keymap "Compare")) | 139 | (defvar menu-bar-ediff-menu (make-sparse-keymap "Compare")) |
| 143 | (fset 'menu-bar-ediff-menu (symbol-value 'menu-bar-ediff-menu)) | 140 | (fset 'menu-bar-ediff-menu menu-bar-ediff-menu) |
| 144 | 141 | ||
| 145 | ;; define ediff compare menu | 142 | ;; define ediff compare menu |
| 146 | (define-key menu-bar-ediff-menu [ediff-misc] | 143 | (define-key menu-bar-ediff-menu [ediff-misc] |
| @@ -245,7 +242,15 @@ | |||
| 245 | (define-key menu-bar-ediff-misc-menu [emultiframe] | 242 | (define-key menu-bar-ediff-misc-menu [emultiframe] |
| 246 | `(menu-item ,(purecopy "Use separate control buffer frame") | 243 | `(menu-item ,(purecopy "Use separate control buffer frame") |
| 247 | ediff-toggle-multiframe | 244 | ediff-toggle-multiframe |
| 248 | :help ,(purecopy "Switch between the single-frame presentation mode and the multi-frame mode"))) | 245 | :help ,(purecopy "Switch between the single-frame presentation mode and the multi-frame mode") |
| 246 | :button (:toggle . (eq (bound-and-true-p ediff-window-setup-function) | ||
| 247 | #'ediff-setup-windows-multiframe)))) | ||
| 248 | ;; FIXME: Port XEmacs's toolbar support! | ||
| 249 | ;; ["Use a toolbar with Ediff control buffer" | ||
| 250 | ;; ediff-toggle-use-toolbar | ||
| 251 | ;; :style toggle | ||
| 252 | ;; :selected (if (featurep 'ediff-tbar) | ||
| 253 | ;; (ediff-use-toolbar-p))] | ||
| 249 | (define-key menu-bar-ediff-misc-menu [eregistry] | 254 | (define-key menu-bar-ediff-misc-menu [eregistry] |
| 250 | `(menu-item ,(purecopy "List Ediff Sessions") ediff-show-registry | 255 | `(menu-item ,(purecopy "List Ediff Sessions") ediff-show-registry |
| 251 | :help ,(purecopy "List all active Ediff sessions; it is a convenient way to find and resume such a session"))) | 256 | :help ,(purecopy "List all active Ediff sessions; it is a convenient way to find and resume such a session"))) |
| @@ -257,6 +262,4 @@ | |||
| 257 | :help ,(purecopy "Bring up the Ediff manual")))) | 262 | :help ,(purecopy "Bring up the Ediff manual")))) |
| 258 | 263 | ||
| 259 | (provide 'ediff-hook) | 264 | (provide 'ediff-hook) |
| 260 | |||
| 261 | |||
| 262 | ;;; ediff-hook.el ends here | 265 | ;;; ediff-hook.el ends here |
diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el index 18c396f164c..f98a7ed560c 100644 --- a/lisp/vc/ediff-init.el +++ b/lisp/vc/ediff-init.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff -*- lexical-binding: nil; -*- | 1 | ;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994-2019 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -86,7 +86,7 @@ that Ediff doesn't know about.") | |||
| 86 | ;; Plagiarized from `emerge-defvar-local' for XEmacs. | 86 | ;; Plagiarized from `emerge-defvar-local' for XEmacs. |
| 87 | (defmacro ediff-defvar-local (var value doc) | 87 | (defmacro ediff-defvar-local (var value doc) |
| 88 | "Defines VAR as a local variable." | 88 | "Defines VAR as a local variable." |
| 89 | (declare (indent defun)) | 89 | (declare (indent defun) (doc-string 3)) |
| 90 | `(progn | 90 | `(progn |
| 91 | (defvar ,var ,value ,doc) | 91 | (defvar ,var ,value ,doc) |
| 92 | (make-variable-buffer-local ',var) | 92 | (make-variable-buffer-local ',var) |
| @@ -502,7 +502,7 @@ set local variables that determine how the display looks like." | |||
| 502 | 502 | ||
| 503 | ;; Selective browsing | 503 | ;; Selective browsing |
| 504 | 504 | ||
| 505 | (ediff-defvar-local ediff-skip-diff-region-function 'ediff-show-all-diffs | 505 | (ediff-defvar-local ediff-skip-diff-region-function #'ediff-show-all-diffs |
| 506 | "Function that determines the next/previous diff region to show. | 506 | "Function that determines the next/previous diff region to show. |
| 507 | Should return t for regions to be ignored and nil otherwise. | 507 | Should return t for regions to be ignored and nil otherwise. |
| 508 | This function gets a region number as an argument. The region number | 508 | 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." | |||
| 740 | (defalias 'ediff-delete-overlay | 740 | (defalias 'ediff-delete-overlay |
| 741 | (if (featurep 'xemacs) 'delete-extent 'delete-overlay)) | 741 | (if (featurep 'xemacs) 'delete-extent 'delete-overlay)) |
| 742 | 742 | ||
| 743 | ;; Assumes that emacs-major-version and emacs-minor-version are defined. | ||
| 744 | (defun ediff-check-version (op major minor &optional type-of-emacs) | ||
| 745 | "Check the current version against MAJOR and MINOR version numbers. | ||
| 746 | The comparison uses operator OP, which may be any of: =, >, >=, <, <=. | ||
| 747 | TYPE-OF-EMACS is either `emacs' or `xemacs'." | ||
| 748 | (declare (obsolete version< "23.1")) | ||
| 749 | (and (cond ((eq type-of-emacs 'xemacs) (featurep 'xemacs)) | ||
| 750 | ((eq type-of-emacs 'emacs) (featurep 'emacs)) | ||
| 751 | (t)) | ||
| 752 | (cond ((eq op '=) (and (= emacs-minor-version minor) | ||
| 753 | (= emacs-major-version major))) | ||
| 754 | ((memq op '(> >= < <=)) | ||
| 755 | (and (or (funcall op emacs-major-version major) | ||
| 756 | (= emacs-major-version major)) | ||
| 757 | (if (= emacs-major-version major) | ||
| 758 | (funcall op emacs-minor-version minor) | ||
| 759 | t))) | ||
| 760 | (t | ||
| 761 | (user-error "%S: Invalid op in ediff-check-version" op))))) | ||
| 762 | |||
| 763 | (defun ediff-color-display-p () | 743 | (defun ediff-color-display-p () |
| 764 | (condition-case nil | 744 | (condition-case nil |
| 765 | (if (featurep 'xemacs) | 745 | (if (featurep 'xemacs) |
| @@ -1508,7 +1488,7 @@ This default should work without changes." | |||
| 1508 | ;; this record is itself a vector | 1488 | ;; this record is itself a vector |
| 1509 | (defsubst ediff-clear-fine-diff-vector (diff-record) | 1489 | (defsubst ediff-clear-fine-diff-vector (diff-record) |
| 1510 | (if diff-record | 1490 | (if diff-record |
| 1511 | (mapc 'ediff-delete-overlay | 1491 | (mapc #'ediff-delete-overlay |
| 1512 | (ediff-get-fine-diff-vector-from-diff-record diff-record)))) | 1492 | (ediff-get-fine-diff-vector-from-diff-record diff-record)))) |
| 1513 | 1493 | ||
| 1514 | (defsubst ediff-clear-fine-differences-in-one-buffer (n buf-type) | 1494 | (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." | |||
| 1779 | 1759 | ||
| 1780 | (defsubst ediff-message-if-verbose (string &rest args) | 1760 | (defsubst ediff-message-if-verbose (string &rest args) |
| 1781 | (if ediff-verbose-p | 1761 | (if ediff-verbose-p |
| 1782 | (apply 'message string args))) | 1762 | (apply #'message string args))) |
| 1783 | 1763 | ||
| 1784 | (defun ediff-file-attributes (filename attr-number) | 1764 | (defun ediff-file-attributes (filename attr-number) |
| 1785 | (if (ediff-listable-file filename) | 1765 | (if (ediff-listable-file filename) |
| @@ -1818,13 +1798,4 @@ Unless optional argument INPLACE is non-nil, return a new string." | |||
| 1818 | 1798 | ||
| 1819 | 1799 | ||
| 1820 | (provide 'ediff-init) | 1800 | (provide 'ediff-init) |
| 1821 | |||
| 1822 | |||
| 1823 | |||
| 1824 | ;; Local Variables: | ||
| 1825 | ;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | ||
| 1826 | ;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) | ||
| 1827 | ;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) | ||
| 1828 | ;; End: | ||
| 1829 | |||
| 1830 | ;;; ediff-init.el ends here | 1801 | ;;; ediff-init.el ends here |
diff --git a/lisp/vc/ediff-merg.el b/lisp/vc/ediff-merg.el index cadc15325c7..4e17dbeaefa 100644 --- a/lisp/vc/ediff-merg.el +++ b/lisp/vc/ediff-merg.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; ediff-merg.el --- merging utilities -*- lexical-binding: nil; -*- | 1 | ;;; ediff-merg.el --- merging utilities -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994-2019 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -382,12 +382,4 @@ Combining is done according to the specifications in variable | |||
| 382 | 382 | ||
| 383 | 383 | ||
| 384 | (provide 'ediff-merg) | 384 | (provide 'ediff-merg) |
| 385 | |||
| 386 | |||
| 387 | ;; Local Variables: | ||
| 388 | ;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | ||
| 389 | ;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) | ||
| 390 | ;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) | ||
| 391 | ;; End: | ||
| 392 | |||
| 393 | ;;; ediff-merg.el ends here | 385 | ;;; ediff-merg.el ends here |
diff --git a/lisp/vc/ediff-mult.el b/lisp/vc/ediff-mult.el index f44236c44df..bfa399d3033 100644 --- a/lisp/vc/ediff-mult.el +++ b/lisp/vc/ediff-mult.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff -*- lexical-binding: nil; -*- | 1 | ;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1995-2019 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1995-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -103,8 +103,6 @@ | |||
| 103 | ;;; Code: | 103 | ;;; Code: |
| 104 | 104 | ||
| 105 | 105 | ||
| 106 | (provide 'ediff-mult) | ||
| 107 | |||
| 108 | (defgroup ediff-mult nil | 106 | (defgroup ediff-mult nil |
| 109 | "Multi-file and multi-buffer processing in Ediff." | 107 | "Multi-file and multi-buffer processing in Ediff." |
| 110 | :prefix "ediff-" | 108 | :prefix "ediff-" |
| @@ -147,7 +145,20 @@ Useful commands (type ? to hide them and free up screen): | |||
| 147 | 145 | ||
| 148 | (ediff-defvar-local ediff-meta-buffer-map nil | 146 | (ediff-defvar-local ediff-meta-buffer-map nil |
| 149 | "The keymap for the meta buffer.") | 147 | "The keymap for the meta buffer.") |
| 150 | (defvar ediff-dir-diffs-buffer-map (make-sparse-keymap) | 148 | (defvar ediff-dir-diffs-buffer-map |
| 149 | (let ((map (make-sparse-keymap))) | ||
| 150 | (suppress-keymap map) | ||
| 151 | (define-key map "q" 'ediff-bury-dir-diffs-buffer) | ||
| 152 | (define-key map " " 'next-line) | ||
| 153 | (define-key map "n" 'next-line) | ||
| 154 | (define-key map "\C-?" 'previous-line) | ||
| 155 | (define-key map "p" 'previous-line) | ||
| 156 | (define-key map "C" 'ediff-dir-diff-copy-file) | ||
| 157 | (define-key map (if (featurep 'emacs) [mouse-2] [button2]) | ||
| 158 | 'ediff-dir-diff-copy-file) | ||
| 159 | (define-key map [delete] 'previous-line) | ||
| 160 | (define-key map [backspace] 'previous-line) | ||
| 161 | map) | ||
| 151 | "The keymap to be installed in the buffer showing differences between | 162 | "The keymap to be installed in the buffer showing differences between |
| 152 | directories.") | 163 | directories.") |
| 153 | 164 | ||
| @@ -175,8 +186,7 @@ directories.") | |||
| 175 | "The default regular expression used as a filename filter in multifile comparisons. | 186 | "The default regular expression used as a filename filter in multifile comparisons. |
| 176 | Should be a sexp. For instance (car ediff-filtering-regexp-history) or nil." | 187 | Should be a sexp. For instance (car ediff-filtering-regexp-history) or nil." |
| 177 | :type 'sexp ; yuck - why not just a regexp? | 188 | :type 'sexp ; yuck - why not just a regexp? |
| 178 | :risky t | 189 | :risky t) |
| 179 | :group 'ediff-mult) | ||
| 180 | 190 | ||
| 181 | ;; This has the form ((meta-buf regexp dir1 dir2 dir3 merge-auto-store-dir) | 191 | ;; This has the form ((meta-buf regexp dir1 dir2 dir3 merge-auto-store-dir) |
| 182 | ;; (ctl-buf session-status (file1 . eq-status) (file2 . eq-status) (file3 | 192 | ;; (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." | |||
| 202 | (defcustom ediff-meta-truncate-filenames t | 212 | (defcustom ediff-meta-truncate-filenames t |
| 203 | "If non-nil, truncate long file names in the session group buffers. | 213 | "If non-nil, truncate long file names in the session group buffers. |
| 204 | This can be toggled with `ediff-toggle-filename-truncation'." | 214 | This can be toggled with `ediff-toggle-filename-truncation'." |
| 205 | :type 'boolean | 215 | :type 'boolean) |
| 206 | :group 'ediff-mult) | ||
| 207 | 216 | ||
| 208 | (defcustom ediff-meta-mode-hook nil | 217 | (defcustom ediff-meta-mode-hook nil |
| 209 | "Hooks run just after setting up meta mode." | 218 | "Hooks run just after setting up meta mode." |
| 210 | :type 'hook | 219 | :type 'hook) |
| 211 | :group 'ediff-mult) | ||
| 212 | 220 | ||
| 213 | (defcustom ediff-registry-setup-hook nil | 221 | (defcustom ediff-registry-setup-hook nil |
| 214 | "Hooks run just after the registry control panel is set up." | 222 | "Hooks run just after the registry control panel is set up." |
| 215 | :type 'hook | 223 | :type 'hook) |
| 216 | :group 'ediff-mult) | ||
| 217 | 224 | ||
| 218 | (defcustom ediff-before-session-group-setup-hooks | 225 | (defcustom ediff-before-session-group-setup-hooks |
| 219 | nil ;FIXME: Bad name (should be -hook or -functions) and never run?? | 226 | 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'." | |||
| 226 | (defcustom ediff-after-session-group-setup-hook nil | 233 | (defcustom ediff-after-session-group-setup-hook nil |
| 227 | "Hooks run just after a meta-buffer controlling a session group, such as | 234 | "Hooks run just after a meta-buffer controlling a session group, such as |
| 228 | ediff-directories, is run." | 235 | ediff-directories, is run." |
| 229 | :type 'hook | 236 | :type 'hook) |
| 230 | :group 'ediff-mult) | ||
| 231 | (defcustom ediff-quit-session-group-hook nil | 237 | (defcustom ediff-quit-session-group-hook nil |
| 232 | "Hooks run just before exiting a session group." | 238 | "Hooks run just before exiting a session group." |
| 233 | :type 'hook | 239 | :type 'hook) |
| 234 | :group 'ediff-mult) | ||
| 235 | (defcustom ediff-show-registry-hook nil | 240 | (defcustom ediff-show-registry-hook nil |
| 236 | "Hooks run just after the registry buffer is shown." | 241 | "Hooks run just after the registry buffer is shown." |
| 237 | :type 'hook | 242 | :type 'hook) |
| 238 | :group 'ediff-mult) | ||
| 239 | (defcustom ediff-show-session-group-hook '(delete-other-windows) | 243 | (defcustom ediff-show-session-group-hook '(delete-other-windows) |
| 240 | "Hooks run just after a session group buffer is shown." | 244 | "Hooks run just after a session group buffer is shown." |
| 241 | :type 'hook | 245 | :type 'hook) |
| 242 | :group 'ediff-mult) | ||
| 243 | (defcustom ediff-meta-buffer-keymap-setup-hook nil | 246 | (defcustom ediff-meta-buffer-keymap-setup-hook nil |
| 244 | "Hooks run just after setting up the `ediff-meta-buffer-map'. | 247 | "Hooks run just after setting up the `ediff-meta-buffer-map'. |
| 245 | This keymap controls key bindings in the meta buffer and is a local variable. | 248 | This keymap controls key bindings in the meta buffer and is a local variable. |
| 246 | This means that you can set different bindings for different kinds of meta | 249 | This means that you can set different bindings for different kinds of meta |
| 247 | buffers." | 250 | buffers." |
| 248 | :type 'hook | 251 | :type 'hook) |
| 249 | :group 'ediff-mult) | ||
| 250 | 252 | ||
| 251 | ;; Buffer holding the multi-file patch. Local to the meta buffer | 253 | ;; Buffer holding the multi-file patch. Local to the meta buffer |
| 252 | (ediff-defvar-local ediff-meta-patchbufer nil "") | 254 | (ediff-defvar-local ediff-meta-patchbufer nil "") |
| @@ -436,7 +438,7 @@ Toggled by ediff-toggle-verbose-help-meta-buffer" ) | |||
| 436 | (run-hooks 'ediff-meta-buffer-keymap-setup-hook)) | 438 | (run-hooks 'ediff-meta-buffer-keymap-setup-hook)) |
| 437 | 439 | ||
| 438 | 440 | ||
| 439 | (defun ediff-meta-mode () | 441 | (define-derived-mode ediff-meta-mode nil "MetaEdiff" |
| 440 | "This mode controls all operations on Ediff session groups. | 442 | "This mode controls all operations on Ediff session groups. |
| 441 | It is entered through one of the following commands: | 443 | It is entered through one of the following commands: |
| 442 | `ediff-directories' | 444 | `ediff-directories' |
| @@ -455,28 +457,7 @@ It is entered through one of the following commands: | |||
| 455 | `edir-merge-revisions-with-ancestor' | 457 | `edir-merge-revisions-with-ancestor' |
| 456 | 458 | ||
| 457 | Commands: | 459 | Commands: |
| 458 | \\{ediff-meta-buffer-map}" | 460 | \\{ediff-meta-buffer-map}") |
| 459 | ;; FIXME: Use define-derived-mode. | ||
| 460 | (kill-all-local-variables) | ||
| 461 | (setq major-mode 'ediff-meta-mode) | ||
| 462 | (setq mode-name "MetaEdiff") | ||
| 463 | ;; don't use run-mode-hooks here! | ||
| 464 | (run-hooks 'ediff-meta-mode-hook)) | ||
| 465 | |||
| 466 | |||
| 467 | ;; the keymap for the buffer showing directory differences | ||
| 468 | (suppress-keymap ediff-dir-diffs-buffer-map) | ||
| 469 | (define-key ediff-dir-diffs-buffer-map "q" 'ediff-bury-dir-diffs-buffer) | ||
| 470 | (define-key ediff-dir-diffs-buffer-map " " 'next-line) | ||
| 471 | (define-key ediff-dir-diffs-buffer-map "n" 'next-line) | ||
| 472 | (define-key ediff-dir-diffs-buffer-map "\C-?" 'previous-line) | ||
| 473 | (define-key ediff-dir-diffs-buffer-map "p" 'previous-line) | ||
| 474 | (define-key ediff-dir-diffs-buffer-map "C" 'ediff-dir-diff-copy-file) | ||
| 475 | (if (featurep 'emacs) | ||
| 476 | (define-key ediff-dir-diffs-buffer-map [mouse-2] 'ediff-dir-diff-copy-file) | ||
| 477 | (define-key ediff-dir-diffs-buffer-map [button2] 'ediff-dir-diff-copy-file)) | ||
| 478 | (define-key ediff-dir-diffs-buffer-map [delete] 'previous-line) | ||
| 479 | (define-key ediff-dir-diffs-buffer-map [backspace] 'previous-line) | ||
| 480 | 461 | ||
| 481 | (defun ediff-next-meta-item (count) | 462 | (defun ediff-next-meta-item (count) |
| 482 | "Move to the next item in Ediff registry or session group buffer. | 463 | "Move to the next item in Ediff registry or session group buffer. |
| @@ -598,8 +579,7 @@ behavior." | |||
| 598 | (defun ediff-intersect-directories (jobname | 579 | (defun ediff-intersect-directories (jobname |
| 599 | regexp dir1 dir2 | 580 | regexp dir1 dir2 |
| 600 | &optional | 581 | &optional |
| 601 | dir3 merge-autostore-dir comparison-func) | 582 | dir3 merge-autostore-dir) |
| 602 | (setq comparison-func (or comparison-func 'string=)) | ||
| 603 | (let (lis1 lis2 lis3 common auxdir1 auxdir2 auxdir3 common-part difflist) | 583 | (let (lis1 lis2 lis3 common auxdir1 auxdir2 auxdir3 common-part difflist) |
| 604 | 584 | ||
| 605 | (setq auxdir1 (file-name-as-directory dir1) | 585 | (setq auxdir1 (file-name-as-directory dir1) |
| @@ -632,24 +612,24 @@ behavior." | |||
| 632 | (if (ediff-nonempty-string-p merge-autostore-dir) | 612 | (if (ediff-nonempty-string-p merge-autostore-dir) |
| 633 | (setq merge-autostore-dir | 613 | (setq merge-autostore-dir |
| 634 | (file-name-as-directory merge-autostore-dir))) | 614 | (file-name-as-directory merge-autostore-dir))) |
| 635 | (setq common (ediff-intersection lis1 lis2 comparison-func)) | 615 | (setq common (ediff-intersection lis1 lis2 #'string=)) |
| 636 | 616 | ||
| 637 | ;; In merge with ancestor jobs, we don't intersect with lis3. | 617 | ;; In merge with ancestor jobs, we don't intersect with lis3. |
| 638 | ;; If there is no ancestor, we'll offer to merge without the ancestor. | 618 | ;; If there is no ancestor, we'll offer to merge without the ancestor. |
| 639 | ;; So, we intersect with lis3 only when we are doing 3-way file comparison | 619 | ;; So, we intersect with lis3 only when we are doing 3-way file comparison |
| 640 | (if (and lis3 (ediff-comparison-metajob3 jobname)) | 620 | (if (and lis3 (ediff-comparison-metajob3 jobname)) |
| 641 | (setq common (ediff-intersection common lis3 comparison-func))) | 621 | (setq common (ediff-intersection common lis3 #'string=))) |
| 642 | 622 | ||
| 643 | ;; copying is needed because sort sorts via side effects | 623 | ;; copying is needed because sort sorts via side effects |
| 644 | (setq common (sort (ediff-copy-list common) 'string-lessp)) | 624 | (setq common (sort (ediff-copy-list common) 'string-lessp)) |
| 645 | 625 | ||
| 646 | ;; compute difference list | 626 | ;; compute difference list |
| 647 | (setq difflist (ediff-set-difference | 627 | (setq difflist (ediff-set-difference |
| 648 | (ediff-union (ediff-union lis1 lis2 comparison-func) | 628 | (ediff-union (ediff-union lis1 lis2 #'string=) |
| 649 | lis3 | 629 | lis3 |
| 650 | comparison-func) | 630 | #'string=) |
| 651 | common | 631 | common |
| 652 | comparison-func) | 632 | #'string=) |
| 653 | difflist (delete "." difflist) | 633 | difflist (delete "." difflist) |
| 654 | ;; copying is needed because sort sorts via side effects | 634 | ;; copying is needed because sort sorts via side effects |
| 655 | difflist (sort (ediff-copy-list (delete ".." difflist)) | 635 | difflist (sort (ediff-copy-list (delete ".." difflist)) |
| @@ -679,7 +659,7 @@ behavior." | |||
| 679 | (ediff-make-new-meta-list-header regexp | 659 | (ediff-make-new-meta-list-header regexp |
| 680 | auxdir1 auxdir2 auxdir3 | 660 | auxdir1 auxdir2 auxdir3 |
| 681 | merge-autostore-dir | 661 | merge-autostore-dir |
| 682 | comparison-func) | 662 | #'string=) |
| 683 | difflist)) | 663 | difflist)) |
| 684 | 664 | ||
| 685 | (setq common-part | 665 | (setq common-part |
| @@ -688,7 +668,7 @@ behavior." | |||
| 688 | (ediff-make-new-meta-list-header regexp | 668 | (ediff-make-new-meta-list-header regexp |
| 689 | auxdir1 auxdir2 auxdir3 | 669 | auxdir1 auxdir2 auxdir3 |
| 690 | merge-autostore-dir | 670 | merge-autostore-dir |
| 691 | comparison-func) | 671 | #'string=) |
| 692 | (mapcar | 672 | (mapcar |
| 693 | (lambda (elt) | 673 | (lambda (elt) |
| 694 | (ediff-make-new-meta-list-element | 674 | (ediff-make-new-meta-list-element |
| @@ -767,9 +747,9 @@ behavior." | |||
| 767 | 747 | ||
| 768 | ;; If file groups selected by patterns will ever be implemented, this | 748 | ;; If file groups selected by patterns will ever be implemented, this |
| 769 | ;; comparison function might become useful. | 749 | ;; comparison function might become useful. |
| 770 | ;;;; uses external variables PAT1 PAT2 to compare str1/2 | 750 | ;; ;; uses external variables PAT1 PAT2 to compare str1/2 |
| 771 | ;;;; patterns must be of the form ???*???? where ??? are strings of chars | 751 | ;; ;; patterns must be of the form ???*???? where ??? are strings of chars |
| 772 | ;;;; containing no *. | 752 | ;; ;; containing no *. |
| 773 | ;;(defun ediff-pattern= (str1 str2) | 753 | ;;(defun ediff-pattern= (str1 str2) |
| 774 | ;; (let (pos11 pos12 pos21 pos22 len1 len2) | 754 | ;; (let (pos11 pos12 pos21 pos22 len1 len2) |
| 775 | ;; (setq pos11 0 | 755 | ;; (setq pos11 0 |
| @@ -799,7 +779,7 @@ behavior." | |||
| 799 | ;; redraw-function. Must return the created meta-buffer. | 779 | ;; redraw-function. Must return the created meta-buffer. |
| 800 | (defun ediff-prepare-meta-buffer (action-func meta-list | 780 | (defun ediff-prepare-meta-buffer (action-func meta-list |
| 801 | meta-buffer-name redraw-function | 781 | meta-buffer-name redraw-function |
| 802 | jobname &optional _startup-hooks) | 782 | jobname &optional startup-hooks) |
| 803 | (let* ((meta-buffer-name | 783 | (let* ((meta-buffer-name |
| 804 | (ediff-unique-buffer-name meta-buffer-name "*")) | 784 | (ediff-unique-buffer-name meta-buffer-name "*")) |
| 805 | (meta-buffer (get-buffer-create meta-buffer-name))) | 785 | (meta-buffer (get-buffer-create meta-buffer-name))) |
| @@ -841,7 +821,7 @@ behavior." | |||
| 841 | (setq buffer-read-only t) | 821 | (setq buffer-read-only t) |
| 842 | (set-buffer-modified-p nil) | 822 | (set-buffer-modified-p nil) |
| 843 | 823 | ||
| 844 | (run-hooks 'startup-hooks) | 824 | (mapc #'funcall startup-hooks) |
| 845 | 825 | ||
| 846 | ;; Arrange to show directory contents differences | 826 | ;; Arrange to show directory contents differences |
| 847 | ;; Must be after run startup-hooks, since ediff-dir-difference-list is | 827 | ;; Must be after run startup-hooks, since ediff-dir-difference-list is |
| @@ -1009,7 +989,7 @@ behavior." | |||
| 1009 | ;; was redrawn | 989 | ;; was redrawn |
| 1010 | (if (featurep 'xemacs) | 990 | (if (featurep 'xemacs) |
| 1011 | (map-extents 'delete-extent) | 991 | (map-extents 'delete-extent) |
| 1012 | (mapc 'delete-overlay (overlays-in 1 1))) | 992 | (mapc #'delete-overlay (overlays-in 1 1))) |
| 1013 | 993 | ||
| 1014 | (setq regexp (ediff-get-group-regexp meta-list) | 994 | (setq regexp (ediff-get-group-regexp meta-list) |
| 1015 | merge-autostore-dir | 995 | merge-autostore-dir |
| @@ -1455,7 +1435,7 @@ Useful commands: | |||
| 1455 | ;; was redrawn | 1435 | ;; was redrawn |
| 1456 | (if (featurep 'xemacs) | 1436 | (if (featurep 'xemacs) |
| 1457 | (map-extents 'delete-extent) | 1437 | (map-extents 'delete-extent) |
| 1458 | (mapc 'delete-overlay (overlays-in 1 1))) | 1438 | (mapc #'delete-overlay (overlays-in 1 1))) |
| 1459 | 1439 | ||
| 1460 | (insert (substitute-command-keys "\ | 1440 | (insert (substitute-command-keys "\ |
| 1461 | This is a registry of all active Ediff sessions. | 1441 | This is a registry of all active Ediff sessions. |
| @@ -1757,7 +1737,7 @@ all marked sessions must be active." | |||
| 1757 | (ediff-with-current-buffer ediff-meta-diff-buffer | 1737 | (ediff-with-current-buffer ediff-meta-diff-buffer |
| 1758 | (setq buffer-read-only nil) | 1738 | (setq buffer-read-only nil) |
| 1759 | (erase-buffer)) | 1739 | (erase-buffer)) |
| 1760 | (if (> (ediff-operate-on-marked-sessions 'ediff-append-custom-diff) 0) | 1740 | (if (> (ediff-operate-on-marked-sessions #'ediff-append-custom-diff) 0) |
| 1761 | ;; did something | 1741 | ;; did something |
| 1762 | (progn | 1742 | (progn |
| 1763 | (display-buffer ediff-meta-diff-buffer 'not-this-window) | 1743 | (display-buffer ediff-meta-diff-buffer 'not-this-window) |
| @@ -1812,7 +1792,7 @@ all marked sessions must be active." | |||
| 1812 | (info (ediff-get-meta-info meta-buf pos)) | 1792 | (info (ediff-get-meta-info meta-buf pos)) |
| 1813 | (session-buf (ediff-get-session-buffer info)) | 1793 | (session-buf (ediff-get-session-buffer info)) |
| 1814 | (session-number (ediff-get-session-number-at-pos pos meta-buf)) | 1794 | (session-number (ediff-get-session-number-at-pos pos meta-buf)) |
| 1815 | (default-regexp (eval ediff-default-filtering-regexp)) | 1795 | (default-regexp (eval ediff-default-filtering-regexp t)) |
| 1816 | merge-autostore-dir file1 file2 file3 regexp) | 1796 | merge-autostore-dir file1 file2 file3 regexp) |
| 1817 | 1797 | ||
| 1818 | (setq file1 (ediff-get-session-objA-name info) | 1798 | (setq file1 (ediff-get-session-objA-name info) |
| @@ -1850,7 +1830,7 @@ all marked sessions must be active." | |||
| 1850 | "Filter filenames through regular expression: ") | 1830 | "Filter filenames through regular expression: ") |
| 1851 | nil | 1831 | nil |
| 1852 | 'ediff-filtering-regexp-history | 1832 | 'ediff-filtering-regexp-history |
| 1853 | (eval ediff-default-filtering-regexp))) | 1833 | (eval ediff-default-filtering-regexp t))) |
| 1854 | (ediff-directories-internal | 1834 | (ediff-directories-internal |
| 1855 | file1 file2 file3 regexp | 1835 | file1 file2 file3 regexp |
| 1856 | ediff-session-action-function | 1836 | ediff-session-action-function |
| @@ -2198,10 +2178,10 @@ all marked sessions must be active." | |||
| 2198 | (if (ediff-buffer-live-p ediff-registry-buffer) | 2178 | (if (ediff-buffer-live-p ediff-registry-buffer) |
| 2199 | (ediff-redraw-registry-buffer) | 2179 | (ediff-redraw-registry-buffer) |
| 2200 | (ediff-prepare-meta-buffer | 2180 | (ediff-prepare-meta-buffer |
| 2201 | 'ediff-registry-action | 2181 | #'ediff-registry-action |
| 2202 | ediff-session-registry | 2182 | ediff-session-registry |
| 2203 | "*Ediff Registry" | 2183 | "*Ediff Registry" |
| 2204 | 'ediff-redraw-registry-buffer | 2184 | #'ediff-redraw-registry-buffer |
| 2205 | 'ediff-registry)) | 2185 | 'ediff-registry)) |
| 2206 | )) | 2186 | )) |
| 2207 | 2187 | ||
| @@ -2474,12 +2454,5 @@ for operation, or simply indicate which are equal files. If it is nil, then | |||
| 2474 | )) | 2454 | )) |
| 2475 | )) | 2455 | )) |
| 2476 | 2456 | ||
| 2477 | 2457 | (provide 'ediff-mult) | |
| 2478 | |||
| 2479 | ;; Local Variables: | ||
| 2480 | ;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | ||
| 2481 | ;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) | ||
| 2482 | ;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) | ||
| 2483 | ;; End: | ||
| 2484 | |||
| 2485 | ;;; ediff-mult.el ends here | 2458 | ;;; ediff-mult.el ends here |
diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el index 7b743a8d723..8e8f96e6d60 100644 --- a/lisp/vc/ediff-ptch.el +++ b/lisp/vc/ediff-ptch.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; ediff-ptch.el --- Ediff's patch support -*- lexical-binding: nil; -*- | 1 | ;;; ediff-ptch.el --- Ediff's patch support -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1996-2019 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1996-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -27,7 +27,6 @@ | |||
| 27 | 27 | ||
| 28 | (require 'diff-mode) ; For `diff-file-junk-re'. | 28 | (require 'diff-mode) ; For `diff-file-junk-re'. |
| 29 | 29 | ||
| 30 | (provide 'ediff-ptch) | ||
| 31 | 30 | ||
| 32 | (defgroup ediff-ptch nil | 31 | (defgroup ediff-ptch nil |
| 33 | "Ediff patch support." | 32 | "Ediff patch support." |
| @@ -37,12 +36,12 @@ | |||
| 37 | 36 | ||
| 38 | (require 'ediff-init) | 37 | (require 'ediff-init) |
| 39 | (require 'ediff-util) | 38 | (require 'ediff-util) |
| 39 | (require 'ediff) | ||
| 40 | 40 | ||
| 41 | (defcustom ediff-patch-program "patch" | 41 | (defcustom ediff-patch-program "patch" |
| 42 | "Name of the program that applies patches. | 42 | "Name of the program that applies patches. |
| 43 | It is recommended to use GNU-compatible versions." | 43 | It is recommended to use GNU-compatible versions." |
| 44 | :type 'string | 44 | :type 'string) |
| 45 | :group 'ediff-ptch) | ||
| 46 | (defcustom ediff-patch-options "-f" | 45 | (defcustom ediff-patch-options "-f" |
| 47 | "Options to pass to ediff-patch-program. | 46 | "Options to pass to ediff-patch-program. |
| 48 | 47 | ||
| @@ -51,8 +50,7 @@ Note: the `-b' option should be specified in `ediff-backup-specs'. | |||
| 51 | It is recommended to pass the `-f' option to the patch program, so it won't ask | 50 | It is recommended to pass the `-f' option to the patch program, so it won't ask |
| 52 | questions. However, some implementations don't accept this option, in which | 51 | questions. However, some implementations don't accept this option, in which |
| 53 | case the default value for this variable should be changed." | 52 | case the default value for this variable should be changed." |
| 54 | :type 'string | 53 | :type 'string) |
| 55 | :group 'ediff-ptch) | ||
| 56 | 54 | ||
| 57 | (defvar ediff-last-dir-patch nil | 55 | (defvar ediff-last-dir-patch nil |
| 58 | "Last directory used by an Ediff command for file to patch.") | 56 | "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." | |||
| 66 | (defcustom ediff-backup-extension ediff-default-backup-extension | 64 | (defcustom ediff-backup-extension ediff-default-backup-extension |
| 67 | "Backup extension used by the patch program. | 65 | "Backup extension used by the patch program. |
| 68 | See also `ediff-backup-specs'." | 66 | See also `ediff-backup-specs'." |
| 69 | :type 'string | 67 | :type 'string) |
| 70 | :group 'ediff-ptch) | ||
| 71 | 68 | ||
| 72 | (defun ediff-test-patch-utility () | 69 | (defun ediff-test-patch-utility () |
| 73 | (condition-case nil | 70 | (condition-case nil |
| @@ -110,14 +107,12 @@ still be set so Ediff will know which extension to use. | |||
| 110 | Ediff tries to guess the appropriate value for this variables. It is believed | 107 | Ediff tries to guess the appropriate value for this variables. It is believed |
| 111 | to be working for `traditional' patch, all versions of GNU patch, and for POSIX | 108 | to be working for `traditional' patch, all versions of GNU patch, and for POSIX |
| 112 | patch. So, don't change these variables, unless the default doesn't work." | 109 | patch. So, don't change these variables, unless the default doesn't work." |
| 113 | :type 'string | 110 | :type 'string) |
| 114 | :group 'ediff-ptch) | ||
| 115 | 111 | ||
| 116 | 112 | ||
| 117 | (defcustom ediff-patch-default-directory nil | 113 | (defcustom ediff-patch-default-directory nil |
| 118 | "Default directory to look for patches." | 114 | "Default directory to look for patches." |
| 119 | :type '(choice (const nil) string) | 115 | :type '(choice (const nil) string)) |
| 120 | :group 'ediff-ptch) | ||
| 121 | 116 | ||
| 122 | ;; This context diff does not recognize spaces inside files, but removing ' ' | 117 | ;; This context diff does not recognize spaces inside files, but removing ' ' |
| 123 | ;; from [^ \t] breaks normal patches for some reason | 118 | ;; 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." | |||
| 131 | "Regexp matching filename 2-liners at the start of each context diff. | 126 | "Regexp matching filename 2-liners at the start of each context diff. |
| 132 | You probably don't want to change that, unless you are using an obscure patch | 127 | You probably don't want to change that, unless you are using an obscure patch |
| 133 | program." | 128 | program." |
| 134 | :type 'regexp | 129 | :type 'regexp) |
| 135 | :group 'ediff-ptch) | ||
| 136 | 130 | ||
| 137 | ;; The buffer of the patch file. Local to control buffer. | 131 | ;; The buffer of the patch file. Local to control buffer. |
| 138 | (ediff-defvar-local ediff-patchbufer nil "") | 132 | (ediff-defvar-local ediff-patchbufer nil "") |
| @@ -687,7 +681,8 @@ optional argument, then use it." | |||
| 687 | ;; encoding that Emacs thinks is right for that type of text | 681 | ;; encoding that Emacs thinks is right for that type of text |
| 688 | (coding-system-for-write | 682 | (coding-system-for-write |
| 689 | (if (boundp 'buffer-file-coding-system) buffer-file-coding-system)) | 683 | (if (boundp 'buffer-file-coding-system) buffer-file-coding-system)) |
| 690 | target-buf buf-to-patch file-name-magic-p | 684 | (ediff--startup-hook startup-hooks) |
| 685 | target-buf buf-to-patch magic-file-name | ||
| 691 | patch-return-code ctl-buf backup-style aux-wind) | 686 | patch-return-code ctl-buf backup-style aux-wind) |
| 692 | 687 | ||
| 693 | (if (string-match-p "V" ediff-patch-options) | 688 | (if (string-match-p "V" ediff-patch-options) |
| @@ -698,15 +693,14 @@ optional argument, then use it." | |||
| 698 | ;; it is handled via auto-mode-alist and similar magic). | 693 | ;; it is handled via auto-mode-alist and similar magic). |
| 699 | ;; Check if there is a buffer visiting source-filename and if they are in | 694 | ;; Check if there is a buffer visiting source-filename and if they are in |
| 700 | ;; sync; arrange for the deletion of temp file. | 695 | ;; sync; arrange for the deletion of temp file. |
| 701 | (ediff-find-file 'true-source-filename 'buf-to-patch | 696 | (setq buf-to-patch (ediff-find-file true-source-filename |
| 702 | 'ediff-last-dir-patch 'startup-hooks) | 697 | 'ediff-last-dir-patch)) |
| 698 | (setq startup-hooks ediff--startup-hook) | ||
| 703 | 699 | ||
| 704 | ;; Check if source file name has triggered black magic, such as file name | 700 | ;; Check if source file name has triggered black magic, such as file name |
| 705 | ;; handlers or auto mode alist, and make a note of it. | 701 | ;; handlers or auto mode alist, and make a note of it. |
| 706 | ;; true-source-filename should be either the original name or a | 702 | (setq magic-file-name |
| 707 | ;; temporary file where we put the after-product of the file name handler. | 703 | (with-current-buffer buf-to-patch ediff--magic-file-name)) |
| 708 | (setq file-name-magic-p (not (equal (file-truename true-source-filename) | ||
| 709 | (file-truename source-filename)))) | ||
| 710 | 704 | ||
| 711 | ;; Checkout orig file, if necessary, so that the patched file | 705 | ;; Checkout orig file, if necessary, so that the patched file |
| 712 | ;; could be checked back in. | 706 | ;; could be checked back in. |
| @@ -730,7 +724,7 @@ optional argument, then use it." | |||
| 730 | ediff-patch-program | 724 | ediff-patch-program |
| 731 | ediff-patch-options | 725 | ediff-patch-options |
| 732 | ediff-backup-specs | 726 | ediff-backup-specs |
| 733 | (expand-file-name true-source-filename)) | 727 | (ediff--buffer-file-name buf-to-patch)) |
| 734 | )) | 728 | )) |
| 735 | 729 | ||
| 736 | ;; restore environment for gnu patch | 730 | ;; restore environment for gnu patch |
| @@ -744,7 +738,8 @@ optional argument, then use it." | |||
| 744 | 738 | ||
| 745 | (or (and (ediff-patch-return-code-ok patch-return-code) | 739 | (or (and (ediff-patch-return-code-ok patch-return-code) |
| 746 | (file-exists-p | 740 | (file-exists-p |
| 747 | (concat true-source-filename ediff-backup-extension))) | 741 | (concat (ediff--buffer-file-name buf-to-patch) |
| 742 | ediff-backup-extension))) | ||
| 748 | (progn | 743 | (progn |
| 749 | (with-output-to-temp-buffer ediff-msg-buffer | 744 | (with-output-to-temp-buffer ediff-msg-buffer |
| 750 | (ediff-with-current-buffer standard-output | 745 | (ediff-with-current-buffer standard-output |
| @@ -789,7 +784,7 @@ you can still examine the changes via M-x ediff-files" | |||
| 789 | ;; Without magic, the original file is renamed (usually into | 784 | ;; Without magic, the original file is renamed (usually into |
| 790 | ;; old-name_orig) and the result of patching will have the same name as | 785 | ;; old-name_orig) and the result of patching will have the same name as |
| 791 | ;; the original. | 786 | ;; the original. |
| 792 | (if (not file-name-magic-p) | 787 | (if (not magic-file-name) |
| 793 | (ediff-with-current-buffer buf-to-patch | 788 | (ediff-with-current-buffer buf-to-patch |
| 794 | (set-visited-file-name | 789 | (set-visited-file-name |
| 795 | (concat source-filename ediff-backup-extension)) | 790 | (concat source-filename ediff-backup-extension)) |
| @@ -802,19 +797,19 @@ you can still examine the changes via M-x ediff-files" | |||
| 802 | (setq target-filename | 797 | (setq target-filename |
| 803 | (concat | 798 | (concat |
| 804 | (if (ediff-file-remote-p (file-truename source-filename)) | 799 | (if (ediff-file-remote-p (file-truename source-filename)) |
| 805 | true-source-filename | 800 | magic-file-name |
| 806 | source-filename) | 801 | source-filename) |
| 807 | "_patched")) | 802 | "_patched")) |
| 808 | 803 | ||
| 809 | (rename-file true-source-filename target-filename t) | 804 | (rename-file magic-file-name target-filename t) |
| 810 | 805 | ||
| 811 | ;; arrange that the temp copy of orig will be deleted | 806 | ;; arrange that the temp copy of orig will be deleted |
| 812 | (rename-file (concat true-source-filename ediff-backup-extension) | 807 | (rename-file (concat magic-file-name |
| 813 | true-source-filename t)) | 808 | ediff-backup-extension) |
| 809 | magic-file-name t)) | ||
| 814 | 810 | ||
| 815 | ;; make orig buffer read-only | 811 | ;; make orig buffer read-only |
| 816 | (setq startup-hooks | 812 | (push #'ediff-set-read-only-in-buf-A startup-hooks) |
| 817 | (cons 'ediff-set-read-only-in-buf-A startup-hooks)) | ||
| 818 | 813 | ||
| 819 | ;; set up a buf for the patched file | 814 | ;; set up a buf for the patched file |
| 820 | (setq target-buf (find-file-noselect target-filename)) | 815 | (setq target-buf (find-file-noselect target-filename)) |
| @@ -833,17 +828,16 @@ you can still examine the changes via M-x ediff-files" | |||
| 833 | 828 | ||
| 834 | (defun ediff-multi-patch-internal (patch-buf &optional startup-hooks) | 829 | (defun ediff-multi-patch-internal (patch-buf &optional startup-hooks) |
| 835 | (let (meta-buf) | 830 | (let (meta-buf) |
| 836 | (setq startup-hooks | 831 | ;; this sets various vars in the meta buffer inside |
| 837 | ;; this sets various vars in the meta buffer inside | 832 | ;; ediff-prepare-meta-buffer |
| 838 | ;; ediff-prepare-meta-buffer | 833 | (push (lambda () |
| 839 | (cons (lambda () | 834 | ;; tell what to do if the user clicks on a session record |
| 840 | ;; tell what to do if the user clicks on a session record | 835 | (setq ediff-session-action-function |
| 841 | (setq ediff-session-action-function | 836 | 'ediff-patch-file-form-meta |
| 842 | 'ediff-patch-file-form-meta | 837 | ediff-meta-patchbufer patch-buf) ) |
| 843 | ediff-meta-patchbufer patch-buf) ) | 838 | startup-hooks) |
| 844 | startup-hooks)) | ||
| 845 | (setq meta-buf (ediff-prepare-meta-buffer | 839 | (setq meta-buf (ediff-prepare-meta-buffer |
| 846 | 'ediff-filegroup-action | 840 | #'ediff-filegroup-action |
| 847 | (ediff-with-current-buffer patch-buf | 841 | (ediff-with-current-buffer patch-buf |
| 848 | (cons (ediff-make-new-meta-list-header | 842 | (cons (ediff-make-new-meta-list-header |
| 849 | nil ; regexp | 843 | nil ; regexp |
| @@ -854,19 +848,11 @@ you can still examine the changes via M-x ediff-files" | |||
| 854 | ) | 848 | ) |
| 855 | ediff-patch-map)) | 849 | ediff-patch-map)) |
| 856 | "*Ediff Session Group Panel" | 850 | "*Ediff Session Group Panel" |
| 857 | 'ediff-redraw-directory-group-buffer | 851 | #'ediff-redraw-directory-group-buffer |
| 858 | 'ediff-multifile-patch | 852 | 'ediff-multifile-patch |
| 859 | startup-hooks)) | 853 | startup-hooks)) |
| 860 | (ediff-show-meta-buffer meta-buf) | 854 | (ediff-show-meta-buffer meta-buf) |
| 861 | )) | 855 | )) |
| 862 | 856 | ||
| 863 | 857 | (provide 'ediff-ptch) | |
| 864 | |||
| 865 | |||
| 866 | ;; Local Variables: | ||
| 867 | ;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | ||
| 868 | ;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) | ||
| 869 | ;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) | ||
| 870 | ;; End: | ||
| 871 | |||
| 872 | ;;; ediff-ptch.el ends here | 858 | ;;; ediff-ptch.el ends here |
diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index 6e282a4fd80..796027deadb 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | ;;; Code: | 25 | ;;; Code: |
| 26 | 26 | ||
| 27 | 27 | ||
| 28 | (provide 'ediff-util) | 28 | (provide 'ediff-util) ;FIXME: Break cyclic dependencies and move to the end! |
| 29 | 29 | ||
| 30 | ;; Compiler pacifier | 30 | ;; Compiler pacifier |
| 31 | (defvar ediff-use-toolbar-p) | 31 | (defvar ediff-use-toolbar-p) |
| @@ -390,8 +390,8 @@ to invocation.") | |||
| 390 | ;; parameters are processed. | 390 | ;; parameters are processed. |
| 391 | (setq ediff-setup-diff-regions-function | 391 | (setq ediff-setup-diff-regions-function |
| 392 | (if ediff-diff3-job | 392 | (if ediff-diff3-job |
| 393 | 'ediff-setup-diff-regions3 | 393 | #'ediff-setup-diff-regions3 |
| 394 | 'ediff-setup-diff-regions)) | 394 | #'ediff-setup-diff-regions)) |
| 395 | 395 | ||
| 396 | (setq ediff-wide-bounds | 396 | (setq ediff-wide-bounds |
| 397 | (list (ediff-make-bullet-proof-overlay | 397 | (list (ediff-make-bullet-proof-overlay |
| @@ -885,8 +885,8 @@ Does nothing if file-A and file-B are in different frames." | |||
| 885 | (eq frame-A frame-C) (eq frame-B frame-C)))) | 885 | (eq frame-A frame-C) (eq frame-B frame-C)))) |
| 886 | (setq ediff-split-window-function | 886 | (setq ediff-split-window-function |
| 887 | (if (eq ediff-split-window-function 'split-window-vertically) | 887 | (if (eq ediff-split-window-function 'split-window-vertically) |
| 888 | 'split-window-horizontally | 888 | #'split-window-horizontally |
| 889 | 'split-window-vertically)) | 889 | #'split-window-vertically)) |
| 890 | (message "Buffers being compared are in different frames")) | 890 | (message "Buffers being compared are in different frames")) |
| 891 | (ediff-recenter 'no-rehighlight))) | 891 | (ediff-recenter 'no-rehighlight))) |
| 892 | 892 | ||
| @@ -1300,25 +1300,25 @@ which see." | |||
| 1300 | (user-error "%sEmacs is not running as a window application" | 1300 | (user-error "%sEmacs is not running as a window application" |
| 1301 | (if (featurep 'emacs) "" "X"))) | 1301 | (if (featurep 'emacs) "" "X"))) |
| 1302 | 1302 | ||
| 1303 | (cond ((eq ediff-window-setup-function 'ediff-setup-windows-multiframe) | 1303 | (cond ((eq ediff-window-setup-function #'ediff-setup-windows-multiframe) |
| 1304 | (setq ediff-multiframe nil) | 1304 | (setq ediff-multiframe nil) |
| 1305 | (setq window-setup-func 'ediff-setup-windows-plain) | 1305 | (setq window-setup-func #'ediff-setup-windows-plain) |
| 1306 | (message "ediff is now in 'plain' mode")) | 1306 | (message "ediff is now in 'plain' mode")) |
| 1307 | ((eq ediff-window-setup-function 'ediff-setup-windows-plain) | 1307 | ((eq ediff-window-setup-function #'ediff-setup-windows-plain) |
| 1308 | (if (ediff-in-control-buffer-p) | 1308 | (if (ediff-in-control-buffer-p) |
| 1309 | (ediff-kill-bottom-toolbar)) | 1309 | (ediff-kill-bottom-toolbar)) |
| 1310 | (if (and (ediff-buffer-live-p ediff-control-buffer) | 1310 | (if (and (ediff-buffer-live-p ediff-control-buffer) |
| 1311 | (window-live-p ediff-control-window)) | 1311 | (window-live-p ediff-control-window)) |
| 1312 | (set-window-dedicated-p ediff-control-window nil)) | 1312 | (set-window-dedicated-p ediff-control-window nil)) |
| 1313 | (setq ediff-multiframe t) | 1313 | (setq ediff-multiframe t) |
| 1314 | (setq window-setup-func 'ediff-setup-windows-multiframe) | 1314 | (setq window-setup-func #'ediff-setup-windows-multiframe) |
| 1315 | (message "ediff is now in 'multiframe' mode")) | 1315 | (message "ediff is now in 'multiframe' mode")) |
| 1316 | (t | 1316 | (t |
| 1317 | (if (and (ediff-buffer-live-p ediff-control-buffer) | 1317 | (if (and (ediff-buffer-live-p ediff-control-buffer) |
| 1318 | (window-live-p ediff-control-window)) | 1318 | (window-live-p ediff-control-window)) |
| 1319 | (set-window-dedicated-p ediff-control-window nil)) | 1319 | (set-window-dedicated-p ediff-control-window nil)) |
| 1320 | (setq ediff-multiframe t) | 1320 | (setq ediff-multiframe t) |
| 1321 | (setq window-setup-func 'ediff-setup-windows-multiframe)) | 1321 | (setq window-setup-func #'ediff-setup-windows-multiframe)) |
| 1322 | (message "ediff is now in 'multiframe' mode")) | 1322 | (message "ediff is now in 'multiframe' mode")) |
| 1323 | 1323 | ||
| 1324 | ;; change default | 1324 | ;; change default |
| @@ -1340,6 +1340,7 @@ which see." | |||
| 1340 | Works only in versions of Emacs that support toolbars. | 1340 | Works only in versions of Emacs that support toolbars. |
| 1341 | To change the default, set the variable `ediff-use-toolbar-p', which see." | 1341 | To change the default, set the variable `ediff-use-toolbar-p', which see." |
| 1342 | (interactive) | 1342 | (interactive) |
| 1343 | ;; FIXME: Make it work in Emacs! | ||
| 1343 | (if (featurep 'ediff-tbar) | 1344 | (if (featurep 'ediff-tbar) |
| 1344 | (progn | 1345 | (progn |
| 1345 | (or (ediff-window-display-p) | 1346 | (or (ediff-window-display-p) |
| @@ -1544,8 +1545,8 @@ the one half of the height of window-A." | |||
| 1544 | 1545 | ||
| 1545 | (ediff-operate-on-windows | 1546 | (ediff-operate-on-windows |
| 1546 | (if (memq (ediff-last-command-char) '(?v ?\C-v)) | 1547 | (if (memq (ediff-last-command-char) '(?v ?\C-v)) |
| 1547 | 'scroll-up | 1548 | #'scroll-up |
| 1548 | 'scroll-down) | 1549 | #'scroll-down) |
| 1549 | ;; calculate argument to scroll-up/down | 1550 | ;; calculate argument to scroll-up/down |
| 1550 | ;; if there is an explicit argument | 1551 | ;; if there is an explicit argument |
| 1551 | (if (and arg (not (equal arg '-))) | 1552 | (if (and arg (not (equal arg '-))) |
| @@ -1601,10 +1602,10 @@ the width of the A/B/C windows." | |||
| 1601 | (if (= (ediff-last-command-char) ?<) | 1602 | (if (= (ediff-last-command-char) ?<) |
| 1602 | (lambda (arg) | 1603 | (lambda (arg) |
| 1603 | (let ((prefix-arg arg)) | 1604 | (let ((prefix-arg arg)) |
| 1604 | (call-interactively 'scroll-left))) | 1605 | (call-interactively #'scroll-left))) |
| 1605 | (lambda (arg) | 1606 | (lambda (arg) |
| 1606 | (let ((prefix-arg arg)) | 1607 | (let ((prefix-arg arg)) |
| 1607 | (call-interactively 'scroll-right)))) | 1608 | (call-interactively #'scroll-right)))) |
| 1608 | ;; calculate argument to scroll-left/right | 1609 | ;; calculate argument to scroll-left/right |
| 1609 | ;; if there is an explicit argument | 1610 | ;; if there is an explicit argument |
| 1610 | (if (and arg (not (equal arg '-))) | 1611 | (if (and arg (not (equal arg '-))) |
| @@ -1718,9 +1719,9 @@ the width of the A/B/C windows." | |||
| 1718 | (ediff-with-current-buffer (or ctl-buf ediff-control-buffer) | 1719 | (ediff-with-current-buffer (or ctl-buf ediff-control-buffer) |
| 1719 | (if (ediff-valid-difference-p n) | 1720 | (if (ediff-valid-difference-p n) |
| 1720 | (let* ((func (cond ((eq op 'scroll-down) | 1721 | (let* ((func (cond ((eq op 'scroll-down) |
| 1721 | 'ediff-get-lines-to-region-start) | 1722 | #'ediff-get-lines-to-region-start) |
| 1722 | ((eq op 'scroll-up) | 1723 | ((eq op 'scroll-up) |
| 1723 | 'ediff-get-lines-to-region-end) | 1724 | #'ediff-get-lines-to-region-end) |
| 1724 | (t (lambda (_a _b _c) 0)))) | 1725 | (t (lambda (_a _b _c) 0)))) |
| 1725 | (max-lines (max (funcall func 'A n ctl-buf) | 1726 | (max-lines (max (funcall func 'A n ctl-buf) |
| 1726 | (funcall func 'B n ctl-buf) | 1727 | (funcall func 'B n ctl-buf) |
| @@ -2077,7 +2078,7 @@ ARG is a prefix argument. If nil, copy the current difference region." | |||
| 2077 | (ediff-save-diff-region n to-buf-type reg-to-delete)))) | 2078 | (ediff-save-diff-region n to-buf-type reg-to-delete)))) |
| 2078 | (error (message "ediff-copy-diff: %s %s" | 2079 | (error (message "ediff-copy-diff: %s %s" |
| 2079 | (car conds) | 2080 | (car conds) |
| 2080 | (mapconcat 'prin1-to-string (cdr conds) " ")) | 2081 | (mapconcat #'prin1-to-string (cdr conds) " ")) |
| 2081 | (beep 1) | 2082 | (beep 1) |
| 2082 | (sit-for 2) ; let the user see the error msg | 2083 | (sit-for 2) ; let the user see the error msg |
| 2083 | (setq saved-p nil) | 2084 | (setq saved-p nil) |
| @@ -2178,7 +2179,7 @@ ARG is a prefix argument. If nil, copy the current difference region." | |||
| 2178 | )) | 2179 | )) |
| 2179 | (error (message "ediff-pop-diff: %s %s" | 2180 | (error (message "ediff-pop-diff: %s %s" |
| 2180 | (car conds) | 2181 | (car conds) |
| 2181 | (mapconcat 'prin1-to-string (cdr conds) " ")) | 2182 | (mapconcat #'prin1-to-string (cdr conds) " ")) |
| 2182 | (beep 1))) | 2183 | (beep 1))) |
| 2183 | 2184 | ||
| 2184 | ;; Clearing fine diffs is necessary for | 2185 | ;; Clearing fine diffs is necessary for |
| @@ -2241,7 +2242,7 @@ a regular expression typed in by the user." | |||
| 2241 | ediff-hide-regexp-matches-function) | 2242 | ediff-hide-regexp-matches-function) |
| 2242 | (eq (ediff-last-command-char) ?h))) | 2243 | (eq (ediff-last-command-char) ?h))) |
| 2243 | (message "Selective browsing by regexp turned off") | 2244 | (message "Selective browsing by regexp turned off") |
| 2244 | (setq ediff-skip-diff-region-function 'ediff-show-all-diffs)) | 2245 | (setq ediff-skip-diff-region-function #'ediff-show-all-diffs)) |
| 2245 | ((eq (ediff-last-command-char) ?h) | 2246 | ((eq (ediff-last-command-char) ?h) |
| 2246 | (setq ediff-skip-diff-region-function ediff-hide-regexp-matches-function | 2247 | (setq ediff-skip-diff-region-function ediff-hide-regexp-matches-function |
| 2247 | regexp-A | 2248 | regexp-A |
| @@ -2929,7 +2930,7 @@ Hit \\[ediff-recenter] to reset the windows afterward." | |||
| 2929 | (princ | 2930 | (princ |
| 2930 | "\nSkipping merge regions that differ from default setting")) | 2931 | "\nSkipping merge regions that differ from default setting")) |
| 2931 | 2932 | ||
| 2932 | (cond ((eq ediff-skip-diff-region-function 'ediff-show-all-diffs) | 2933 | (cond ((eq ediff-skip-diff-region-function #'ediff-show-all-diffs) |
| 2933 | (princ "\nSelective browsing by regexp is off\n")) | 2934 | (princ "\nSelective browsing by regexp is off\n")) |
| 2934 | ((eq ediff-skip-diff-region-function | 2935 | ((eq ediff-skip-diff-region-function |
| 2935 | ediff-hide-regexp-matches-function) | 2936 | ediff-hide-regexp-matches-function) |
| @@ -3314,7 +3315,7 @@ Hit \\[ediff-recenter] to reset the windows afterward." | |||
| 3314 | (buffer-name) | 3315 | (buffer-name) |
| 3315 | buffer-file-name)) | 3316 | buffer-file-name)) |
| 3316 | (progn | 3317 | (progn |
| 3317 | (if file-magic | 3318 | (if file-magic ;FIXME: Why? |
| 3318 | (erase-buffer)) | 3319 | (erase-buffer)) |
| 3319 | (revert-buffer t t)) | 3320 | (revert-buffer t t)) |
| 3320 | (user-error "Buffer out of sync for file %s" buffer-file-name)))) | 3321 | (user-error "Buffer out of sync for file %s" buffer-file-name)))) |
| @@ -3573,12 +3574,12 @@ Ediff Control Panel to restore highlighting." | |||
| 3573 | (t (beep 1) | 3574 | (t (beep 1) |
| 3574 | (message | 3575 | (message |
| 3575 | "Valid values are %s" | 3576 | "Valid values are %s" |
| 3576 | (mapconcat 'char-to-string possibilities " or ")) | 3577 | (mapconcat #'char-to-string possibilities " or ")) |
| 3577 | (sit-for 2) | 3578 | (sit-for 2) |
| 3578 | t)) | 3579 | t)) |
| 3579 | (let ((cursor-in-echo-area t)) | 3580 | (let ((cursor-in-echo-area t)) |
| 3580 | (message "Enter the 1st buffer you want to compare (%s): " | 3581 | (message "Enter the 1st buffer you want to compare (%s): " |
| 3581 | (mapconcat 'char-to-string possibilities " or ")) | 3582 | (mapconcat #'char-to-string possibilities " or ")) |
| 3582 | (setq answer (capitalize (read-char-exclusive))))) | 3583 | (setq answer (capitalize (read-char-exclusive))))) |
| 3583 | (setq answer "") ; silence error msg | 3584 | (setq answer "") ; silence error msg |
| 3584 | (while (cond ((memq answer possibilities) | 3585 | (while (cond ((memq answer possibilities) |
| @@ -3592,12 +3593,12 @@ Ediff Control Panel to restore highlighting." | |||
| 3592 | (t (beep 1) | 3593 | (t (beep 1) |
| 3593 | (message | 3594 | (message |
| 3594 | "Valid values are %s" | 3595 | "Valid values are %s" |
| 3595 | (mapconcat 'char-to-string possibilities " or ")) | 3596 | (mapconcat #'char-to-string possibilities " or ")) |
| 3596 | (sit-for 2) | 3597 | (sit-for 2) |
| 3597 | t)) | 3598 | t)) |
| 3598 | (let ((cursor-in-echo-area t)) | 3599 | (let ((cursor-in-echo-area t)) |
| 3599 | (message "Enter the 2nd buffer you want to compare (%s): " | 3600 | (message "Enter the 2nd buffer you want to compare (%s): " |
| 3600 | (mapconcat 'char-to-string possibilities "/")) | 3601 | (mapconcat #'char-to-string possibilities "/")) |
| 3601 | (setq answer (capitalize (read-char-exclusive)))))) | 3602 | (setq answer (capitalize (read-char-exclusive)))))) |
| 3602 | (t ; 2way comparison | 3603 | (t ; 2way comparison |
| 3603 | (setq bufA ediff-buffer-A | 3604 | (setq bufA ediff-buffer-A |
| @@ -4110,27 +4111,12 @@ Mail anyway? (y or n) ") | |||
| 4110 | (if (featurep 'xemacs) | 4111 | (if (featurep 'xemacs) |
| 4111 | (zmacs-activate-region) | 4112 | (zmacs-activate-region) |
| 4112 | (make-local-variable 'transient-mark-mode) | 4113 | (make-local-variable 'transient-mark-mode) |
| 4113 | (setq mark-active t transient-mark-mode t))) | 4114 | (setq mark-active 'ediff-util transient-mark-mode t))) |
| 4114 | 4115 | ||
| 4115 | (defun ediff-nuke-selective-display () | 4116 | (defun ediff-nuke-selective-display () |
| 4116 | (if (featurep 'xemacs) | 4117 | (if (featurep 'xemacs) |
| 4117 | (nuke-selective-display) | 4118 | (nuke-selective-display) |
| 4118 | (save-excursion | 4119 | )) |
| 4119 | (save-restriction | ||
| 4120 | (widen) | ||
| 4121 | (goto-char (point-min)) | ||
| 4122 | (let ((mod-p (buffer-modified-p)) | ||
| 4123 | buffer-read-only end) | ||
| 4124 | (and (eq t selective-display) | ||
| 4125 | (while (search-forward "\^M" nil t) | ||
| 4126 | (end-of-line) | ||
| 4127 | (setq end (point)) | ||
| 4128 | (beginning-of-line) | ||
| 4129 | (while (search-forward "\^M" end t) | ||
| 4130 | (delete-char -1) | ||
| 4131 | (insert "\^J")))) | ||
| 4132 | (set-buffer-modified-p mod-p) | ||
| 4133 | (setq selective-display nil)))))) | ||
| 4134 | 4120 | ||
| 4135 | 4121 | ||
| 4136 | ;; The next two are modified versions from emerge.el. | 4122 | ;; The next two are modified versions from emerge.el. |
| @@ -4244,7 +4230,7 @@ Mail anyway? (y or n) ") | |||
| 4244 | ;; fine-diff-vector | 4230 | ;; fine-diff-vector |
| 4245 | (if (= (length (aref overl-vec 1)) 0) | 4231 | (if (= (length (aref overl-vec 1)) 0) |
| 4246 | "none\n" | 4232 | "none\n" |
| 4247 | (mapconcat 'prin1-to-string | 4233 | (mapconcat #'prin1-to-string |
| 4248 | (aref overl-vec 1) "\n\t\t\t ")) | 4234 | (aref overl-vec 1) "\n\t\t\t ")) |
| 4249 | (aref overl-vec 2) ; no fine diff flag | 4235 | (aref overl-vec 2) ; no fine diff flag |
| 4250 | (aref overl-vec 3) ; state-of-diff | 4236 | (aref overl-vec 3) ; state-of-diff |
| @@ -4320,10 +4306,7 @@ Mail anyway? (y or n) ") | |||
| 4320 | (setq lis1 (cdr lis1))) | 4306 | (setq lis1 (cdr lis1))) |
| 4321 | (cdr result))) | 4307 | (cdr result))) |
| 4322 | 4308 | ||
| 4323 | (defun ediff-add-to-history (history-var newelt) | 4309 | (define-obsolete-function-alias 'ediff-add-to-history #'add-to-history "27.1") |
| 4324 | (if (fboundp 'add-to-history) | ||
| 4325 | (add-to-history history-var newelt) | ||
| 4326 | (set history-var (cons newelt (symbol-value history-var))))) | ||
| 4327 | 4310 | ||
| 4328 | (defalias 'ediff-copy-list 'copy-sequence) | 4311 | (defalias 'ediff-copy-list 'copy-sequence) |
| 4329 | 4312 | ||
| @@ -4333,11 +4316,4 @@ Mail anyway? (y or n) ") | |||
| 4333 | 4316 | ||
| 4334 | (run-hooks 'ediff-load-hook) | 4317 | (run-hooks 'ediff-load-hook) |
| 4335 | 4318 | ||
| 4336 | |||
| 4337 | ;; Local Variables: | ||
| 4338 | ;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | ||
| 4339 | ;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) | ||
| 4340 | ;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) | ||
| 4341 | ;; End: | ||
| 4342 | |||
| 4343 | ;;; ediff-util.el ends here | 4319 | ;;; ediff-util.el ends here |
diff --git a/lisp/vc/ediff-vers.el b/lisp/vc/ediff-vers.el index cadb057a9ab..3826edad891 100644 --- a/lisp/vc/ediff-vers.el +++ b/lisp/vc/ediff-vers.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; ediff-vers.el --- version control interface to Ediff -*- lexical-binding: nil; -*- | 1 | ;;; ediff-vers.el --- version control interface to Ediff -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1995-1997, 2001-2019 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1995-1997, 2001-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -96,11 +96,10 @@ comparison or merge operations are being performed." | |||
| 96 | (ediff-vc-revision-other-window rev2)) | 96 | (ediff-vc-revision-other-window rev2)) |
| 97 | (setq rev2buf (current-buffer) | 97 | (setq rev2buf (current-buffer) |
| 98 | file2 (buffer-file-name))) | 98 | file2 (buffer-file-name))) |
| 99 | (setq startup-hooks | 99 | (push (lambda () |
| 100 | (cons `(lambda () | 100 | (ediff-delete-version-file file1) |
| 101 | (ediff-delete-version-file ,file1) | 101 | (or (string= rev2 "") (ediff-delete-version-file file2))) |
| 102 | (or ,(string= rev2 "") (ediff-delete-version-file ,file2))) | 102 | startup-hooks)) |
| 103 | startup-hooks))) | ||
| 104 | (ediff-buffers | 103 | (ediff-buffers |
| 105 | rev1buf rev2buf | 104 | rev1buf rev2buf |
| 106 | startup-hooks | 105 | startup-hooks |
| @@ -124,7 +123,7 @@ comparison or merge operations are being performed." | |||
| 124 | (let ((output-buffer (ediff-rcs-get-output-buffer filename buff))) | 123 | (let ((output-buffer (ediff-rcs-get-output-buffer filename buff))) |
| 125 | (delete-windows-on output-buffer) | 124 | (delete-windows-on output-buffer) |
| 126 | (with-current-buffer output-buffer | 125 | (with-current-buffer output-buffer |
| 127 | (apply 'call-process "co" nil t nil | 126 | (apply #'call-process "co" nil t nil |
| 128 | ;; -q: quiet (no diagnostics) | 127 | ;; -q: quiet (no diagnostics) |
| 129 | (append switches rcs-default-co-switches | 128 | (append switches rcs-default-co-switches |
| 130 | (list "-q" filename))))) | 129 | (list "-q" filename))))) |
| @@ -175,20 +174,20 @@ comparison or merge operations are being performed." | |||
| 175 | (if ancestor-rev | 174 | (if ancestor-rev |
| 176 | (save-excursion | 175 | (save-excursion |
| 177 | (if (string= ancestor-rev "") | 176 | (if (string= ancestor-rev "") |
| 178 | (setq ancestor-rev (ediff-vc-working-revision buffer-file-name))) | 177 | (setq ancestor-rev (ediff-vc-working-revision |
| 178 | buffer-file-name))) | ||
| 179 | (ediff-vc-revision-other-window ancestor-rev) | 179 | (ediff-vc-revision-other-window ancestor-rev) |
| 180 | (setq ancestor-buf (current-buffer)))) | 180 | (setq ancestor-buf (current-buffer)))) |
| 181 | (setq startup-hooks | 181 | (push (let ((f1 (buffer-file-name buf1)) |
| 182 | (cons | 182 | (f2 (unless (string= rev2 "") (buffer-file-name buf2))) |
| 183 | `(lambda () | 183 | (fa (unless (or (string= ancestor-rev "") |
| 184 | (ediff-delete-version-file ,(buffer-file-name buf1)) | 184 | (not ancestor-rev)) |
| 185 | (or ,(string= rev2 "") | 185 | (buffer-file-name ancestor-buf)))) |
| 186 | (ediff-delete-version-file ,(buffer-file-name buf2))) | 186 | (lambda () |
| 187 | (or ,(string= ancestor-rev "") | 187 | (ediff-delete-version-file f1) |
| 188 | ,(not ancestor-rev) | 188 | (if f2 (ediff-delete-version-file f2)) |
| 189 | (ediff-delete-version-file ,(buffer-file-name ancestor-buf))) | 189 | (if fa (ediff-delete-version-file fa)))) |
| 190 | ) | 190 | startup-hooks)) |
| 191 | startup-hooks))) | ||
| 192 | (if ancestor-rev | 191 | (if ancestor-rev |
| 193 | (ediff-merge-buffers-with-ancestor | 192 | (ediff-merge-buffers-with-ancestor |
| 194 | buf1 buf2 ancestor-buf | 193 | buf1 buf2 ancestor-buf |
| @@ -227,12 +226,4 @@ comparison or merge operations are being performed." | |||
| 227 | 226 | ||
| 228 | 227 | ||
| 229 | (provide 'ediff-vers) | 228 | (provide 'ediff-vers) |
| 230 | |||
| 231 | |||
| 232 | ;; Local Variables: | ||
| 233 | ;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | ||
| 234 | ;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) | ||
| 235 | ;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) | ||
| 236 | ;; End: | ||
| 237 | |||
| 238 | ;;; ediff-vers.el ends here | 229 | ;;; ediff-vers.el ends here |
diff --git a/lisp/vc/ediff-wind.el b/lisp/vc/ediff-wind.el index 5439110160b..d4a60a16df1 100644 --- a/lisp/vc/ediff-wind.el +++ b/lisp/vc/ediff-wind.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; ediff-wind.el --- window manipulation utilities -*- lexical-binding: nil; -*- | 1 | ;;; ediff-wind.el --- window manipulation utilities -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994-1997, 2000-2019 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994-1997, 2000-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -94,7 +94,6 @@ provided functions are written." | |||
| 94 | (const :tag "Multi Frame" ediff-setup-windows-multiframe) | 94 | (const :tag "Multi Frame" ediff-setup-windows-multiframe) |
| 95 | (const :tag "Single Frame" ediff-setup-windows-plain) | 95 | (const :tag "Single Frame" ediff-setup-windows-plain) |
| 96 | (function :tag "Other function")) | 96 | (function :tag "Other function")) |
| 97 | :group 'ediff-window | ||
| 98 | :version "24.3") | 97 | :version "24.3") |
| 99 | 98 | ||
| 100 | ;; indicates if we are in a multiframe setup | 99 | ;; indicates if we are in a multiframe setup |
| @@ -138,8 +137,7 @@ In this case, Ediff will use those frames to display these buffers." | |||
| 138 | :type '(choice | 137 | :type '(choice |
| 139 | (const :tag "Split vertically" split-window-vertically) | 138 | (const :tag "Split vertically" split-window-vertically) |
| 140 | (const :tag "Split horizontally" split-window-horizontally) | 139 | (const :tag "Split horizontally" split-window-horizontally) |
| 141 | function) | 140 | function)) |
| 142 | :group 'ediff-window) | ||
| 143 | 141 | ||
| 144 | (defcustom ediff-merge-split-window-function #'split-window-horizontally | 142 | (defcustom ediff-merge-split-window-function #'split-window-horizontally |
| 145 | "The function used to split the main window between buffer-A and buffer-B. | 143 | "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." | |||
| 151 | :type '(choice | 149 | :type '(choice |
| 152 | (const :tag "Split vertically" split-window-vertically) | 150 | (const :tag "Split vertically" split-window-vertically) |
| 153 | (const :tag "Split horizontally" split-window-horizontally) | 151 | (const :tag "Split horizontally" split-window-horizontally) |
| 154 | function) | 152 | function)) |
| 155 | :group 'ediff-window) | ||
| 156 | 153 | ||
| 157 | ;; Definitions hidden from the compiler by compat wrappers. | 154 | ;; Definitions hidden from the compiler by compat wrappers. |
| 158 | (declare-function ediff-display-pixel-width "ediff-init") | 155 | (declare-function ediff-display-pixel-width "ediff-init") |
| @@ -205,16 +202,14 @@ Used internally---not a user option.") | |||
| 205 | If `maybe', Ediff will do it sometimes, but not after operations that require | 202 | If `maybe', Ediff will do it sometimes, but not after operations that require |
| 206 | relatively long time. If nil, the mouse will be entirely user's | 203 | relatively long time. If nil, the mouse will be entirely user's |
| 207 | responsibility." | 204 | responsibility." |
| 208 | :type 'boolean | 205 | :type 'boolean) |
| 209 | :group 'ediff-window) | ||
| 210 | 206 | ||
| 211 | (defcustom ediff-control-frame-position-function #'ediff-make-frame-position | 207 | (defcustom ediff-control-frame-position-function #'ediff-make-frame-position |
| 212 | "Function to call to determine the desired location for the control panel. | 208 | "Function to call to determine the desired location for the control panel. |
| 213 | Expects three parameters: the control buffer, the desired width and height | 209 | Expects three parameters: the control buffer, the desired width and height |
| 214 | of the control frame. It returns an association list | 210 | of the control frame. It returns an association list |
| 215 | of the form \((top . <position>) \(left . <position>))" | 211 | of the form \((top . <position>) \(left . <position>))" |
| 216 | :type 'function | 212 | :type 'function) |
| 217 | :group 'ediff-window) | ||
| 218 | 213 | ||
| 219 | (defcustom ediff-control-frame-upward-shift 42 | 214 | (defcustom ediff-control-frame-upward-shift 42 |
| 220 | "The upward shift of control frame from the top of buffer A's frame. | 215 | "The upward shift of control frame from the top of buffer A's frame. |
| @@ -222,8 +217,7 @@ Measured in pixels. | |||
| 222 | This is used by the default control frame positioning function, | 217 | This is used by the default control frame positioning function, |
| 223 | `ediff-make-frame-position'. This variable is provided for easy | 218 | `ediff-make-frame-position'. This variable is provided for easy |
| 224 | customization of the default control frame positioning." | 219 | customization of the default control frame positioning." |
| 225 | :type 'integer | 220 | :type 'integer) |
| 226 | :group 'ediff-window) | ||
| 227 | 221 | ||
| 228 | (defcustom ediff-narrow-control-frame-leftward-shift (if (featurep 'xemacs) 7 3) | 222 | (defcustom ediff-narrow-control-frame-leftward-shift (if (featurep 'xemacs) 7 3) |
| 229 | "The leftward shift of control frame from the right edge of buf A's frame. | 223 | "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, | |||
| 232 | `ediff-make-frame-position' to adjust the position of the control frame | 226 | `ediff-make-frame-position' to adjust the position of the control frame |
| 233 | when it shows the short menu. This variable is provided for easy | 227 | when it shows the short menu. This variable is provided for easy |
| 234 | customization of the default." | 228 | customization of the default." |
| 235 | :type 'integer | 229 | :type 'integer) |
| 236 | :group 'ediff-window) | ||
| 237 | 230 | ||
| 238 | (defcustom ediff-wide-control-frame-rightward-shift 7 | 231 | (defcustom ediff-wide-control-frame-rightward-shift 7 |
| 239 | "The rightward shift of control frame from the left edge of buf A's frame. | 232 | "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, | |||
| 242 | `ediff-make-frame-position' to adjust the position of the control frame | 235 | `ediff-make-frame-position' to adjust the position of the control frame |
| 243 | when it shows the full menu. This variable is provided for easy | 236 | when it shows the full menu. This variable is provided for easy |
| 244 | customization of the default." | 237 | customization of the default." |
| 245 | :type 'integer | 238 | :type 'integer) |
| 246 | :group 'ediff-window) | ||
| 247 | 239 | ||
| 248 | 240 | ||
| 249 | ;; Wide frame display | 241 | ;; Wide frame display |
| @@ -276,8 +268,7 @@ This is only useful in Emacs and only for certain kinds of window managers, | |||
| 276 | such as TWM and its derivatives, since the window manager must permit | 268 | such as TWM and its derivatives, since the window manager must permit |
| 277 | keyboard input to go into icons. XEmacs completely ignores keyboard input | 269 | keyboard input to go into icons. XEmacs completely ignores keyboard input |
| 278 | into icons, regardless of the window manager." | 270 | into icons, regardless of the window manager." |
| 279 | :type 'boolean | 271 | :type 'boolean) |
| 280 | :group 'ediff-window) | ||
| 281 | 272 | ||
| 282 | ;;; Functions | 273 | ;;; Functions |
| 283 | 274 | ||
| @@ -342,8 +333,8 @@ into icons, regardless of the window manager." | |||
| 342 | 333 | ||
| 343 | (defun ediff-setup-windows-default (buffer-A buffer-B buffer-C control-buffer) | 334 | (defun ediff-setup-windows-default (buffer-A buffer-B buffer-C control-buffer) |
| 344 | (funcall (if (display-graphic-p) | 335 | (funcall (if (display-graphic-p) |
| 345 | 'ediff-setup-windows-multiframe | 336 | #'ediff-setup-windows-multiframe |
| 346 | 'ediff-setup-windows-plain) | 337 | #'ediff-setup-windows-plain) |
| 347 | buffer-A buffer-B buffer-C control-buffer)) | 338 | buffer-A buffer-B buffer-C control-buffer)) |
| 348 | 339 | ||
| 349 | ;; Just set up 3 windows. | 340 | ;; Just set up 3 windows. |
| @@ -524,7 +515,7 @@ into icons, regardless of the window manager." | |||
| 524 | 515 | ||
| 525 | ;; Skip dedicated or iconified frames. | 516 | ;; Skip dedicated or iconified frames. |
| 526 | ;; Unsplittable frames are taken care of later. | 517 | ;; Unsplittable frames are taken care of later. |
| 527 | (ediff-skip-unsuitable-frames 'ok-unsplittable) | 518 | ;; (ediff-skip-unsuitable-frames 'ok-unsplittable) |
| 528 | 519 | ||
| 529 | (let* ((window-min-height 1) | 520 | (let* ((window-min-height 1) |
| 530 | (wind-A (ediff-get-visible-buffer-window buf-A)) | 521 | (wind-A (ediff-get-visible-buffer-window buf-A)) |
diff --git a/lisp/vc/ediff.el b/lisp/vc/ediff.el index 4e2ead4f439..20e27003dac 100644 --- a/lisp/vc/ediff.el +++ b/lisp/vc/ediff.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; ediff.el --- a comprehensive visual interface to diff & patch -*- lexical-binding: nil; -*- | 1 | ;;; ediff.el --- a comprehensive visual interface to diff & patch -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994-2019 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -107,8 +107,6 @@ | |||
| 107 | 107 | ||
| 108 | ;;; Code: | 108 | ;;; Code: |
| 109 | 109 | ||
| 110 | (provide 'ediff) | ||
| 111 | |||
| 112 | (require 'ediff-util) | 110 | (require 'ediff-util) |
| 113 | ;; end pacifier | 111 | ;; end pacifier |
| 114 | 112 | ||
| @@ -123,8 +121,7 @@ | |||
| 123 | 121 | ||
| 124 | (defcustom ediff-use-last-dir nil | 122 | (defcustom ediff-use-last-dir nil |
| 125 | "If t, Ediff will use previous directory as default when reading file name." | 123 | "If t, Ediff will use previous directory as default when reading file name." |
| 126 | :type 'boolean | 124 | :type 'boolean) |
| 127 | :group 'ediff) | ||
| 128 | 125 | ||
| 129 | ;; Last directory used by an Ediff command for file-A. | 126 | ;; Last directory used by an Ediff command for file-A. |
| 130 | (defvar ediff-last-dir-A nil) | 127 | (defvar ediff-last-dir-A nil) |
| @@ -197,7 +194,7 @@ arguments after setting up the Ediff buffers." | |||
| 197 | ediff-last-dir-B | 194 | ediff-last-dir-B |
| 198 | (file-name-directory f))) | 195 | (file-name-directory f))) |
| 199 | (progn | 196 | (progn |
| 200 | (ediff-add-to-history | 197 | (add-to-history |
| 201 | 'file-name-history | 198 | 'file-name-history |
| 202 | (ediff-abbreviate-file-name | 199 | (ediff-abbreviate-file-name |
| 203 | (expand-file-name | 200 | (expand-file-name |
| @@ -235,7 +232,7 @@ arguments after setting up the Ediff buffers." | |||
| 235 | ediff-last-dir-B | 232 | ediff-last-dir-B |
| 236 | (file-name-directory f))) | 233 | (file-name-directory f))) |
| 237 | (progn | 234 | (progn |
| 238 | (ediff-add-to-history | 235 | (add-to-history |
| 239 | 'file-name-history | 236 | 'file-name-history |
| 240 | (ediff-abbreviate-file-name | 237 | (ediff-abbreviate-file-name |
| 241 | (expand-file-name | 238 | (expand-file-name |
| @@ -247,7 +244,7 @@ arguments after setting up the Ediff buffers." | |||
| 247 | ediff-last-dir-C | 244 | ediff-last-dir-C |
| 248 | (file-name-directory ff))) | 245 | (file-name-directory ff))) |
| 249 | (progn | 246 | (progn |
| 250 | (ediff-add-to-history | 247 | (add-to-history |
| 251 | 'file-name-history | 248 | 'file-name-history |
| 252 | (ediff-abbreviate-file-name | 249 | (ediff-abbreviate-file-name |
| 253 | (expand-file-name | 250 | (expand-file-name |
| @@ -270,20 +267,24 @@ arguments after setting up the Ediff buffers." | |||
| 270 | ;;;###autoload | 267 | ;;;###autoload |
| 271 | (defalias 'ediff3 'ediff-files3) | 268 | (defalias 'ediff3 'ediff-files3) |
| 272 | 269 | ||
| 270 | (defvar-local ediff--magic-file-name nil | ||
| 271 | "Name of file where buffer's content was saved. | ||
| 272 | Only non-nil in \"magic\" buffers such as those of remote files.") | ||
| 273 | 273 | ||
| 274 | (defun ediff-find-file (file-var buffer-name &optional last-dir hooks-var) | 274 | (defvar ediff--startup-hook nil) |
| 275 | |||
| 276 | (defun ediff-find-file (file &optional last-dir) | ||
| 275 | "Visit FILE and arrange its buffer to Ediff's liking. | 277 | "Visit FILE and arrange its buffer to Ediff's liking. |
| 276 | FILE-VAR is actually a variable symbol whose value must contain a true | 278 | FILE is the file name. |
| 277 | file name. | ||
| 278 | BUFFER-NAME is a variable symbol, which will get the buffer object into | ||
| 279 | which FILE is read. | ||
| 280 | LAST-DIR is the directory variable symbol where FILE's | 279 | LAST-DIR is the directory variable symbol where FILE's |
| 281 | directory name should be returned. HOOKS-VAR is a variable symbol that will | 280 | directory name should be returned. May push to `ediff--startup-hook' |
| 282 | be assigned the hook to be executed after `ediff-startup' is finished. | 281 | functions to be executed after `ediff-startup' is finished. |
| 283 | `ediff-find-file' arranges that the temp files it might create will be | 282 | `ediff-find-file' arranges that the temp files it might create will be |
| 284 | deleted." | 283 | deleted. |
| 285 | (let* ((file (symbol-value file-var)) | 284 | Returns the buffer into which the file is visited. |
| 286 | (file-magic (ediff-filename-magic-p file)) | 285 | Also sets `ediff--magic-file-name' to indicate where the file's content |
| 286 | has been saved (if not in `buffer-file-name')." | ||
| 287 | (let* ((file-magic (ediff-filename-magic-p file)) | ||
| 287 | (temp-file-name-prefix (file-name-nondirectory file))) | 288 | (temp-file-name-prefix (file-name-nondirectory file))) |
| 288 | (cond ((not (file-readable-p file)) | 289 | (cond ((not (file-readable-p file)) |
| 289 | (user-error "File `%s' does not exist or is not readable" file)) | 290 | (user-error "File `%s' does not exist or is not readable" file)) |
| @@ -298,58 +299,61 @@ deleted." | |||
| 298 | (set last-dir (expand-file-name (file-name-directory file)))) | 299 | (set last-dir (expand-file-name (file-name-directory file)))) |
| 299 | 300 | ||
| 300 | ;; Setup the buffer | 301 | ;; Setup the buffer |
| 301 | (set buffer-name (find-file-noselect file)) | 302 | (with-current-buffer (find-file-noselect file) |
| 302 | 303 | (widen) ; Make sure the entire file is seen | |
| 303 | (ediff-with-current-buffer (symbol-value buffer-name) | 304 | (setq ediff--magic-file-name nil) |
| 304 | (widen) ; Make sure the entire file is seen | 305 | (cond (file-magic ; File has a handler, such as jka-compr-handler or |
| 305 | (cond (file-magic ; file has a handler, such as jka-compr-handler or | 306 | ; ange-ftp-hook-function--arrange for temp file |
| 306 | ;;; ange-ftp-hook-function--arrange for temp file | ||
| 307 | (ediff-verify-file-buffer 'magic) | 307 | (ediff-verify-file-buffer 'magic) |
| 308 | (setq file | 308 | (let ((file |
| 309 | (ediff-make-temp-file | 309 | (ediff-make-temp-file |
| 310 | (current-buffer) temp-file-name-prefix)) | 310 | (current-buffer) temp-file-name-prefix))) |
| 311 | (set hooks-var (cons `(lambda () (delete-file ,file)) | 311 | (add-hook 'ediff--startup-hook (lambda () (delete-file file))) |
| 312 | (symbol-value hooks-var)))) | 312 | (setq ediff--magic-file-name file))) |
| 313 | ;; file processed via auto-mode-alist, a la uncompress.el | 313 | ;; file processed via auto-mode-alist, a la uncompress.el |
| 314 | ((not (equal (file-truename file) | 314 | ((not (equal (file-truename file) |
| 315 | (file-truename (buffer-file-name)))) | 315 | (file-truename buffer-file-name))) |
| 316 | (setq file | 316 | (let ((file |
| 317 | (ediff-make-temp-file | 317 | (ediff-make-temp-file |
| 318 | (current-buffer) temp-file-name-prefix)) | 318 | (current-buffer) temp-file-name-prefix))) |
| 319 | (set hooks-var (cons `(lambda () (delete-file ,file)) | 319 | (add-hook 'ediff--startup-hook (lambda () (delete-file file))) |
| 320 | (symbol-value hooks-var)))) | 320 | (setq ediff--magic-file-name file))) |
| 321 | (t ;; plain file---just check that the file matches the buffer | 321 | (t ;; plain file---just check that the file matches the buffer |
| 322 | (ediff-verify-file-buffer)))) | 322 | (ediff-verify-file-buffer))) |
| 323 | (set file-var file))) | 323 | (current-buffer)))) |
| 324 | |||
| 325 | (defun ediff--buffer-file-name (buf) | ||
| 326 | (when buf | ||
| 327 | (with-current-buffer buf (or ediff--magic-file-name buffer-file-name)))) | ||
| 324 | 328 | ||
| 325 | ;; MERGE-BUFFER-FILE is the file to be associated with the merge buffer | 329 | ;; MERGE-BUFFER-FILE is the file to be associated with the merge buffer |
| 326 | (defun ediff-files-internal (file-A file-B file-C startup-hooks job-name | 330 | (defun ediff-files-internal (file-A file-B file-C startup-hooks job-name |
| 327 | &optional merge-buffer-file) | 331 | &optional merge-buffer-file) |
| 328 | (let (buf-A buf-B buf-C) | 332 | (if (string= file-A file-B) |
| 329 | (if (string= file-A file-B) | 333 | (error "Files A and B are the same")) |
| 330 | (error "Files A and B are the same")) | 334 | (if (stringp file-C) |
| 331 | (if (stringp file-C) | 335 | (or (and (string= file-A file-C) (error "Files A and C are the same")) |
| 332 | (or (and (string= file-A file-C) (error "Files A and C are the same")) | 336 | (and (string= file-B file-C) (error "Files B and C are the same")))) |
| 333 | (and (string= file-B file-C) (error "Files B and C are the same")))) | 337 | (let ((ediff--startup-hook startup-hooks) |
| 338 | buf-A buf-B buf-C) | ||
| 339 | |||
| 334 | (message "Reading file %s ... " file-A) | 340 | (message "Reading file %s ... " file-A) |
| 335 | ;;(sit-for 0) | 341 | ;;(sit-for 0) |
| 336 | (ediff-find-file 'file-A 'buf-A 'ediff-last-dir-A 'startup-hooks) | 342 | (setq buf-A (ediff-find-file file-A 'ediff-last-dir-A)) |
| 337 | (message "Reading file %s ... " file-B) | 343 | (message "Reading file %s ... " file-B) |
| 338 | ;;(sit-for 0) | 344 | ;;(sit-for 0) |
| 339 | (ediff-find-file 'file-B 'buf-B 'ediff-last-dir-B 'startup-hooks) | 345 | (setq buf-B (ediff-find-file file-B 'ediff-last-dir-B)) |
| 340 | (if (stringp file-C) | 346 | (when (stringp file-C) |
| 341 | (progn | 347 | (message "Reading file %s ... " file-C) |
| 342 | (message "Reading file %s ... " file-C) | 348 | ;;(sit-for 0) |
| 343 | ;;(sit-for 0) | 349 | (setq buf-C (ediff-find-file |
| 344 | (ediff-find-file | 350 | file-C |
| 345 | 'file-C 'buf-C | 351 | (if (eq job-name 'ediff-merge-files-with-ancestor) |
| 346 | (if (eq job-name 'ediff-merge-files-with-ancestor) | 352 | 'ediff-last-dir-ancestor 'ediff-last-dir-C)))) |
| 347 | 'ediff-last-dir-ancestor 'ediff-last-dir-C) | 353 | (ediff-setup buf-A (ediff--buffer-file-name buf-A) |
| 348 | 'startup-hooks))) | 354 | buf-B (ediff--buffer-file-name buf-B) |
| 349 | (ediff-setup buf-A file-A | 355 | buf-C (ediff--buffer-file-name buf-C) |
| 350 | buf-B file-B | 356 | ediff--startup-hook |
| 351 | buf-C file-C | ||
| 352 | startup-hooks | ||
| 353 | (list (cons 'ediff-job-name job-name)) | 357 | (list (cons 'ediff-job-name job-name)) |
| 354 | merge-buffer-file))) | 358 | merge-buffer-file))) |
| 355 | 359 | ||
| @@ -515,10 +519,10 @@ symbol describing the Ediff job type; it defaults to | |||
| 515 | (get-buffer buf-B) file-B | 519 | (get-buffer buf-B) file-B |
| 516 | (if buf-C-is-alive (get-buffer buf-C)) | 520 | (if buf-C-is-alive (get-buffer buf-C)) |
| 517 | file-C | 521 | file-C |
| 518 | (cons `(lambda () | 522 | (cons (lambda () |
| 519 | (delete-file ,file-A) | 523 | (delete-file file-A) |
| 520 | (delete-file ,file-B) | 524 | (delete-file file-B) |
| 521 | (if (stringp ,file-C) (delete-file ,file-C))) | 525 | (if (stringp file-C) (delete-file file-C))) |
| 522 | startup-hooks) | 526 | startup-hooks) |
| 523 | (list (cons 'ediff-job-name job-name)) | 527 | (list (cons 'ediff-job-name job-name)) |
| 524 | merge-buffer-file)) | 528 | merge-buffer-file)) |
| @@ -572,7 +576,7 @@ expression; only file names that match the regexp are considered." | |||
| 572 | (eval ediff-default-filtering-regexp)) | 576 | (eval ediff-default-filtering-regexp)) |
| 573 | ))) | 577 | ))) |
| 574 | (ediff-directories-internal | 578 | (ediff-directories-internal |
| 575 | dir1 dir2 nil regexp 'ediff-files 'ediff-directories | 579 | dir1 dir2 nil regexp #'ediff-files 'ediff-directories |
| 576 | )) | 580 | )) |
| 577 | 581 | ||
| 578 | ;;;###autoload | 582 | ;;;###autoload |
| @@ -638,7 +642,7 @@ regular expression; only file names that match the regexp are considered." | |||
| 638 | (eval ediff-default-filtering-regexp)) | 642 | (eval ediff-default-filtering-regexp)) |
| 639 | ))) | 643 | ))) |
| 640 | (ediff-directories-internal | 644 | (ediff-directories-internal |
| 641 | dir1 dir2 dir3 regexp 'ediff-files3 'ediff-directories3 | 645 | dir1 dir2 dir3 regexp #'ediff-files3 'ediff-directories3 |
| 642 | )) | 646 | )) |
| 643 | 647 | ||
| 644 | ;;;###autoload | 648 | ;;;###autoload |
| @@ -671,7 +675,7 @@ MERGE-AUTOSTORE-DIR is the directory in which to store merged files." | |||
| 671 | (eval ediff-default-filtering-regexp)) | 675 | (eval ediff-default-filtering-regexp)) |
| 672 | ))) | 676 | ))) |
| 673 | (ediff-directories-internal | 677 | (ediff-directories-internal |
| 674 | dir1 dir2 nil regexp 'ediff-merge-files 'ediff-merge-directories | 678 | dir1 dir2 nil regexp #'ediff-merge-files 'ediff-merge-directories |
| 675 | nil merge-autostore-dir | 679 | nil merge-autostore-dir |
| 676 | )) | 680 | )) |
| 677 | 681 | ||
| @@ -714,7 +718,7 @@ MERGE-AUTOSTORE-DIR is the directory in which to store merged files." | |||
| 714 | ))) | 718 | ))) |
| 715 | (ediff-directories-internal | 719 | (ediff-directories-internal |
| 716 | dir1 dir2 ancestor-dir regexp | 720 | dir1 dir2 ancestor-dir regexp |
| 717 | 'ediff-merge-files-with-ancestor 'ediff-merge-directories-with-ancestor | 721 | #'ediff-merge-files-with-ancestor 'ediff-merge-directories-with-ancestor |
| 718 | nil merge-autostore-dir | 722 | nil merge-autostore-dir |
| 719 | )) | 723 | )) |
| 720 | 724 | ||
| @@ -844,21 +848,20 @@ MERGE-AUTOSTORE-DIR is the directory in which to store merged files." | |||
| 844 | (setq dir-diff-struct (ediff-intersect-directories | 848 | (setq dir-diff-struct (ediff-intersect-directories |
| 845 | jobname | 849 | jobname |
| 846 | regexp dir1 dir2 dir3 merge-autostore-dir)) | 850 | regexp dir1 dir2 dir3 merge-autostore-dir)) |
| 847 | (setq startup-hooks | 851 | ;; this sets various vars in the meta buffer inside |
| 848 | ;; this sets various vars in the meta buffer inside | 852 | ;; ediff-prepare-meta-buffer |
| 849 | ;; ediff-prepare-meta-buffer | 853 | (push (lambda () |
| 850 | (cons `(lambda () | 854 | ;; tell what to do if the user clicks on a session record |
| 851 | ;; tell what to do if the user clicks on a session record | 855 | (setq ediff-session-action-function action) |
| 852 | (setq ediff-session-action-function (quote ,action)) | 856 | ;; set ediff-dir-difference-list |
| 853 | ;; set ediff-dir-difference-list | 857 | (setq ediff-dir-difference-list |
| 854 | (setq ediff-dir-difference-list | 858 | (cdr dir-diff-struct))) |
| 855 | (cdr (quote ,dir-diff-struct)))) | 859 | startup-hooks) |
| 856 | startup-hooks)) | ||
| 857 | (setq meta-buf (ediff-prepare-meta-buffer | 860 | (setq meta-buf (ediff-prepare-meta-buffer |
| 858 | 'ediff-filegroup-action | 861 | #'ediff-filegroup-action |
| 859 | (car dir-diff-struct) | 862 | (car dir-diff-struct) |
| 860 | "*Ediff Session Group Panel" | 863 | "*Ediff Session Group Panel" |
| 861 | 'ediff-redraw-directory-group-buffer | 864 | #'ediff-redraw-directory-group-buffer |
| 862 | jobname | 865 | jobname |
| 863 | startup-hooks)) | 866 | startup-hooks)) |
| 864 | (ediff-show-meta-buffer meta-buf) | 867 | (ediff-show-meta-buffer meta-buf) |
| @@ -897,18 +900,17 @@ MERGE-AUTOSTORE-DIR is the directory in which to store merged files." | |||
| 897 | (setq file-list | 900 | (setq file-list |
| 898 | (ediff-get-directory-files-under-revision | 901 | (ediff-get-directory-files-under-revision |
| 899 | jobname regexp dir1 merge-autostore-dir)) | 902 | jobname regexp dir1 merge-autostore-dir)) |
| 900 | (setq startup-hooks | 903 | ;; this sets various vars in the meta buffer inside |
| 901 | ;; this sets various vars in the meta buffer inside | 904 | ;; ediff-prepare-meta-buffer |
| 902 | ;; ediff-prepare-meta-buffer | 905 | (push (lambda () |
| 903 | (cons `(lambda () | 906 | ;; tell what to do if the user clicks on a session record |
| 904 | ;; tell what to do if the user clicks on a session record | 907 | (setq ediff-session-action-function action)) |
| 905 | (setq ediff-session-action-function (quote ,action))) | 908 | startup-hooks) |
| 906 | startup-hooks)) | ||
| 907 | (setq meta-buf (ediff-prepare-meta-buffer | 909 | (setq meta-buf (ediff-prepare-meta-buffer |
| 908 | 'ediff-filegroup-action | 910 | #'ediff-filegroup-action |
| 909 | file-list | 911 | file-list |
| 910 | "*Ediff Session Group Panel" | 912 | "*Ediff Session Group Panel" |
| 911 | 'ediff-redraw-directory-group-buffer | 913 | #'ediff-redraw-directory-group-buffer |
| 912 | jobname | 914 | jobname |
| 913 | startup-hooks)) | 915 | startup-hooks)) |
| 914 | (ediff-show-meta-buffer meta-buf) | 916 | (ediff-show-meta-buffer meta-buf) |
| @@ -1121,9 +1123,9 @@ arguments after setting up the Ediff buffers." | |||
| 1121 | (ediff-setup buffer-A file-A | 1123 | (ediff-setup buffer-A file-A |
| 1122 | buffer-B file-B | 1124 | buffer-B file-B |
| 1123 | nil nil ; buffer & file C | 1125 | nil nil ; buffer & file C |
| 1124 | (cons `(lambda () | 1126 | (cons (lambda () |
| 1125 | (delete-file ,file-A) | 1127 | (delete-file file-A) |
| 1126 | (delete-file ,file-B)) | 1128 | (delete-file file-B)) |
| 1127 | startup-hooks) | 1129 | startup-hooks) |
| 1128 | (append | 1130 | (append |
| 1129 | (list (cons 'ediff-word-mode word-mode) | 1131 | (list (cons 'ediff-word-mode word-mode) |
| @@ -1176,7 +1178,7 @@ is the name of the file to be associated with the merge buffer.." | |||
| 1176 | ediff-last-dir-B | 1178 | ediff-last-dir-B |
| 1177 | (file-name-directory f))) | 1179 | (file-name-directory f))) |
| 1178 | (progn | 1180 | (progn |
| 1179 | (ediff-add-to-history | 1181 | (add-to-history |
| 1180 | 'file-name-history | 1182 | 'file-name-history |
| 1181 | (ediff-abbreviate-file-name | 1183 | (ediff-abbreviate-file-name |
| 1182 | (expand-file-name | 1184 | (expand-file-name |
| @@ -1225,7 +1227,7 @@ the file to be associated with the merge buffer." | |||
| 1225 | ediff-last-dir-B | 1227 | ediff-last-dir-B |
| 1226 | (file-name-directory f))) | 1228 | (file-name-directory f))) |
| 1227 | (progn | 1229 | (progn |
| 1228 | (ediff-add-to-history | 1230 | (add-to-history |
| 1229 | 'file-name-history | 1231 | 'file-name-history |
| 1230 | (ediff-abbreviate-file-name | 1232 | (ediff-abbreviate-file-name |
| 1231 | (expand-file-name | 1233 | (expand-file-name |
| @@ -1238,7 +1240,7 @@ the file to be associated with the merge buffer." | |||
| 1238 | ediff-last-dir-ancestor | 1240 | ediff-last-dir-ancestor |
| 1239 | (file-name-directory ff))) | 1241 | (file-name-directory ff))) |
| 1240 | (progn | 1242 | (progn |
| 1241 | (ediff-add-to-history | 1243 | (add-to-history |
| 1242 | 'file-name-history | 1244 | 'file-name-history |
| 1243 | (ediff-abbreviate-file-name | 1245 | (ediff-abbreviate-file-name |
| 1244 | (expand-file-name | 1246 | (expand-file-name |
| @@ -1650,17 +1652,7 @@ With optional NODE, goes to that node." | |||
| 1650 | (setq command-line-args-left (nthcdr 4 command-line-args-left)) | 1652 | (setq command-line-args-left (nthcdr 4 command-line-args-left)) |
| 1651 | (ediff-merge-directories-with-ancestor file-a file-b ancestor regexp))) | 1653 | (ediff-merge-directories-with-ancestor file-a file-b ancestor regexp))) |
| 1652 | 1654 | ||
| 1653 | |||
| 1654 | |||
| 1655 | (require 'ediff-util) | ||
| 1656 | |||
| 1657 | (run-hooks 'ediff-load-hook) | 1655 | (run-hooks 'ediff-load-hook) |
| 1658 | 1656 | ||
| 1659 | 1657 | (provide 'ediff) | |
| 1660 | ;; Local Variables: | ||
| 1661 | ;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | ||
| 1662 | ;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) | ||
| 1663 | ;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) | ||
| 1664 | ;; End: | ||
| 1665 | |||
| 1666 | ;;; ediff.el ends here | 1658 | ;;; ediff.el ends here |