Skip to content

Commit

Permalink
Set x-resource-name in elisp as well
Browse files Browse the repository at this point in the history
It seems x-resource-name gets set directly in elisp before it ever has a chance
to get set via the C code so set it here to "emacs" as well to ensure it is
named as we prefer. Fixes #83.

Signed-off-by: Alex Murray <murray.alex@gmail.com>
  • Loading branch information
alexmurray committed Feb 26, 2024
1 parent 054800f commit 70833d9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 12 deletions.
26 changes: 26 additions & 0 deletions emacs-x-resource-name.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
diff --git a/lisp/term/pgtk-win.el b/lisp/term/pgtk-win.el
index 2e03e7f57a5..a816224b703 100644
--- a/lisp/term/pgtk-win.el
+++ b/lisp/term/pgtk-win.el
@@ -116,7 +116,7 @@ DISPLAY is the name of the display Emacs should connect to."
(when (boundp 'x-resource-name)
(unless (stringp x-resource-name)
(let (i)
- (setq x-resource-name (copy-sequence invocation-name))
+ (setq x-resource-name (copy-sequence "emacs"))

;; Change any . or * characters in x-resource-name to hyphens,
;; so as not to choke when we use it in X resource queries.
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index 98dd576fea2..ac1fae6d600 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -1231,7 +1231,7 @@ This returns an error if any Emacs frames are X frames."
;; Make sure we have a valid resource name.
(or (stringp x-resource-name)
(let (i)
- (setq x-resource-name (copy-sequence invocation-name))
+ (setq x-resource-name (copy-sequence "emacs"))

;; Change any . or * characters in x-resource-name to hyphens,
;; so as not to choke when we use it in X resource queries.
diff --git a/src/pgtkfns.c b/src/pgtkfns.c
index 5f806e18090..abfc239a2c5 100644
--- a/src/pgtkfns.c
Expand Down
26 changes: 14 additions & 12 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ parts:
- CFLAGS: "$CFLAGS -O2"
- NATIVE_FULL_AOT: "1"
- LD_LIBRARY_PATH: "$SNAPCRAFT_STAGE/usr/lib"
override-build: |
override-pull: |
snapcraftctl pull
# ensure we hard-code our copy of gcc-10 and g++10 for tree-sitter
# otherwise it will use the system installed ones which will have a
# different libc version and we will fail to load them
Expand All @@ -237,40 +238,41 @@ parts:
# the invocation name (which is emacs-gtk or similar)
patch -p1 < $SNAPCRAFT_PROJECT_DIR/emacs-x-resource-name.patch
# build without pgtk as well
override-build: |
# build with pgtk for wayland
env NOCONFIGURE=1 ./autogen.sh
make distclean
./configure \
--prefix=/snap/emacs/current/usr \
--with-x-toolkit=gtk3 \
--without-xaw3d \
--with-modules \
--with-cairo \
--with-native-compilation=aot \
--without-pgtk \
--with-pgtk \
--with-xinput2 \
--with-tree-sitter \
--with-json
make -j"${SNAPCRAFT_PARALLEL_BUILD_COUNT}"
cp src/emacs src/emacs-gtk
cp src/emacs.pdmp src/emacs-gtk.pdmp
env NATIVE_FULL_AOT=1 make -j"${SNAPCRAFT_PARALLEL_BUILD_COUNT}"
cp src/emacs src/emacs-wayland
cp src/emacs.pdmp src/emacs-wayland.pdmp
# then build with pgtk for wayland
# then build without pgtk as well
env NOCONFIGURE=1 ./autogen.sh
make distclean
./configure \
--prefix=/snap/emacs/current/usr \
--with-x-toolkit=gtk3 \
--without-xaw3d \
--with-modules \
--with-cairo \
--with-native-compilation=aot \
--with-pgtk \
--without-pgtk \
--with-xinput2 \
--with-tree-sitter \
--with-json
make -j"${SNAPCRAFT_PARALLEL_BUILD_COUNT}"
cp src/emacs src/emacs-wayland
cp src/emacs.pdmp src/emacs-wayland.pdmp
env NATIVE_FULL_AOT=1 make -j"${SNAPCRAFT_PARALLEL_BUILD_COUNT}"
cp src/emacs src/emacs-gtk
cp src/emacs.pdmp src/emacs-gtk.pdmp
make install DESTDIR="${SNAPCRAFT_PART_INSTALL}"
Expand Down

0 comments on commit 70833d9

Please sign in to comment.