Re: Auto-indent for various languages=pretty print
- From: "chris glur" <crglur gmail com>
- To: mc gnome org
- Subject: Re: Auto-indent for various languages=pretty print
- Date: Fri, 23 Nov 2007 05:13:20 +0200
==================
OK, I'll asume that my previous [the 1st one] post was
delivered. This is what I've discover since then:-
It must be great to be able to build small programs from structures,
instead of chars and have the code auto-pretty-printed.
And the syntax colouring helps to manage the code.
mc provides facilities [currently mostly for C, but hopefully
can be extended to other languages] whereby: F11 shows a
select-structure-menu like:
......
5 IF () ELSEIF ()
6 CASE (int) OF
7 for ()
8 while ()
...etc...
Q1 -where is this [headed as] " User menu" located ?
Searching /home & /usr for "CASE (int)" didn't find it for me!
Apparently the pretty-printing via F19 is driven by
file ~/.mc/cedit/edit.indent.rc which has:--
#! /bin/sh
# *** External Formatter (Indenter) for GNU Midnight Commander.
# arguments:
# $1 - Name of the file being edited
# $2 - Name of the file to be processed
exec >/dev/null
case `echo $1 |sed 's/^.*\.//'` in
c|h)
# ftp://ftp.gnu.org/pub/gnu/indent/
# Please add options to your ~/.indent.pro, not here.
indent "$2"
;;...etc. for c++, java, html...etc....
I.e. the script's section says:
"if the file type [via the name] is *.c or *.h
then use the "indent" utility with the 2nd argument.
I.e. use the "indent" utility on the C-source-file.
'man indent' tells about the indent utility.
Q2 - In the comment of the script: I think I know what
"the file being edited" is, but what's "the file to
be processed" ?
Perhaps the many args for indent are passed via a file ?
Q3 - how exactly does:
"`echo $1 |sed 's/^.*\.//'` in
c|h)", translate to " if the file is *.c OR *.h" ?
Q4 - does anybody use these F11 & F19 mc facilities ?
Q5 - what's the differnce between mcedit & cooledit and which does
mc use ?
Thanks for any feedback,
== Chris Glur.
The selected structure is placed at the cursor.
And F19 pretty-prints the pre-marked block.
On 11/22/07, chris glur <crglur gmail com> wrote:
As a long time user of NC/mc I'm keen to use the intended facilities
of cooledit re. External Formatter.
The ability to enter structure-templates instead of single chars
is the right way to go; and the pretty printer facility is essential.
I'm not a C programmer, and I'd like to make versions for Oberon
[similar to pascal] & soar [an AI system], but it seems that my
ver. 4.6.0 can't quiet get C right yet ?
I don't want to hack-around trying to decode what
file: /usr/share/mc/syntax/c.syntax *EXACTLY* means eg. at line:
keyword whole linestart \{\s\t\}\[\s\t\]#*\n brightmagenta
I can speculate & confirm eg. by replacing the "{,}" with
"BEGIN,END", that it concerns the 'Block-brackets'.
And probably it's important for the pretty-printing.
Looking at the incomplete efforts at the many <language>.syntax files
shows a waste of effort?
Let's use the wikipedia method: contributors should document their
efforts so that other can build-on-top-of-it.
Q1- is the latest version able to give a usable 'structure selector'
& pretty-printer, for at least C ?
It's acceptable if the next-contained-structure must be specifically
located - provided this usage-knowledge is documented.
We don't want each contributor to re-invent the wheel.
Q2- is there any documentation [other than src code] to describe
how to write the syntax-file for its 'interpreter' ?
Thank for any feedback,
== Chris Glur.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]