Created
June 21, 2012 16:44
-
-
Save papaeye/2966932 to your computer and use it in GitHub Desktop.
A formula for self-contained emacs-24.1-mac-3.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class EmacsMacPort < Formula | |
homepage 'http://www.gnu.org/software/emacs/' | |
url 'http://ftpmirror.gnu.org/emacs/emacs-24.1.tar.bz2' | |
mirror 'http://ftp.gnu.org/pub/gnu/emacs/emacs-24.1.tar.bz2' | |
sha1 'ab22d5bf2072d04faa4aebf819fef3dfe44aacca' | |
def port_url | |
"ftp://ftp.math.s.chiba-u.ac.jp/emacs/emacs-#{version}-mac-3.0.tar.gz" | |
end | |
# Stripping on Xcode 4 causes malformed object errors. | |
# Just skip everything. | |
skip_clean :all | |
# http://lists.gnu.org/archive/html/emacs-diffs/2012-05/msg00398.html | |
def patches | |
[ | |
'https://raw.github.com/gist/2966536/cc90ab354283f86a1f9546a3fd391f0f3d997822/fix-infopath.patch' | |
] | |
end | |
def install | |
patch_mac_port | |
ENV.j1 | |
ENV['CC'] = 'clang -fobjc-arc' | |
# from configure.in | |
appbindir = prefix+'Emacs.app/Contents/MacOS' | |
appresdir = prefix+'Emacs.app/Contents/Resources' | |
args = ["--prefix=#{appresdir}", | |
"--exec-prefix=#{appbindir}", | |
"--libexecdir=#{appbindir+'libexec'}", | |
"--infodir=#{appresdir+'info'}", | |
"--with-mac", | |
"--without-dbus", | |
"--enable-mac-app=#{prefix}"] | |
system "./configure", *args | |
system "make bootstrap" | |
system "make install" | |
# from Makefile.in | |
mv Dir[appresdir+'share/emacs/*/*'], appresdir | |
mv Dir[appresdir+'share/{info,man}'], appresdir | |
rm_rf appresdir+'share' | |
mv Dir[appbindir+'libexec/emacs/*/*/*'], appbindir+'libexec' | |
rm_rf appbindir+'libexec/emacs' | |
cd appbindir+'bin' do | |
rm_f Dir['emacs', 'emacs-*'] | |
ln_sf Dir['../libexec/*'], '.' | |
end | |
end | |
def patch_mac_port | |
patch = cache_or_download port_url | |
mktemp do | |
system 'tar', 'xf', patch | |
cd "emacs-#{version}-mac-#{port_version}" do | |
system 'patch', '-p0', '-d', buildpath, '-i', Pathname.pwd+'patch-mac' | |
mv 'mac', buildpath | |
mv buildpath+'nextstep/Cocoa/Emacs.base/Contents/Resources/Emacs.icns', | |
buildpath+'mac/Emacs.app/Contents/Resources/Emacs.icns' | |
mv Dir['src/*'], buildpath+'src' | |
mv 'lisp/term/mac-win.el', buildpath+'lisp/term' | |
end | |
# http://lists.gnu.org/archive/html/emacs-devel/2012-06/msg00185.html | |
Pathname.new('fix-mac-win.patch').write DATA.read | |
system 'patch', '-p1', '-d', buildpath, '-i', Pathname.pwd+'fix-mac-win.patch' | |
end | |
end | |
def cache_or_download url | |
path = HOMEBREW_CACHE+File.basename(url) | |
curl url, '-o', path unless path.exist? | |
path | |
end | |
def port_version | |
Pathname.new(port_url).version | |
end | |
end | |
__END__ | |
diff --git a/lisp/term/mac-win.el b/lisp/term/mac-win.el | |
index f228a5e..4cb1130 100644 | |
--- a/lisp/term/mac-win.el | |
+++ b/lisp/term/mac-win.el | |
@@ -1977,6 +1977,11 @@ non-nil, and the input device supports it." | |
(cadr (pos-visible-in-window-p | |
(posn-point target-posn) nil t))) | |
(scrolled-pixel-height (- target-y first-y))) | |
+ ;; Emacs 23 -> 24 incompatibility: the | |
+ ;; actual row part of POSITION now counts | |
+ ;; the header line. | |
+ (if header-line-height | |
+ (setq target-row (1- target-row))) | |
(scroll-up (if (= delta-y scrolled-pixel-height) | |
target-row | |
(1+ target-row))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment