Re: extending mc.menu ?



Saith Chris Glur:
I want to view char(13)-line-terminated files directly via mc.

I think the very latest version(s)of mc can view Mac and Oberon text files already. Edit... no, I think you still need a tr | $EDITOR | tr pipe.

Currently I can transform these file types to unix-text with:
   cat <inputFile> | tr "\015" "\012" >  LnxFile
so, I guess simply translating char(octal15=8+5=13) to char(10)
is all that's required.

But because I do this so often I don't want to have to create a
new file before I use mc to view/edit it.

mc's customisable menu can already do other similar smart jobs.
eg. the one existing menu entry is:--

0       Edit a bug report and send it to root
        ${EDITOR-vi} /tmp/mail.$$
        test -r /tmp/mail.$$ && mail root < /tmp/mail.$$
        rm -f /tmp/mail.$$
.... or this one is close to my requirements:
t       Run latex on file and show it with xdvi
        latex %f && xdvi `basename %f .tex`.dvi
-------------------

Q1. is the above bash syntax or sch....?

Q2. what mc.menu entry should I try to view my
   char(13)-line-terminated files ?

I've started & tested as OK:
e       Show ETH-oberon format
        ls *obn


Thanks for any feedback,

== Chris Glur.

Assuming your files are *.obn, you could try modifying ~/.mc/bindings (if you have it) or /usr/share/mc/mc.ext to, say:

shell/.obn
   View=%view{ascii} tr '\015' '\012' <%f

After that, a plain F3 should let you view them. You can then add Open and Edit options as you need/want them.

Reynir H. Stefánsson (reynirhs mi is)
--
We'd make a great couple. I'm an anesthesiologist and you're a knockout.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]