@@ -218,7 +218,7 @@ class Build
218218 end
219219
220220 tarball = download_tarball ( meta [ :sha ] )
221- @source_dir = extract_tarball ( tarball , patches ( options ) )
221+ @source_dir = extract_tarball ( tarball , build_patches )
222222
223223 autogen
224224 detect_native_comp if options [ :native_comp ] . nil?
@@ -1052,7 +1052,7 @@ class Build
10521052 end
10531053 end
10541054
1055- def patches ( opts = { } )
1055+ def build_patches
10561056 p = [ ]
10571057
10581058 # Enabled by default patches.
@@ -1129,14 +1129,30 @@ class Build
11291129 }
11301130 end
11311131
1132- if opts [ :xwidgets ] && effective_version == 27
1132+ if options [ :xwidgets ] && effective_version == 27
11331133 p << {
11341134 url :
11351135 'https://github.com/d12frosted/homebrew-emacs-plus/raw/master/' \
11361136 "patches/emacs-#{ effective_version } /xwidgets_webkit_in_cocoa.patch"
11371137 }
11381138 end
11391139
1140+ if options [ :alpha_background ]
1141+ if effective_version == 29
1142+ p << {
1143+ file : File . join (
1144+ __dir__ , 'patches' , 'emacs-29' , 'ns-alpha-background.patch'
1145+ )
1146+ }
1147+ elsif ( 30 ..31 ) . include? ( effective_version )
1148+ p << {
1149+ url :
1150+ "https://github.com/emacs-mirror/emacs/compare/#{ meta [ :sha ] } " \
1151+ '...jonrubens:emacs:ns-alpha-background.patch'
1152+ }
1153+ end
1154+ end
1155+
11401156 # Custom patches.
11411157 options [ :patches ] . each do |patch_str |
11421158 patch = { }
@@ -1940,12 +1956,6 @@ class CLIOptions
19401956 '(default: enabled if IN_NIX_SHELL is set)'
19411957 ) { |v | options [ :use_nix ] = v }
19421958
1943- opts . on (
1944- '--[no-]xwidgets' ,
1945- 'Enable/disable XWidgets if supported ' \
1946- '(default: enabled)'
1947- ) { |v | options [ :xwidgets ] = v }
1948-
19491959 opts . on (
19501960 '--[no-]tree-sitter' ,
19511961 'Enable/disable tree-sitter if supported ' \
@@ -2010,23 +2020,37 @@ class CLIOptions
20102020 ) { |v | options [ :dbus ] = v }
20112021
20122022 opts . on (
2013- '--no-titlebar' ,
2014- 'Apply no-titlebar patch (default: disabled)'
2015- ) { options [ :no_titlebar ] = true }
2016-
2017- opts . on ( '--posix-spawn' , 'Apply posix-spawn patch (deprecated)' ) do
2018- warn '==> WARN: posix-spawn patch is deprecated and has no effect.'
2019- end
2023+ '--alpha-background' ,
2024+ 'Apply experimental alpha-background patch when building Emacs ' \
2025+ '30.x - 31.x (default: disabled)'
2026+ ) { |v | options [ :alpha_background ] = v }
20202027
20212028 opts . on (
20222029 '--no-frame-refocus' ,
2023- 'Apply no-frame-refocus patch (default: disabled)'
2030+ 'Apply no-frame-refocus patch when building Emacs 27.x - 31.x ' \
2031+ '(default: disabled)'
20242032 ) { options [ :no_frame_refocus ] = true }
20252033
2034+ opts . on (
2035+ '--no-titlebar' ,
2036+ 'Apply no-titlebar patch when building Emacs 27.x - 28.x ' \
2037+ '(default: disabled)'
2038+ ) { options [ :no_titlebar ] = true }
2039+
2040+ opts . on (
2041+ '--[no-]xwidgets' ,
2042+ 'Enable/disable XWidgets when building Emacs 27.x ' \
2043+ '(default: disabled)'
2044+ ) { |v | options [ :xwidgets ] = v }
2045+
20262046 opts . on ( '--[no-]poll' , 'Apply poll patch (deprecated)' ) do
20272047 warn '==> WARN: poll patch is deprecated and has no effect.'
20282048 end
20292049
2050+ opts . on ( '--posix-spawn' , 'Apply posix-spawn patch (deprecated)' ) do
2051+ warn '==> WARN: posix-spawn patch is deprecated and has no effect.'
2052+ end
2053+
20302054 opts . on (
20312055 '-p=URL' , '--patch=URL' ,
20322056 'Specify a custom patch file or URL to apply to the Emacs source ' \
0 commit comments