Skip to content

Commit

Permalink
Merge branch 'snapshot' into pgtk
Browse files Browse the repository at this point in the history
This updates snapshot to core24

Signed-off-by: Alex Murray <murray.alex@gmail.com>
  • Loading branch information
alexmurray committed Nov 4, 2024
2 parents 324541f + ec7ee9a commit 729e87a
Show file tree
Hide file tree
Showing 10 changed files with 632 additions and 165 deletions.
7 changes: 6 additions & 1 deletion emacs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
# toolkit to use by checking if the XDG_SESSION_TYPE environment variable is
# set to wayland or x11.

# FIXME - remove the following once the various issues like
# https://github.com/alexmurray/emacs-snap/issues/78 and
# https://github.com/alexmurray/emacs-snap/issues/79 are resolved
: "${EMACS_TOOLKIT:=gtk}"

if [ -n "${XDG_SESSION_TYPE}" ]; then
if [ "${XDG_SESSION_TYPE}" = "wayland" ]; then
: "${EMACS_TOOLKIT:=wayland}"
Expand All @@ -24,7 +29,7 @@ case "${EMACS_TOOLKIT}" in
gtk|wayland)
;;
*)
echo "Invalid value for EMACS_TOOLKIT: ${EMACS_TOOLKIT}"
echo "Invalid value for EMACS_TOOLKIT: ${EMACS_TOOLKIT} - must be either gtk or wayland"
exit 1
;;
esac
Expand Down
91 changes: 91 additions & 0 deletions emacs-x-resource-name.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
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
+++ 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..b30ff50f97c 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))
{
@@ -29514,6 +29514,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
/* gtk_init does set_locale. Fix locale before and after. */
fixup_locale ();
unrequest_sigio (); /* See comment in x_display_ok. */
+ g_set_prgname ("emacs");
gtk_init (&argc, &argv2);
request_sigio ();

44 changes: 40 additions & 4 deletions emacsclient
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@
#!/bin/sh
#!/bin/bash
# Launch emacsclient with the most appropriate toolkit (currently gtk (for real
# x11) or wayland)

# The environment variable EMACS_TOOLKIT can be used to specify the preferred toolkit.
# The value should be one of: gtk or wayland

# If the environment variable is not set, the script will try to detect the
# toolkit to use by checking if the XDG_SESSION_TYPE environment variable is
# set to wayland or x11.

# FIXME - remove the following once the various issues like
# https://github.com/alexmurray/emacs-snap/issues/78 and
# https://github.com/alexmurray/emacs-snap/issues/79 are resolved
: "${EMACS_TOOLKIT:=gtk}"

if [ -n "${XDG_SESSION_TYPE}" ]; then
if [ "${XDG_SESSION_TYPE}" = "wayland" ]; then
: "${EMACS_TOOLKIT:=wayland}"
else
: "${EMACS_TOOLKIT:=gtk}"
fi
else
: "${EMACS_TOOLKIT:=gtk}"
fi

case "${EMACS_TOOLKIT}" in
gtk|wayland)
;;
*)
echo "Invalid value for EMACS_TOOLKIT: ${EMACS_TOOLKIT} - must be either gtk or wayland"
exit 1
;;
esac

EMACSCLIENT="emacsclient-${EMACS_TOOLKIT}"

# add logic from the upstream emacsclient.desktop script which supports
# spawning a new frame when launched with no arguments but only do this
# when we are launched from the desktop file which we can detect via the
Expand All @@ -7,10 +43,10 @@
if [ -n "$GIO_LAUNCHED_DESKTOP_FILE" ] && [ "$$" -eq "$GIO_LAUNCHED_DESKTOP_FILE_PID" ]; then
# the following is the logic from the upstream emacsclient.desktop file
if [ -n "$*" ]; then
exec $SNAP/usr/bin/emacsclient --alternate-editor= --display="$DISPLAY" "$@"
exec "$SNAP/usr/bin/$EMACSCLIENT" --alternate-editor= --display="$DISPLAY" "$@"
else
exec $SNAP/usr/bin/emacsclient --alternate-editor= --create-frame
exec "$SNAP/usr/bin/$EMACSCLIENT" --alternate-editor= --create-frame
fi
else
exec $SNAP/usr/bin/emacsclient "$@"
exec "$SNAP/usr/bin/$EMACSCLIENT" "$@"
fi
2 changes: 1 addition & 1 deletion native-comp.patch
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ index e97832455b9..b04cfa00c33 100644
(cond ((eq system-type 'darwin) '("-Wl,-w"))
- ((eq system-type 'cygwin) '("-Wl,-dynamicbase")))
+ ((eq system-type 'cygwin) '("-Wl,-dynamicbase"))
+ ((getenv "SNAP") (list (concat "--sysroot=" (file-name-as-directory (getenv "SNAP"))) (concat "-B" (file-name-as-directory (getenv "SNAP")) "usr/lib/gcc/"))))
+ ((getenv "SNAP_USER_COMMON") (list (concat "--sysroot=" (file-name-as-directory (getenv "SNAP_USER_COMMON")) "sysroot/") (concat "-B" (file-name-as-directory (getenv "SNAP_USER_COMMON")) "sysroot/usr/lib/gcc/"))))
"Options passed verbatim to the native compiler's back-end driver.
Note that not all options are meaningful; typically only the options
affecting the assembler and linker are likely to be useful.
82 changes: 0 additions & 82 deletions setup-env

This file was deleted.

5 changes: 5 additions & 0 deletions setup-env/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
setup-env: setup-env.c
gcc setup-env.c -o setup-env

install: setup-env
install -m 755 setup-env $(DESTDIR)/
Loading

0 comments on commit 729e87a

Please sign in to comment.