unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Avoiding/removing the Async Shell Command buffer
@ 2011-09-27 16:19 Buchs, Kevin
  2011-09-28 10:25 ` Ludwig, Mark
  0 siblings, 1 reply; 3+ messages in thread
From: Buchs, Kevin @ 2011-09-27 16:19 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1181 bytes --]

In gnuemacs 23, I have a shell command I want to run asynchronously but
I want it to not open an output buffer (except perhaps if there is an
error - but that is quite unlikely). Could someone suggest an approach
to solving this? Does it take creation of a custom async-shell-command
variant?

 

I have tried implementing some commands to remove that buffer, but it
fails and prompts me to be sure I want to kill the buffer. Here is what
I have tried:

 

(defun org-doc ()

   "Open PDF for Org Mode"

   (interactive)

   (async-shell-command (concat custom-dir "/org-7.7/doc/org.pdf"))

   ; like to have it put away the *Async Shell Command* buffer

   (let ( (process (get-buffer-process "*Async Shell Command*")) )

      (kill-process process))

   (kill-buffer "*Async Shell Command*"))

 

Does anyone see any *mistakes* in that code?

 

Kevin Buchs   |  Senior Engineer  |  Department of Physiology and
Biomedical Engineering - SPPDG

507-538-5459  |   buchs.kevin@mayo.edu <mailto:buchs.kevin@mayo.edu>   |
http://www.mayo.edu/sppdg <http://www.mayo.edu/sppdg> 
Mayo Clinic  |  200 1st St. SW  |  Rochester, MN 55905  

 


[-- Attachment #2: Type: text/html, Size: 5124 bytes --]

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

* RE: Avoiding/removing the Async Shell Command buffer
  2011-09-27 16:19 Avoiding/removing the Async Shell Command buffer Buchs, Kevin
@ 2011-09-28 10:25 ` Ludwig, Mark
  2011-09-28 15:19   ` Buchs, Kevin
  0 siblings, 1 reply; 3+ messages in thread
From: Ludwig, Mark @ 2011-09-28 10:25 UTC (permalink / raw)
  To: Buchs, Kevin, help-gnu-emacs@gnu.org

From the doc (C-h f) for kill-buffer:

The functions in `kill-buffer-query-functions' are called with the buffer to be killed as the current buffer.  If any of them returns nil, the buffer is not killed.

HTH,
Mark

From: help-gnu-emacs-bounces+ludwig.mark=siemens.com@gnu.org [mailto:help-gnu-emacs-bounces+ludwig.mark=siemens.com@gnu.org] On Behalf Of Buchs, Kevin
Sent: Tuesday, September 27, 2011 11:19 AM
To: help-gnu-emacs@gnu.org
Subject: Avoiding/removing the Async Shell Command buffer

In gnuemacs 23, I have a shell command I want to run asynchronously but I want it to not open an output buffer (except perhaps if there is an error - but that is quite unlikely). Could someone suggest an approach to solving this? Does it take creation of a custom async-shell-command variant?

I have tried implementing some commands to remove that buffer, but it fails and prompts me to be sure I want to kill the buffer. Here is what I have tried:

(defun org-doc ()
   "Open PDF for Org Mode"
   (interactive)
   (async-shell-command (concat custom-dir "/org-7.7/doc/org.pdf"))
   ; like to have it put away the *Async Shell Command* buffer
   (let ( (process (get-buffer-process "*Async Shell Command*")) )
      (kill-process process))
   (kill-buffer "*Async Shell Command*"))

Does anyone see any *mistakes* in that code?

Kevin Buchs   |  Senior Engineer  |  Department of Physiology and Biomedical Engineering - SPPDG
507-538-5459  |   buchs.kevin@mayo.edu  |  http://www.mayo.edu/sppdg
Mayo Clinic  |  200 1st St. SW  |  Rochester, MN 55905  




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

* RE: Avoiding/removing the Async Shell Command buffer
  2011-09-28 10:25 ` Ludwig, Mark
@ 2011-09-28 15:19   ` Buchs, Kevin
  0 siblings, 0 replies; 3+ messages in thread
From: Buchs, Kevin @ 2011-09-28 15:19 UTC (permalink / raw)
  To: Ludwig, Mark, Buchs, Kevin, help-gnu-emacs

Thanks, Mark. You got me thinking/researching outside of my box and I realized that using start-process would allow me to control things more carefully and not starting a shell is faster. I just leave the process going, but I let the output come to the *Messages* buffer, so no visible changes occur in emacs.

(defun org-doc ()
   "Open PDF for Org Mode. Run process associated to the *Messages* buffer"
   (interactive)
   (start-process "org-doc-process" "*Messages*" 
      "C:/Program Files/Adobe/Acrobat 10.0/Acrobat/Acrobat.exe" 
      (concat custom-dir "/org-7.7/doc/org.pdf")))

Kevin Buchs   |  Senior Engineer  |  Department of Physiology and Biomedical Engineering - SPPDG
507-538-5459  |   buchs.kevin@mayo.edu  |  http://www.mayo.edu/sppdg
Mayo Clinic  |  200 1st St. SW  |  Rochester, MN 55905  



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

end of thread, other threads:[~2011-09-28 15:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-27 16:19 Avoiding/removing the Async Shell Command buffer Buchs, Kevin
2011-09-28 10:25 ` Ludwig, Mark
2011-09-28 15:19   ` Buchs, Kevin

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 read-only IMAP folder(s) and NNTP newsgroup(s).