Change the way a server is created;

This is in the direction of migrating towards a situation in which
the emacs server is started when an activity is started.
For the time being, it only starts a server when necessary and
declares its name in the process

Possibly this could be taken care of by using the -a option in
emacsclient, but I am not entirely sure that it would work…
master
Jacopo De Simoi 8 years ago
parent 9f96c2ce33
commit 5d33d5040d
  1. 30
      emacsclient-activities
  2. 4
      global.org

@ -11,5 +11,31 @@ kde-current-activity-name () {
qdbus org.kde.ActivityManager /ActivityManager/Activities org.kde.ActivityManager.Activities.ActivityName `kde-current-activity` qdbus org.kde.ActivityManager /ActivityManager/Activities org.kde.ActivityManager.Activities.ActivityName `kde-current-activity`
} }
emacsclient -s "$(kde-current-activity-name)" -a '/usr/bin/emacs' $@ # Check if server has been started and start it otherwise
emacsclient -s "$(kde-current-activity-name)" -e '(recenter)' emacs-server-start () {
emacsclient -s "$(kde-current-activity-name)" -e '(version)' &> /dev/null || (/usr/bin/emacs --daemon="$(kde-current-activity-name)";
);
}
# This ensures that the right server is started;
# I guess it can be done with -a "" when calling emacsclient, but
# eventually I want to start emacs servers when the activity changes,
# so this would need to be done separately anyways.
emacs-server-start
# This ensures that a new frame is created if only the default (tty)
# one is present. It also names the new frame, in case I decide to
# create secondary frames (e.g. for the agenda).
emacsclient -s "$(kde-current-activity-name)" -n -e "(if (> (length (frame-list)) 1) 't)" | grep t >/dev/null;
if [ "$?" = "1" ]; then
emacsclient -s "$(kde-current-activity-name)" -c --frame-parameters='(quote (name . "main-frame"))' "$@"
else
emacsclient -s "$(kde-current-activity-name)" "$@"
fi
STATUS=$?;
# This does not seem to be needed anymore
#emacsclient -s "$(kde-current-activity-name)" -e '(recenter-top-bottom)'
return $STATUS

@ -1066,7 +1066,7 @@
I prefer to keep one server for each KDE activity, so I prefer to keep one server for each KDE activity, so
set the server name to be the name of the current activity set the server name to be the name of the current activity
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq server-name (kde-current-activity-name)) ; (setq server-name (kde-current-activity-name))
#+END_SRC #+END_SRC
** TODO elisp ** TODO elisp
*** Paredit *** Paredit
@ -1283,5 +1283,5 @@
** Start server ** Start server
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(server-start) ; (server-start)
#+END_SRC #+END_SRC

Loading…
Cancel
Save