Skip to content

takaxp/ns-inline-patch

Repository files navigation

An enhanced inline patch for GNU Emacs

../../actions/workflows/head-latest.yml/badge.svg

see https://qiita.com/takaxp/items/e07bb286d80fa9dd8e05 and https://qiita.com/takaxp/items/6a7f9b26eb1b1a8237a0

Note

Version 30.2 has been released. The previous inline patch (emacs-29.1-inline.patch) is still applicable to Emacs 30.2. Installer packages for Intel-based Mac and Apple Silicon Mac are also available.

Supported features

  • avoid β€œM-x あ”
  • faces for composing text
  • non ja locale
  • directly change input source

Supported Emacs version

  • Emacs HEAD (emacs-head-inline.patch)
  • Emacs 30.2, 30.1 (emacs-29.1-inline.patch)
  • Emacs 29.4, 29.3, 29.2, 29.1 (emacs-29.1-inline.patch)
  • Emacs 28.2, 28.1 (emacs-28.1-inline.patch)
  • Emacs 27.2, 27.1 (emacs-27.1-inline.patch)
  • Emacs 26.3, 26.2, 26.1 (emacs-25.2-inline.patch)
  • Emacs 25.3, 25.2 (emacs-25.2-inline.patch)

Integrated functions and hooks

  • M-x mac-build-info
  • M-x mac-ime-input-source-list
  • M-x mac-ime-activate
  • M-x mac-ime-deactivate
  • M-x mac-ime-toggle
  • mac-ime-before-put-text-hook
  • mac-ime-after-put-text-hook

How to use?

Add the following code to your init.el.

(when (and (memq window-system '(ns nil))
           (fboundp 'mac-get-current-input-source))
  (when (version< "27.0" emacs-version)
    ;; Required for some cases when auto detection is failed or the locale is "en".
    (custom-set-variables
     '(mac-default-input-source "com.google.inputmethod.Japanese.base")))
  (mac-input-method-mode 1))

Tip

You can find available input sources by M-x mac-ime-input-source-list. The available sources will be listed in the Message buffer.

Build scripts

For your convenience, some build scripts are provided. Before you run the script, please run setup.sh first.

git clone --depth=1 https://github.com/takaxp/ns-inline-patch.git
cd ns-inline-patch
sh ./build/setup.sh
sh ./build/emacs-30.sh -n

Important

Please provide -n option to enable NativeComp if needed.

Tip

Specifying CC may resolve your issue when you get an error on missing AppKit.h.

CC=/usr/bin/clang sh ./build/emacs-30.sh

If your environment for building Emacs is under PROXY, you can use emacs-mirror to get Emacs source codes. Please change the URL of the git repository specified in emacs-head.sh and emacs-30.sh if needed.

Pre-built distribution package

You can download my pre-built Emacs HEAD, 30.2, 29.4, 28.2, 27.2 with ns-inline patch. Emacs.app will be installed under /Applications/Emacs-takaxp in your macOS. Please copy Emacs.app into /Applications if needed. The provided packages contain GnuTLS and jansson. Also TREE-SITTER is included in 29.4 or later packages.

All packages are signed and notarized with my Apple developer ID: H2PH8KNN3H.

Emacs 31.x !unstable!

Warning

These packages are built based on the latest development source code. So it may be unstable or broken.

  • Emacs 31.0.50 HEAD of Master branch with NativeComp

../../actions/workflows/nightly-arm64-nc.yml/badge.svg ../../actions/workflows/nightly-x86_64-nc.yml/badge.svg

VersionChipmacOSπŸ”—Datemd5
31.0.50AppleTahoe or laterπŸ“¦2026-03-203ab10361e7c55b796f21c941672f56a5
31.0.50AppleSequoia (15)πŸ“¦2026-03-209c4de27b60fd49c3f343987fc4b71065
31.0.50AppleSonoma (14)πŸ“¦2026-03-20cfaee8b36083947ef611f01335b7b4b9
31.0.50IntelTahoe or laterπŸ“¦2026-03-206edc4edff9a61662238668f6d89a56d8
31.0.50IntelSequoia (15)πŸ“¦2026-03-20c8c8ef7390e4c634c42490a4f87d260c

Important

Please read Using NativeComp section if you have any troubles.

If you want to try the above HEAD package without enabling NativeComp, please check disable NativeComp section.

Emacs 30 (latest version)

  • Emacs 30.2 with NativeComp

../../actions/workflows/release-30-arm64-nc.yml/badge.svg ../../actions/workflows/release-30-x86_64-nc.yml/badge.svg

VersionChipmacOSπŸ”—Datemd5
30.2AppleTahoe or laterπŸ“¦2026-03-144804ceaa2392aa2e75c80fca753dd5a6
30.2AppleSequoia (15)πŸ“¦2026-03-14a0762202c6bb0f282669d7178ff2e56a
30.2AppleSonoma (14)πŸ“¦2026-03-14a34a9727cbac59b67058a8e8df4ba19e
30.2IntelTahoe or laterπŸ“¦2026-03-142f65369a818d18b382e3ececeab274f9
30.2IntelSequoia (15)πŸ“¦2026-03-14eaaea6ff0a92bce72b7ba5991770841b

Important

Please read Using NativeComp section if you have any troubles.

  • Emacs 30.2 without NativeComp

../../actions/workflows/release-30-arm64.yml/badge.svg ../../actions/workflows/release-30-x86_64.yml/badge.svg

VersionChipmacOSπŸ”—Datemd5
30.2AppleTahoe or laterπŸ“¦2026-03-13c53696495162e1cda44467c960a56cca
30.2AppleSequoia (15)πŸ“¦2026-03-132597efceb90c72726200ae31a4ea77e3
30.2AppleSonoma (14)πŸ“¦2026-03-13eb0c0e0cd9e2d372b5489ea9e37e7762
30.2IntelTahoe or laterπŸ“¦2026-03-13a48c13e135b88c656e7fe73d36b5566d
30.2IntelSequoia (15)πŸ“¦2026-03-13295cc10126d11db4e1271191f93b5d30

Emacs 29

  • Emacs 29.4 with NativeComp

../../actions/workflows/release-29-arm64-nc.yml/badge.svg ../../actions/workflows/release-29-x86_64-nc.yml/badge.svg

VersionChipmacOSπŸ”—Datemd5
29.4AppleTahoe or laterπŸ“¦2026-03-13c752a2ef757792391903eae2250cfdf4
29.4AppleSequoia (15)πŸ“¦2026-03-133b6feda59e574a7ecd7fddefea3b03f6
29.4AppleSonoma (14)πŸ“¦2026-03-13ed299905476e222bb0fc94d968d03bfc
29.4IntelTahoe or laterπŸ“¦2026-03-13a56bdce24afcc3dc8895c520f114db34
29.4IntelSequoia (15)πŸ“¦2026-03-13e524791289974b41486f367ece0ec0ca

Important

Please read Using NativeComp section if you have any troubles.

  • Emacs 29.4 without NativeComp

../../actions/workflows/release-29-arm64.yml/badge.svg ../../actions/workflows/release-29-x86_64.yml/badge.svg

VersionChipmacOSπŸ”—Datemd5
29.4AppleTahoe or laterπŸ“¦2026-03-130cbe422978d5ec8706a36007cd179036
29.4AppleSequoia (15)πŸ“¦2026-03-13fd05d58389a2a1b7c55b074cc77c867e
29.4AppleSonoma (14)πŸ“¦2026-03-13f226ee11ed332d764fe3428a55cbe7ee
29.4IntelTahoe or laterπŸ“¦2026-03-13574a928f270a468f737217eb7fbb453d
29.4IntelSequoia (15)πŸ“¦2026-03-13627b58efb880090c283e0defdc742396

Emacs 28

  • Emacs 28.2 without NativeComp

../../actions/workflows/release-28-arm64.yml/badge.svg ../../actions/workflows/release-28-x86_64.yml/badge.svg

VersionChipmacOSπŸ”—Datemd5
28.2AppleTahoe or laterπŸ“¦2026-03-130f94d657345e05413c3e631c8c71cca9
28.2AppleSequoia (15)πŸ“¦2026-03-13cbc20c66b49e798baa4a52d345501c15
28.2AppleSonoma (14)πŸ“¦2026-03-13fda1c4883182bc4b217570e12124ac88
28.2IntelTahoe or laterπŸ“¦2026-03-13103e7a1f85038a643b9ea15efb2b0a70
28.2IntelSequoia (15)πŸ“¦2026-03-13786fd12f9616b6fdba1e6da0061618c2

Emacs 27

  • Emacs 27.2 without NativeComp

../../actions/workflows/release-27-arm64.yml/badge.svg ../../actions/workflows/release-27-x86_64.yml/badge.svg

VersionChipmacOSπŸ”—Datemd5
27.2AppleTahoe or laterπŸ“¦2026-03-13f145f239ee6ebfff137a5c1353247925
27.2AppleSequoia (15)πŸ“¦2026-03-13d4e03c78596485da0e4b1a746352c254
27.2AppleSonoma (14)πŸ“¦2026-03-138f6f81d47eb2123b2f7bf66351d0680c
27.2IntelTahoe or laterπŸ“¦2026-03-13ba2dcc3fc41740e95d4942c93bb4a1d2
27.2IntelSequoia (15)πŸ“¦2026-03-139a48ad3a12858be0939668b6a4c0b923

Using NativeComp

For Emacs 31.x, 30.2, and 29.4 users, you can try to use an Emacs supporting NativeComp by downloading pkg from the links in above sections. Integrated lisp code are natively compiled so the pkg size is increased compared to that of the normal pkg file.

Currently, installing gcc by brew is required to compile additional lisp code by the installed Emacs. And adding the following configuration will be needed to your early-init.el or beginning of init.el when you face a warning like Warning (comp): libgccjit.so: error: error invoking gcc driver.

(setenv "LIBRARY_PATH"
        (string-join
         '("/opt/homebrew/opt/gcc/lib/gcc/15"
           "/opt/homebrew/opt/libgccjit/lib/gcc/15"
           "/opt/homebrew/opt/gcc/lib/gcc/15/gcc/aarch64-apple-darwin25/15")
         ":"))

Note

  • 15 specified in the above paths may have to be aligned to your environment.
  • For Intel mac user, please replace aarch64 with x86_64.
  • darwin25 may also be changed, check the output of M-x emacs-version, or run /opt/homebrew/bin/gcc-15 -dumpmachine.

If you use batch-native-compile or batch-byte+native-compile in a batch mode, setting for LIBRARY_PATH in your shell may be required as well.

export LIBRARY_PATH="/opt/homebrew/opt/gcc/lib/gcc/15:/opt/homebrew/opt/libgccjit/lib/gcc/15:/opt/homebrew/opt/gcc/lib/gcc/15/gcc/aarch64-apple-darwin25/15"
${EMACS} -Q --batch --eval="(setq native-comp-eln-load-path (list (expand-file-name \"eln-cache/\" user-emacs-directory)))" -f batch-byte+native-compile init.el

install gcc by HomeBrew

Just run the following two commands.

# setup grew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# install gcc
brew install gcc

disable NativeComp

The following code will disable NativeComp module in each emacs session. So, no need to install GCC via Homebrew. Put the following code to early-init.el or beginning of init.el.

(setq native-comp-jit-compilation nil
      native-comp-enable-subr-trampolines nil)  

Integrated dynamic libraries:

  • libffi.7.dylib (or libffi.8.dylib), libffi is NOT contained in HEAD pkg.
  • libgmp.10.dylib
  • libintl.8.dylib
  • libtree-sitter.0.26.dylib
  • libgnutls.30.dylib
  • libnettle.8.dylib
  • libunistring.5.dylib
  • libhogweed.6.dylib
  • libp11-kit.0.dylib
  • libidn2.0.dylib
  • libtasn1.6.dylib

The system-configuration-features is:

ACL GNUTLS LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER SQLITE3 THREADS TOOLKIT_SCROLL_BARS TREE_SITTER ZLIB

Enjoy!

About

An enhanced inline patch for GNU Emacs (nextstep)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  

Packages

 
 
 

Contributors