From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jeffrey Spencer Newsgroups: gmane.emacs.help Subject: Re: open recent file on startup Date: Tue, 7 Aug 2012 17:02:15 +1000 Message-ID: References: <116DF072-D45B-4BF2-B227-6904425D33D7@gmx.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f46d04447e29ffa0cf04c6a79318 X-Trace: dough.gmane.org 1344322974 32662 80.91.229.3 (7 Aug 2012 07:02:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 7 Aug 2012 07:02:54 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org" To: Alp Aker Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Aug 07 09:02:54 2012 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 1SydoV-0006zG-6z for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Aug 2012 09:02:47 +0200 Original-Received: from localhost ([::1]:58767 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SydoU-0000xp-Fl for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Aug 2012 03:02:46 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:53724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SydoM-0000xa-LD for help-gnu-emacs@gnu.org; Tue, 07 Aug 2012 03:02:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SydoG-0007Ri-Ra for help-gnu-emacs@gnu.org; Tue, 07 Aug 2012 03:02:38 -0400 Original-Received: from mail-we0-f169.google.com ([74.125.82.169]:41380) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SydoG-0007Rc-Kh for help-gnu-emacs@gnu.org; Tue, 07 Aug 2012 03:02:32 -0400 Original-Received: by weys10 with SMTP id s10so2888569wey.0 for ; Tue, 07 Aug 2012 00:02:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=E6e6Am2STWQule2q9UzPD9JnxxVHZ303ZfY1x1fPY6g=; b=OLpAphu/UTKB5YyqpYEDJg66T9RGh3b964KC39FNv42HL1RWcflw4aoj3chihXXs+g tAzOLeU4PhjbuwHa2fXvUv8AkHz737xyzL6J7hpoqvXPwHaBzPK8GKh2ADCxDKKE8LBR gOzsrM2Oo93bzXWfaa3woVtq9R78JuH4BTXAUMU4FtKYfrsOYfGRS06DkmiaRGeKmP1p Rugm9Zq5KrvIPAli3DLNkkDns7liRSBZTqjWHqLZ+S0S2VADtY9XD3eM4QG4x1s5IhS+ 2uZtUhwx2fIwephLS0MvOszSPy7Kmc8qmPxfskcuqPMSAh1xkyQ9zirznPIsm5TUQKVF mLSA== Original-Received: by 10.180.89.65 with SMTP id bm1mr28711318wib.1.1344322951684; Tue, 07 Aug 2012 00:02:31 -0700 (PDT) Original-Received: by 10.216.72.79 with HTTP; Tue, 7 Aug 2012 00:02:15 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.169 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:86233 Archived-At: --f46d04447e29ffa0cf04c6a79318 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable How do you check if emacs is opening from clicking a file or passing in a file argument in the terminal. I had set the function above but if I double click a file or pass in a file on the terminal I'd prefer this to not be activated. Instead the file clicked to be shown and to not set the initial-buffer-choice. I figured there is a variable for the file passed in but couldn't figure it out. thanks On Fri, Aug 3, 2012 at 12:44 PM, Alp Aker wrote: > > I copied this in my .emacs file so that the recent file gets opened on > startup: > > > > (recentf-mode 1) > > (if (file-readable-p recentf-save-file) > > (if (> (length recentf-list) 0) > > (find-file (car (recentf-elements 1))))) > > > > It seems to work =96 when I start emacs I see my last opened file. > > But then after a second, it switches the buffer back to the standard > emacs start-screen. > > Setting `initial-buffer-choice' in your .emacs might be what you want. > > --f46d04447e29ffa0cf04c6a79318 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable How do you check if emacs is opening from clicking a file or passing in a f= ile argument in the terminal. I had set the function above but if I double = click a file or pass in a file on the terminal I'd prefer this to not b= e activated. Instead the file clicked to be shown and to not set the initia= l-buffer-choice. I figured there is a variable for the file passed in but c= ouldn't figure it out.

thanks

On Fri, Aug 3,= 2012 at 12:44 PM, Alp Aker <alptekin.aker@gmail.com> = wrote:
> I copied this in my .= emacs file so that the recent file gets opened on startup:
>
> (recentf-mode 1)
> (if (file-readable-p recentf-save-file)
> =A0 =A0(if (> (length recentf-list) 0)
> =A0 =A0 =A0 (find-file (car (recentf-elements 1)))))
>
> It seems to work =96 when I start emacs I see my last opened file.
> But then after a second, it switches the buffer back to the standard e= macs start-screen.

Setting `initial-buffer-choice' in your .emacs might be what you = want.


--f46d04447e29ffa0cf04c6a79318--