Usando Emacs come server e aprendo esattamente una finestra, che dovrebbe essere massimizzata

StackOverflow https://stackoverflow.com//questions/25029877

  •  21-12-2019
  •  | 
  •  

Domanda

Mi piacerebbe eseguire i miei emacs in modalità demone, quindi utilizzare emacsclient per visualizzare effettivamente le cose.Tuttavia, se eseguo emacsclient filename, si presenta nel terminale, che non è quello che voglio;Devo invece passare l'opzione -c.

Tuttavia, questa opzione crea sempre un nuovo telaio, che non è quello che voglio - preferirei semplicemente avere uno cornice e avere cose aperte in un nuovo buffer nello stesso frame seEsiste già;Altrimenti, dovrebbe farmi un nuovo telaio.Tuttavia, non sono sicuro di come farlo.

Inoltre, voglio che un fotogramma sia massimizzato, che di solito ottengo i miei emac di partenza con l'opzione -mm;Come potrei garantire che anche un fotogramma realizzato da emacsclient?

È stato utile?

Soluzione

Per avere ogni nuovo frame massimizzato, potresti aggiungerlo ai tuoi .emacs:

(modify-all-frames-parameters '((fullscreen . maximized))))
.

Altri suggerimenti

Il seguente script fa quanto segue:

    .
  • Avvia il server Emacs se necessario
  • Se non ci sono fotogrammi aperti, apri uno nuovo
  • Apri i file specificati nel telaio corrente
#!/bin/bash

# Selected options for "emacsclient"
#
# -c          Create a new frame instead of trying to use the current
#             Emacs frame.
#
# -e          Evaluate the FILE arguments as ELisp expressions.
#
# -n          Don't wait for the server to return.
#
# -t          Open a new Emacs frame on the current terminal.
#
# Note that the "-t" and "-n" options are contradictory: "-t" says to
# take control of the current text terminal to create a new client frame,
# while "-n" says not to take control of the text terminal.  If you
# supply both options, Emacs visits the specified files(s) in an existing
# frame rather than a new client frame, negating the effect of "-t".

# check whether an Emacs server is already running
pgrep -l "^emacs$" > /dev/null

# otherwise, start Emacs server daemon
if [ $? -ne 0 ]; then
    emacs --daemon
fi

# return a list of all frames on $DISPLAY
emacsclient -e "(frames-on-display-list \"$DISPLAY\")" &>/dev/null

# open frames detected, so open files in current frame
if [ $? -eq 0 ]; then
    emacsclient -n -t "$@"
# no open frames detected, so open new frame
else
    emacsclient -n -c "$@"
fi
.

Modifica: Espansione fissa di argomenti posizionali (2017-12-31).

Is your DISPLAY env set in the terminal where you're running emacsclient? Because the behavior you request should be the default (the behavior of reusing existing frames, I mean).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top