1

I, personally, don't mind the welcome screen. But I find it a wee bit annoying to look at when I open a document in a new instance of emacs. I don't mind it, when I don't open a document, but having to hit C-x 1 every time I want to edit a text file is getting annoying. Is there a way for me to have it hide the welcome screen, but only when I open a document?

Let me put this in another way. Is there a way to inhibit the welcome screen, when double clicking a document on the desktop? I don't care about launching from the terminal or opening documents while emacs is running.

phils
  • 71,335
  • 11
  • 153
  • 198
Electric Coffee
  • 11,733
  • 9
  • 70
  • 131
  • 1
    http://stackoverflow.com/q/744672/1030675 – choroba Dec 15 '14 at 11:26
  • this inhibits the welcome screen in general, which isn't what I want – Electric Coffee Dec 15 '14 at 11:27
  • 1
    OK. So start `server-mode` and use `emacsclient` to open documents. – choroba Dec 15 '14 at 11:28
  • How about just inhibiting the welcome screen in general (which will affect all areas and all circumstances), and then configure Emacs to display a welcome screen **only** under whatever circumstance makes you happy to see it? – lawlist Dec 15 '14 at 17:50
  • How would I go by doing that? – Electric Coffee Dec 15 '14 at 17:58
  • Disabling globally is the easy part. You would need to assemble a list of all circumstances when you want to see the welcome screen, and then whoever writes the solution would need to think about it and devise a custom solution based upon your personal preferences. – lawlist Dec 15 '14 at 18:26
  • Out of curiosity, why do you not want to just inhibit it generally? – Drew Dec 15 '14 at 18:58
  • @Drew because I like the way it looks, it feels so emacsy. It only gets in the way when I open a document by double clicking it – Electric Coffee Dec 15 '14 at 19:00
  • You don't mention your operating system or window manager. You talk about double-clicking a document on the desktop, but that action clearly is OS/window mgr-dependent. What do you mean by a "document" on your desktop? Improve your description of the problem and you might get better help - just a suggestion. – Drew Dec 15 '14 at 19:06
  • I don't mention it because that's how it is, I use all three major systems daily and the problem is on all three – Electric Coffee Dec 15 '14 at 19:21
  • OSX uses `ns-find-file` when double clicking or using command+down. The other OS probably have a similar something or other. Custom solutions attaching to functions of that nature would be one way to attack the issue -- e.g., setting a let-bound variable and when the variable is `t`, then do not display splash screen. – lawlist Dec 15 '14 at 19:22

2 Answers2

1

OK, I've gathered that your Emacs enlightenment isn't final yet, and you're using file managers rather than dired. That's fine, I've been there too.

Put this into ~/.emacs:

(require 'server)
(or (server-running-p) (server-start))

Put this into /usr/local/share/applications/emacsclient.desktop:

[Desktop Entry]
Name=Emacsclient
GenericName=Text Editor
Comment=View and edit files
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=/usr/local/bin/emacsclient %F -a emacs
Icon=emacs
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupWMClass=Emacs

Run this command once:

sudo update-desktop-database

Now emacsclient should be registered and you can open it with right click, or even associate it with certain file types.

abo-abo
  • 20,038
  • 3
  • 50
  • 71
  • yeah it's weird, read my edit – Electric Coffee Dec 15 '14 at 11:31
  • So you want and don't want the startup screen at the same time? When do you want it? – abo-abo Dec 15 '14 at 11:35
  • it says so in my question. When I just open emacs without pointing it to the file, I want the welcome screen. If I open a file by double clicking on it, I want it gone, simple. – Electric Coffee Dec 15 '14 at 11:36
  • Then you need the emacsclient. – abo-abo Dec 15 '14 at 11:37
  • and how's that different from the standard gui version of gnu emacs? – Electric Coffee Dec 15 '14 at 11:40
  • not at all, what's your system? – abo-abo Dec 15 '14 at 11:40
  • ubuntu 14.04, osx mavericks, and windows 8.1 – Electric Coffee Dec 15 '14 at 11:46
  • a thing I want to note, is that the desktop is just one of the folders I work from, not the only one. – Electric Coffee Dec 15 '14 at 11:57
  • @ElectricCoffee, in fact `emacsclient` *is* different. `emacsclient` lets you open a file in an *already running instance of Emacs*; abo-abo is suggesting that you use this instead of spawning a new instance of Emacs, which should avoid the splash screen. – ChrisGPT was on strike Dec 15 '14 at 16:36
  • @Chris it seems a tad ridiculous, that a program as advanced as emacs doesn't allow for conditional splash screens... `(if document (setq *nosplash* T) (setq *nosplash* nil))` could be handy... I don't always have emacs open, I don't *live* inside emacs, and I find the gui to be more than adequate for lightweight file manipulation, so I don't see any need to go balls to the wall and run emacs in the background 100% of the time... – Electric Coffee Dec 15 '14 at 16:42
  • @ElectricCoffee, language like "ridiculous" and "balls to the wall" isn't very constructive. As flexible as it is, Emacs doesn't come with an infinite number of built-in toggles. abo-abo suggested one answer, which you don't seem to like. choroba suggested another (my personal preference) in the comments, but you don't like that either. Both of these solutions are very popular among Emacs users. Maybe you should try one of them for a while before deciding that you don't like it. – ChrisGPT was on strike Dec 15 '14 at 17:01
  • @ElectricCoffee, `emacsclient` starts `emacs` if it's not running. – abo-abo Dec 15 '14 at 17:06
0

How about:

(when (> (length command-line-args) 1)
  (setq inhibit-splash-screen t))

It should be sufficient for the circumstances you're talking about.

n.b. I don't know anything about the double-clicking-to-open process, but I presume that ultimately emacs is passed a filename argument, so I'm guessing this will work for you.

phils
  • 71,335
  • 11
  • 153
  • 198
  • this works for cases like `emacs test.txt`, but also inhibits splash on cases like `emacs -q -l c:\home\.emacs-no-splash`. I don't know if that matters or not. – Rorschach Dec 16 '14 at 07:32
  • I had concluded that those sorts of cases didn't matter when the question was about launching Emacs from a GUI file manager. It seemed pretty unlikely to me that the GUI would be passing Emacs anything other than the file path. (I'm sure you *could* get it to do so; I was just dubious that it would actually be a factor.) – phils Dec 16 '14 at 07:50
  • the interesting thing is that the splash screen doesn't appear for me when launching from the terminal anyway... – Electric Coffee Dec 16 '14 at 08:18