emacs-devel
[Top][All Lists]
Advanced

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

RE: Scratch buffer annoyance


From: Drew Adams
Subject: RE: Scratch buffer annoyance
Date: Wed, 1 Aug 2007 09:53:26 -0700

> > If Customize can determine whether a string is a proper file or
> > directory name (types `file' and `directory'),
>
> It doesn't.  The difference is only in the UI, but otherwise matches any
> string.

I see; I wasn't aware of that. Why is that?

Then shouldn't the doc (e.g. Elisp manual) be corrected to explain that
strong statements such as "The value must be a directory name" don't mean
what they say, that they mean only that you can use completion to insert an
existing directory name? They apparently mean nothing about the value
itself. If there is really no requirement that "the value _must_ be a
directory name", then why say that?

Wrt requiring an absolute name for a file or directory: We already do that
elsewhere - note the doc string here:

(defcustom auto-insert-directory "~/insert/"
  "*Directory from which auto-inserted files are taken.
The value must be an absolute directory name..."
  :type 'directory :group 'auto-insert)

Presumably, it is the code that uses `auto-insert-directory' that ensures
that the value is in fact an absolute directory name. The same could be done
for `visit-on-startup': check its value at startup time, to see if it is
`file-name-absolute-p', and use a buffer if it is not. And document this
behavior in the doc string.

Going beyond control at startup time, couldn't we use, instead of `file' and
`directory' for :type, a suitable `restricted-sexp' expression, to ensure
that the saved value is in fact a string that satisfies
`file-name-absolute-p'? I'm no expert on custom types, but what about
something like this - its seems to work OK:

:type '(restricted-sexp :match-alternatives
        ((lambda (x) (and (stringp x) (file-name-absolute-p x)))))

Anyway, this doesn't sound like an unsurmountable problem, however we
approach it. We should be able to let a user specify an absolute file or
directory name or a buffer name.






reply via email to

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