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 <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)
>    (if (> (length recentf-list) 0)
>       (find-file (car (recentf-elements 1)))))
>
> It seems to work – 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.