help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: setting minor mode via file local variable from function


From: Rainer M Krug
Subject: Re: setting minor mode via file local variable from function
Date: Fri, 14 Jun 2013 09:45:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Stephen Berman <stephen.berman@gmx.net> writes:

> On Thu, 13 Jun 2013 14:16:40 +0200 Rainer M Krug <Rainer@krugs.de> wrote:
>
>> Hi
>>
>> I have the following function definition:
>>
>> ,----
>> | (defun org-babel-mark-file-as-tangled ()
>> |   (when  (string-match "[.]R" (buffer-file-name))
>> |       (add-file-local-variable 'org-babel-tangled-file t)
>> |       (add-file-local-variable 'buffer-read-only t)
>> |       (basic-save-buffer)))
>> `----
>>
>> Now I would like to set the minor mode (auto-revert-mode) as
>> well. According to the manual, one should use
>>
>> ,----
>> | eval: (auto-revert-mode)
>> `----
>>
>> But how can I include this in my function above?
>
> How about this:
>
>  (defun org-babel-mark-file-as-tangled ()
>    (when  (string-match "[.]R" (buffer-file-name))
>        (add-file-local-variable 'org-babel-tangled-file t)
>        (add-file-local-variable 'buffer-read-only t)
>        (add-file-local-variable 'eval '(auto-revert-mode))
>        (basic-save-buffer)))

Haven't thought about that - but it makes perfect sense now.

Have somehow thought, the function add-file-local-variable is limited to
variables - and as eval: is not a variable, I discarded this option
before trying it.

Thanks,

Rainer



>
> Steve Berman
>
>
>

-- 
Rainer M. Krug

email: RMKrug<at>gmail<dot>com

Attachment: pgp7AtK1qJxKj.pgp
Description: PGP signature


reply via email to

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