From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suvayu Ali Subject: Re: How can I autorun M-x linum-mode when file is opened? Date: Mon, 11 Aug 2014 09:12:18 +0200 Message-ID: <20140811071218.GD23223@chitra.no-ip.org> References: <87iom0i983.fsf@skimble.plus.com> <87tx5kfcvx.fsf@skimble.plus.com> <87y4uwcj6f.fsf@turing.flintfam.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56582) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGjmU-0002Em-IC for emacs-orgmode@gnu.org; Mon, 11 Aug 2014 03:12:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XGjmO-0004D9-Ip for emacs-orgmode@gnu.org; Mon, 11 Aug 2014 03:12:34 -0400 Received: from mail-we0-x22e.google.com ([2a00:1450:400c:c03::22e]:53345) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGjmO-0004D4-BO for emacs-orgmode@gnu.org; Mon, 11 Aug 2014 03:12:28 -0400 Received: by mail-we0-f174.google.com with SMTP id x48so8181783wes.19 for ; Mon, 11 Aug 2014 00:12:27 -0700 (PDT) Received: from chitra.no-ip.org (sd44012d5.adsl.online.nl. [212.64.18.213]) by mx.google.com with ESMTPSA id ex2sm40321069wic.24.2014.08.11.00.12.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Aug 2014 00:12:26 -0700 (PDT) Content-Disposition: inline In-Reply-To: <87y4uwcj6f.fsf@turing.flintfam.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org On Sun, Aug 10, 2014 at 01:07:36PM -0500, Samuel W Flint wrote: > On 10 Aug 2014, Sharon Kimble wrote: > [Edited for the sake of brevity] > > >>> How can I have a command auto-run when a file is opened from > >>> 'desktop recovery' please? I want to auto-run "M-x linum-mode" when > >>> I open my daily journal, which stays open all the time. Running that > >>> command will switch off linum-mode for that file, which may stop > >>> "file-rot" that I have observed in the past. This can, at present, > >>> only be resolved by shutting down emacs for half an hour or so, and > >>> then restarting it, and normal functionality will have been > >>> restored. > > Have you considered using a hook? That is what they are for, and > generally, I’ve found that linum mode in an org file can be annoying, so > in my init file I have =(add-hook ‘org-mode-hook #’(lambda () > (linum-mode -1)))=, and, while I have Linum on globally, this disables > it for all org mode files. FWIW, if anyone is curious, the following post gives some insight into why that might be. Cheers, -- Suvayu Open source is the future. It sets us free.