Gnus development mailing list
 help / color / mirror / Atom feed
* window-system and batch mode
@ 2007-10-30  2:35 Katsumi Yamaoka
  2007-10-30  8:22 ` Richard Stallman
  2007-10-30 18:56 ` Stefan Monnier
  0 siblings, 2 replies; 6+ messages in thread
From: Katsumi Yamaoka @ 2007-10-30  2:35 UTC (permalink / raw)
  To: emacs-devel; +Cc: ding

Hi,

Recently Emacs sets `window-system' to t in the batch mode:

emacs -batch -Q -eval '(message "%s" window-system)'
t

Shouldn't it be nil?  If not, what is the right way that a Lisp
program knows that it runs in the batch mode?  Is it `noninteractive',
`(display-graphic-p)' or possibly `initial-window-system'?

I run Gnus in the batch mode using cron every day before I come
to the office for fetching new mails, but it failed nowadays
because Gnus calls `gnus-x-splash' which requires a graphic Emacs
frame[1].  The relevant code is:

(defun gnus-1 (&optional arg dont-connect slave)
[...]
      (cond
       ((featurep 'xemacs)
	(gnus-xmas-splash))
       (window-system
	(gnus-x-splash))))

([1] Although I've fixed in Gnus CVS the real cause, that is the
 form `(frame-parameter nil 'vertical-scroll-bars)' returns nil
 in `gnus-x-splash', it is essentially needless to be called if
 there's no window system.)

Regards,

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: window-system and batch mode
  2007-10-30  2:35 window-system and batch mode Katsumi Yamaoka
@ 2007-10-30  8:22 ` Richard Stallman
  2007-10-31 19:26   ` Stefan Monnier
  2007-10-30 18:56 ` Stefan Monnier
  1 sibling, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2007-10-30  8:22 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: ding, emacs-devel

    Recently Emacs sets `window-system' to t in the batch mode:

    emacs -batch -Q -eval '(message "%s" window-system)'
    t

    Shouldn't it be nil?

I think that is a bug, and it should be nil.
Would someone please DTRT then ack?

However, the right way to test for batch mode is `noninteractive'.
That is documented in the Lisp Manual.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: window-system and batch mode
  2007-10-30  2:35 window-system and batch mode Katsumi Yamaoka
  2007-10-30  8:22 ` Richard Stallman
@ 2007-10-30 18:56 ` Stefan Monnier
  2007-10-31  7:47   ` Richard Stallman
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2007-10-30 18:56 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: ding, emacs-devel

> Recently Emacs sets `window-system' to t in the batch mode:

Yes, when I changed window-system to be terminal-local I had to decide
what value to give to it for the initial "terminal" (which is basically
just stdin/stdout rather than an X11 or tty connection).  I decided to
use t (rather than nil which means "tty") to see what happens and
hopefully catch some bugs.  And indeed it helped me get the
"terminal-local window-system" patch working.

> Shouldn't it be nil?

Yes, we can easily change it back to nil.  I think code which relies on
this is broken, but I don't feel strongly about it.

> If not, what is the right way that a Lisp
> program knows that it runs in the batch mode?  Is it `noninteractive',
> `(display-graphic-p)' or possibly `initial-window-system'?

If we ever get the "frameless" emacs-server working, it will most likely
be using such a terminal, now whether that's interactive or not... the
limit will be a bit more blurry by then.


        Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: window-system and batch mode
  2007-10-30 18:56 ` Stefan Monnier
@ 2007-10-31  7:47   ` Richard Stallman
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2007-10-31  7:47 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: yamaoka, ding, emacs-devel

    Yes, when I changed window-system to be terminal-local I had to decide
    what value to give to it for the initial "terminal" (which is basically
    just stdin/stdout rather than an X11 or tty connection).  I decided to
    use t (rather than nil which means "tty") to see what happens and
    hopefully catch some bugs.  And indeed it helped me get the
    "terminal-local window-system" patch working.

I am glad it helped catch some bugs, but the correct value for a stdin
is certainly nil.  stdin is not a window system.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: window-system and batch mode
  2007-10-30  8:22 ` Richard Stallman
@ 2007-10-31 19:26   ` Stefan Monnier
  2007-11-01  1:44     ` Katsumi Yamaoka
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2007-10-31 19:26 UTC (permalink / raw)
  To: rms; +Cc: Katsumi Yamaoka, ding, emacs-devel

>     Recently Emacs sets `window-system' to t in the batch mode:
>     emacs -batch -Q -eval '(message "%s" window-system)'
>     t

>     Shouldn't it be nil?

> I think that is a bug, and it should be nil.
> Would someone please DTRT then ack?

Done,


        Stefan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: window-system and batch mode
  2007-10-31 19:26   ` Stefan Monnier
@ 2007-11-01  1:44     ` Katsumi Yamaoka
  0 siblings, 0 replies; 6+ messages in thread
From: Katsumi Yamaoka @ 2007-11-01  1:44 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: rms, ding, emacs-devel

>>>>> Stefan Monnier wrote:

>>     Recently Emacs sets `window-system' to t in the batch mode:
>>     emacs -batch -Q -eval '(message "%s" window-system)'
>>     t

>>     Shouldn't it be nil?

>> I think that is a bug, and it should be nil.
>> Would someone please DTRT then ack?

> Done,

Confirmed.  Thanks.

>>>>> Richard Stallman wrote:

> However, the right way to test for batch mode is `noninteractive'.
> That is documented in the Lisp Manual.

I see.  I verified Gnus uses `noninteractive' properly for
`gnus-batch-kill'.   Only `gnus-batch-kill' seems to be a non-
interactive feature that Gnus explicitly supports, so I don't
add something useful for the batch mode to other Gnus functions
for the moment.  FYI, my crontab entry is in the next page.

OTOH, the usages of `window-system' are not all necessarily
proper.  For instance, `mailcap-mime-data' inhibits some X
applications if Emacs runs in tty even if it runs in the local
X window system.  Gnus may assume that nil for `window-system'
means a user uses a teletype in a far place, though.

\f
crontab -l
--8<---------------cut here---------------start------------->8---
15 6 * * * rm -f ~/#.newsrc-dribble# ~/.newsrc-dribble; emacs -batch\
 -u yamaoka -l gnus --eval '(let ((gnus-batch-mode t)) (gnus 1))'\
 -f gnus-group-quit
--8<---------------cut here---------------end--------------->8---

`-u yamaoka' is similar to `-l ~yamaoka/.emacs'.  Binding
`gnus-batch-mode' to t makes Gnus not make query when opening a
primary (nntp, in my case) server fails.  The argument `1'
passed to `gnus' means fetching only new mails (the group levels
of my mail groups are all `1').

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-11-01  1:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-30  2:35 window-system and batch mode Katsumi Yamaoka
2007-10-30  8:22 ` Richard Stallman
2007-10-31 19:26   ` Stefan Monnier
2007-11-01  1:44     ` Katsumi Yamaoka
2007-10-30 18:56 ` Stefan Monnier
2007-10-31  7:47   ` Richard Stallman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).