emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Links in tables: could the plain text also look good?
@ 2014-03-06 19:00 Oleh
  2014-03-06 22:33 ` Ilya Shlyakhter
  2014-03-06 22:39 ` Michael Brand
  0 siblings, 2 replies; 3+ messages in thread
From: Oleh @ 2014-03-06 19:00 UTC (permalink / raw)
  To: org mode

Hi all,

I don't know if this issue has been raised before (it's a bit
difficult to google it).

I was just committing a single line change to an org-mode table into
git, and the diff isn't good at all: the whole table appears to have
changed. Well, not really - just a few spaces were added on each table
line because the single new line caused a need to re-align the whole
table.

So I'm thinking: if org-mode uses overlays for links to make some of
the real text invisible, why not keep the plain text aligned and use
the overlays to align the fontified text?

Having a good-looking plain text is an achievement in itself, but
using an smart allocation strategy (like std::vector growth) to add
more spaces than needed each time a column grows, would alleviate the
diff problem, i.e. the diff would show only a single line change most
of the time a line is added or removed.

I'd like some feedback on whether:

- it's done already and I just haven't enabled this behavior
- it can't be done because of some complex issue
- it can be done, but just isn't a priority

In the third case maybe some pointers on where to start implementing
would help.

regards,
Oleh

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Links in tables: could the plain text also look good?
  2014-03-06 19:00 Links in tables: could the plain text also look good? Oleh
@ 2014-03-06 22:33 ` Ilya Shlyakhter
  2014-03-06 22:39 ` Michael Brand
  1 sibling, 0 replies; 3+ messages in thread
From: Ilya Shlyakhter @ 2014-03-06 22:33 UTC (permalink / raw)
  To: emacs-orgmode

On 3/6/14 2:00 PM, Oleh wrote:

> I was just committing a single line change to an org-mode table into
> git, and the diff isn't good at all: the whole table appears to have
> changed. Well, not really - just a few spaces were added on each table
> line because the single new line caused a need to re-align the whole
> table.

You can tell diff to ignore whitespace-only changes by using the -w option:

https://www.kernel.org/pub/software/scm/git/docs/git-diff.html

-w
--ignore-all-space
Ignore whitespace when comparing lines. This ignores differences even if 
one line has whitespace where the other line has none.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Links in tables: could the plain text also look good?
  2014-03-06 19:00 Links in tables: could the plain text also look good? Oleh
  2014-03-06 22:33 ` Ilya Shlyakhter
@ 2014-03-06 22:39 ` Michael Brand
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Brand @ 2014-03-06 22:39 UTC (permalink / raw)
  To: Oleh; +Cc: org mode

Hi Oleh

On Thu, Mar 6, 2014 at 8:00 PM, Oleh <ohwoeowho@gmail.com> wrote:
> I was just committing a single line change to an org-mode table into
> git, and the diff isn't good at all: the whole table appears to have
> changed. Well, not really - just a few spaces were added on each table
> line because the single new line caused a need to re-align the whole
> table.

Did you try the git diff options -b and/or --color-words to not list
the table lines and/or color the columns that were only realigned?
There are many other (also color-less) word variants which might come
closer to your need. With a regexp it should be possible to omit even
realigned horizontal separator lines in tables.

Or instrument git to use an external tool like, well, Emacs ediff. To
find a solution to your need search the web for the words git difftool
ediff-files. Emacs 24.3 changed coloring of the diffs to what I find
much more convenient. See also the git command "difftool" and Worg
hacks "How to ediff folded Org files" and the entire mailing list
thread linked there, currently in this section
http://orgmode.org/worg/org-hacks.html#sec-2-1

A discussion that I didn't read yet about the git diff format

    -a <r>b</r> c
    +a <g>x</g> c

which is what I would prefer can be found here
http://git.661346.n2.nabble.com/Understanding-and-improving-word-diff-td5717239.html

> So I'm thinking: if org-mode uses overlays for links to make some of
> the real text invisible, why not keep the plain text aligned and use
> the overlays to align the fontified text?
>
> Having a good-looking plain text is an achievement in itself, but
> using an smart allocation strategy (like std::vector growth) to add
> more spaces than needed each time a column grows, would alleviate the
> diff problem, i.e. the diff would show only a single line change most
> of the time a line is added or removed.
>
> I'd like some feedback on whether:
>
> - it's done already and I just haven't enabled this behavior

This time no ;-)

> - it can't be done because of some complex issue
> - it can be done, but just isn't a priority

At least it would have to be optional because it would make reading
and editing Org files outside of Org mode or in Org mode with Visible
mode less fun. For this I find the current behaviour, also with
narrowed columns, a perfect solution. (Disclaimer: I hacked and use
hidestarsfile, see
http://orgmode.org/worg/org-hacks.html#fileconversion )

Michael

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-06 22:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-06 19:00 Links in tables: could the plain text also look good? Oleh
2014-03-06 22:33 ` Ilya Shlyakhter
2014-03-06 22:39 ` Michael Brand

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).