Subject: bug#18326: 24.4.50; allow-no-window for async-shell-command in temp buffer

From: Joe Corneli <[email-masked]>
Date: Sun, 24 Aug 2014 19:34:21 +0100

The docs for `async-shell-command' say:

(async-shell-command COMMAND &optional OUTPUT-BUFFER ERROR-BUFFER)
  [...]
  To run COMMAND without displaying the output in a window you can
  configure `display-buffer-alist' to use the action
  `display-buffer-no-window' for the buffer `*Async Shell Command*'.

Referring to further docs and a recent discussion on this list,
https://lists.gnu.org/archive/html/bug-gnu-emacs/2014-07/msg00935.html
I see that that boils down to a setting like this:

(setq display-buffer-alist 
      '(("\\*Async Shell Command\\*" . (display-buffer-no-window
      . ((allow-no-window . t))))))

So, I've made that setting, expecting that it means that the Async Shell
Command buffer will not appear.  But then, defining the following
function and running the snippet that follows gives me an error:

(defun sudo-shell-command (command)
  (interactive "MShell command (root): ")
    (with-temp-buffer
      (cd "/sudo::/")
      (async-shell-command command)))

(sudo-shell-command "touch /dev/null")

  byte-code: Wrong type argument: window-live-p, nil

...Is that really to be expected?

As a work-around: if I return to the default setting for
`display-buffer-alist' and define my function this way, there is
no error and, as desired, the buffer doesn't display:

(setq display-buffer-alist nil)

(defun sudo-shell-command (command)
  (interactive "MShell command (root): ")
  (save-window-excursion
    (with-temp-buffer
      (cd "/sudo::/")
      (async-shell-command command))))

(sudo-shell-command "touch /dev/null")

I get the message:

  nil: finished.

I might have expect to see:

  touch /dev/null: finished.

but at least there's no error!

In GNU Emacs 24.4.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
 of 2014-08-09 on Teacup
Repository revision: 117674 [email-masked]
Windowing system distributor `The X.Org Foundation', version 11.0.11501000
System Description:	Ubuntu 14.04.1 LTS

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GSETTINGS NOTIFY GNUTLS
LIBXML2 FREETYPE XFT ZLIB

Important settings:
  value of $LC_MONETARY: en_GB.UTF-8
  value of $LC_NUMERIC: en_GB.UTF-8
  value of $LC_TIME: en_GB.UTF-8
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  shell-dirtrack-mode: t
  show-paren-mode: t
  tooltip-mode: t
  electric-indent-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
  column-number-mode: t
  line-number-mode: t

Recent input:
<return> C-x b * e w <tab> <return> g C-z M-> c d SPC 
. . <return> w h i c h <backspace> <backspace> <backspace> 
<backspace> <backspace> c d SPC s r c <return> e m 
a c s SPC - - v e r s i o n C-a . / C-e <return> M-x 
a b o u t <tab> <return> C-x C-b C-x <C-down-mouse-4> 
<C-mouse-4> o C-x o C-n C-n C-n <return> C-x b * e 
<tab> <return> g C-x b <return> M-< ; ; ; <return> 
<down-mouse-4> <mouse-4> <double-down-mouse-4> <double-mouse-4> 
<up> C-e SPC C-y <return> C-x 1 C-n C-n <up> <up> <up> 
C-SPC M-> M-w M-x r e p <tab> o <tab> r <tab> <return>

Recent messages:
nil: finished.
https://lists.gnu.org/archive/html/bug-gnu-emacs/2014-07/msg00935.html
Mark set
~/emacs 
~/emacs/src 
You can run the command `about-emacs' with C-h C-a
o is undefined
https://lists.gnu.org/archive/html/bug-gnu-emacs/2014-07/msg00935.html
Mark set [3 times]
Making completion list... [2 times]

Load-path shadows:
~/org-mode/lisp/org-crypt hides /usr/local/share/emacs/24.4.50/lisp/org/org-crypt
~/org-mode/lisp/org-mouse hides /usr/local/share/emacs/24.4.50/lisp/org/org-mouse
~/org-mode/lisp/ob-R hides /usr/local/share/emacs/24.4.50/lisp/org/ob-R
~/org-mode/lisp/org-indent hides /usr/local/share/emacs/24.4.50/lisp/org/org-indent
~/org-mode/lisp/ob-lilypond hides /usr/local/share/emacs/24.4.50/lisp/org/ob-lilypond
~/org-mode/lisp/org-mobile hides /usr/local/share/emacs/24.4.50/lisp/org/org-mobile
~/org-mode/lisp/ob-scheme hides /usr/local/share/emacs/24.4.50/lisp/org/ob-scheme
~/org-mode/lisp/ob-comint hides /usr/local/share/emacs/24.4.50/lisp/org/ob-comint
~/org-mode/lisp/org-eshell hides /usr/local/share/emacs/24.4.50/lisp/org/org-eshell
~/org-mode/lisp/ob-asymptote hides /usr/local/share/emacs/24.4.50/lisp/org/ob-asymptote
~/org-mode/lisp/ob-makefile hides /usr/local/share/emacs/24.4.50/lisp/org/ob-makefile
~/org-mode/lisp/org-w3m hides /usr/local/share/emacs/24.4.50/lisp/org/org-w3m
~/org-mode/lisp/org-colview hides /usr/local/share/emacs/24.4.50/lisp/org/org-colview
~/org-mode/lisp/org-install hides /usr/local/share/emacs/24.4.50/lisp/org/org-install
~/org-mode/lisp/org-bibtex hides /usr/local/share/emacs/24.4.50/lisp/org/org-bibtex
~/org-mode/lisp/ob-sqlite hides /usr/local/share/emacs/24.4.50/lisp/org/ob-sqlite
~/org-mode/lisp/org-element hides /usr/local/share/emacs/24.4.50/lisp/org/org-element
~/org-mode/lisp/org-timer hides /usr/local/share/emacs/24.4.50/lisp/org/org-timer
~/org-mode/lisp/ob-C hides /usr/local/share/emacs/24.4.50/lisp/org/ob-C
~/org-mode/lisp/ob-haskell hides /usr/local/share/emacs/24.4.50/lisp/org/ob-haskell
~/org-mode/lisp/ob-sql hides /usr/local/share/emacs/24.4.50/lisp/org/ob-sql
~/org-mode/lisp/ob-picolisp hides /usr/local/share/emacs/24.4.50/lisp/org/ob-picolisp
~/org-mode/lisp/ob-java hides /usr/local/share/emacs/24.4.50/lisp/org/ob-java
~/org-mode/lisp/org-footnote hides /usr/local/share/emacs/24.4.50/lisp/org/org-footnote
~/org-mode/lisp/ox-html hides /usr/local/share/emacs/24.4.50/lisp/org/ox-html
~/org-mode/lisp/ob-latex hides /usr/local/share/emacs/24.4.50/lisp/org/ob-latex
~/org-mode/lisp/ob-screen hides /usr/local/share/emacs/24.4.50/lisp/org/ob-screen
~/org-mode/lisp/ob-css hides /usr/local/share/emacs/24.4.50/lisp/org/ob-css
~/org-mode/lisp/org-attach hides /usr/local/share/emacs/24.4.50/lisp/org/org-attach
~/org-mode/lisp/ob-ditaa hides /usr/local/share/emacs/24.4.50/lisp/org/ob-ditaa
~/org-mode/lisp/ob-shen hides /usr/local/share/emacs/24.4.50/lisp/org/ob-shen
~/org-mode/lisp/org-feed hides /usr/local/share/emacs/24.4.50/lisp/org/org-feed
~/org-mode/lisp/ob-keys hides /usr/local/share/emacs/24.4.50/lisp/org/ob-keys
~/org-mode/lisp/ob-exp hides /usr/local/share/emacs/24.4.50/lisp/org/ob-exp
~/org-mode/lisp/org-datetree hides /usr/local/share/emacs/24.4.50/lisp/org/org-datetree
~/org-mode/lisp/org-macs hides /usr/local/share/emacs/24.4.50/lisp/org/org-macs
~/org-mode/lisp/ob-ruby hides /usr/local/share/emacs/24.4.50/lisp/org/ob-ruby
~/org-mode/lisp/ob-mscgen hides /usr/local/share/emacs/24.4.50/lisp/org/ob-mscgen
~/org-mode/lisp/ob-fortran hides /usr/local/share/emacs/24.4.50/lisp/org/ob-fortran
~/org-mode/lisp/org-irc hides /usr/local/share/emacs/24.4.50/lisp/org/org-irc
~/org-mode/lisp/org-version hides /usr/local/share/emacs/24.4.50/lisp/org/org-version
~/org-mode/lisp/ox-beamer hides /usr/local/share/emacs/24.4.50/lisp/org/ox-beamer
~/org-mode/lisp/ob-ref hides /usr/local/share/emacs/24.4.50/lisp/org/ob-ref
~/org-mode/lisp/org-rmail hides /usr/local/share/emacs/24.4.50/lisp/org/org-rmail
~/org-mode/lisp/ox hides /usr/local/share/emacs/24.4.50/lisp/org/ox
~/org-mode/lisp/ob-perl hides /usr/local/share/emacs/24.4.50/lisp/org/ob-perl
~/org-mode/lisp/org-agenda hides /usr/local/share/emacs/24.4.50/lisp/org/org-agenda
~/org-mode/lisp/org-habit hides /usr/local/share/emacs/24.4.50/lisp/org/org-habit
~/org-mode/lisp/org-compat hides /usr/local/share/emacs/24.4.50/lisp/org/org-compat
~/org-mode/lisp/ox-md hides /usr/local/share/emacs/24.4.50/lisp/org/ox-md
~/org-mode/lisp/org-plot hides /usr/local/share/emacs/24.4.50/lisp/org/org-plot
~/org-mode/lisp/ob-clojure hides /usr/local/share/emacs/24.4.50/lisp/org/ob-clojure
~/org-mode/lisp/ob-matlab hides /usr/local/share/emacs/24.4.50/lisp/org/ob-matlab
~/org-mode/lisp/ob-core hides /usr/local/share/emacs/24.4.50/lisp/org/ob-core
~/org-mode/lisp/ob-tangle hides /usr/local/share/emacs/24.4.50/lisp/org/ob-tangle
~/org-mode/lisp/org-loaddefs hides /usr/local/share/emacs/24.4.50/lisp/org/org-loaddefs
~/org-mode/lisp/org-ctags hides /usr/local/share/emacs/24.4.50/lisp/org/org-ctags
~/org-mode/lisp/org-docview hides /usr/local/share/emacs/24.4.50/lisp/org/org-docview
~/org-mode/lisp/ob-ledger hides /usr/local/share/emacs/24.4.50/lisp/org/ob-ledger
~/org-mode/lisp/org hides /usr/local/share/emacs/24.4.50/lisp/org/org
~/org-mode/lisp/org-protocol hides /usr/local/share/emacs/24.4.50/lisp/org/org-protocol
~/org-mode/lisp/ox-latex hides /usr/local/share/emacs/24.4.50/lisp/org/ox-latex
~/org-mode/lisp/ob-gnuplot hides /usr/local/share/emacs/24.4.50/lisp/org/ob-gnuplot
~/org-mode/lisp/ob-sass hides /usr/local/share/emacs/24.4.50/lisp/org/ob-sass
~/org-mode/lisp/org-pcomplete hides /usr/local/share/emacs/24.4.50/lisp/org/org-pcomplete
~/org-mode/lisp/ob hides /usr/local/share/emacs/24.4.50/lisp/org/ob
~/org-mode/lisp/ox-odt hides /usr/local/share/emacs/24.4.50/lisp/org/ox-odt
~/org-mode/lisp/ob-lob hides /usr/local/share/emacs/24.4.50/lisp/org/ob-lob
~/org-mode/lisp/ob-table hides /usr/local/share/emacs/24.4.50/lisp/org/ob-table
~/org-mode/lisp/org-mhe hides /usr/local/share/emacs/24.4.50/lisp/org/org-mhe
~/org-mode/lisp/ob-dot hides /usr/local/share/emacs/24.4.50/lisp/org/ob-dot
~/org-mode/lisp/ob-octave hides /usr/local/share/emacs/24.4.50/lisp/org/ob-octave
~/org-mode/lisp/ob-calc hides /usr/local/share/emacs/24.4.50/lisp/org/ob-calc
~/org-mode/lisp/ob-scala hides /usr/local/share/emacs/24.4.50/lisp/org/ob-scala
~/org-mode/lisp/ox-texinfo hides /usr/local/share/emacs/24.4.50/lisp/org/ox-texinfo
~/org-mode/lisp/org-macro hides /usr/local/share/emacs/24.4.50/lisp/org/org-macro
~/org-mode/lisp/ox-ascii hides /usr/local/share/emacs/24.4.50/lisp/org/ox-ascii
~/org-mode/lisp/ob-org hides /usr/local/share/emacs/24.4.50/lisp/org/ob-org
~/org-mode/lisp/ob-plantuml hides /usr/local/share/emacs/24.4.50/lisp/org/ob-plantuml
~/org-mode/lisp/org-gnus hides /usr/local/share/emacs/24.4.50/lisp/org/org-gnus
~/org-mode/lisp/ox-man hides /usr/local/share/emacs/24.4.50/lisp/org/ox-man
~/org-mode/lisp/ob-emacs-lisp hides /usr/local/share/emacs/24.4.50/lisp/org/ob-emacs-lisp
~/org-mode/lisp/ob-ocaml hides /usr/local/share/emacs/24.4.50/lisp/org/ob-ocaml
~/org-mode/lisp/org-faces hides /usr/local/share/emacs/24.4.50/lisp/org/org-faces
~/org-mode/lisp/org-clock hides /usr/local/share/emacs/24.4.50/lisp/org/org-clock
~/org-mode/lisp/org-src hides /usr/local/share/emacs/24.4.50/lisp/org/org-src
~/org-mode/lisp/ob-lisp hides /usr/local/share/emacs/24.4.50/lisp/org/ob-lisp
~/org-mode/lisp/org-list hides /usr/local/share/emacs/24.4.50/lisp/org/org-list
~/org-mode/lisp/ob-js hides /usr/local/share/emacs/24.4.50/lisp/org/ob-js
~/org-mode/lisp/ob-maxima hides /usr/local/share/emacs/24.4.50/lisp/org/ob-maxima
~/org-mode/lisp/ox-publish hides /usr/local/share/emacs/24.4.50/lisp/org/ox-publish
~/org-mode/lisp/org-archive hides /usr/local/share/emacs/24.4.50/lisp/org/org-archive
~/org-mode/lisp/ob-awk hides /usr/local/share/emacs/24.4.50/lisp/org/ob-awk
~/org-mode/lisp/ob-io hides /usr/local/share/emacs/24.4.50/lisp/org/ob-io
~/org-mode/lisp/ob-python hides /usr/local/share/emacs/24.4.50/lisp/org/ob-python
~/org-mode/lisp/ox-icalendar hides /usr/local/share/emacs/24.4.50/lisp/org/ox-icalendar
~/org-mode/lisp/org-bbdb hides /usr/local/share/emacs/24.4.50/lisp/org/org-bbdb
~/org-mode/lisp/org-id hides /usr/local/share/emacs/24.4.50/lisp/org/org-id
~/org-mode/lisp/org-capture hides /usr/local/share/emacs/24.4.50/lisp/org/org-capture
~/org-mode/lisp/org-entities hides /usr/local/share/emacs/24.4.50/lisp/org/org-entities
~/org-mode/lisp/ox-org hides /usr/local/share/emacs/24.4.50/lisp/org/ox-org
~/org-mode/lisp/org-inlinetask hides /usr/local/share/emacs/24.4.50/lisp/org/org-inlinetask
~/org-mode/lisp/org-info hides /usr/local/share/emacs/24.4.50/lisp/org/org-info
~/org-mode/lisp/ob-eval hides /usr/local/share/emacs/24.4.50/lisp/org/ob-eval
~/org-mode/lisp/org-table hides /usr/local/share/emacs/24.4.50/lisp/org/org-table
~/postdoc.git/elisp/lisp-mode hides /usr/local/share/emacs/24.4.50/lisp/emacs-lisp/lisp-mode

Features:
(shadow sort mail-extr emacsbug info vc-bzr pcmpl-unix dabbrev cus-edit
pp edebug cus-start cus-load debug eieio-opt help-mode rect tabify imenu
man url-queue shr-color color timezone gnutls network-stream starttls
url-http url-gw url-cache url-auth sh-script smie executable mule-util
face-remap conf-mode tramp-cmds tramp-sh tramp-cache tramp tramp-compat
tramp-loaddefs trampver misearch multi-isearch shell joes-dired-config
ls-lisp joes-buffer-menu-config joes-eww eww mm-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util url-parse url-vars mailcap joes-org-mode ox-s5 org-agenda
ox-latex ox-icalendar ox-html ox-ascii ox-publish ox org-rmail org-mhe
org-irc org-info org-gnus org-docview org-bibtex bibtex org-bbdb org-w3m
gnus-sum gnus-group gnus-undo gnus-start gnus-cloud nnimap nnmail
mail-source tls utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range
gnus-win gnus gnus-ems nnheader wid-edit org-element avl-tree
org-install joes-mu4e-config org-mu4e org org-macro org-footnote
org-pcomplete pcomplete org-list org-faces org-entities noutline outline
easy-mmode org-version ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob
ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat org-macs
org-loaddefs find-func cal-menu calendar cal-loaddefs shr smtpmail-multi
mu4e mu4e-speedbar speedbar sb-image ezimage dframe mu4e-main mu4e-view
epa derived epg epg-config browse-url comint ansi-color ring
mu4e-headers mu4e-compose mu4e-draft mu4e-actions ido rfc2368 smtpmail
auth-source eieio byte-opt bytecomp byte-compile cconv eieio-core
gnus-util password-cache sendmail mu4e-mark mu4e-message html2text
mu4e-proc mu4e-utils doc-view jka-compr image-mode mu4e-lists mu4e-about
mu4e-vars message cl-macs dired format-spec rfc822 mml easymenu mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader
hl-line cl gv mu4e-meta generic generic-x advice help-fns edmacro kmacro
cl-loaddefs cl-lib paren time-date tooltip electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process gfilenotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty emacs)

Memory information:
((conses 16 479492 120066)
 (symbols 48 41860 0)
 (miscs 40 1031 1465)
 (strings 32 100290 33196)
 (string-bytes 1 3166797)
 (vectors 16 32860)
 (vector-slots 8 664954 30872)
 (floats 8 532 920)
 (intervals 56 10643 1693)
 (buffers 976 44)
 (heap 1024 71763 68922))