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 &
Loom
  • 9,042
  • 19
  • 50
  • 102

2 Answers2

8

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

$ meld ./1/a1.txt ./2/a2.txt &
$ meld -n ./3/a3.txt ./4/b4.txt &
Loom
  • 9,042
  • 19
  • 50
  • 102
  • Using version 1.3.1. this doesn't seem to work: `meld: error: no such option: -n`. Does anyone know anything about this? – Tomerikoo Jul 23 '20 at 10:32
  • 1
    -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). – Tech-On-the_Beach Oct 13 '20 at 16:26
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 &
  • 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... – Tomerikoo Oct 13 '20 at 16:27
  • 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](https://gitlab.gnome.org/GNOME/meld/-/blob/release-1_3_1/meldapp.py) you will not find -n or --newtab as argument, nor will you find it in any version older than 1.7.0 – Tech-On-the_Beach Oct 13 '20 at 16:45
  • :) 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. – Tech-On-the_Beach Oct 13 '20 at 17:00
  • 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... – Tomerikoo Oct 14 '20 at 07:32
  • no worries.. glad the information helped in some way. – Tech-On-the_Beach Oct 14 '20 at 09:24