@@ -316,8 +316,13 @@ RECURSIVE is non-nil."
316
316
(user-error " This buffer isn't bound to a file" )))
317
317
318
318
(defvar +apply-patch-dwim-proj-dir nil )
319
+ (defvar +apply-patch-dwim-extra-options " --ignore-whitespace" )
320
+ (autoload 'project-files " project" )
321
+ (autoload 'diff-hunk-next " diff-mode" )
322
+ (autoload 'diff-hunk-file-names " diff-mode" )
319
323
320
324
(defun +patch-get-patched-files (patch-buff)
325
+ " Get the list of the patches A/B files mentioned in PATCH-BUFF."
321
326
(with-current-buffer (get-buffer patch-buff)
322
327
(save-excursion
323
328
(goto-char (point-min ))
@@ -372,13 +377,16 @@ When a region is active, propose to use it as the patch buffer."
372
377
((length> results 1 ) (completing-read " Select a target directory: " results))
373
378
(t (read-directory-name " Cannot deduce the target directory, select one: " )))))
374
379
(when (y-or-n-p (format " Apply patch %S in directory %S ? " (file-name-nondirectory (buffer-file-name patch-buf)) target-dir))
375
- ; ; Hakish way of forcing `ediff-patch-file' to use the `target-file-or-dir' without asking
376
- (cl-letf (((symbol-function 'read-file-name )
377
- (lambda (&rest args )
378
- (if (length= patch-files 2 )
379
- (expand-file-name (caar candidates) target-dir)
380
- target-dir))))
381
- (ediff-patch-file nil patch-buf))))))))
380
+ ; ; Add the `+apply-patch-dwim-extra-options' to `ediff-patch-options'
381
+ (require 'ediff-ptch ) ; for `ediff-patch-options'
382
+ (let ((ediff-patch-options (format " %s %s " ediff-patch-options +apply-patch-dwim-extra-options)))
383
+ ; ; Hackish way of forcing `ediff-patch-file' to use the `target-file-or-dir' without asking
384
+ (cl-letf (((symbol-function 'read-file-name )
385
+ (lambda (&rest args )
386
+ (if (length= patch-files 2 )
387
+ (expand-file-name (caar candidates) target-dir)
388
+ target-dir))))
389
+ (ediff-patch-file nil patch-buf)))))))))
382
390
383
391
;;;### autoload
384
392
(defun +clean-file-name (filename &optional downcase-p)
0 commit comments