unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Behaviour of add-file-local-variable?
@ 2011-10-19  8:57 Jambunathan K
  2011-10-19  9:39 ` Juri Linkov
  0 siblings, 1 reply; 5+ messages in thread
From: Jambunathan K @ 2011-10-19  8:57 UTC (permalink / raw)
  To: emacs-devel


Should add-file-local-variable also set the variable immediately rather
than merely updating the file footer?
-- 



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

* Re: Behaviour of add-file-local-variable?
  2011-10-19  8:57 Behaviour of add-file-local-variable? Jambunathan K
@ 2011-10-19  9:39 ` Juri Linkov
  2011-10-20  4:21   ` Jambunathan K
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2011-10-19  9:39 UTC (permalink / raw)
  To: emacs-devel

> Should add-file-local-variable also set the variable immediately rather
> than merely updating the file footer?

While keeping text in the Local Variables section in sync with actual
values looks like the right thing to do, it raises related questions
that are more difficult to decide:

Should `M-x add-file-local-variable RET mode RET' also change current mode?

Should `M-x add-file-local-variable RET coding RET' also change the
current buffer coding?

Should `M-x add-file-local-variable RET eval RET' evaluate the added expression?

Should `delete-file-local-variable' return the previous buffer-local value
or revert to the global value?

Should `add-dir-local-variable' after modifying .dir-locals.el
also update values in all visited file buffers in all subdirectories?



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

* Re: Behaviour of add-file-local-variable?
  2011-10-19  9:39 ` Juri Linkov
@ 2011-10-20  4:21   ` Jambunathan K
  2011-10-20 13:13     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Jambunathan K @ 2011-10-20  4:21 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel

Juri Linkov <juri@jurta.org> writes:

>> Should add-file-local-variable also set the variable immediately rather
>> than merely updating the file footer?

> While keeping text in the Local Variables section in sync with actual
> values looks like the right thing to do, it raises related questions
> that are more difficult to decide:

If a user adds a file local variable and intends that it take
immediately what will he do? I believe he is more likely to revert the
file. Does "act-as-though-the-file-were-reverted policy" still very
difficult to deal with while applying file local variables?

Even if you insist on retaining the existing behaviour, at the minimum I
need some warning that the local variable has not kicked in. This could
be handled by

1. Updating the docstring of the above commands
2. Prompting the user whether he wants to "apply" the changes (in much
   the same way that a user is warned of risky or non-safe variables)
3. Provide a prefix modifier to the commands

(1) is the easiest way to tackle it.

Anyways, I surprised by the current behaviour and it took sometime to
figure out what's happening.

> Should `M-x add-file-local-variable RET mode RET' also change current mode?
>
> Should `M-x add-file-local-variable RET coding RET' also change the
> current buffer coding?
>
> Should `M-x add-file-local-variable RET eval RET' evaluate the added expression?
>
> Should `delete-file-local-variable' return the previous buffer-local value
> or revert to the global value?
>
> Should `add-dir-local-variable' after modifying .dir-locals.el
> also update values in all visited file buffers in all subdirectories?

-- 



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

* Re: Behaviour of add-file-local-variable?
  2011-10-20  4:21   ` Jambunathan K
@ 2011-10-20 13:13     ` Stefan Monnier
  2011-10-21  0:01       ` Nix
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2011-10-20 13:13 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel

> Even if you insist on retaining the existing behaviour, at the minimum I
> need some warning that the local variable has not kicked in. This could
> be handled by

I think that add-file-local-variable could simply check if the
variable's value is already the new one and if not output a message
along the lines "Done; revisit the file to make it take effect" (tho
"take effect" doesn't sound right: please native speakers fix it for
me).


        Stefan



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

* Re: Behaviour of add-file-local-variable?
  2011-10-20 13:13     ` Stefan Monnier
@ 2011-10-21  0:01       ` Nix
  0 siblings, 0 replies; 5+ messages in thread
From: Nix @ 2011-10-21  0:01 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Juri Linkov, emacs-devel

On 20 Oct 2011, Stefan Monnier stated:
> I think that add-file-local-variable could simply check if the
> variable's value is already the new one and if not output a message
> along the lines "Done; revisit the file to make it take effect" (tho
> "take effect" doesn't sound right: please native speakers fix it for
> me).

Your instincts mislead you: it's right. Perhaps a more explicit "Revisit
file to make this change take effect" would be better? (But that's
style, not grammar.)

-- 
NULL && (void)



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

end of thread, other threads:[~2011-10-21  0:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-19  8:57 Behaviour of add-file-local-variable? Jambunathan K
2011-10-19  9:39 ` Juri Linkov
2011-10-20  4:21   ` Jambunathan K
2011-10-20 13:13     ` Stefan Monnier
2011-10-21  0:01       ` Nix

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).