unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: help-gnu-emacs@gnu.org
Subject: Re: setting minor mode via file local variable from function
Date: Fri, 14 Jun 2013 00:03:34 +0200	[thread overview]
Message-ID: <8738slbrd5.fsf@rosalinde.fritz.box> (raw)
In-Reply-To: 87ip1i2lax.fsf@krugs.de

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




  reply	other threads:[~2013-06-13 22:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-13 12:16 setting minor mode via file local variable from function Rainer M Krug
2013-06-13 22:03 ` Stephen Berman [this message]
2013-06-14  7:45   ` Rainer M Krug

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8738slbrd5.fsf@rosalinde.fritz.box \
    --to=stephen.berman@gmx.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).