After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 112908 - Option to wait until done editing
Option to wait until done editing
Status: RESOLVED FIXED
Product: gedit
Classification: Applications
Component: general
2.6.x
Other Linux
: High enhancement
: ---
Assigned To: Gedit maintainers
Gedit maintainers
: 148594 498979 511071 513433 534534 592645 645307 (view as bug list)
Depends on:
Blocks: 538556
 
 
Reported: 2003-05-13 15:15 UTC by nik
Modified: 2011-03-20 15:53 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description nik 2003-05-13 15:15:49 UTC
When using gedit as the editor called from non-gnome programs
(VISUAL=gedit), it is necessary to tell the invoked gedit to wait until the
gedit server is done editing the document before returning.

I experience this as a problem when using gedit from mutt, in particular,
but it's a general problem.

I suggest a "--wait" option (inverse of gnuclient's --no-wait option).
Comment 1 nik 2004-04-23 15:49:45 UTC
I've been off in KDE land for a while, but Gnome 2.6 performance is much better 
on my 800MHz Transmeta, so I'm back. Unfortunately, this issue is still around, 
so I'm bumping the version up to 2.6.
Comment 2 Paolo Borelli 2004-08-01 10:44:54 UTC
*** Bug 148594 has been marked as a duplicate of this bug. ***
Comment 3 Paolo Borelli 2004-08-01 10:46:03 UTC
as noted in bug 148594, I suppose this happens when there is another instance of
gedit already open...
Comment 4 dowem 2004-09-06 22:42:08 UTC
Hey Paolo :) I am just cruising through the open bugs marked with the usability
keyword and ran across this one. Is this bug still being actively addressed? It
was marked high priority for the 2.6 timeframe, so if it isn't closable right
now, maybe we can bump the Version to 2.10 so this could get some action in the
2.9 development timeframe? What do you think?
Comment 5 Paolo Maggi 2004-09-07 14:53:11 UTC
This bug is still to be fixed.
Please, move to "FUTURE" timeframe.
I don't think to have time to fix it in 2.10 timeframe.
Thanks.
Comment 6 Paolo Maggi 2006-06-19 07:40:09 UTC
A possible way to fix this bug could be:

- add a "--wait" parameter
- when --wait is used, a new window is opened and the console is blocked until the new window is closed.
Comment 7 Steve Frécinaux 2006-07-29 17:18:32 UTC
mh, shouldn't it be the new document instead of the new window ?
Comment 8 Mikko Rantalainen 2006-10-03 13:51:28 UTC
Any progress? As of now gedit cannot be used for SVN_EDITOR because if you happen to have any instance of gedit running when you run svn commit (or something similar) the gedit will return immediately. I'd prefer if jEdit's behavior would be copied. jedit --help:
...
-wait: Wait until the user closes the specified buffer in the server
         instance. Does nothing if passed to the initial jEdit instance.

"gedit --wait filename" should open the filename for editing and main() shouldn't return until the buffer for "filename" has been closed. The fact that jEdit ignores the flag if passed to initial instance should be considered a bug and shouldn't be copied (if I open first file with --wait, then open an another file and the I close the first one the process that was started with --wait should return. If the --wait flag is ignored then the process will return only after all gedit windows has been closed).
Comment 9 Paolo Borelli 2006-10-03 16:34:12 UTC
I think this is pretty much in a PATCHWELCOME state :)

In other words, we would be happy to consider a patch, but I don't think it will be on our short term TODO list any time soon.

If someone wants to give it a try, you should consider that the way "single instance" apps are implemented within gnome is a bit in flux. It may be that if/when we switch to a full d-bus solution this will be fixed automatically.
Also note that running two gedit instance can potentially corrupt some metadata, so this is not as trivial as it may sound (e.g. you need to disable metadata and maybe other things).


As a quick workaround note that by running "TMPDIR=/some/dir gedit" runs a new gedit instance since it doesn't find the socket open by the running instance in /tmp. I guess you could such a trick for SVN_EDITOR, at the risk of losing some of the metadata.
Comment 10 Colin Walters 2008-01-21 17:14:39 UTC
*** Bug 511071 has been marked as a duplicate of this bug. ***
Comment 11 Colin Walters 2008-01-21 17:18:00 UTC
Just a note, I am adding support for using GEdit as an editor to the Hotwire hypershell; the way I'm currently coding this is trying to exec GEdit using a --wait option, if that returns an error code, then using an internal wrapper which does the TMPDIR trick.  

So if someone writes this patch, please name the option --wait =)
Comment 12 Paolo Maggi 2008-02-01 09:04:33 UTC
*** Bug 513433 has been marked as a duplicate of this bug. ***
Comment 13 Paolo Borelli 2009-01-03 15:34:34 UTC
*** Bug 498979 has been marked as a duplicate of this bug. ***
Comment 14 Paolo Borelli 2009-01-03 15:34:52 UTC
*** Bug 534534 has been marked as a duplicate of this bug. ***
Comment 15 jessevdk@gmail.com 2009-01-06 11:40:45 UTC
I'm thinking of implementing this when going from bacon to DBus. I'm currently coming up with the following scheme:

---------------------------
== Modes of Operation ==
To allow control over whether gedit should run as a single instance application, or as a standalone application, and to allow proper blocking of the gedit process when waiting for files to be finished editing (like is used often with $EDITOR), the following modes of operations are suggested:

1. Single Instance (default)
  1. Instance already exists
    * Send command line arguments over DBus to existing instance
    * Use Message-Wait strategy for --wait
  2. Instance does not yet exist
    * Use default command line handling
    * Use Fork-Wait strategy for --wait
2. Standalone (--standalone}
  * Do not start DBus
  * Use default command line handling
  * Use Fork-Wait strategy for --wait

=== Fork-Wait strategy ===
The Fork-Wait strategy will fork the process. The parent process continues to run the normal mode of operation, starting up gedit etc. The child process will wait for a signal from the parent process that the wait is over (see Wait Handlers).

=== Message-Wait strategy ===
This strategy is slightly different since signalling that the wait is done has to be done over the message bus now. The process installs the wait with a certain message and then waits for a 'wait done' message to be sent by the instance process over the bus.

=== Wait Handlers ===
Wait handlers can be installed on documents or windows. If files were opened from the command line, wait handlers are installed on the documents opened by those files. In this case, the wait is done if all those documents are closed. If a new window was opened to open these documents, the window is also destroyed. If no files were specified and a new window was opened (either there was none, or with --new-window), then install a wait handler on the newly opened window. The wait done is signalled when this window is closed.
---------------------------

With regard to pbor's remark on metadata corruption, it might not be a good idea to support --standalone right away (is it even useful?).
Comment 16 Paolo Borelli 2009-08-22 19:36:02 UTC
*** Bug 592645 has been marked as a duplicate of this bug. ***
Comment 17 jessevdk@gmail.com 2010-05-15 13:28:22 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
Comment 18 Garrett Regier 2011-03-20 15:53:21 UTC
*** Bug 645307 has been marked as a duplicate of this bug. ***