Dr. Werner Fink 2013-05-24 10:47:07 +00:00 committed by Git OBS Bridge
parent 43f6555818
commit 9f976d12b6
3 changed files with 111 additions and 44 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri May 24 10:30:24 UTC 2013 - werner@suse.de
- Make emacs launch script smart, that is search for a valid dbus
on the current system if if not found launch a own dbus session
- With emacs version 24.3 the package epg becoes obsolate
-------------------------------------------------------------------
Wed May 22 10:13:13 UTC 2013 - werner@suse.de

99
emacs.sh Normal file
View File

@ -0,0 +1,99 @@
#!/bin/bash
#
# Launch a GNU Emacs
#
# The environment variable EMACS_TOOLKIT is used to determine
# the prefered GUI. Possible values/types of EMACS_TOOLKIT are
#
# nox -- for pure console based GNU Emacs
# gtk -- for full GTK2/3 based GNU Emacs
# x11 -- for full LUCID based GNU Emacs (used Xaw3d)
#
# Should work but remember history
# bnc#345669 -- Emacs doesn't un-maximize in KDE/KWin
# bnc#342385 -- Emacs doesn't keep the iconic information in KDE/KWin
#
# if test -z "$EMACS_TOOLKIT" ; then
# EMACS_TOOLKIT=gtk
# KDE_FULL_SESSION=$(xprop -root KDE_FULL_SESSION 2>/dev/null)
# case "$KDE_FULL_SESSION" in
# *true*) EMACS_TOOLKIT=x11
# esac
# fi
#
: ${EMACS_TOOLKIT:=gtk}
if test "$EMACS_TOOLKIT" = gtk; then
# Currently (2013/05/24) the parser of the GNOME libs
# are broken that is it is not independent from locale
LC_NUMERIC=POSIX
export LC_NUMERIC
fi
arg0=$0
argv=("$@")
if test -e ${arg0}-${EMACS_TOOLKIT}
then
set -- ${arg0}-${EMACS_TOOLKIT}
elif test -e ${arg0}-x11
then
set -- ${arg0}-x11
elif test -e ${arg0}-nox
then
set -- ${arg0}-nox
else
echo "no emacs binary found"
exit 1
fi
#
# Now check for valid dbus, e.g. after su/sudo/slogin
#
if dbusdaemon=$(type -p dbus-daemon) && dbuslaunch=$(type -p dbus-launch) ; then
#
# Currently (2013/05/24) the option --autolaunch for scanning for an
# already existing session is an internal option of dbus-launch(1).
#
if test -s /var/lib/dbus/machine-id ; then
read -t1 mid < /var/lib/dbus/machine-id
elif test -s /etc/machine-id ; then
read -t1 mid < /etc/machine-id
else
mid=
fi
if test -n "$DBUS_SESSION_BUS_ADDRESS" ; then
# Determine dbus identifier
for guid in ${DBUS_SESSION_BUS_ADDRESS//,/ } ; do
case "$guid" in
guid=*) break
esac
done
# Check if dbus-daemon is active
dpid=
for suid in "${HOME}/.dbus/session-bus/"${mid}* ; do
test -e "$suid" || break
grep -q $guid "$suid" || continue
dpid=$(grep -E '^DBUS_SESSION_BUS_PID=[[:digit:]]+' "$suid")
test /proc/${dpid#*=}/exe -ef $dbusdaemon && continue
unset DBUS_SESSION_BUS_ADDRESS
break
done
test -n "$dpid" || unset DBUS_SESSION_BUS_ADDRESS
fi
# Find a valid dbus-daemon if active
if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
for suid in "${HOME}/.dbus/session-bus/"${mid}* ; do
test -e "$suid" || break
dpid=$(grep -E '^DBUS_SESSION_BUS_PID=[[:digit:]]+' "$suid")
test /proc/${dpid#*=}/exe -ef $dbusdaemon || continue
dadd=$(grep -E '^DBUS_SESSION_BUS_ADDRESS=' "$suid")
DBUS_SESSION_BUS_ADDRESS=${dadd#*=}
export DBUS_SESSION_BUS_ADDRESS
done
fi
unset mid guid suid dadd
# Oops ... no dbus-daemon then launch a new session
if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
set -- $dbuslaunch --sh-syntax --close-stderr --exit-with-session ${1+"$@"}
arg0=$dbuslaunch
fi
unset dbuslaunch dbusdaemon
fi
exec -a $arg0 ${1+"$@"} "${argv[@]}"

View File

@ -80,11 +80,14 @@ License: GPL-3.0+
Group: Productivity/Editors/Emacs
Provides: nxml-mode = 20041004
Obsoletes: nxml-mode < 20041004
Provides: epg = 1.0.0
Obsoletes: epg < 1.0.0
Source: ftp://ftp.gnu.org/gnu/emacs/emacs-24.3.tar.xz
Source1: app-defaults.Emacs
Source2: site-lisp.tar.bz2
Source3: dot.gnu-emacs
Source4: emacs-rpmlintrc
Source5: emacs.sh
Patch: emacs-24.3.dif
Patch2: emacs-24.3-glibc.patch
Patch3: emacs-24.3-decl.dif
@ -100,7 +103,6 @@ Patch22: emacs-24.1-bnc628268.patch
Patch23: emacs-24.3-xevent.patch
Patch25: emacs-24.3-giflib5.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%global bug_345669 0
%{expand: %%global _exec_prefix %(type -p pkg-config &>/dev/null && pkg-config --variable prefix x11 || echo /usr/X11R6)}
%if "%_exec_prefix" == "/usr/X11R6"
%define _x11lib %{_exec_prefix}/%{_lib}
@ -423,48 +425,7 @@ install -m 0755 emacs-gtk %{buildroot}/usr/bin/
install -m 0755 emacs-x11 %{buildroot}/usr/bin/
make install DESTDIR=%{buildroot}
rm -vf %{buildroot}/usr/bin/emacs
%if %bug_345669
cat > %{buildroot}/usr/bin/emacs <<-"EOF"
#!/bin/bash
# Avoid trouble with maximize/minimize within KDE (bug #345669)
# -> under KWin emacs does not maximize in the correct way if
# GTK/GDK is used as toolkit. After click on the maximize
# button emacs shrinks to fit to the current font which
# destroys the maximize state in KWin.
# Avoid trouble with "iconic" state information (bug #342385)
# -> under KWin emacs with GTK/GDK toolkit does not hold its
# "iconic" state if a desktop state is saved before logout
# and restored after login.
if test -z "$EMACS_TOOLKIT" ; then
EMACS_TOOLKIT=gtk
KDE_FULL_SESSION=$(xprop -root KDE_FULL_SESSION 2>/dev/null)
case "$KDE_FULL_SESSION" in
*true*) EMACS_TOOLKIT=x11
esac
fi
exec -a ${0} ${0}-${EMACS_TOOLKIT} ${1+"$@"}
EOF
%else
cat > %{buildroot}/usr/bin/emacs <<-"EOF"
#!/bin/bash
# Possible values are nox, gtk, or x11
: ${EMACS_TOOLKIT:=gtk}
if test "$EMACS_TOOLKIT" = gtk; then
LC_NUMERIC=POSIX
export LC_NUMERIC
fi
if test -e ${0}-${EMACS_TOOLKIT} ; then
exec -a ${0} ${0}-${EMACS_TOOLKIT} ${1+"$@"}
elif test -e ${0}-x11 ; then
exec -a ${0} ${0}-x11 ${1+"$@"}
elif test -e ${0}-nox ; then
exec -a ${0} ${0}-nox ${1+"$@"}
else
echo "no emacs binary found"
exit 1
fi
EOF
%endif
install -p %{S:5} %{buildroot}/usr/bin/emacs
chmod 0755 %{buildroot}/usr/bin/emacs
tar cf - `find site-lisp/ -name '*.el' -o -name '*.elc'` | \
tar -x -f - -C %{buildroot}%{_datadir}/emacs/%{version}/