* bug#63181: 28.2; Can't suppress server-already-running warning
@ 2023-04-30 2:27 Dave Abrahams
2023-04-30 5:56 ` Eli Zaretskii
0 siblings, 1 reply; 6+ messages in thread
From: Dave Abrahams @ 2023-04-30 2:27 UTC (permalink / raw)
To: 63181
with emacs -Q or emacs -q, you can run
(dlet ((warning-suppress-types '((server))))
(server-mode))
from the *scratch* buffer, and if a server is already running, you just
get nil. But: if I put that stanza at the beginning of my early-init.el
(or init.el) and have no other configuration, I get a warning if the
server is already running.
Warning (server): Unable to start the Emacs server.
There is an existing Emacs server, named "server".
To start the server in this Emacs process, stop the existing
server or call ‘M-x server-force-delete’ to forcibly disconnect it. Disable showing Disable logging
It should be possible to suppress this warning programmatically, but I
can't find a way.
In GNU Emacs 28.2 (build 1, x86_64-apple-darwin22.3.0, Carbon Version 169 AppKit 2299.4)
of 2023-03-13 built on DaveMBP16.luannocracy.com
Windowing system distributor 'Apple Inc.', version 13.3.1
System Description: macOS 13.3.1
Configured using:
'configure --enable-locallisppath=/usr/local/share/emacs/site-lisp
--infodir=/usr/local/Cellar/emacs-mac/emacs-28.2-mac-9.1/share/info
--mandir=/usr/local/Cellar/emacs-mac/emacs-28.2-mac-9.1/share/man
--prefix=/usr/local/Cellar/emacs-mac/emacs-28.2-mac-9.1 --with-mac
--enable-mac-app=/usr/local/Cellar/emacs-mac/emacs-28.2-mac-9.1
--with-gnutls --with-modules --with-native-compilation
'CFLAGS=-I/usr/local/opt/gcc/include
-I/usr/local/opt/libgccjit/include' 'LDFLAGS=-L/usr/local/lib/gcc/12
-I/usr/local/opt/gcc/include -I/usr/local/opt/libgccjit/include''
Configured features:
ACL GMP GNUTLS JSON LIBXML2 MODULES NATIVE_COMP NOTIFY KQUEUE PDUMPER
THREADS TOOLKIT_SCROLL_BARS ZLIB
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: ELisp/d
Minor modes in effect:
magit-wip-initial-backup-mode: t
magit-wip-before-change-mode: t
magit-wip-after-apply-mode: t
magit-wip-after-save-mode: t
magit-wip-after-save-local-mode: t
global-git-commit-mode: t
shell-dirtrack-mode: t
ws-butler-global-mode: t
ws-butler-mode: t
global-auto-revert-mode: t
delete-selection-mode: t
override-global-mode: t
straight-use-package-mode: t
straight-package-neutering-mode: t
server-mode: t
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mac-mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
indent-tabs-mode: t
transient-mark-mode: t
Load-path shadows:
/Users/dave/.emacs.d.default/straight/build/transient/transient hides /usr/local/Cellar/emacs-mac/emacs-28.2-mac-9.1/share/emacs/28.2/lisp/transient
Features:
(shadow sort mail-extr emacsbug sendmail vc-git vc-dispatcher files-x
grep magit-extras magit-submodule magit-blame magit-stash magit-reflog
magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs magit-status
magit package browse-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util mailcap
url-handlers url-parse url-vars magit-repos magit-apply jka-compr pcase
dwa-init focus thingatpt focus-autoloads darkroom face-remap
darkroom-autoloads org-modern org-modern-autoloads poly-org org ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src
ob-comint org-pcomplete org-list org-faces org-entities noutline outline
org-version ob-emacs-lisp ob-core ob-eval org-table oc-basic bibtex
iso8601 ol org-keys oc org-compat org-macs org-loaddefs find-func
cal-menu calendar cal-loaddefs polymode poly-lock polymode-base
polymode-weave polymode-export polymode-compat advice polymode-methods
polymode-core polymode-classes eieio-custom wid-edit eieio-base color
poly-org-autoloads poly-markdown-autoloads markdown-mode-autoloads
polymode-autoloads find-file-in-repository-autoloads magit-wip magit-log
which-func imenu magit-diff smerge-mode diff git-commit log-edit message
rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068
epg-config gnus-util rmail rmail-loaddefs auth-source password-cache
json map time-date mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils
gmm-utils mailheader pcvs-util add-log magit-core magit-autorevert
magit-margin magit-transient magit-process with-editor comp comp-cstr
warnings rx shell pcomplete magit-mode transient magit-git magit-base
magit-section format-spec crm eieio eieio-core eieio-loaddefs dash
compat compat-29 magit-autoloads magit-section-autoloads
git-commit-autoloads with-editor-autoloads transient-autoloads
dash-autoloads compat-autoloads dwa-progmodes swift-mode-autoloads
dwa-global-config compile text-property-search comint ansi-color ring
skeleton modus-operandi-tinted-theme modus-themes modus-themes-autoloads
use-package-bind-key ws-butler ws-butler-autoloads use-package-diminish
diminish diminish-autoloads ediff ediff-merg ediff-mult ediff-wind
ediff-diff ediff-help ediff-init ediff-util diff-mode descr-text
finder-inf ido autorevert filenotify delsel cus-load use-package-core
dwa-global-keybindings edmacro kmacro bind-key easy-mmode dwa-folding
disp-table dwa-compile dwa-buffers dwa-navigation use-package-autoloads
info bind-key-autoloads straight-autoloads cl-seq cl-extra help-mode seq
byte-opt straight subr-x cl-macs cl-loaddefs cl-lib bytecomp
byte-compile cconv server chemacs gv iso-transl tooltip eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/mac-win mac-win term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice
button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads kqueue multi-tty
make-network-process native-compile emacs)
Memory information:
((conses 16 373463 19938)
(symbols 48 26280 0)
(strings 32 103745 4848)
(string-bytes 1 4257135)
(vectors 16 51630)
(vector-slots 8 963432 23953)
(floats 8 283 350)
(intervals 56 959 0)
(buffers 992 16))
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#63181: 28.2; Can't suppress server-already-running warning
2023-04-30 2:27 bug#63181: 28.2; Can't suppress server-already-running warning Dave Abrahams
@ 2023-04-30 5:56 ` Eli Zaretskii
2023-05-01 15:27 ` Dave Abrahams
0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2023-04-30 5:56 UTC (permalink / raw)
To: Dave Abrahams; +Cc: 63181
> From: Dave Abrahams <dave@boostpro.com>
> Date: Sat, 29 Apr 2023 19:27:14 -0700
>
> with emacs -Q or emacs -q, you can run
>
> (dlet ((warning-suppress-types '((server))))
> (server-mode))
>
> from the *scratch* buffer, and if a server is already running, you just
> get nil. But: if I put that stanza at the beginning of my early-init.el
> (or init.el) and have no other configuration, I get a warning if the
> server is already running.
>
> Warning (server): Unable to start the Emacs server.
> There is an existing Emacs server, named "server".
> To start the server in this Emacs process, stop the existing
> server or call ‘M-x server-force-delete’ to forcibly disconnect it. Disable showing Disable logging
>
> It should be possible to suppress this warning programmatically, but I
> can't find a way.
Why do you let-bind the variable, instead of assigning a value to it?
It's a defcustom, so it is meant to be bound with setq. You seem to
assume that the warning produced by server-mode will be processed
inside the binding, but that is not true during startup: warnings
emitted during startup are delayed until after the init files are read
and processed, and by that time your let-binding is long gone.
If you, for some reason, insist on doing this with a let-binding, you
will need to move this to after-init-hook or emacs-startup-hook, which
are invoked after loading the init files, and warnings are no longer
delayed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#63181: 28.2; Can't suppress server-already-running warning
2023-04-30 5:56 ` Eli Zaretskii
@ 2023-05-01 15:27 ` Dave Abrahams
2023-05-01 15:54 ` Eli Zaretskii
0 siblings, 1 reply; 6+ messages in thread
From: Dave Abrahams @ 2023-05-01 15:27 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 63181
I let-bind because I don’t want to suppress all server warnings forever, which is what I presume adding ‘sever to the list means ; just this one. Thanks for the explanation
Sent from my iPhone
> On Apr 29, 2023, at 10:55 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>
>>
>> From: Dave Abrahams <dave@boostpro.com>
>> Date: Sat, 29 Apr 2023 19:27:14 -0700
>>
>> with emacs -Q or emacs -q, you can run
>>
>> (dlet ((warning-suppress-types '((server))))
>> (server-mode))
>>
>> from the *scratch* buffer, and if a server is already running, you just
>> get nil. But: if I put that stanza at the beginning of my early-init.el
>> (or init.el) and have no other configuration, I get a warning if the
>> server is already running.
>>
>> Warning (server): Unable to start the Emacs server.
>> There is an existing Emacs server, named "server".
>> To start the server in this Emacs process, stop the existing
>> server or call ‘M-x server-force-delete’ to forcibly disconnect it. Disable showing Disable logging
>>
>> It should be possible to suppress this warning programmatically, but I
>> can't find a way.
>
> Why do you let-bind the variable, instead of assigning a value to it?
> It's a defcustom, so it is meant to be bound with setq. You seem to
> assume that the warning produced by server-mode will be processed
> inside the binding, but that is not true during startup: warnings
> emitted during startup are delayed until after the init files are read
> and processed, and by that time your let-binding is long gone.
>
> If you, for some reason, insist on doing this with a let-binding, you
> will need to move this to after-init-hook or emacs-startup-hook, which
> are invoked after loading the init files, and warnings are no longer
> delayed.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#63181: 28.2; Can't suppress server-already-running warning
2023-05-01 15:27 ` Dave Abrahams
@ 2023-05-01 15:54 ` Eli Zaretskii
2023-05-01 16:24 ` Dave Abrahams
0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2023-05-01 15:54 UTC (permalink / raw)
To: Dave Abrahams; +Cc: 63181
> From: Dave Abrahams <dave@boostpro.com>
> Date: Mon, 1 May 2023 08:27:46 -0700
> Cc: 63181@debbugs.gnu.org
>
> I let-bind because I don’t want to suppress all server warnings forever, which is what I presume adding ‘sever to the list means ; just this one. Thanks for the explanation
If you want to suppress these warnings only during startup, you can
restore the original value of warning-suppress-types in
emacs-startup-hook.
Did you try my other suggestions? did they work? can we close this bug
report?
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#63181: 28.2; Can't suppress server-already-running warning
2023-05-01 15:54 ` Eli Zaretskii
@ 2023-05-01 16:24 ` Dave Abrahams
2023-05-01 16:56 ` Eli Zaretskii
0 siblings, 1 reply; 6+ messages in thread
From: Dave Abrahams @ 2023-05-01 16:24 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 63181
> On May 1, 2023, at 8:54 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> From: Dave Abrahams <dave@boostpro.com>
>> Date: Mon, 1 May 2023 08:27:46 -0700
>> Cc: 63181@debbugs.gnu.org
>>
>> I let-bind because I don’t want to suppress all server warnings forever, which is what I presume adding ‘sever to the list means ; just this one. Thanks for the explanation
>
> If you want to suppress these warnings only during startup, you can
> restore the original value of warning-suppress-types in
> emacs-startup-hook.
Saving and restoring this thing manually seems very inelegant compared with allowing `let' to do what it's designed for, and I don't want to globally override
I should point out that I wasn't presuming that warnings would be issued immediately, only that the setting of warning-suppress-types would be examined in whichever function was responsible for queueing warnings, rather than (only) the code that reports them.
>
> Did you try my other suggestions? did they work? can we close this bug
> report?
This works for me:
;;
;; Start the server, suppressing warnings
;;
;; I often run a 2nd emacs especially when working on configuration,
;; and I don't like startup to be noisy. But the suppression doesn't
;; work unless I defer the work because warning processing is
;; deferred until after startup; see
;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63181
(add-hook 'emacs-startup-hook
(lambda ()
(dlet ((warning-suppress-types '((server))))
(server-mode))))
Whether to close the bug is up to you of course, but IMO there's still a problem, at *least* in documentation. Ideally the value of warning-suppress-types should be respected at the time warnings are queued, but if not, the documentation should be updated with a caveat about trying to use it during startup. But really, who wants more caveats? ;-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#63181: 28.2; Can't suppress server-already-running warning
2023-05-01 16:24 ` Dave Abrahams
@ 2023-05-01 16:56 ` Eli Zaretskii
0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2023-05-01 16:56 UTC (permalink / raw)
To: Dave Abrahams; +Cc: 63181-done
> From: Dave Abrahams <dave@boostpro.com>
> Date: Mon, 1 May 2023 09:24:10 -0700
> Cc: 63181@debbugs.gnu.org
>
> > Did you try my other suggestions? did they work? can we close this bug
> > report?
>
> This works for me:
>
> ;;
> ;; Start the server, suppressing warnings
> ;;
> ;; I often run a 2nd emacs especially when working on configuration,
> ;; and I don't like startup to be noisy. But the suppression doesn't
> ;; work unless I defer the work because warning processing is
> ;; deferred until after startup; see
> ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63181
> (add-hook 'emacs-startup-hook
> (lambda ()
> (dlet ((warning-suppress-types '((server))))
> (server-mode))))
That's a good solution, thanks.
> Whether to close the bug is up to you of course, but IMO there's still a problem, at *least* in documentation. Ideally the value of warning-suppress-types should be respected at the time warnings are queued, but if not, the documentation should be updated with a caveat about trying to use it during startup. But really, who wants more caveats? ;-)
The documentation was already fixed to mention this caveat and the
proposed solutions, as you will find if you look at the emacs-29
branch of the Emacs Git repository.
More generally, I think it's unreasonable to assume that every
let-binding takes effect for everything that is triggered inside the
body of the binding. A prominent example where this is not true is
when the body triggers some display-related feature -- the binding
doesn't work in that case because redisplay happens later, after the
command performed its thing and returned to the Emacs main loop. In
addition, problems during startup are notoriously hard to detect and
debug if their warnings are suppressed, so I think it's completely
okay if suppressing them is not really easy.
So I don't think we have anything else to do here aside of documenting
the fact that warnings are delayed during startup, and so I'm closing
this bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-05-01 16:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-30 2:27 bug#63181: 28.2; Can't suppress server-already-running warning Dave Abrahams
2023-04-30 5:56 ` Eli Zaretskii
2023-05-01 15:27 ` Dave Abrahams
2023-05-01 15:54 ` Eli Zaretskii
2023-05-01 16:24 ` Dave Abrahams
2023-05-01 16:56 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.