Subject: Re: bug#5360: 23.1.91; rgrep forces me to choose a directory

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 01 Oct 2019 17:11:14 +0200

[email-masked] writes:

> rgrep forces me to choose a directory, e.g.,
> (rgrep "INIT" "* .*" "/usr/share/initscripts/" nil)
> when I really want to choose a wildcard of several directories.
>
> OK, so I use repeat-complex-command to forge in
> (rgrep "INIT" "* .*" "/usr/share/init*" nil)
> And low and behold, rgrep assumes it can cd to that "directory" and
> proceeds even though the cd failed! So at least it should check that its
> cd doesn't fail, even if wildcard directories will never be implemented.

This seems to be on purpose:

    (unless (and dir (file-accessible-directory-p dir))
      (setq dir default-directory))

If you name a directory and it doesn't exist, then default-directory is
used, and it's done on purpose:

commit 32a2cf25a74160b855041c176d2e7e937baa4de8
Author: Juri Linkov <[email-masked]>
Date:   Sat Aug 22 00:17:56 2009 +0000

    (lgrep, rgrep): At the beginning
    set `dir' to `default-directory' unless `dir' is a non-nil
    readable directory.  (Bug#4052)
    (lgrep, rgrep): Change a weird way to report an error
    from using `read-string' to using `error'.
    Instead of using interactive arguments in the function body,
    add new argument `confirm'.

So I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no