Open new tab in existing meld instance via a command line
Asked Answered
C

2

5

Is there a way to start new file comparison in an existing meld instance with a command line (like terminal) or programmatically.


For example, following two commands start two instances of meld

$ meld ./1/a1.txt ./2/a2.txt &
$ meld ./3/a3.txt ./4/b4.txt &

However, I'd prefer both file comparisons were opened in same instance in different tabs. I don't know the way to obtain it, but I can illustrate what I mean.

I assume that it possible to modify second command (meld ./3/a3.txt ./4/b4.txt &). For example it can help some unknown option,

$ meld --some-option-to-open-in-tab ./3/a3.txt ./4/b4.txt &

or maybe it's possible to write some application that added a file comparison to existing instance of meld

$ MyMeld ./3/a3.txt ./4/b4.txt &
Cohette answered 13/1, 2015 at 16:0 Comment(0)
C
9

There is -n undocumented option (or --newtab)

$ meld ./1/a1.txt ./2/a2.txt &
$ meld -n ./3/a3.txt ./4/b4.txt &
Cohette answered 16/1, 2015 at 15:57 Comment(2)
Using version 1.3.1. this doesn't seem to work: meld: error: no such option: -n. Does anyone know anything about this?Metamorphic
-n / --newtab argument was only introduced in meld version 1.7.0 (7-Nov-2012), so is not available in version 1.3.1 (14-Aug-2009). Latest meld version is 3.21.0 (19-Apr-2020).Enthymeme
E
3

The -n / --newtab command line argument to "Open a new tab in an already running instance" was only introduced in meld version 1.7.0 (7-Nov-2012), so it was not available in version 1.6.1 or older versions. At the time of writing, the current/latest release is meld version 3.21.0 (19-Apr-2020).

Note that this answer is strictly about when the new tab option/flag was added as a command line argument. Tabs themselves where available for use on the meld application's user interface (GUI) well before version 1.7.0

1.7.0 Release Notes: https://gitlab.gnome.org/GNOME/meld/-/commit/da800fe3428410572e28f617f904476712993ab8 "Comparisons can be opened in new tabs (rather than in a new window) from the command line (Kacper Wysocki, Antoine, Kai Willadsen)"

1.7.0 Code Extract: https://gitlab.gnome.org/GNOME/meld/-/blob/1.7.0/meld/meldapp.py

parser.add_option("-n", "--newtab", action="store_true", default=False,
            help=_("Open a new tab in an already running instance"))

Example: 2-way and 3-way file comparison, with results in tabs of same instance

meld file1 file2 &
meld -n file3 file4 file5 &
Enthymeme answered 13/10, 2020 at 16:19 Comment(5)
So what you're saying is that I'm actually outdated and not the question... I'm using an older version of meld. But I'm confused by the links and sources. Your first link shows this as a new feature in version 1.7, while the bug link in the OP's answer, shows version 1.3.x...Metamorphic
I am unsure how the OP bug report from 2010 fits in with the official release notes from 2012 either.. maybe the bug report was to do with initiating the tabs from inside the GUI. If you look at the source for 1.3.1, starting at line 851 of meldapp.py you will not find -n or --newtab as argument, nor will you find it in any version older than 1.7.0Enthymeme
:) yes. You will find it (i.e. the -n / --newtab command line argument) supported in newer versions than 1.7.0 but not in older versions. This is not a comment on when the GUI itself introduced Tabs, but when the command line argument was introduced that made use of the Tab feature. There is a distinction between those 2 issues.Enthymeme
Yes sure. Even in my 1.3 version there are tabs, just can't open them from the command line. Well thank you very much. Unless something else comes up, I will give you the bounty for the effort and even though this doesn't directly solve my problem - I know what the problem is. The issue is that it's a work environmetn, so I already asked IT to upgrade the version... See if that works...Metamorphic
no worries.. glad the information helped in some way.Enthymeme

© 2022 - 2024 — McMap. All rights reserved.