unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Should `auto-fill-function' be a safe local variable?
@ 2009-01-06 18:27 Leo
  2009-01-06 21:39 ` Stefan Monnier
  2009-01-06 22:59 ` Richard M Stallman
  0 siblings, 2 replies; 19+ messages in thread
From: Leo @ 2009-01-06 18:27 UTC (permalink / raw)
  To: emacs-devel

Hi there,

I have to disable auto-fill-mode for one file and it seems setting
auto-fill-function to nil in the file's local variables is a good
way. However, since auto-fill-function is currently marked risky, it
requires a confirmation each time the file is opened.

So should `auto-fill-function' be a safe local variable?

Cheers,
-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .: I use Emacs :.





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

* Re: Should `auto-fill-function' be a safe local variable?
  2009-01-06 18:27 Should `auto-fill-function' be a safe local variable? Leo
@ 2009-01-06 21:39 ` Stefan Monnier
  2009-01-07  4:01   ` Leo
  2009-01-06 22:59 ` Richard M Stallman
  1 sibling, 1 reply; 19+ messages in thread
From: Stefan Monnier @ 2009-01-06 21:39 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

> I have to disable auto-fill-mode for one file and it seems setting
> auto-fill-function to nil in the file's local variables is a good
> way. However, since auto-fill-function is currently marked risky, it
> requires a confirmation each time the file is opened.

How do you confirm?  The confirmation dialog offers you to make your
choice stick, so that subsequent uses of this settings are accepted
without confirmation.  Did you use that?

> So should `auto-fill-function' be a safe local variable?

Of course not.  It's safe to set it to nil, but not to set it to some
arbitrary value such as (lambda (&rest) (wreak-havoc)).


        Stefan




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

* Re: Should `auto-fill-function' be a safe local variable?
  2009-01-06 18:27 Should `auto-fill-function' be a safe local variable? Leo
  2009-01-06 21:39 ` Stefan Monnier
@ 2009-01-06 22:59 ` Richard M Stallman
  2009-01-07  3:49   ` Stefan Monnier
                     ` (2 more replies)
  1 sibling, 3 replies; 19+ messages in thread
From: Richard M Stallman @ 2009-01-06 22:59 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

    So should `auto-fill-function' be a safe local variable?

In general, it cannot be safe.  Its value is a function.
But we could say that the value nil is safe for it.

Perhaps it is unfortunate that the variable which controls
Auto Fill mode has a function value rather than a boolean value.
If nobody makes use of the potential to specify different kinds of
auto-filling functions, perhaps we should replace it with a boolean
variable `auto-fill-mode'.




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

* Re: Should `auto-fill-function' be a safe local variable?
  2009-01-06 22:59 ` Richard M Stallman
@ 2009-01-07  3:49   ` Stefan Monnier
  2009-01-08 11:38     ` Richard M Stallman
  2009-01-22  3:51   ` Leo
  2009-03-31 16:22   ` Leo
  2 siblings, 1 reply; 19+ messages in thread
From: Stefan Monnier @ 2009-01-07  3:49 UTC (permalink / raw)
  To: rms; +Cc: Leo, emacs-devel

> If nobody makes use of the potential to specify different kinds of
> auto-filling functions, perhaps we should replace it with a boolean
> variable `auto-fill-mode'.

Several major modes do make use of this potential.


        Stefan




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

* Re: Should `auto-fill-function' be a safe local variable?
  2009-01-06 21:39 ` Stefan Monnier
@ 2009-01-07  4:01   ` Leo
  0 siblings, 0 replies; 19+ messages in thread
From: Leo @ 2009-01-07  4:01 UTC (permalink / raw)
  To: emacs-devel

On 2009-01-06 21:39 +0000, Stefan Monnier wrote:
>> I have to disable auto-fill-mode for one file and it seems setting
>> auto-fill-function to nil in the file's local variables is a good
>> way. However, since auto-fill-function is currently marked risky, it
>> requires a confirmation each time the file is opened.
>
> How do you confirm?  The confirmation dialog offers you to make your
> choice stick, so that subsequent uses of this settings are accepted
> without confirmation.  Did you use that?

There is no such option.

,----
| The local variables list in example.tex
| contains variables that are risky (**).
| 
| Do you want to apply it?  You can type
| y  -- to apply the local variables list.
| n  -- to ignore the local variables list.
| 
|  ** auto-fill-function : nil
`----

>> So should `auto-fill-function' be a safe local variable?
>
> Of course not.  It's safe to set it to nil, but not to set it to some
> arbitrary value such as (lambda (&rest) (wreak-havoc)).

Maybe value nil should be marked safe as RMS suggested in another thread.

>         Stefan

Cheers,
-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .: I use Emacs :.





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

* Re: Should `auto-fill-function' be a safe local variable?
  2009-01-07  3:49   ` Stefan Monnier
@ 2009-01-08 11:38     ` Richard M Stallman
  2009-01-09  5:33       ` Leo
  0 siblings, 1 reply; 19+ messages in thread
From: Richard M Stallman @ 2009-01-08 11:38 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: sdl.web, emacs-devel

    > If nobody makes use of the potential to specify different kinds of
    > auto-filling functions, perhaps we should replace it with a boolean
    > variable `auto-fill-mode'.

    Several major modes do make use of this potential.

We could also add a local variable `auto-fill-mode' to enable
and disable the mode, and have `auto-fill-function' by default
have the usual function for auto-filling.  Then a major mode
could set `auto-fill-function' to specify HOW to do auto-fill
when it is enabled.

However...

I think it is a bad idea for a file to enable auto filling
in its local variables list, because that's a user preference
rather than a description of the file's format.

I think the OP wanted to a file disable auto filling, not enable it.
MAYBE that really does represent some info about the file's format.
We could make nil a safe value for `auto-fill-function'
and it would allow this.




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

* Re: Should `auto-fill-function' be a safe local variable?
  2009-01-08 11:38     ` Richard M Stallman
@ 2009-01-09  5:33       ` Leo
  2009-01-09 23:58         ` Richard M Stallman
  0 siblings, 1 reply; 19+ messages in thread
From: Leo @ 2009-01-09  5:33 UTC (permalink / raw)
  To: emacs-devel

On 2009-01-08 11:38 +0000, Richard M Stallman wrote:
> I think the OP wanted to a file disable auto filling, not enable it.
> MAYBE that really does represent some info about the file's format.
> We could make nil a safe value for `auto-fill-function' and it would
> allow this.

I have auto-fill-mode enabled for all text modes however, there's one
particular file that I got from someone else which I don't want
auto-fill to happen.

Thanks,
-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .: I use Emacs :.





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

* Re: Should `auto-fill-function' be a safe local variable?
  2009-01-09  5:33       ` Leo
@ 2009-01-09 23:58         ` Richard M Stallman
  2009-01-10  4:18           ` Leo
  0 siblings, 1 reply; 19+ messages in thread
From: Richard M Stallman @ 2009-01-09 23:58 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

    I have auto-fill-mode enabled for all text modes however, there's one
    particular file that I got from someone else which I don't want
    auto-fill to happen.

The question is whether this is a matter of personal taste
or in some sense an objective statement about that particular file.
If the former, you should set up a text-mode-hook function to check
for that file.  If the latter, setting auto-save-function to nil
in that file's local variables list is the right solution.

What do that file's contents look like?




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

* Re: Should `auto-fill-function' be a safe local variable?
  2009-01-09 23:58         ` Richard M Stallman
@ 2009-01-10  4:18           ` Leo
  2009-01-10 20:33             ` Richard M Stallman
  0 siblings, 1 reply; 19+ messages in thread
From: Leo @ 2009-01-10  4:18 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

On 2009-01-09 23:58 +0000, Richard M Stallman wrote:
> The question is whether this is a matter of personal taste
> or in some sense an objective statement about that particular file.
> If the former, you should set up a text-mode-hook function to check
> for that file.  If the latter, setting auto-save-function to nil
> in that file's local variables list is the right solution.

It is a personal taste I guess. Other editors may have its own way of
displaying long lines and thus not need something like
auto-fill-mode. Some people actual hate automatically inserting hard
newlines. So when you are working with them, you don't want auto-fill to
get in the way.

> What do that file's contents look like?

It is a tex file something like this:

\define@key{codeexample}{vbox}[]{\def\code@pre{\vbox\bgroup\setlength{\hsize}{\linewidth-6pt}}\def\code@post{\egroup}}

Best,

Leo




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

* Re: Should `auto-fill-function' be a safe local variable?
  2009-01-10  4:18           ` Leo
@ 2009-01-10 20:33             ` Richard M Stallman
  2009-01-11  3:46               ` Leo
  0 siblings, 1 reply; 19+ messages in thread
From: Richard M Stallman @ 2009-01-10 20:33 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

    It is a tex file something like this:

    \define@key{codeexample}{vbox}[]{\def\code@pre{\vbox\bgroup\setlength{\hsize}{\linewidth-6pt}}\def\code@post{\egroup}}

For that file, Emacs should use TeX mode, not Text mode.
Does it?
 




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

* Re: Should `auto-fill-function' be a safe local variable?
  2009-01-10 20:33             ` Richard M Stallman
@ 2009-01-11  3:46               ` Leo
  2009-01-11 19:12                 ` Richard M Stallman
  0 siblings, 1 reply; 19+ messages in thread
From: Leo @ 2009-01-11  3:46 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

On 2009-01-10 20:33 +0000, Richard M Stallman wrote:
>     It is a tex file something like this:
>
>     \define@key{codeexample}{vbox}[]{\def\code@pre{\vbox\bgroup\setlength{\hsize}{\linewidth-6pt}}\def\code@post{\egroup}}
>
> For that file, Emacs should use TeX mode, not Text mode.  Does it?

It seems it is derived from text-mode at least for the one in AUCTEX.

Best,

Leo




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

* Re: Should `auto-fill-function' be a safe local variable?
  2009-01-11  3:46               ` Leo
@ 2009-01-11 19:12                 ` Richard M Stallman
  2009-01-11 21:56                   ` Reiner Steib
  2009-01-12  5:28                   ` Leo
  0 siblings, 2 replies; 19+ messages in thread
From: Richard M Stallman @ 2009-01-11 19:12 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

    > For that file, Emacs should use TeX mode, not Text mode.  Does it?

    It seems it is derived from text-mode at least for the one in AUCTEX.

The normal TeX-mode is also derived from text-mode, I see.

But your hook function on text-mode-hook, which turns on Auto Fill
mode, can test what the mode really is, and not operate for TeX files.




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

* Re: Should `auto-fill-function' be a safe local variable?
  2009-01-11 19:12                 ` Richard M Stallman
@ 2009-01-11 21:56                   ` Reiner Steib
  2009-01-12  5:28                   ` Leo
  1 sibling, 0 replies; 19+ messages in thread
From: Reiner Steib @ 2009-01-11 21:56 UTC (permalink / raw)
  To: Richard Stallman; +Cc: Leo, emacs-devel

On Sun, Jan 11 2009, Richard M Stallman wrote:

>     It seems it is derived from text-mode at least for the one in AUCTEX.
>
> The normal TeX-mode is also derived from text-mode, I see.
>
> But your hook function on text-mode-hook, which turns on Auto Fill
> mode, can test what the mode really is, and not operate for TeX files.

Most user like to have auto-fill in (La)TeX files, I'd guess.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




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

* Re: Should `auto-fill-function' be a safe local variable?
  2009-01-11 19:12                 ` Richard M Stallman
  2009-01-11 21:56                   ` Reiner Steib
@ 2009-01-12  5:28                   ` Leo
  2009-01-12  6:34                     ` Miles Bader
  1 sibling, 1 reply; 19+ messages in thread
From: Leo @ 2009-01-12  5:28 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

On 2009-01-11 19:12 +0000, Richard M Stallman wrote:
>     > For that file, Emacs should use TeX mode, not Text mode.  Does it?
>
>     It seems it is derived from text-mode at least for the one in AUCTEX.
>
> The normal TeX-mode is also derived from text-mode, I see.
>
> But your hook function on text-mode-hook, which turns on Auto Fill
> mode, can test what the mode really is, and not operate for TeX files.

Yes, normally I want auto-fill in TeX mode. But occasionally I want to
turn it off for some particular files.

Best,

Leo




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

* Re: Should `auto-fill-function' be a safe local variable?
  2009-01-12  5:28                   ` Leo
@ 2009-01-12  6:34                     ` Miles Bader
  0 siblings, 0 replies; 19+ messages in thread
From: Miles Bader @ 2009-01-12  6:34 UTC (permalink / raw)
  To: Leo; +Cc: rms, emacs-devel

Leo <sdl.web@gmail.com> writes:
>> But your hook function on text-mode-hook, which turns on Auto Fill
>> mode, can test what the mode really is, and not operate for TeX files.
>
> Yes, normally I want auto-fill in TeX mode. But occasionally I want to
> turn it off for some particular files.

It would seem much more convenient to have a separate boolean
`auto-fill-mode' variable, so the file-variables can fool with that, and
leave setting of auto-fill-function to the mode!

-Miles

-- 
Rational, adj. Devoid of all delusions save those of observation, experience
and reflection.




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

* Re: Should `auto-fill-function' be a safe local variable?
  2009-01-06 22:59 ` Richard M Stallman
  2009-01-07  3:49   ` Stefan Monnier
@ 2009-01-22  3:51   ` Leo
  2009-03-31 16:22   ` Leo
  2 siblings, 0 replies; 19+ messages in thread
From: Leo @ 2009-01-22  3:51 UTC (permalink / raw)
  To: emacs-devel

On 2009-01-06 22:59 +0000, Richard M Stallman wrote:
> In general, it cannot be safe.  Its value is a function.  But we could
> say that the value nil is safe for it.

What's the solution to my original problem?

Thanks,
-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .: I use Emacs :.





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

* Re: Should `auto-fill-function' be a safe local variable?
  2009-01-06 22:59 ` Richard M Stallman
  2009-01-07  3:49   ` Stefan Monnier
  2009-01-22  3:51   ` Leo
@ 2009-03-31 16:22   ` Leo
  2009-04-02  1:56     ` Stefan Monnier
  2 siblings, 1 reply; 19+ messages in thread
From: Leo @ 2009-03-31 16:22 UTC (permalink / raw)
  To: rms; +Cc: Stefan Monnier, emacs-devel

On 2009-01-06 22:59 +0000, Richard M Stallman wrote:
>     So should `auto-fill-function' be a safe local variable?
>
> In general, it cannot be safe.  Its value is a function.
> But we could say that the value nil is safe for it.
[...]

On 2009-01-06 21:39 +0000, Stefan Monnier wrote:
[...]
>> So should `auto-fill-function' be a safe local variable?
>
> Of course not.  It's safe to set it to nil, but not to set it to some
> arbitrary value such as (lambda (&rest) (wreak-havoc)).

Hi Richard and Stefan,

Our discussion a long while ago seems to converge to making nil safe for
auto-fill-function. I have been using

  (put 'auto-fill-function 'safe-local-variable 'null)

in my .emacs, which enables users to disable auto-fill on a per-file
basis. May it be possible to make that default in Emacs?


Best wishes,
Leo




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

* Re: Should `auto-fill-function' be a safe local variable?
  2009-03-31 16:22   ` Leo
@ 2009-04-02  1:56     ` Stefan Monnier
  2009-04-02 14:36       ` Leo
  0 siblings, 1 reply; 19+ messages in thread
From: Stefan Monnier @ 2009-04-02  1:56 UTC (permalink / raw)
  To: Leo; +Cc: rms, emacs-devel

> Our discussion a long while ago seems to converge to making nil safe for
> auto-fill-function. I have been using

>   (put 'auto-fill-function 'safe-local-variable 'null)

> in my .emacs, which enables users to disable auto-fill on a per-file
> basis. May it be possible to make that default in Emacs?

Yes, done, thank you, and sorry for the delay,


        Stefan




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

* Re: Should `auto-fill-function' be a safe local variable?
  2009-04-02  1:56     ` Stefan Monnier
@ 2009-04-02 14:36       ` Leo
  0 siblings, 0 replies; 19+ messages in thread
From: Leo @ 2009-04-02 14:36 UTC (permalink / raw)
  To: emacs-devel

On 2009-04-02 02:56 +0100, Stefan Monnier wrote:
>> Our discussion a long while ago seems to converge to making nil safe for
>> auto-fill-function. I have been using
>
>>   (put 'auto-fill-function 'safe-local-variable 'null)
>
>> in my .emacs, which enables users to disable auto-fill on a per-file
>> basis. May it be possible to make that default in Emacs?
>
> Yes, done, thank you, and sorry for the delay,

Many thanks!
>
>         Stefan

-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .: I use Emacs :.

               www.git-scm.com
    git - the one true version control system





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

end of thread, other threads:[~2009-04-02 14:36 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-06 18:27 Should `auto-fill-function' be a safe local variable? Leo
2009-01-06 21:39 ` Stefan Monnier
2009-01-07  4:01   ` Leo
2009-01-06 22:59 ` Richard M Stallman
2009-01-07  3:49   ` Stefan Monnier
2009-01-08 11:38     ` Richard M Stallman
2009-01-09  5:33       ` Leo
2009-01-09 23:58         ` Richard M Stallman
2009-01-10  4:18           ` Leo
2009-01-10 20:33             ` Richard M Stallman
2009-01-11  3:46               ` Leo
2009-01-11 19:12                 ` Richard M Stallman
2009-01-11 21:56                   ` Reiner Steib
2009-01-12  5:28                   ` Leo
2009-01-12  6:34                     ` Miles Bader
2009-01-22  3:51   ` Leo
2009-03-31 16:22   ` Leo
2009-04-02  1:56     ` Stefan Monnier
2009-04-02 14:36       ` Leo

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).