* Use regexp with dir-locals-set-directory-class
@ 2014-08-20 9:05 Florian Lindner
0 siblings, 0 replies; 2+ messages in thread
From: Florian Lindner @ 2014-08-20 9:05 UTC (permalink / raw)
To: help-gnu-emacs
Hello,
can I use a regular expression (or globbing pattern) as DIRECTORY argument
to dir-locals-set-directory-class and set a class for all directories that
match?
Thanks,
Florian
^ permalink raw reply [flat|nested] 2+ messages in thread
[parent not found: <mailman.7268.1408525586.1147.help-gnu-emacs@gnu.org>]
* Re: Use regexp with dir-locals-set-directory-class
[not found] <mailman.7268.1408525586.1147.help-gnu-emacs@gnu.org>
@ 2014-08-20 17:05 ` Emanuel Berg
0 siblings, 0 replies; 2+ messages in thread
From: Emanuel Berg @ 2014-08-20 17:05 UTC (permalink / raw)
To: help-gnu-emacs
Florian Lindner <mailinglists@xgm.de> writes:
> can I use a regular expression (or globbing pattern)
> as DIRECTORY argument to
> dir-locals-set-directory-class and set a class for
> all directories that match?
Interesting question! Seems short answer is no, if you
check out the help:
DIRECTORY is the name of a directory, a string.
But that of course doesn't mean you cannot have what
you want.
There should be many ways to do this. Perhaps even a
standard one?
The principle should be easy:
1. Apply the regexp on the set of possible directories,
to get a list of matches.
2. Feed those one-by-one to the function.
Now, step one is the tricky part. I would use the shell
and ls. Like this:
(let*((dirs-str (with-temp-buffer
(call-process-shell-command
"ls -d testdir/*/" ; shell regexp here
nil ; no INFILE
t) ; BUFFER (t -> current buffer = the temp one)
(buffer-substring (point-min) (point-max)) ))
(dirs (split-string dirs-str)) )
(dolist (dir dirs)
(dir-locals-set-directory-class dir 'class-one) ))
--
underground experts united
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-08-20 17:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-20 9:05 Use regexp with dir-locals-set-directory-class Florian Lindner
[not found] <mailman.7268.1408525586.1147.help-gnu-emacs@gnu.org>
2014-08-20 17:05 ` Emanuel Berg
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.