all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Problem with `dir-locals-set-class-variables'
@ 2012-04-06  8:26 Arne Jørgensen
  2012-04-06 16:26 ` Glenn Morris
       [not found] ` <mailman.660.1333729584.20052.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Arne Jørgensen @ 2012-04-06  8:26 UTC (permalink / raw)
  To: help-gnu-emacs

I am trying to use `dir-locals-set-class-variables'.

If I do

  (dir-locals-set-class-variables 'my-test '((nil . ((my-test-var . "some-value")))))
  (dir-locals-set-directory-class "~/my-test-dir" 'my-test)

and then visit a file i.e. ~/my-test-dir/my-test-file the variable
`my-test-var' will be applied as local variable just as it should.

But if I want to use the other form of `dir-locals-set-class-variables'
where  variables is of the form (DIRECTORY . LIST) like this:

  (dir-locals-set-class-variables 'my-test '(("~/my-test-dir" . ((nil . ((my-test-var . "some-value")))))))

and then visit a file i.e. ~/my-test-dir/my-test-file the variable is
NOT applied.

Am I using the second form in a wrong way or what am I missing?

I have tried using both Emacs 23.1.1 and form a recent build 24.0.94.1.


Kind regards,
Arne



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

* Re: Problem with `dir-locals-set-class-variables'
  2012-04-06  8:26 Problem with `dir-locals-set-class-variables' Arne Jørgensen
@ 2012-04-06 16:26 ` Glenn Morris
       [not found] ` <mailman.660.1333729584.20052.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Glenn Morris @ 2012-04-06 16:26 UTC (permalink / raw)
  To: Arne Jørgensen; +Cc: help-gnu-emacs

Arne Jørgensen wrote:

> But if I want to use the other form of `dir-locals-set-class-variables'
> where  variables is of the form (DIRECTORY . LIST) like this:
>
>   (dir-locals-set-class-variables 'my-test '(("~/my-test-dir" . ((nil . ((my-test-var . "some-value")))))))
>
> and then visit a file i.e. ~/my-test-dir/my-test-file the variable is
> NOT applied.

I don't see this form documented anywhere. What makes you think it
should work?

C-h f dir-locals-set-class-variables

  (dir-locals-set-directory-class DIRECTORY CLASS &optional MTIME)
  [...]
  CLASS is the name of a project class, a symbol.



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

* Re: Problem with `dir-locals-set-class-variables'
       [not found] ` <mailman.660.1333729584.20052.help-gnu-emacs@gnu.org>
@ 2012-04-08  9:09   ` Arne Jørgensen
  2012-04-09  7:05     ` Glenn Morris
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Arne Jørgensen @ 2012-04-08  9:09 UTC (permalink / raw)
  To: help-gnu-emacs

Glenn Morris <rgm@gnu.org> writes:

> Arne Jørgensen wrote:
>
>> But if I want to use the other form of `dir-locals-set-class-variables'
>> where  variables is of the form (DIRECTORY . LIST) like this:
>>
>>   (dir-locals-set-class-variables 'my-test '(("~/my-test-dir" . ((nil . ((my-test-var . "some-value")))))))
>>
>> and then visit a file i.e. ~/my-test-dir/my-test-file the variable is
>> NOT applied.
>
> I don't see this form documented anywhere. What makes you think it
> should work?
>
> C-h f dir-locals-set-class-variables
>
>   (dir-locals-set-directory-class DIRECTORY CLASS &optional MTIME)
>   [...]
>   CLASS is the name of a project class, a symbol.

C-h f dir-locals-set-class-variables

  dir-locals-set-class-variables is a compiled Lisp function in
  `files.el'.

  (dir-locals-set-class-variables CLASS VARIABLES)

  Map the type CLASS to a list of variable settings.
  CLASS is the project class, a symbol.  VARIABLES is a list
  that declares directory-local variables for the class.
  An element in VARIABLES is either of the form:
      (MAJOR-MODE . ALIST)
  or
      (DIRECTORY . LIST)

  In the first form, MAJOR-MODE is a symbol, and ALIST is an alist
  whose elements are of the form (VARIABLE . VALUE).

  In the second form, DIRECTORY is a directory name (a string), and
  LIST is a list of the form accepted by the function.

  When a file is visited, the file's class is found.  A directory
  may be assigned a class using `dir-locals-set-directory-class'.
  Then variables are set in the file's buffer according to the
  class' LIST.  The list is processed in order.

  * If the element is of the form (MAJOR-MODE . ALIST), and the
    buffer's major mode is derived from MAJOR-MODE (as determined
    by `derived-mode-p'), then all the variables in ALIST are
    applied.  A MAJOR-MODE of nil may be used to match any buffer.
    `make-local-variable' is called for each variable before it is
    set.

  * If the element is of the form (DIRECTORY . LIST), and DIRECTORY
    is an initial substring of the file's directory, then LIST is
    applied by recursively following these rules.


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

* Re: Problem with `dir-locals-set-class-variables'
  2012-04-08  9:09   ` Arne Jørgensen
@ 2012-04-09  7:05     ` Glenn Morris
       [not found]     ` <mailman.781.1333955155.20052.help-gnu-emacs@gnu.org>
  2012-04-11 16:36     ` Glenn Morris
  2 siblings, 0 replies; 6+ messages in thread
From: Glenn Morris @ 2012-04-09  7:05 UTC (permalink / raw)
  To: Arne Jørgensen; +Cc: help-gnu-emacs


>> C-h f dir-locals-set-class-variables
>>
>>   (dir-locals-set-directory-class DIRECTORY CLASS &optional MTIME)

Sorry, I have no idea what I was doing there.
Obviously I can't read...



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

* Re: Problem with `dir-locals-set-class-variables'
       [not found]     ` <mailman.781.1333955155.20052.help-gnu-emacs@gnu.org>
@ 2012-04-09 16:24       ` Arne Jørgensen
  0 siblings, 0 replies; 6+ messages in thread
From: Arne Jørgensen @ 2012-04-09 16:24 UTC (permalink / raw)
  To: help-gnu-emacs

Glenn Morris <rgm@gnu.org> writes:

> Sorry, I have no idea what I was doing there.
> Obviously I can't read...

I tried that as well :-)

Arne


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

* Re: Problem with `dir-locals-set-class-variables'
  2012-04-08  9:09   ` Arne Jørgensen
  2012-04-09  7:05     ` Glenn Morris
       [not found]     ` <mailman.781.1333955155.20052.help-gnu-emacs@gnu.org>
@ 2012-04-11 16:36     ` Glenn Morris
  2 siblings, 0 replies; 6+ messages in thread
From: Glenn Morris @ 2012-04-11 16:36 UTC (permalink / raw)
  To: help-gnu-emacs


AFAICS, this feature simply doesn't work, for a variety of reasons.
You might like to file a bug report about it.
The first form that does work seems fine to me, so I don't see that the
second form needs to exist, so I think it should probably just be
undocumented.



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

end of thread, other threads:[~2012-04-11 16:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-06  8:26 Problem with `dir-locals-set-class-variables' Arne Jørgensen
2012-04-06 16:26 ` Glenn Morris
     [not found] ` <mailman.660.1333729584.20052.help-gnu-emacs@gnu.org>
2012-04-08  9:09   ` Arne Jørgensen
2012-04-09  7:05     ` Glenn Morris
     [not found]     ` <mailman.781.1333955155.20052.help-gnu-emacs@gnu.org>
2012-04-09 16:24       ` Arne Jørgensen
2012-04-11 16:36     ` Glenn Morris

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.