emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Info-insert-dir


From: martin rudalics
Subject: Re: Info-insert-dir
Date: Tue, 20 Mar 2007 10:56:55 +0100
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

>     Probably.  It's a customizable variable and `wid-edit' doesn't even
>     check if the user puts valid directory names in there.
>
> It shouldn't check that.  We do not try to stop users from putting
> nonexistent directory names into Lisp variables.

I meant `wid-edit' doesn't even check whether it's a "directory name" in
the sense of a filename ending with a slash (`wid-edit' doesn't
discriminate directories and files although it provides separate widgets
for them).

> It would be incorrect to change call-process to change the default
> directory on its own.  Often the execution of a command depends on the
> current directory, so that if the current directory is nonexistent, an
> error is the right thing.

Agreed.

> We could make a subroutine which does this and calls call-process.

What about `call-process-region', `start-process', `shell-command'?

Maybe we could introduce a macro like

(defmacro with-valid-default-directory (&rest body)
  "Run BODY with `default-directory' bound to an existing directory."
  (declare (indent 0) (debug t))
  `(let ((default-directory
           (if (and (stringp default-directory)
                    (file-directory-p default-directory))
               default-directory
             (expand-file-name "~/"))))
     ,@body))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]