GNU bug report logs - #63620
30.0.50; [Feature Request] run hooks on sleep/wake

Previous Next

Package: emacs;

Reported by: Andrew Cohen <acohen <at> ust.hk>

Date: Sat, 20 May 2023 23:25:02 UTC

Severity: wishlist

Tags: patch

Found in version 30.0.50

Full log


Message #241 received at 63620 <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: acohen <at> ust.hk, 63620 <at> debbugs.gnu.org, michael.albinus <at> gmx.de,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#63620: 30.0.50; [Feature Request] run hooks on sleep/wake
Date: Fri, 7 Feb 2025 10:49:33 -0500
[Message part 1 (text/plain, inline)]
This works:

$ mac-emacs -Q --batch --eval '(message "%S" (boundp
'\''ns-version-string))'
t

But not the below. It looks like no accessible event loop so no sleep/wake
in batch on macOS. This could be addressed by the current NS experts. It's
not really clear why it was done this way. Running applescript
scripts doesn't have to be tied to a GUI. Neither does sleep/wake.

$ mac-emacs -Q --batch --eval '(ns-do-applescript "display notification
\"foo\"")'
+ exec /Applications/Emacs.app/Contents/MacOS/Emacs -Q --batch --eval
'(ns-do-applescript "display notification \"foo\"")'

Error: error ("Window system is not in use or not initialized")
  mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode
-0x1fffb8046512f81>))
  debug-early-backtrace()
  debug-early(error (error "Window system is not in use or not
initialized"))
  ns-do-applescript("display notification \"foo\"")
  command-line-1(("--eval" "(ns-do-applescript \"display notification
\\\"foo\\\"\")"))
  command-line()
  normal-top-level()
Window system is not in use or not initialized

On Fri, Feb 7, 2025 at 10:29 AM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: Ship Mints <shipmints <at> gmail.com>
> > Date: Fri, 7 Feb 2025 08:20:09 -0500
> > Cc: acohen <at> ust.hk, 63620 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca,
> >       michael.albinus <at> gmx.de
> >
> > In nsterm.m, it says:
> >
> >   /* emacs -nw doesn't have an NSApp, so we're done.  */
> >   if (NSApp == nil)
> >
> > That may influence if sleep/wake features are available in batch, at
> least for macos, yes?
>
> Could be.  I know almost nothing about how Emacs's inner loops work on
> macOS, sorry.  Only that it's different from every other platform.
>
[Message part 2 (text/html, inline)]

This bug report was last modified 130 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.