mailing-list for TeXmacs Users

Text archives Help


Re: [TeXmacs] Feedback on texmacx


Chronological Thread 
  • From: "Sam Liddicott" <address@hidden>
  • To: address@hidden
  • Subject: Re: [TeXmacs] Feedback on texmacx
  • Date: Thu, 17 Jun 2010 14:26:53 +0100
  • Envelope-to: address@hidden
  • 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=

This file will explain what I mean about the multi/single line

<TeXmacs|1.0.7.4>

<style|noweb>

<\body>
  <assign|nw-fragment|<\macro|name|x>
    <assign|<arg|name>|<arg|x>><\cpp-fragment>
      \<less\>\<less\><label|<arg|name>><with|color|blue|<arg|name>>\<gtr\>\<gtr\>=

      <arg|x>

      @
    </cpp-fragment>
  </macro>>

  <assign|nw-ref|<macro|name|\<less\>\<less\><hlink|<arg|name>|<merge|#|<arg|name>>>\<gtr\>\<gtr\><compound|<quote-arg|name>>>>

  \;

  \;

  <\nw-fragment|MULTI>
    LINE 1 OF CHUNK

    LINE 2 OF CHUNK
  </nw-fragment>

  Note that the words ``single line'' below should probably be aligned with
  the bottom of the multi-line chunk.

  <\nw-fragment|SAMPLE>
    i am <nw-ref|MULTI> single line
  </nw-fragment>

  \;

  \;
</body>


Sam

On 17/06/10 14:21, Sam Liddicott wrote:
I got it, quote-arg was what I needed:
<compound|<quote-arg|name>>
does the trick!

<assign|nw-fragment|<\macro|name|x>
  <assign|<arg|name>|<arg|x>><\cpp-fragment>
    \<less\>\<less\><label|<arg|name>><with|color|blue|<arg|name>>\<gtr\>\<gtr\>=

    <arg|x>

    @
  </cpp-fragment>
</macro>>

<assign|nw-ref|<macro|name|\<less\>\<less\><hlink|<arg|name>|<merge|#|<arg|name>>>\<gtr\>\<gtr\><compound|<quote-arg|name>>>>

However, if the including chunk is defined before the chunk to be included then it still fails... so I need to use the aux area or something...

I also need to give the nw-ref some flags or something so it can show folded or unfolded.

I do note that if I include a multi-line chunk like this

i am <<INCLUDE>> I AM MULTI single line
                                 LINE CHUNK

and the part "single line" appears with it's top aligned with the top of the chunk, it should probably have it's bottom aligned with the bottom of the chunk.

Sam

On 17/06/10 12:38, Sam Liddicott wrote:
Wow; it works:

<assign|nw-fragment|<\macro|name|x>
  <assign|<arg|name>|<arg|x>><\cpp-fragment>
    \<less\>\<less\><label|<arg|name>><with|color|blue|<arg|name>>\<gtr\>\<gtr\>=

    <arg|x>

    @
  </cpp-fragment>
</macro>>

I'm now trying to define nw-ref so that it can fold or unfold to show it's contents; this doesn't quite seem to show the contents:
\ <assign|nw-ref|<\macro|name>
  \<less\>\<less\><hlink|<arg|name>|<merge|#|<arg|name>>>\<gtr\>\<gtr\><eval|<value|name>>
</macro>>

<eval|<value|name>> shows: <macro|x|x> and
<arg|name> shows the name of the referenced item, and
<compound|<arg|name>> also shows the name of the referenced item

<value|<arg|name>> shows: <value|blahblah> if blahblah is the name of the refernce, yet
<value|blahblah> shows the actual contents of blahblah
hmmm... how to get the value of a macro whose name I have as a parameter...

even
<eval|<arg|name>>
doesn't work

<eval|<value|<arg|name>>> gives <error|Bad value>

Hmm..

Sam


On 17/06/10 09:43, Sam Liddicott wrote: That's pretty sweet stuff!

I'm impressed. It's great that you can have references as a distinct semantic item.

I'm wondering if guile will make parameterized chunks easier. If I can make ctrl-2 style chunks define first-class texmacs macros within the body, then ctrl-1 style references are really just regular texmacs macro invocations which can be activated or deactivated!

Sam

On 16/06/10 23:40, Michael Lachmann wrote:
You can look a bit back up the list for the discussion. I'm using two
files, I think:
noweb.ts stored in ~/.TeXmacs/styles, and a few key bindings in
~/.TeXmacs/progs/my-init-texmacs.scm

I installed noweb, and maybe that's it. Attached is a sample TeXmacs file.

Tell me if it worked...

Michael

noweb.ts:
--
<TeXmacs|1.0.7.2>

<style|source>

<\body>
  <use-package|jsc|tmdoc-traversal|tmdoc-markup|tmdoc-keyboard>

  <assign|noweb-fragment|<\macro|name|x>

    <\cpp-fragment>

       \<less\>\<less\><label|<arg|name>><with|color|red|<arg|name>>\<gtr\>\<gtr\>=

      <arg|x>

      @
    </cpp-fragment>
  </macro>>

  <assign|noweb-ref|<macro|name|\<less\>\<less\><hlink|<arg|name>|<merge|#|<arg|name>>>\<gtr\>\<gtr\>>>

</body>

<\initial>
  <\collection>
    <associate|page-type|letter>
  </collection>
</initial>

<\references>
  <\collection>
  </collection>
</references>
--
The key bindings: in ~/.TeXmacs/progs/my-init-texmacs.scm:
--
(kbd-map
          ("C-1" (make 'noweb-ref))
          ("C-2" (make 'noweb-fragment))
          ("C-9" (choose-file (texmacs-save-buffer "verbatim") "save
verbatim file" "verbatim") )
          )
--
On 16 June 2010 22:23, Sam Liddicott <address@hidden> wrote:
On 16/06/10 17:18, Michael Lachmann wrote:

On 11 June 2010 18:04, Sam Liddicott <address@hidden> wrote:

I really miss latex's lstlistings. I wrote a literate programming addon for
Lyx (http://www.nongnu.org/newfangle/index.shtml). The weave side was done
entirely in latex macros and based on lstlistings, and the tangle side was
done with a single awk script. I see that texmacs replaces tex mostly (fair
enough, the difficulties in parsing tex drove me to texmacs). I intend to
port the literate programming to texmacs and implement as xslt and guile.  I
guess I'll have a lot to do to get lstlistings ported. Mainly it had syntax
highlighting and line counting, but it had some freaky tricks to approximate
per-word grids for fake mono-spacing with variable fonts. (I know about
lp4texmacs).

I've been using texmacs for literate programming over the last year
with a bunch of hacks.
There is a small environment for texmacs to install that makes a new
document class, 'noweb'. The document is exported to verbatim from
within texmacs, and then I run  notangle on it to get the various
parts. I haven't implemented a nice make interface as you have. One
nice feature is that because of texmacs' sessions, at the end of the
document I have a shell session and a scheme session that I use to
generate everything. So I don't need to remember how to do stuff.

Inserting a new section is done with ctrl-2, and a link to a prev
section with ctrl-1. It is nice that once that is done you can easily
jump between the different parts of the program.

Syntax highlighting of the different languages has to be hard coded
using cpp for now....

It would really be nice to make it less hacky, add some make
possibility that recognizes changes, and the possibility to reassemble
the document from the files so that you can edit your code in whatever
editor you want....


I'm quite excited by the guile/scheme integration, for once it may mean that
references to other blocks can be expanded, and possibly even edited
in-situ.

But it seems like the main task will be re-writing lstlistings in scheme. I
know how the keywording works in lstlistings, by looking for keywords that
are not in quoted strings, so I think I can do that.

On partially implemented feature in newfangle is automatic contextual
quoting, so that if a chunk of text is included in a line that begins with
// that all the lines have // prefixed; or if a chunk of text with a newline
in is included within a string definition, the newline is replaced with
\n"<literal-newline>"

and so on; but I found this to be difficult with languages like perl where
$a=~m/a/; and $a=~s|a/|b/|; are both regex type stuff and quite hard to
detect where the regex starts and ends; so I can't automatically do such
stuff in perl; but as the Texmacs editor is so great with it's macro editing
I can quite easily have the human markup regexes and so-forth and not need
to automatically detect all of it!

Please could you tell me where to get the literate stuff you have been
doing?

Sam

--
Sam's signature


--
Sam's signature


--
Sam's signature


--
Sam's signature


--
Sam's signature



Archive powered by MHonArc 2.6.19.

Top of page