Skip to content


Emacs formula: patching errors #4085

jone opened this Issue · 5 comments

4 participants


I just tried to build emacs using
$ brew install emacs --use-git-head --HEAD --cocoa

Console output:
==> Patching

patching file lisp/term/ns-win.el
Hunk #1 succeeded at 921 with fuzz 1 (offset -342 lines).
patching file src/nsfns.m
Hunk #1 succeeded at 2566 (offset -23 lines).
Hunk #2 succeeded at 2679 (offset -25 lines).
patching file src/nsterm.h
Hunk #1 succeeded at 97 (offset 2 lines).
patching file src/nsterm.m
Hunk #1 succeeded at 674 (offset -12 lines).
Hunk #2 succeeded at 1146 (offset 8 lines).
Hunk #3 FAILED at 1171.
Hunk #4 succeeded at 1202 (offset -8 lines).
Hunk #5 succeeded at 5698 with fuzz 2 (offset 76 lines).
Hunk #6 succeeded at 5806 (offset 73 lines).
1 out of 6 hunks FAILED -- saving rejects to file src/nsterm.m.rej
Error: Failure while executing: /usr/bin/patch -f -p1 -i 001-homebrew.diff

The formula applies a fullscreen-patch (when using --cocoa):
"" if ARGV.include? "--cocoa"

The patch seems not to apply any more on the git-head.
After some bisecting I discovered the commit which seems to break the patch:

The commit breaks the following hunk of the patch:
diff --git a/src/nsterm.m b/src/nsterm.m

index 9256c08..8bbb575 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1150,7 +1163,7 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows)

   /* constrain to screen if we can */
-  if (screen)
+  if (screen && ![window isKindOfClass:[EmacsFullWindow class]])
       NSSize sz = [screen visibleFrame].size;
       NSSize ez = { wr.size.width - sz.width, wr.size.height - sz.height };

I'm not able to fix this due to lack of language knowledge.
Any clues how this could be fixed?



We'll probably need to disable applying patches on HEAD builds.


Removing the failing hunk seems to work, but I'm not sure if this a good idea.

Homebrew member

It probably isn't really, we'll disable applying patches on HEAD builds.


Pulled an emacs patch that skips the patch for --HEAD builds.


brew install emacs --cocoa --HEAD --use-git-head still attempts to apply patches for me. I did brew update, and no formulae were updated, checked the Emacs formula, commented out the fullscreen patch, and it worked.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.