aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2008-09-14 21:16:30 +0000
committerStefan Monnier2008-09-14 21:16:30 +0000
commit68035b97640be3248dd931e8853e20d642b40bd4 (patch)
tree17148de5a81041e14194caae9d73f858c7b4d1b0
parentaa5fecb5371e152777e8addcc1e2a7f8d7ae5954 (diff)
downloademacs-68035b97640be3248dd931e8853e20d642b40bd4.tar.gz
emacs-68035b97640be3248dd931e8853e20d642b40bd4.zip
(diff-find-file-name): Rename `batch' to `noprompt' and
be more honest when we don't know. (diff-tell-file-name): Don't prompt before the actual prompt. (diff-mode): Don't prompt in add-log-buffer-file-name-function. (diff-find-source-location): Add `noprompt' argument. (diff-current-defun): Don't prompt.
-rw-r--r--lisp/ChangeLog93
-rw-r--r--lisp/diff-mode.el76
2 files changed, 91 insertions, 78 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9f7f6259b15..4bbc8597270 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,8 +1,17 @@
12008-09-14 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * diff-mode.el (diff-find-file-name): Rename `batch' to `noprompt' and
4 be more honest when we don't know.
5 (diff-tell-file-name): Don't prompt before the actual prompt.
6 (diff-mode): Don't prompt in add-log-buffer-file-name-function.
7 (diff-find-source-location): Add `noprompt' argument.
8 (diff-current-defun): Don't prompt.
9
12008-09-14 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> 102008-09-14 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
2 11
3 * proced.el (proced-mark-face, proced-marked-face) 12 * proced.el (proced-mark-face, proced-marked-face)
4 (proced-sort-header-face): Removed. 13 (proced-sort-header-face): Remove.
5 (proced-font-lock-keywords): Simplified. 14 (proced-font-lock-keywords): Simplify.
6 (proced-format): Use face proced-sort-header. 15 (proced-format): Use face proced-sort-header.
7 (proced-format-interactive, proced-sort-interactive) 16 (proced-format-interactive, proced-sort-interactive)
8 (proced-filter-interactive): Only call proced-update if the scheme 17 (proced-filter-interactive): Only call proced-update if the scheme
@@ -12,8 +21,8 @@
122008-09-14 Martin Rudalics <rudalics@gmx.at> 212008-09-14 Martin Rudalics <rudalics@gmx.at>
13 22
14 * add-log.el (change-log-find-window): New variable. 23 * add-log.el (change-log-find-window): New variable.
15 (change-log-goto-source-1, change-log-goto-source): Set 24 (change-log-goto-source-1, change-log-goto-source):
16 change-log-find-window to window displaying source. 25 Set change-log-find-window to window displaying source.
17 (change-log-next-error): Select window specified by 26 (change-log-next-error): Select window specified by
18 change-log-find-window. 27 change-log-find-window.
19 28
@@ -28,13 +37,13 @@
28 37
29 * proced.el (proced-sort-header): New face. 38 * proced.el (proced-sort-header): New face.
30 (proced-sort-header-face): New variable. 39 (proced-sort-header-face): New variable.
31 (proced-format): Allow format value nil. Use 40 (proced-format): Allow format value nil.
32 proced-sort-header-face for header of sort column. 41 Use proced-sort-header-face for header of sort column.
33 (proced-format-args): New function. 42 (proced-format-args): New function.
34 (proced-grammar-alist, proced-timer-flag, proced-process-alist) 43 (proced-grammar-alist, proced-timer-flag, proced-process-alist)
35 (proced-header-help-echo, proced-field-help-echo, proced-timer) 44 (proced-header-help-echo, proced-field-help-echo, proced-timer)
36 (proced-toggle-timer-flag, proced, proced-mode): Doc fix. 45 (proced-toggle-timer-flag, proced, proced-mode): Doc fix.
37 (proced-refine): Renamed from proced-filter-attribute. Doc fix. 46 (proced-refine): Rename from proced-filter-attribute. Doc fix.
38 (proced-sort-header): Bind also to mouse-1. 47 (proced-sort-header): Bind also to mouse-1.
39 (proced-move-to-goal-column): Return position of point. 48 (proced-move-to-goal-column): Return position of point.
40 (proced-filter-interactive): Always revert listing. 49 (proced-filter-interactive): Always revert listing.
@@ -337,7 +346,7 @@
337 346
3382008-09-04 Juanma Barranquero <lekktu@gmail.com> 3472008-09-04 Juanma Barranquero <lekktu@gmail.com>
339 348
340 * net/tramp-cache.el (tramp-flush-file-function): Fix typo in docstring. 349 * net/tramp-cache.el (tramp-flush-file-function): Fix docstring typo.
341 (tramp-parse-connection-properties): Reflow docstring. 350 (tramp-parse-connection-properties): Reflow docstring.
342 351
3432008-09-04 Kim F. Storm <storm@cua.dk> 3522008-09-04 Kim F. Storm <storm@cua.dk>
@@ -410,9 +419,9 @@
410 419
4112008-09-01 Chong Yidong <cyd@stupidchicken.com> 4202008-09-01 Chong Yidong <cyd@stupidchicken.com>
412 421
413 * minibuffer.el (completion-pcm--pattern->regex): When 422 * minibuffer.el (completion-pcm--pattern->regex):
414 completion-ignore-case is non-nil, generate a regexp that ignores 423 When completion-ignore-case is non-nil, generate a regexp that
415 case. 424 ignores case.
416 425
417 * window.el (recenter-top-bottom): Doc fix. 426 * window.el (recenter-top-bottom): Doc fix.
418 427
@@ -427,7 +436,7 @@
4272008-09-01 Martin Rudalics <rudalics@gmx.at> 4362008-09-01 Martin Rudalics <rudalics@gmx.at>
428 437
429 * help-fns.el (describe-simplify-lib-file-name) 438 * help-fns.el (describe-simplify-lib-file-name)
430 (find-source-lisp-file): Removed. 439 (find-source-lisp-file): Remove.
431 (find-lisp-object-file-name): New function giving preference to 440 (find-lisp-object-file-name): New function giving preference to
432 files found via load-path instead of loaddefs.el. 441 files found via load-path instead of loaddefs.el.
433 (describe-function-1): Use new function instead of the removed 442 (describe-function-1): Use new function instead of the removed
@@ -439,8 +448,8 @@
439 448
440 * international/mule-diag.el (font-show-log): Fix previous change. 449 * international/mule-diag.el (font-show-log): Fix previous change.
441 450
442 * international/mule-cmds.el (set-language-environment): Don't 451 * international/mule-cmds.el (set-language-environment):
443 overwrite current-iso639-language if the current language 452 Don't overwrite current-iso639-language if the current language
444 environment doesn't provide that data. 453 environment doesn't provide that data.
445 (set-locale-environment): Set current-iso639-language from the 454 (set-locale-environment): Set current-iso639-language from the
446 locale name. 455 locale name.
@@ -483,7 +492,7 @@
483 These changes are to adjust the automatic composition for the new 492 These changes are to adjust the automatic composition for the new
484 implementation (avoid using text property). 493 implementation (avoid using text property).
485 494
486 * composite.el (composition-function-table): Declaration moved to 495 * composite.el (composition-function-table): Move declaration to
487 composite.c. 496 composite.c.
488 (terminal-composition-base-character-p): Delete it. 497 (terminal-composition-base-character-p): Delete it.
489 (terminal-composition-function): Delete it. 498 (terminal-composition-function): Delete it.
@@ -519,8 +528,8 @@
519 (tamil-composable-pattern, kannada-composable-pattern) 528 (tamil-composable-pattern, kannada-composable-pattern)
520 (malayalam-composable-pattern): New variables. 529 (malayalam-composable-pattern): New variables.
521 530
522 * international/characters.el (unicode-category-table): Setup 531 * international/characters.el (unicode-category-table):
523 unicode-category-table. 532 Setup unicode-category-table.
524 533
525 * international/fontset.el (setup-default-fontset): Prepend 534 * international/fontset.el (setup-default-fontset): Prepend
526 iso10646-1 fonts to the fallback font groups instead of appending. 535 iso10646-1 fonts to the fallback font groups instead of appending.
@@ -574,7 +583,7 @@
574 583
5752008-08-27 Tomas Abrahamsson <tab@lysator.liu.se> 5842008-08-27 Tomas Abrahamsson <tab@lysator.liu.se>
576 585
577 * textmodes/artist.el (artist-mode-init): Added comment on the 586 * textmodes/artist.el (artist-mode-init): Add comment on the
578 setting up of the `artist-replacement-table' array. 587 setting up of the `artist-replacement-table' array.
579 (artist-get-replacement-char): New defsubst. 588 (artist-get-replacement-char): New defsubst.
580 (artist-get-char-at-xy-conv, artist-replace-char) 589 (artist-get-char-at-xy-conv, artist-replace-char)
@@ -582,7 +591,7 @@
582 accessing `artist-replacement-table' directly. 591 accessing `artist-replacement-table' directly.
583 Reported by Rubén Berenguel <ruben@maia.ub.es>. 592 Reported by Rubén Berenguel <ruben@maia.ub.es>.
584 593
585 (artist-mt): Fixed structures for cut and copy operations. 594 (artist-mt): Fix structures for cut and copy operations.
586 595
5872008-08-27 Chong Yidong <cyd@stupidchicken.com> 5962008-08-27 Chong Yidong <cyd@stupidchicken.com>
588 597
@@ -646,10 +655,10 @@
646 (newsticker-treeview-treewindow-width): New. 655 (newsticker-treeview-treewindow-width): New.
647 (newsticker-treeview-listwindow-height): New. 656 (newsticker-treeview-listwindow-height): New.
648 (newsticker-treeview-browse-url-item): New. 657 (newsticker-treeview-browse-url-item): New.
649 (newsticker-treeview-mode-map): Added 658 (newsticker-treeview-mode-map):
650 newsticker-treeview-browse-url-item. 659 Add newsticker-treeview-browse-url-item.
651 (newsticker--treeview-window-init): Use 660 (newsticker--treeview-window-init):
652 newsticker-treeview-treewindow-width and 661 Use newsticker-treeview-treewindow-width and
653 newsticker-treeview-listwindow-height. 662 newsticker-treeview-listwindow-height.
654 663
655 * net/newst-reader.el (newsticker-browse-url-item): New. 664 * net/newst-reader.el (newsticker-browse-url-item): New.
@@ -685,7 +694,7 @@
685 keys we will be remapping via local-function-key-map. 694 keys we will be remapping via local-function-key-map.
686 (msdos-setup-keyboard): New function. 695 (msdos-setup-keyboard): New function.
687 696
688 * term/pc-win.el (msdos-create-frame-with-faces): Renamed from 697 * term/pc-win.el (msdos-create-frame-with-faces): Rename from
689 make-msdos-frame. 698 make-msdos-frame.
690 (terminal-init-internal): New function, errors out if called. 699 (terminal-init-internal): New function, errors out if called.
691 (msdos-initialize-window-system): New function. 700 (msdos-initialize-window-system): New function.
@@ -745,9 +754,9 @@
745 754
7462008-08-21 Chong Yidong <cyd@stupidchicken.com> 7552008-08-21 Chong Yidong <cyd@stupidchicken.com>
747 756
748 * minibuffer.el (completion--try-word-completion): Disable 757 * minibuffer.el (completion--try-word-completion):
749 partial-completion when considering the addition of a space or 758 Disable partial-completion when considering the addition of a space
750 hyphen. 759 or hyphen.
751 760
7522008-08-21 John Paul Wallington <jpw@pobox.com> 7612008-08-21 John Paul Wallington <jpw@pobox.com>
753 762
@@ -803,8 +812,8 @@
803 812
8042008-08-18 Chong Yidong <cyd@stupidchicken.com> 8132008-08-18 Chong Yidong <cyd@stupidchicken.com>
805 814
806 * emulation/edt.el (edt-default-emulation-setup): Share 815 * emulation/edt.el (edt-default-emulation-setup):
807 global-buffers-menu-map with the emulated global map. 816 Share global-buffers-menu-map with the emulated global map.
808 817
8092008-08-18 Adrian Robert <Adrian.B.Robert@gmail.com> 8182008-08-18 Adrian Robert <Adrian.B.Robert@gmail.com>
810 819
@@ -833,10 +842,10 @@
833 (proced-log-buffer): New variable. 842 (proced-log-buffer): New variable.
834 (proced-mark-all, proced-unmark-all, proced-do-mark-al): Operate on 843 (proced-mark-all, proced-unmark-all, proced-do-mark-al): Operate on
835 region if transient-mark-mode is turned on and the region is active. 844 region if transient-mark-mode is turned on and the region is active.
836 (proced-omit-processes): Renamed from proced-hide-processes to 845 (proced-omit-processes): Rename from proced-hide-processes to
837 avoid key clash with describe-mode (bound to h). Search for 846 avoid key clash with describe-mode (bound to h). Search for
838 marked processes starting from point-min. 847 marked processes starting from point-min.
839 (proced-header-space): Removed. 848 (proced-header-space): Remove.
840 (proced-send-signal): Handle errors. Operate on current process 849 (proced-send-signal): Handle errors. Operate on current process
841 if no process is marked. 850 if no process is marked.
842 (proced-why): New command. 851 (proced-why): New command.
@@ -902,8 +911,8 @@
902 911
9032008-08-13 Glenn Morris <rgm@gnu.org> 9122008-08-13 Glenn Morris <rgm@gnu.org>
904 913
905 * eshell/esh-cmd.el (eshell/which): Handle the case where no description 914 * eshell/esh-cmd.el (eshell/which): Handle the case where no
906 is found. 915 description is found.
907 916
9082008-08-12 Alan Mackenzie <acm@muc.de> 9172008-08-12 Alan Mackenzie <acm@muc.de>
909 918
@@ -923,8 +932,8 @@
923 932
9242008-08-11 Chong Yidong <cyd@stupidchicken.com> 9332008-08-11 Chong Yidong <cyd@stupidchicken.com>
925 934
926 * progmodes/cc-defs.el (c-emacs-features): Check 935 * progmodes/cc-defs.el (c-emacs-features):
927 beginning-of-defun-raw instead of beginning-of-defun, and avoid 936 Check beginning-of-defun-raw instead of beginning-of-defun, and avoid
928 moving point during the test. 937 moving point during the test.
929 938
930 * emacs-lisp/lisp.el (beginning-of-defun): Doc fix. 939 * emacs-lisp/lisp.el (beginning-of-defun): Doc fix.
@@ -962,7 +971,7 @@
962 * net/xesam.el (xesam-search-engines): Add Debbugs hit fields. 971 * net/xesam.el (xesam-search-engines): Add Debbugs hit fields.
963 (xesam-refresh-entry): Add Debbugs handling. Insert a widget 972 (xesam-refresh-entry): Add Debbugs handling. Insert a widget
964 "DONE", when all hits are retrieved. 973 "DONE", when all hits are retrieved.
965 (xesam-search): autoload it. 974 (xesam-search): Autoload it.
966 975
9672008-08-11 John Paul Wallington <jpw@pobox.com> 9762008-08-11 John Paul Wallington <jpw@pobox.com>
968 977
@@ -1200,8 +1209,8 @@
1200 Extend docstring. Adapt implementation according to new 1209 Extend docstring. Adapt implementation according to new
1201 `dbus-event' layout. 1210 `dbus-event' layout.
1202 (dbus-event-service-name, dbus-event-path-name) 1211 (dbus-event-service-name, dbus-event-path-name)
1203 (dbus-event-interface-name, dbus-event-member-name): Adapt 1212 (dbus-event-interface-name, dbus-event-member-name):
1204 implementation according to new `dbus-event' layout. 1213 Adapt implementation according to new `dbus-event' layout.
1205 (dbus-set-property): Correct `dbus-introspect-get-attribute' call. 1214 (dbus-set-property): Correct `dbus-introspect-get-attribute' call.
1206 1215
1207 * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New defvar. 1216 * net/xesam.el (xesam-type, xesam-query, xesam-xml-string): New defvar.
@@ -1232,13 +1241,13 @@
1232 1241
1233 * mb-depth.el: Unify all names under one common name prefix 1242 * mb-depth.el: Unify all names under one common name prefix
1234 `minibuffer-depth-'. 1243 `minibuffer-depth-'.
1235 (minibuffer-depth-indicator-function): Renamed from 1244 (minibuffer-depth-indicator-function): Rename from
1236 `minibuf-depth-indicator-function'. 1245 `minibuf-depth-indicator-function'.
1237 (minibuffer-depth-overlay): Renamed from 1246 (minibuffer-depth-overlay): Rename from
1238 `minibuf-depth-overlay'. 1247 `minibuf-depth-overlay'.
1239 (minibuffer-depth-setup): Renamed from 1248 (minibuffer-depth-setup): Rename from
1240 `minibuf-depth-setup-minibuffer'. 1249 `minibuf-depth-setup-minibuffer'.
1241 (minibuffer-depth-indicate-mode): Renamed from 1250 (minibuffer-depth-indicate-mode): Rename from
1242 `minibuffer-indicate-depth-mode'. 1251 `minibuffer-indicate-depth-mode'.
1243 1252
12442008-07-31 Juri Linkov <juri@jurta.org> 12532008-07-31 Juri Linkov <juri@jurta.org>
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el
index a32047e70f7..b711b0635d6 100644
--- a/lisp/diff-mode.el
+++ b/lisp/diff-mode.el
@@ -723,7 +723,7 @@ If the OLD prefix arg is passed, tell the file NAME of the old file."
723 (fs (diff-hunk-file-names current-prefix-arg))) 723 (fs (diff-hunk-file-names current-prefix-arg)))
724 (unless fs (error "No file name to look for")) 724 (unless fs (error "No file name to look for"))
725 (list old (read-file-name (format "File for %s: " (car fs)) 725 (list old (read-file-name (format "File for %s: " (car fs))
726 nil (diff-find-file-name old) t)))) 726 nil (diff-find-file-name old 'noprompt) t))))
727 (let ((fs (diff-hunk-file-names old))) 727 (let ((fs (diff-hunk-file-names old)))
728 (unless fs (error "No file name to look for")) 728 (unless fs (error "No file name to look for"))
729 (push (cons fs name) diff-remembered-files-alist))) 729 (push (cons fs name) diff-remembered-files-alist)))
@@ -756,11 +756,10 @@ If the OLD prefix arg is passed, tell the file NAME of the old file."
756 (list (if old (match-string 2) (match-string 4)) 756 (list (if old (match-string 2) (match-string 4))
757 (if old (match-string 4) (match-string 2))))))))) 757 (if old (match-string 4) (match-string 2)))))))))
758 758
759(defun diff-find-file-name (&optional old batch prefix) 759(defun diff-find-file-name (&optional old noprompt prefix)
760 "Return the file corresponding to the current patch. 760 "Return the file corresponding to the current patch.
761Non-nil OLD means that we want the old file. 761Non-nil OLD means that we want the old file.
762Non-nil BATCH means to prefer returning an incorrect answer than to prompt 762Non-nil NOPROMPT means to prefer returning nil than to prompt the user.
763the user.
764PREFIX is only used internally: don't use it." 763PREFIX is only used internally: don't use it."
765 (unless (equal diff-remembered-defdir default-directory) 764 (unless (equal diff-remembered-defdir default-directory)
766 ;; Flush diff-remembered-files-alist if the default-directory is changed. 765 ;; Flush diff-remembered-files-alist if the default-directory is changed.
@@ -801,16 +800,15 @@ PREFIX is only used internally: don't use it."
801 (boundp 'cvs-pcl-cvs-dirchange-re) 800 (boundp 'cvs-pcl-cvs-dirchange-re)
802 (save-excursion 801 (save-excursion
803 (re-search-backward cvs-pcl-cvs-dirchange-re nil t)) 802 (re-search-backward cvs-pcl-cvs-dirchange-re nil t))
804 (diff-find-file-name old batch (match-string 1))) 803 (diff-find-file-name old noprompt (match-string 1)))
805 ;; Invent something, if necessary.
806 (when batch
807 (or (car fs) default-directory))
808 ;; if all else fails, ask the user 804 ;; if all else fails, ask the user
809 (let ((file (read-file-name (format "Use file %s: " (or (first fs) "")) 805 (unless noprompt
810 nil (first fs) t (first fs)))) 806 (let ((file (read-file-name (format "Use file %s: "
811 (set (make-local-variable 'diff-remembered-files-alist) 807 (or (first fs) ""))
812 (cons (cons fs file) diff-remembered-files-alist)) 808 nil (first fs) t (first fs))))
813 file))))) 809 (set (make-local-variable 'diff-remembered-files-alist)
810 (cons (cons fs file) diff-remembered-files-alist))
811 file))))))
814 812
815 813
816(defun diff-ediff-patch () 814(defun diff-ediff-patch ()
@@ -1286,7 +1284,7 @@ a diff with \\[diff-reverse-direction].
1286 (set (make-local-variable 'add-log-current-defun-function) 1284 (set (make-local-variable 'add-log-current-defun-function)
1287 'diff-current-defun) 1285 'diff-current-defun)
1288 (set (make-local-variable 'add-log-buffer-file-name-function) 1286 (set (make-local-variable 'add-log-buffer-file-name-function)
1289 'diff-find-file-name)) 1287 (lambda () (diff-find-file-name nil 'noprompt))))
1290 1288
1291;;;###autoload 1289;;;###autoload
1292(define-minor-mode diff-minor-mode 1290(define-minor-mode diff-minor-mode
@@ -1547,7 +1545,7 @@ Whitespace differences are ignored."
1547 1545
1548(defsubst diff-xor (a b) (if a (if (not b) a) b)) 1546(defsubst diff-xor (a b) (if a (if (not b) a) b))
1549 1547
1550(defun diff-find-source-location (&optional other-file reverse) 1548(defun diff-find-source-location (&optional other-file reverse noprompt)
1551 "Find out (BUF LINE-OFFSET POS SRC DST SWITCHED). 1549 "Find out (BUF LINE-OFFSET POS SRC DST SWITCHED).
1552BUF is the buffer corresponding to the source file. 1550BUF is the buffer corresponding to the source file.
1553LINE-OFFSET is the offset between the expected and actual positions 1551LINE-OFFSET is the offset between the expected and actual positions
@@ -1555,7 +1553,8 @@ LINE-OFFSET is the offset between the expected and actual positions
1555POS is a pair (BEG . END) indicating the position of the text in the buffer. 1553POS is a pair (BEG . END) indicating the position of the text in the buffer.
1556SRC and DST are the two variants of text as returned by `diff-hunk-text'. 1554SRC and DST are the two variants of text as returned by `diff-hunk-text'.
1557 SRC is the variant that was found in the buffer. 1555 SRC is the variant that was found in the buffer.
1558SWITCHED is non-nil if the patch is already applied." 1556SWITCHED is non-nil if the patch is already applied.
1557NOPROMPT, if non-nil, means not to prompt the user."
1559 (save-excursion 1558 (save-excursion
1560 (let* ((other (diff-xor other-file diff-jump-to-old-file)) 1559 (let* ((other (diff-xor other-file diff-jump-to-old-file))
1561 (char-offset (- (point) (progn (diff-beginning-of-hunk 'try-harder) 1560 (char-offset (- (point) (progn (diff-beginning-of-hunk 'try-harder)
@@ -1565,8 +1564,8 @@ SWITCHED is non-nil if the patch is already applied."
1565 ;; (e.g. because an empty line truncates the hunk mid-course), 1564 ;; (e.g. because an empty line truncates the hunk mid-course),
1566 ;; leading to potentially nasty surprises for the user. 1565 ;; leading to potentially nasty surprises for the user.
1567 (_ (diff-sanity-check-hunk)) 1566 (_ (diff-sanity-check-hunk))
1568 (hunk (buffer-substring (point) 1567 (hunk (buffer-substring
1569 (save-excursion (diff-end-of-hunk) (point)))) 1568 (point) (save-excursion (diff-end-of-hunk) (point))))
1570 (old (diff-hunk-text hunk reverse char-offset)) 1569 (old (diff-hunk-text hunk reverse char-offset))
1571 (new (diff-hunk-text hunk (not reverse) char-offset)) 1570 (new (diff-hunk-text hunk (not reverse) char-offset))
1572 ;; Find the location specification. 1571 ;; Find the location specification.
@@ -1578,7 +1577,8 @@ SWITCHED is non-nil if the patch is already applied."
1578 diff-context-mid-hunk-header-re nil t) 1577 diff-context-mid-hunk-header-re nil t)
1579 (error "Can't find the hunk separator")) 1578 (error "Can't find the hunk separator"))
1580 (match-string 1))))) 1579 (match-string 1)))))
1581 (file (or (diff-find-file-name other) (error "Can't find the file"))) 1580 (file (or (diff-find-file-name other noprompt)
1581 (error "Can't find the file")))
1582 (buf (find-file-noselect file))) 1582 (buf (find-file-noselect file)))
1583 ;; Update the user preference if he so wished. 1583 ;; Update the user preference if he so wished.
1584 (when (> (prefix-numeric-value other-file) 8) 1584 (when (> (prefix-numeric-value other-file) 8)
@@ -1718,23 +1718,27 @@ For use in `add-log-current-defun-function'."
1718 (when (looking-at diff-hunk-header-re) 1718 (when (looking-at diff-hunk-header-re)
1719 (forward-line 1) 1719 (forward-line 1)
1720 (re-search-forward "^[^ ]" nil t)) 1720 (re-search-forward "^[^ ]" nil t))
1721 (destructuring-bind (buf line-offset pos src dst &optional switched) 1721 (destructuring-bind (&optional buf line-offset pos src dst switched)
1722 (diff-find-source-location) 1722 ;; Use `noprompt' since this is used in which-func-mode and such.
1723 (beginning-of-line) 1723 (ignore-errors ;Signals errors in place of prompting.
1724 (or (when (memq (char-after) '(?< ?-)) 1724 (diff-find-source-location nil nil 'noprompt))
1725 ;; Cursor is pointing at removed text. This could be a removed 1725 (when buf
1726 ;; function, in which case, going to the source buffer will 1726 (beginning-of-line)
1727 ;; not help since the function is now removed. Instead, 1727 (or (when (memq (char-after) '(?< ?-))
1728 ;; try to figure out the function name just from the code-fragment. 1728 ;; Cursor is pointing at removed text. This could be a removed
1729 (let ((old (if switched dst src))) 1729 ;; function, in which case, going to the source buffer will
1730 (with-temp-buffer 1730 ;; not help since the function is now removed. Instead,
1731 (insert (car old)) 1731 ;; try to figure out the function name just from the
1732 (funcall (buffer-local-value 'major-mode buf)) 1732 ;; code-fragment.
1733 (goto-char (+ (point-min) (cdr old))) 1733 (let ((old (if switched dst src)))
1734 (add-log-current-defun)))) 1734 (with-temp-buffer
1735 (with-current-buffer buf 1735 (insert (car old))
1736 (goto-char (+ (car pos) (cdr src))) 1736 (funcall (buffer-local-value 'major-mode buf))
1737 (add-log-current-defun)))))) 1737 (goto-char (+ (point-min) (cdr old)))
1738 (add-log-current-defun))))
1739 (with-current-buffer buf
1740 (goto-char (+ (car pos) (cdr src)))
1741 (add-log-current-defun)))))))
1738 1742
1739(defun diff-ignore-whitespace-hunk () 1743(defun diff-ignore-whitespace-hunk ()
1740 "Re-diff the current hunk, ignoring whitespace differences." 1744 "Re-diff the current hunk, ignoring whitespace differences."