Skip to content

Commit

Permalink
Don't change Vinvocation_name - instead Vx_resource_name
Browse files Browse the repository at this point in the history
Vinvocation_name is used by too many things and causes other issues like
issue #84 so instead leave this but instead default Vx_resource_name to "emacs"
to fix the X WM_CLASS as emacs but allow it to still be set by -name as usual.

Signed-off-by: Alex Murray <[email protected]>
  • Loading branch information
alexmurray committed Feb 25, 2024
1 parent d08a52e commit 6c2d6fe
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 32 deletions.
26 changes: 0 additions & 26 deletions emacs-name.patch

This file was deleted.

57 changes: 57 additions & 0 deletions emacs-x-resource-name.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
diff --git a/src/pgtkfns.c b/src/pgtkfns.c
index 5f806e18090..abfc239a2c5 100644
--- a/src/pgtkfns.c
+++ b/src/pgtkfns.c
@@ -155,7 +155,7 @@ pgtk_display_info_for_name (Lisp_Object name)
}

/* Use this general default value to start with. */
- Vx_resource_name = Vinvocation_name;
+ Vx_resource_name = build_string ("emacs");

validate_x_resource_name ();

@@ -1218,7 +1218,7 @@ This function is an internal primitive--use `make-frame' instead. */ )

/* Use this general default value to start with
until we know if this frame has a specified name. */
- Vx_resource_name = Vinvocation_name;
+ Vx_resource_name = build_string("emacs");

display =
gui_display_get_arg (dpyinfo, parms, Qterminal, 0, 0, RES_TYPE_NUMBER);
diff --git a/src/xfns.c b/src/xfns.c
index 5a618908be1..19343ea8f82 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4629,7 +4629,7 @@ This function is an internal primitive--use `make-frame' instead. */)

/* Use this general default value to start with
until we know if this frame has a specified name. */
- Vx_resource_name = Vinvocation_name;
+ Vx_resource_name = build_string ("emacs");

display = gui_display_get_arg (dpyinfo, parms, Qterminal, 0, 0,
RES_TYPE_NUMBER);
@@ -7281,7 +7281,7 @@ x_display_info_for_name (Lisp_Object name)
return dpyinfo;

/* Use this general default value to start with. */
- Vx_resource_name = Vinvocation_name;
+ Vx_resource_name = build_string ("emacs");

validate_x_resource_name ();

diff --git a/src/xterm.c b/src/xterm.c
index 524e2a32574..22d319c5999 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -29489,7 +29489,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
argv[argc] = 0;

argc = 0;
- argv[argc++] = initial_argv[0];
+ argv[argc++] = "emacs";

if (! NILP (display_name))
{
12 changes: 6 additions & 6 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ parts:
# different libc version and we will fail to load them
patch -p1 < $SNAPCRAFT_PROJECT_DIR/treesit.patch
# also hard-code the name of our emacs binaries to emacs rather than
# emacs-wayland etc
patch -p1 < $SNAPCRAFT_PROJECT_DIR/emacs-name.patch
# also hard-code the default x resource name to emacs rather than using
# the invocation name (which is emacs-gtk or similar)
patch -p1 < $SNAPCRAFT_PROJECT_DIR/emacs-x-resource-name.patch
# build without pgtk as well
env NOCONFIGURE=1 ./autogen.sh
Expand Down Expand Up @@ -281,10 +281,10 @@ parts:
install -m 0644 "src/emacs-$backend.pdmp" "${pdmp_dir}"
ln -sf "emacs-$backend.pdmp" "${pdmp_dir}/emacs-$backend-$(src/emacs-$backend --fingerprint).pdmp"
done
override-prime: |
override-stage: |
set -eu
snapcraftctl prime
glib-compile-schemas $SNAPCRAFT_PRIME/usr/share/glib-2.0/schemas/
snapcraftctl stage
glib-compile-schemas $SNAPCRAFT_STAGE/usr/share/glib-2.0/schemas/
# Fix-up application icon lookup
sed -i -e 's|^Icon=.*|Icon=usr/share/icons/hicolor/scalable/apps/emacs.svg|g' usr/share/applications/emacs*.desktop
# also fixup emacsclient.desktop file since snapd replaces the Exec= line
Expand Down

0 comments on commit 6c2d6fe

Please sign in to comment.