9

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.)

Paul Biggar
  • 27,579
  • 21
  • 99
  • 152
  • I'm not sure if this is possible however those settings could be defined in your .emacs or in you .Xressources. See [this question](http://stackoverflow.com/q/335487/1069569). – Daimrod Dec 03 '11 at 09:29

3 Answers3

16

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))"
VisioN
  • 143,310
  • 32
  • 282
  • 281
Yujian Zhang
  • 161
  • 1
  • 3
3

Let's say you want to run emacsclient fullscreen, which was my case.

man emacsclient shows emacsclient has -F option:

-F, --frame-parameters=ALIST
       set the parameters of a newly-created frame.

In Emacs Manual, which is an info file, section (emacs) emacsclient Options has more information. Specifically for this question (elisp) Size Parameters mentions fullscreen parameter. To run emacsclient fullscreen, you need to supply an alist, with one element being (fullscreen . fullboth) like that:

emacsclient -c -F "((fullscreen . fullboth))"
Mirzhan Irkegulov
  • 17,660
  • 12
  • 105
  • 166
2

emacsclient provides the --eval (-e for short) command line option for executing arbitrary Emacs Lisp code, so you can visit a file and call suspend-frame from the command line like so:

emacsclient -a "" -c --eval "(progn (find-file \"/tmp/my-file\") (suspend-frame))"

You could put this in a script, e.g:

#!/bin/bash
emacsclient -a "" -c --eval "(progn (find-file \"$1\") (suspend-frame))"
Luke Girvin
  • 13,221
  • 9
  • 64
  • 84
  • 1
    OK, but that wasn't the question... The question was how to run command-line options like `-mm` – Paul Biggar Dec 03 '11 at 17:31
  • Emacs is open source, it should be fairly straightforward to modify emacsclient.c to create your own version of emacsclient which accepts -mm. – Luke Girvin Dec 03 '11 at 18:55