Skip to content

Commit

Permalink
Add all emacs-plus patches with explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffkreeftmeijer committed Apr 24, 2024
1 parent 982c376 commit 1c5d074
Show file tree
Hide file tree
Showing 6 changed files with 1,225 additions and 29 deletions.
15 changes: 10 additions & 5 deletions configured-emacs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
} }:

pkgs.emacsWithPackagesFromUsePackage {
package = (pkgs.emacs-git.overrideAttrs(old: {
patches = old.patches ++ [
./system-appearance.patch
];
}));
package = (
pkgs.emacs-git.overrideAttrs(old: {
patches = old.patches ++ [
./patches/system-appearance.patch
./patches/round-undecorated-frame.patch
./patches/poll.patch
./patches/fix-window-role.patch
];
})
);

config = ./default.el;
defaultInitFile = true;
Expand Down
53 changes: 48 additions & 5 deletions emacs-configuration.org
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,51 @@ To use the latest version, replace the revision hash with a branch name like ~ma

Assuming the derivation is saved to a file named ~emacs-git.nix~, it can be built through ~nix build~:

** Applying Emacs Plus patches

[[https://github.com/d12frosted/homebrew-emacs-plus][Emacs Plus]] is a Homebrew formula to build Emacs on macOS, which applies a couple of patches while building.
First, download the patches for the correct Emacs version.
In this case, get the patches for Emacs 30:

#+begin_src shell
curl https://raw.githubusercontent.com/d12frosted/homebrew-emacs-plus/master/patches/emacs-30/system-appearance.patch -o patches/system-appearance.patch
curl https://raw.githubusercontent.com/d12frosted/homebrew-emacs-plus/master/patches/emacs-30/round-undecorated-frame.patch -o patches/round-undecorated-frame.patch
curl https://raw.githubusercontent.com/d12frosted/homebrew-emacs-plus/master/patches/emacs-30/poll.patch -o patches/poll.patch
curl https://raw.githubusercontent.com/d12frosted/homebrew-emacs-plus/master/patches/emacs-28/fix-window-role.patch -o patches/fix-window-role.patch
#+end_src

#+RESULTS:

Then, override the attributes in ~pkgs.emacs-git~ when using emacs-overlay---or ~pkgs.emacs~ when building Emacs from Nixpkgs---to add all path files to the package's patches list:

#+name: patched
#+headers: :exports none
#+begin_src nix
pkgs.emacs-git.overrideAttrs(old: {
patches = old.patches ++ [
./patches/system-appearance.patch
./patches/round-undecorated-frame.patch
./patches/poll.patch
./patches/fix-window-role.patch
];
})
#+end_src

#+headers: :tangle emacs-patched.nix
#+headers: :noweb yes
#+begin_src nix
<<pkgs>>

<<patched>>
#+end_src

Assuming the derivation is saved to a file named ~emacs-patched.nix~, it can be built through ~nix build~:

#+begin_src shell
nix build --file emacs-patched.nix
open /result/Applications/Emacs.app
#+end_src


#+headers: :exports none
#+headers: :noweb yes
Expand All @@ -77,11 +122,9 @@ Assuming the derivation is saved to a file named ~emacs-git.nix~, it can be buil
<<pkgs>>

pkgs.emacsWithPackagesFromUsePackage {
package = (pkgs.emacs-git.overrideAttrs(old: {
patches = old.patches ++ [
./system-appearance.patch
];
}));
package = (
<<patched>>
);

config = ./default.el;
defaultInitFile = true;
Expand Down
25 changes: 25 additions & 0 deletions patches/fix-window-role.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 614bc763e72bdd5b26add04338cacc6803e2a0d6 Mon Sep 17 00:00:00 2001
From: Golem <golem@d12frosted.io>
Date: Thu, 9 Jan 2020 07:22:17 +0200
Subject: [PATCH] [patch] fix-window-role

---
src/nsterm.m | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index 6f9b208953..aa6c1d286f 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -8768,7 +8768,7 @@ - (id)accessibilityAttributeValue:(NSString *)attribute
NSTRACE ("[EmacsWindow accessibilityAttributeValue:]");

if ([attribute isEqualToString:NSAccessibilityRoleAttribute])
- return NSAccessibilityTextFieldRole;
+ return NSAccessibilityWindowRole;

if ([attribute isEqualToString:NSAccessibilitySelectedTextAttribute]
&& curbuf && ! NILP (BVAR (curbuf, mark_active)))
--
2.26.2

Loading

0 comments on commit 1c5d074

Please sign in to comment.