On Windows, CRLF line endings in the output of diff-command can lead to an error in `smerge-refine-regions'. To reproduce, download this patch: https://lists.gnu.org/archive/html/emacs-devel/2017-06/txtWF9rI8yqfI.txt (It is an example of a perfectly ordinary patch, with Unix line endings.) From 'emacs -Q', visit the patch file, do "M-x diff-mode RET", then move point into the second diff hunk (in editfns.c) and type RET (diff-goto-source). The minibuffer shows this error, with a literal carriage return, shown here as ^M: Error running timer: (error "Unexpected patch hunk header: 41a42,121^M") The error doesn't seem to be critical (diff-goto-source still succeeds) but it's annoying, as it obscures a minibuffer prompt. As a data point, the error doesn't happen after applying the attached patch which partially reverts this commit: commit 184d74ce002ecb7399cb2b47fc671bfb2feb9855 Author: Stefan Monnier Date: Wed May 17 15:44:36 2017 -0400 * lisp/vc/smerge-mode.el (smerge-refine-regions): Work in multi-bufs The Lisp backtrace is: Debugger entered--Lisp error: (error "Unexpected patch hunk header: 41a42,121\015") signal(error ("Unexpected patch hunk header: 41a42,121\015")) error("Unexpected patch hunk header: %s" "41a42,121\015") smerge-refine-regions(1019 1212 1212 1485 nil diff-refine-preproc ((diff-mode . fine) (face diff-refine-removed)) ((diff-mode . fine) (face diff-refine-added))) diff-refine-hunk() #f(compiled-function () #)() apply(#f(compiled-function () #) nil) timer-event-handler([t 23113 10990 354825 nil #f(compiled-function () #) nil nil 0]) read-from-minibuffer("Use file c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c: " ("c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c" . 42) (keymap ...) nil file-name-history "c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c" nil) completing-read-default("Use file c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c: " read-file-name-internal file-exists-p t ("c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c" . 41) file-name-history "c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c" nil) completing-read("Use file c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c: " read-file-name-internal file-exists-p t ("c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c" . 41) file-name-history "c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c") read-file-name-default("Use file c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c: " "c:/Users/xxxxxx/AppData/Local/Temp/b/src/" "c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c" t "editfns.c" nil) read-file-name("Use file c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c: " "c:/Users/xxxxxx/AppData/Local/Temp/b/src/" "c:/Users/xxxxxx/AppData/Local/Temp/b/src/editfns.c" t "editfns.c") diff-find-file-name(nil nil) diff-find-source-location(nil t) diff-goto-source(nil return) funcall-interactively(diff-goto-source nil return) call-interactively(diff-goto-source nil nil) command-execute(diff-goto-source) In GNU Emacs 26.0.90 (build 1, x86_64-w64-mingw32) of 2017-12-31 built on MACHINE Repository revision: 39ca289a7a33d514c2a46f005db4e7173fb7e9f5 Windowing system distributor 'Microsoft Corp.', version 10.0.16299 Recent messages: Wrote c:/projects/emacs/lisp/vc/smerge-mode.el Quit [2 times] Finding changes in c:/projects/emacs/lisp/vc/smerge-mode.el...done Hunk already applied Annotating... Redisplaying annotation...done (Spanned from 6597.8 to 16.8 days old) Annotating... done Mark set Mark deactivated x is undefined Configured using: 'configure --config-cache --with-modules --without-pop 'CFLAGS=-O3 -ggdb3'' Configured features: XPM JPEG TIFF GIF PNG SOUND DBUS NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS MODULES LCMS2 Important settings: value of $EMACSLOADPATH: c:\emacs-lisp; value of $LANG: ENG locale-coding-system: cp1252 Major mode: Git-Log-View Minor modes in effect: diff-auto-refine-mode: t tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils vc-annotate vc-dir ewoc smerge-mode m4-mode whitespace add-log log-view pcvs-util cl-extra help-mode vc-git diff-mode easymenu easy-mmode vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs vc vc-dispatcher map seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs elec-pair time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote w32notify dbusbind w32 lcms2 multi-tty make-network-process emacs) Memory information: ((conses 16 130359 22263) (symbols 56 22153 2) (miscs 48 105 257) (strings 32 36280 1509) (string-bytes 1 943844) (vectors 16 23670) (vector-slots 8 1322832 187678) (floats 8 85 611) (intervals 56 4285 3571) (buffers 992 18))