Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8890549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:31:41+00:00 2026-06-14T22:31:41+00:00

Assuming an Emacs server is running, I want emacsclient <file> to either create a

  • 0

Assuming an Emacs server is running, I want emacsclient <file> to either create a new frame (like -c) when there is no existing frame or reuse an existing frame when there is one. In other words, I want the -c only when there is no existing frame. Is that possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:31:42+00:00Added an answer on June 14, 2026 at 10:31 pm

    I solved my problem with a set of shell scripts.

    my_emacs

    #!/bin/sh
    emacs24-x $@ 1> /dev/null 2> /dev/null &
    

    You may need to change emacs24-x to something that points to your X11 emacs.

    my_emacsclient

    #!/bin/sh
    emacsclient $@ 1> /dev/null 2> /dev/null || my_emacs
    

    Add both files to you PATH via ~/bin or the like.

    In my .emacs I also added the followings lines

    (load "server")
    (unless (server-running-p) (server-start))
    

    Also change some environment variables and optionally add an alias

    export ALTERNATE_EDITOR="my_emacs"
    export EDITOR="my_emacsclient -n"
    export SUDO_EDITOR="my_emacsclient"
    ...
    alias e="$EDITOR"
    

    When you run e in your shell it should create or resuse an existing GUI frame. Also, running e <filename> opens that file in a frame; you can also pass other flags like -n to e.

    For the same behaviour in other applications (say your file manager), you should also change the Emacs .desktop file (for me that’s /usr/share/applications/emacs24.desktop) to run my_emacs.

    It might also be a good idea to change emacs to my_emacsclient via the alternatives system in Debian-based (?) distributions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assuming there are 5 items in the settings file ( MySetting1 to MySetting5 ),
Assuming I have a haar cascade xml file. Is there a way to render
Assuming I have a numerical string: var foo = 0; Assume I want to
Assuming I have an Entity Framework 4.2 class like this: class Company { public
Assuming that I have an variable like: int n = 23; it is possible
Assuming network access is sporadic with no central server, what would be the best
Assuming I have an open source web server or proxy I can enhance, let's
Assuming I have the following list: IList<string> list = new List<string>(); list.Add(Mouse); list.Add(Dinner); list.Add(House);
I was experimenting with interplay between Emacs lexical scoping (new feature of Emacs 24)
Assuming Array was not overwritten, why the following comparisons output false? [] === new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.