all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Why does grep add /dev/null the first time?
@ 2014-08-14 18:12 guido
  2014-08-14 19:13 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: guido @ 2014-08-14 18:12 UTC (permalink / raw
  To: help-gnu-emacs

The subject is a proxy for a more complex question. I am using Emacs 24.3.1 on Mac OS X.; however the same issue occurs with Emacs 22.1.1 (which comes with the OS).

I have this in my .emacs:

(defun ack (arg)
  (interactive "sRun ack with arguments: ")
  (grep (concat "ack --noheading " arg)))

Note that "ack" is a grep-like tool which I've installed on my $PATH. Its first argument is a search pattern; optional following arguments are files or directories, defaulting to the current directory.

I invoke this using ESC-x ack (and then typing a search term).

The (minor) issue with this is that the first time after starting Emacs (and only the first time) the shell command actually executed has "/dev/null" appended (causing the search to return no results). Any subsequent invocations it will work fine.

What am I missing?


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

* Re: Why does grep add /dev/null the first time?
  2014-08-14 18:12 Why does grep add /dev/null the first time? guido
@ 2014-08-14 19:13 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2014-08-14 19:13 UTC (permalink / raw
  To: help-gnu-emacs

> Date: Thu, 14 Aug 2014 11:12:07 -0700 (PDT)
> From: guido@dropbox.com
> 
> The (minor) issue with this is that the first time after starting Emacs (and only the first time) the shell command actually executed has "/dev/null" appended (causing the search to return no results). Any subsequent invocations it will work fine.
> 
> What am I missing?

See the doc string of grep-use-null-device, which explains that.  Its
default value is 'auto-detect', which causes Emacs to invoke Grep once
for the purposes of detecting how to invoke it thereafter.



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

end of thread, other threads:[~2014-08-14 19:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-14 18:12 Why does grep add /dev/null the first time? guido
2014-08-14 19:13 ` 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.