nixpkgs/pkgs/applications/editors/emacs/macport.nix
Matthew Bauer 2240445067 emacsMacport: 7.1 → 7.2
Fixes a critical issue with macOS

[NEWS](https://bitbucket.org/mituharu/emacs-mac/raw/master/NEWS-mac)

* emacs-26.1-mac-7.2 (2018-09-09)

** Fixed bugs

*** Buffer contents are not displayed on macOS 10.14.
This is mainly because now NSViews are backed by Core Animation Layer
(layer-backed) by default and non-deferred drawing into views no
longer works.  Instead of switching to deferred drawing (i.e., draw
only inside -[NSView drawRect:]), we draw into our own backing bitmap
in a non-deferred way as before, and update the view contents with the
resulting image via -[NSView updateLayer].  This "application-side
double buffering" is also available on OS X 10.8 - macOS 10.13 if you
set the frame parameter `inhibit-double-buffering' to nil when
creating a frame.  Just like on macOS 10.14, such a frame does not do
LCD smoothing.

*** Screenshot grabbed via Services is displayed in wrong size when we
have display mirroring between Retina and non-Retina displays.

*** Cursor movement just after frame resize sometimes leaves garbage.

*** Crash by the Fall_threads call from the GUI thread at the select
emulation when there are multiple Lisp threads.

*** Info title has ASCII underline unlike other window systems.

*** Vertical scroll bar is created as horizontal if frame font height
is short.

** Improvements

*** macOS 10.14 adds property :appearance to (mac-application-state).
The value may be "NSAppearanceNameAqua" or "NSAppearanceNameDarkAqua".

*** Add new color format "mac:COLOR-LIST-NAME:COLOR-NAME" and
"mac:COLOR-NAME" (shorthand for "mac:System:COLOR-NAME").  The actual
color may be different depending on the global appearance setting on
macOS 10.14.  For example, "mac:textColor" is black on the Light Mode
but is white on the Dark Mode.

*** Default frame colors respect appearance setting on macOS 10.14.
Now the default frame foreground/background color is
"mac:textColor"/"mac:textBackgroundColor", respectively.  Changes of
the system setting of the global appearance are dynamically reflected.

*** New function `mac-color-list-alist' to get the available
combinations of COLOR-LIST-NAMEs and COLOR-NAMEs.  Note that this
value is dependent on user environment and OS version.  Also, some
combinations may represent image patterns rather than colors.  For the
former cases, `(color-values "mac:COLOR-LIST-NAME:COLOR-NAME")'
returns nil.
2018-09-24 21:39:11 -05:00

108 lines
3.7 KiB
Nix

{ stdenv, fetchurl, ncurses, pkgconfig, texinfo, libxml2, gnutls, gettext, autoconf, automake
, AppKit, Carbon, Cocoa, IOKit, OSAKit, Quartz, QuartzCore, WebKit
, ImageCaptureCore, GSS, ImageIO # These may be optional
}:
stdenv.mkDerivation rec {
emacsVersion = "26.1";
emacsName = "emacs-${emacsVersion}";
macportVersion = "7.2";
name = "emacs-mac-${emacsVersion}-${macportVersion}";
builder = ./builder.sh;
src = fetchurl {
url = "mirror://gnu/emacs/${emacsName}.tar.xz";
sha256 = "0b6k1wq44rc8gkvxhi1bbjxbz3cwg29qbq8mklq2az6p1hjgrx0w";
};
macportSrc = fetchurl {
url = "ftp://ftp.math.s.chiba-u.ac.jp/emacs/${emacsName}-mac-${macportVersion}.tar.gz";
sha256 = "0j4dcjv7kh84d6lzzxdzambk6ybbdr2j7r63nkbivssjv29z7zag";
};
hiresSrc = fetchurl {
url = "ftp://ftp.math.s.chiba-u.ac.jp/emacs/emacs-hires-icons-3.0.tar.gz";
sha256 = "0f2wzdw2a3ac581322b2y79rlj3c9f33ddrq9allj97r1si6v5xk";
};
patches = [ ./clean-env.patch ];
enableParallelBuilding = true;
nativeBuildInputs = [ pkgconfig autoconf automake ];
buildInputs = [ ncurses libxml2 gnutls texinfo gettext
AppKit Carbon Cocoa IOKit OSAKit Quartz QuartzCore WebKit
ImageCaptureCore GSS ImageIO # may be optional
];
postUnpack = ''
mv $sourceRoot $name
tar xzf $macportSrc -C $name --strip-components=1
mv $name $sourceRoot
# extract retina image resources
tar xzfv $hiresSrc --strip 1 -C $sourceRoot
'';
postPatch = ''
patch -p1 < patch-mac
substituteInPlace lisp/international/mule-cmds.el \
--replace /usr/share/locale ${gettext}/share/locale
# use newer emacs icon
cp nextstep/Cocoa/Emacs.base/Contents/Resources/Emacs.icns mac/Emacs.app/Contents/Resources/Emacs.icns
'';
configureFlags = [
"LDFLAGS=-L${ncurses.out}/lib"
"--with-xml2=yes"
"--with-gnutls=yes"
"--with-mac"
"--with-modules"
"--enable-mac-app=$$out/Applications"
];
CFLAGS = "-O3 -DMAC_OS_X_VERSION_MAX_ALLOWED=MAC_OS_X_VERSION_10_10 -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_10";
LDFLAGS = "-O3 -L${ncurses.out}/lib";
postInstall = ''
mkdir -p $out/share/emacs/site-lisp/
cp ${./site-start.el} $out/share/emacs/site-lisp/site-start.el
'';
doCheck = true;
meta = with stdenv.lib; {
description = "The extensible, customizable text editor";
homepage = http://www.gnu.org/software/emacs/;
license = licenses.gpl3Plus;
maintainers = with maintainers; [ jwiegley matthewbauer ];
platforms = platforms.darwin;
longDescription = ''
GNU Emacs is an extensible, customizable text editorand more. At its
core is an interpreter for Emacs Lisp, a dialect of the Lisp
programming language with extensions to support text editing.
The features of GNU Emacs include: content-sensitive editing modes,
including syntax coloring, for a wide variety of file types including
plain text, source code, and HTML; complete built-in documentation,
including a tutorial for new users; full Unicode support for nearly all
human languages and their scripts; highly customizable, using Emacs
Lisp code or a graphical interface; a large number of extensions that
add other functionality, including a project planner, mail and news
reader, debugger interface, calendar, and more. Many of these
extensions are distributed with GNU Emacs; others are available
separately.
This is the "Mac port" addition to GNU Emacs 26. This provides a native
GUI support for Mac OS X 10.6 - 10.12. Note that Emacs 23 and later
already contain the official GUI support via the NS (Cocoa) port for
Mac OS X 10.4 and later. So if it is good enough for you, then you
don't need to try this.
'';
};
}