From 8cddbe5ccf1a8331006029915e652e9d02d516b5 Mon Sep 17 00:00:00 2001 Message-Id: <8cddbe5ccf1a8331006029915e652e9d02d516b5.1718310047.git.mdw@distorted.org.uk> From: Mark Wooding Date: Mon, 29 Apr 2024 10:53:10 +0100 Subject: [PATCH] dot/emacs: Look for running server before leaping at starting a new one. Organization: Straylight/Edgeware From: Mark Wooding I used to use `warning-suppress-types' to muffle this, but it doesn't work any more because there's a new mechanism for `delayed warnings'. If we're still starting up (and not being a daemon or noninteractive) then warnings get put on a list to deal with later -- but the suppression lists aren't saved, so the warning `escapes' from under my attempt to muffle it. Instead, look to see if there's a server already running, and just print a message if there is. --- dot/emacs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dot/emacs b/dot/emacs index b78c03c..07c1e33 100644 --- a/dot/emacs +++ b/dot/emacs @@ -141,11 +141,14 @@ edit-server-new-frame nil server-raise-frame nil gnuserv-frame t) - (trap (let ((warning-suppress-types - (cons '(server) - (and (boundp 'warning-suppress-types) - warning-suppress-types)))) - (server-start))) + (trap (progn + (require 'server) + (let ((state (server-running-p))) + (if state + (message "Emacs server %s: not starting" + (cond ((eq state t) "already running") + (t "maybe running"))) + (server-start))))) (trap (progn (require 'edit-server) (edit-server-start) -- [mdw]