Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I provide a command-line option to emacsclient?

Tags:

emacs

I start emacsclient using:

emacsclient -a "" -c

This opens a frame connected to the emacs daemon, and starts the daemon if it's not already started. Great, this works fine.

However, I like opening my emacs frames maximized. With emacs, I would use -mm. However, that doesn't work with emacsclient. How do I make this work?

(It seems I could make something work by adding a shell file like so: emacsclient -a "myshell.sh" -c, where the shell file is: emacs -mm, but I haven't been able to make that work - the server doesn't stay up.)

like image 721
Paul Biggar Avatar asked Dec 02 '11 23:12

Paul Biggar


People also ask

How do I run Emacsclient?

Using EmacsClient The emacsclient program will connect to a running instance of Emacs if it exists. -c tells Emacs to open the file in a new frame, which is optional. Specifying -a=”” tells emacsclient to start an instance of emacs if it cannot find one already running.

How do I run Emacs daemon?

One easy way to start the Emacs daemon is via “Settings > Session and Startup > Application Autostart”. You can also place an init script to place in /etc/init. d/emacsd.

How can I tell if Emacs daemon is running?

1 Answer. Show activity on this post. Simply use (daemonp) which will return t if emacs is running as a daemon.


1 Answers

You can add the following line to .emacs, so that Emacs can be started with the window maximized. See http://www.gnu.org/software/emacs/manual/html_node/elisp/Size-Parameters.html#Size-Parameters for details.

(add-to-list 'default-frame-alist '(fullscreen . maximized))

Emacs client accepts -F option, where you can specify frame parameters, so the above example would be:

emacsclient -c -a "" -F "((fullscreen . maximized))"
like image 134
Yujian Zhang Avatar answered Oct 04 '22 18:10

Yujian Zhang