From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rainer M Krug Newsgroups: gmane.emacs.help Subject: Re: setting minor mode via file local variable from function Date: Fri, 14 Jun 2013 09:45:00 +0200 Message-ID: <87txl116gz.fsf@krugs.de> References: <87ip1i2lax.fsf@krugs.de> <8738slbrd5.fsf@rosalinde.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1371195961 4440 80.91.229.3 (14 Jun 2013 07:46:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Jun 2013 07:46:01 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jun 14 09:46:00 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UnOhr-0004NX-K4 for geh-help-gnu-emacs@m.gmane.org; Fri, 14 Jun 2013 09:45:59 +0200 Original-Received: from localhost ([::1]:51979 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnOho-0006y2-8W for geh-help-gnu-emacs@m.gmane.org; Fri, 14 Jun 2013 03:45:56 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnOhL-0006xk-Ax for help-gnu-emacs@gnu.org; Fri, 14 Jun 2013 03:45:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UnOhD-0001W2-2o for help-gnu-emacs@gnu.org; Fri, 14 Jun 2013 03:45:27 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:37337) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnOhC-0001Vs-RZ for help-gnu-emacs@gnu.org; Fri, 14 Jun 2013 03:45:18 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UnOhB-0003vd-M1 for help-gnu-emacs@gnu.org; Fri, 14 Jun 2013 09:45:17 +0200 Original-Received: from arn78-1-88-186-171-7.fbx.proxad.net ([88.186.171.7]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 14 Jun 2013 09:45:17 +0200 Original-Received: from Rainer by arn78-1-88-186-171-7.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 14 Jun 2013 09:45:17 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 77 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: arn78-1-88-186-171-7.fbx.proxad.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:KGoGtJGzFaGyVMtxhkcod2UQVl8= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:91542 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Stephen Berman writes: > On Thu, 13 Jun 2013 14:16:40 +0200 Rainer M Krug 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 > > > =2D-=20 Rainer M. Krug email: RMKruggmailcom --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJRusn9AAoJENvXNx4PUvmC9wkH/1YGPEvPlLExgWhnKiegGS/s mG0TzCIckcZ1Y4p8D5jPEruelKe0QmZxEB1/MVzttc+mEpUXWeTlc9Z2K6ByNfV8 nT7Ji5RvzOiAVcakY2OMCJb6c7qTaOuRJkhr4X4J63lLWzjSHEs2lRnM8vz8+TtG NJ4mRdi/uC0yWwlF4ozEN7q49sQPl6lbaA1q7YjESfwogA2BS+j5AUfmjzdCwxFg BtTSTt5nCFVKWYgigeKqQkSnzm5ULJku93/+FPS/s4ET5gXtb6tid14WgwD9UUZN n03x62wIFKV/qgHiqKJgZHgG2U9IjBslLMaSK0hC7zocpUOmM4y0XZ/MTFefbOo= =Wtv/ -----END PGP SIGNATURE----- --=-=-=--