Skip to Content.
Sympa Menu

texmacs-users - Re: [TeXmacs] Cleaning up texmacs file for git

Subject: mailing-list for TeXmacs Users

List archive

Re: [TeXmacs] Cleaning up texmacs file for git


Chronological Thread 
  • From: "Sam Liddicott" <address@hidden>
  • To: address@hidden
  • Subject: Re: [TeXmacs] Cleaning up texmacs file for git
  • Date: Thu, 16 Jun 2011 14:34:54 +0100
  • Envelope-to:
  • Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAAXNSR0IArs4c6QAAADxQTFRF NTdQY2Z/i286eHFugnNXoJBwm5GCs5VeoqO0ua+fwLCQ4c2q19C81NDF4eLr/unQ/PTf/fXW+/rq /f/7XKo76wAAAAlwSFlzAAALEwAACxMBAJqcGAAAAi9JREFUSMetloGSqyAMRVsFNAQkxP//15cE 62rFdt/MZqbTVu/hBhLEx/qf8fgDIAN455wHyPk7wCIe9nA+fwGSH87hgD8AHPfRpy2GwdMtcBh+ mg4Ech9Ih+RNixJKDLEL0GF8VLkSojePHrDlryNijbFW8zBg8PUKbBOI6D1WCV5Rf2DzxCtgBlMs tRRVW5LyVW3ew1TfAZZ6RcQicpb4yZmaC74DJADK6BdATOrUAbJzsZie+K22ZnEBknNYysvhVH6u 1X8CqAe4DuANoPoOrAbsHXUARJ5knc5z4EyyTnHoAqj7xvkYIdk65AwhyEZKMusOIDV2QQQaCnDQ gBiDR3RdIEb5CBESt2wgQJI0Yx/Agphg1MgNsD+QkszM9wHVPx/PeQOW+fmcR9DF8+4CyCJhCuP8 fDzmBbLqs8JzMODqYNfDvKhoGYM2lDosy5jlRozccRAgrPM8iygQS3Mv87IugUgKlC7NZ6liuy4r uresVq5QuQAr09ZKEga8OkluyKXeQ6Bs3SrtqgC1pWLNqAfwDhBnB+sK8OrVL4D4h1B4zWPWhJhu gPUHKA5EwSMYUMsdQK+UKDhIOTSHeg+8HCoTOGtB/gwcl4mSdGybwXegPWhM/RHYKwchkckhUNMX 6j7ueQNScLbZZOPRxaADyO2UQCJpl7wbnE6gQ+ksWjpngxOwF1tF5ecP3R6KB+AQxPfHLncQ+nKw 06fhu68OTIfJ869eTtg22l+9zfwDK3mKl5BFHMYAAAAASUVORK5CYII=


Trailing whitespace in texmacs gives git-whitespace warnings; and it has brought me trouble before when I used Lyx,

I'm looking at some git clean-filter cleanups that can find an alternative representation.

To demonstrate, I'll use _ to represent space.

The line:

---8<------8<---
hello__
---8<------8<---

is stored in texmacs as:
---8<------8<---
hello_\_
---8<------8<---

But it seems like this representation will do as well:

---8<------8<---
hello_\_\

---8<---

It seems like an extra \ and new-line can be suffixed onto a trailing space and the document still parse as normal; I applied this sed to a document:

sed -e 's/ $/ \\\n/'

and then loaded and re-saved the document and it was restored to it's original form.

So... does anyone have any comments on a git clean commit script adding \\\n to the end of lines ending in white space so that there are no longer lines ending in white space?

Sam




On 15/06/11 16:07, Sam Liddicott wrote:


On 15/06/11 15:16, Sam Liddicott wrote:


This entry in .gitattributes:
*.tm filter=texmacs

and this entry in the .gitconfig file:
[filter "texmacs"]
clean = "sed -e '/^<[^>]*>/h;x;/references\\|auxiliary/{x;d};x'"

means that .tm files are commited to git without the references or auxilliary sections.
When merging from git branches I so often get conflicts in those sections which can easily be regenerated.

The sed command is, but has been escaped appropriately above for the ..gitconfig file
sed -e '/^<[^>]*>/h;x;/references\|auxiliary/{x;d};x'

Sam

Here is a better clean-up which can also remove table-of-contents (which can also be re-generated):

#! /bin/sed -f

/^\( *<.table-of-contents\|<.references\|<.auxiliary\)/{h;/<\\/p};x;/^ *<\\/{x;d};x

called git-fix-texmacs, so the clean entry in [filter "texmacs"] would need pointing to where-ever this +x 1 line script is saved.

Sam


--
[FSF Associate Member #2325] <http://www.fsf.org/register_form?referrer=2325>

<http://www.openrightsgroup.org/>



Archive powered by MHonArc 2.6.19.

Top of Page