unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* setting minor mode via file local variable from function
@ 2013-06-13 12:16 Rainer M Krug
  2013-06-13 22:03 ` Stephen Berman
  0 siblings, 1 reply; 3+ messages in thread
From: Rainer M Krug @ 2013-06-13 12:16 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 566 bytes --]

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?

Thanks,

Rainer

-- 
Rainer M. Krug

email: RMKrug<at>gmail<dot>com

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

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

* Re: setting minor mode via file local variable from function
  2013-06-13 12:16 setting minor mode via file local variable from function Rainer M Krug
@ 2013-06-13 22:03 ` Stephen Berman
  2013-06-14  7:45   ` Rainer M Krug
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Berman @ 2013-06-13 22:03 UTC (permalink / raw)
  To: help-gnu-emacs

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

Steve Berman




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

* Re: setting minor mode via file local variable from function
  2013-06-13 22:03 ` Stephen Berman
@ 2013-06-14  7:45   ` Rainer M Krug
  0 siblings, 0 replies; 3+ messages in thread
From: Rainer M Krug @ 2013-06-14  7:45 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]


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 #2: Type: application/pgp-signature, Size: 489 bytes --]

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

end of thread, other threads:[~2013-06-14  7:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-13 12:16 setting minor mode via file local variable from function Rainer M Krug
2013-06-13 22:03 ` Stephen Berman
2013-06-14  7:45   ` Rainer M Krug

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