Sponsored Content
Full Discussion: Emacs line indentation
Top Forums Programming Emacs line indentation Post 302259333 by Rledley on Monday 17th of November 2008 11:12:20 PM
Old 11-18-2008
Question Emacs line indentation

Hi. I'm writing a document in Python, so indentation is crucial.

I want to indent a whole section by exactly one tab. Any idea how to go about this? I'm using terminal emacs (no mouse input)

Thanks for any help!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Making Emacs to show line number

Hi all How can I make Emacs to show the line numbers at the left or right as a default. This might help me to quickly jump to a given line. Thanks SS (9 Replies)
Discussion started by: saurya_s
9 Replies

2. UNIX for Dummies Questions & Answers

emacs as a line editor

hello, I would like to use emacs as a line editor (I use emacs as editor). I try "set -o emacs" but I have nothing. Thank you for any help (5 Replies)
Discussion started by: annemar
5 Replies

3. Programming

A question of indentation

Hi, Using GNU indent(1) I tried to indent a C source file which has no indentation (all lines start at column 1). The result I am trying to achieve, should look like this with the exception that only tabs are used for indentation (no spaces). Unfortunately, I couldn't find the appropriate... (1 Reply)
Discussion started by: Michael Iatrou
1 Replies

4. Shell Programming and Scripting

Regarding indentation using unix script

I have piece of Informatica code in a file as : IIF(substr(flag,0,2)=1,false,IIF(flag= 1 ,0,NULL)) Please provide me with idea how to write a unix script which reads this file and write indented code into another file. The output in the second file should look as: ... (1 Reply)
Discussion started by: srikanth.ch
1 Replies

5. Shell Programming and Scripting

indentation and lowercase to uppercase

hi, i need to write a bash script that does two things. the program will take from the command line a file name, which is a C code, and an integer, which is the size of my indentation i would then have to indent every nested code by the number of columns provided by the user in the... (1 Reply)
Discussion started by: kratos.
1 Replies

6. Shell Programming and Scripting

Indentation help

Hi I have coded 300 line script.Its not indented properly.i am not good at indentation. I would appreciate your help on this. i want to use a 4 space indentataion.Hence if i "set tabstop=4" and use tabs for coding and if some one else open this script in their system it looks unindented since... (11 Replies)
Discussion started by: pinnacle
11 Replies

7. UNIX for Dummies Questions & Answers

How to use emacs? Also how to open existing emacs files with .cgi format?

Hi All, I am new to this forum and a beginner in unix. Please correct me if I put the question in a wrong way.. How to use emacs editor? Also how to open existing emacs files with .cgi format? I have the following link :- http link i.e. url and path : /abc/xyz.dev/xyz/documents What... (7 Replies)
Discussion started by: swathi123
7 Replies

8. UNIX for Dummies Questions & Answers

Indentation using awk

I need to write an awk program who does this http://i.stack.imgur.com/yzSqB.jpg I'd be very grateful for any help, Thanks a lot (1 Reply)
Discussion started by: guy9050
1 Replies

9. Homework & Coursework Questions

Indentation using awk

1. The problem statement, all variables and given/known data: I need to write an awk program who does this (sorry its too big) http://i.stack.imgur.com/yzSqB.jpg 2. Relevant commands, code, scripts, algorithms: .. 3. The attempts at a solution (include all code and scripts): declaring a... (2 Replies)
Discussion started by: guy9050
2 Replies

10. UNIX for Beginners Questions & Answers

Indentation for Lists in html

An writing some html instructions to have text beside an image. The image is located on the left and I want the tect to appear on the right side of the image. The text includes a list. The problem is that the list boxes and not shifted. The text within the list align on the left with the... (20 Replies)
Discussion started by: kristinu
20 Replies
INDENT(1)						    BSD General Commands Manual 						 INDENT(1)

NAME
indent -- indent and format C program source SYNOPSIS
indent [input-file [output-file]] [-bacc | -nbacc] [-bad | -nbad] [-bap | -nbap] [-bbb | -nbbb] [-bc | -nbc] [-bl] [-br] [-cn] [-cdn] [-cdb | -ncdb] [-ce | -nce] [-cin] [-clin] [-dn] [-din] [-fc1 | -nfc1] [-in] [-ip | -nip] [-ln] [-lcn] [-lp | -nlp] [-npro] [-pcs | -npcs] [-psl | -npsl] [-sc | -nsc] [-sob | -nsob] [-st] [-troff] [-v | -nv] DESCRIPTION
indent is a C program formatter. It reformats the C program in the input-file according to the switches. The switches which can be speci- fied are described below. They may appear before or after the file names. NOTE: If you only specify an input-file, the formatting is done `in-place', that is, the formatted file is written back into input-file and a backup copy of input-file is written in the current directory. If input-file is named '/blah/blah/file', the backup file is named file.BAK. If output-file is specified, indent checks to make sure it is different from input-file. The options listed below control the formatting style imposed by indent. -bacc, -nbacc If -bacc is specified, a blank line is forced around every conditional compilation block. For example, in front of every #ifdef and after every #endif. Other blank lines surrounding such blocks will be swallowed. Default: -nbacc. -bad, -nbad If -bad is specified, a blank line is forced after every block of declarations. Default: -nbad. -bap, -nbap If -bap is specified, a blank line is forced after every procedure body. Default: -nbap. -bbb, -nbbb If -bbb is specified, a blank line is forced before every block comment. Default: -nbbb. -bc, -nbc If -bc is specified, then a newline is forced after each comma in a declaration. -nbc turns off this option. Default: -bc. -br, -bl Specifying -bl lines up compound statements like this: if (...) { code } Specifying -br (the default) makes them look like this: if (...) { code } -bs, -nbs If -bs is specified, a blank is forced after sizeof. Default: -nbs. -cn The column in which comments on code start. Default: -c33. -cdn The column in which comments on declarations start. The default is for these comments to start in the same column as those on code. -cdb, -ncdb Enables (disables) the placement of comment delimiters on blank lines. With this option enabled, comments look like this: /* * this is a comment */ Rather than like this: /* this is a comment */ This only affects block comments, not comments to the right of code. Default: -cdb. -ce, -nce Enables (disables) forcing `else's to cuddle up to the immediately preceding `}'. Default: -ce. -cin Sets the continuation indent to be n. Continuation lines will be indented that far from the beginning of the first line of the statement. Parenthesized expressions have extra indentation added to indicate the nesting, unless -lp is in effect. -ci defaults to the same value as -i. -clin Causes case labels to be indented n tab stops to the right of the containing switch statement. -cli0.5 causes case labels to be indented half a tab stop. Default: -cli0. -dn Controls the placement of comments which are not to the right of code. For example, -d1 means that such comments are placed one indentation level to the left of code. Specifying the default -d0 lines up these comments with the code. See the sec- tion on comment indentation below. -din Specifies the indentation, in character positions, from a declaration keyword to the following identifier. Default: -di16. -dj, -ndj -dj left justifies declarations. -ndj indents declarations the same as code. Default: -ndj. -ei, -nei Enables (disables) special else-if processing. If it's enabled, an if following an else will have the same indentation as the preceding if statement. Default: -ei. -eei, -neei Enables (disables) extra indentation on continuation lines of the expression part of if and while statements. These continu- ation lines will be indented one extra level. Default: -neei. -fc1, -nfc1 Enables (disables) the formatting of comments that start in column 1. Often, comments whose leading `/' is in column 1 have been carefully hand formatted by the programmer. In such cases, -nfc1 should be used. Default: -fc1. -in The number of spaces for one indentation level. Default: -i8. -ip, -nip Enables (disables) the indentation of parameter declarations from the left margin. Default: -ip. -ln Maximum length of an output line. Default: -l78. -lp, -nlp Lines up code surrounded by parenthesis in continuation lines. If a line has a left parenthesis which is not closed on that line, then continuation lines will be lined up to start at the character position just after the left parenthesis. For exam- ple, here is how a piece of continued code looks with -nlp in effect: p1 = first_procedure(second_procedure(p2, p3), third_procedure(p4,p5)); With -lp in effect (the default) the code looks somewhat clearer: p1 = first_procedure(second_procedure(p2, p3), third_procedure(p4,p5)); Inserting two more newlines we get: p1 = first_procedure(second_procedure(p2, p3), third_procedure(p4 p5)); -npro Causes the profile files, './.indent.pro' and '~/.indent.pro', to be ignored. -pcs, -npcs If true (-pcs) all procedure calls will have a space inserted between the name and the `('. Default: -npcs. -psl, -npsl If true (-psl) the names of procedures being defined are placed in column 1 - their types, if any, will be left on the previ- ous lines. Default: -psl. -sc, -nsc Enables (disables) the placement of asterisks (`*'s) at the left edge of all comments. Default: -sc. -sob, -nsob If -sob is specified, indent will swallow optional blank lines. You can use this to get rid of blank lines after declara- tions. Default: -nsob. -st Causes indent to take its input from stdin, and put its output to stdout. -Ttypename Adds typename to the list of type keywords. Names accumulate: -T can be specified more than once. You need to specify all the typenames that appear in your program that are defined by typedef - nothing will be harmed if you miss a few, but the program won't be formatted as nicely as it should. This sounds like a painful thing to have to do, but it's really a symptom of a problem in C: typedef causes a syntactic change in the language and indent can't find all instances of typedef. -troff Causes indent to format the program for processing by troff(1). It will produce a fancy listing in much the same spirit as vgrind(1). If the output file is not specified, the default is standard output, rather than formatting in place. -v, -nv -v turns on `verbose' mode; -nv turns it off. When in verbose mode, indent reports when it splits one line of input into two or more lines of output, and gives some size statistics at completion. Default: -nv. You may set up your own `profile' of defaults to indent by creating a file called .indent.pro in your login directory and/or the current directory and including whatever switches you like. A `.indent.pro' in the current directory takes precedence over the one in your login directory. If indent is run and a profile file exists, then it is read to set up the program's defaults. Switches on the command line, though, always override profile switches. The switches should be separated by spaces, tabs or newlines. Comments 'Box' comments. indent assumes that any comment with a dash or star immediately after the start of comment (that is, `/*-' or `/**') is a comment surrounded by a box of stars. Each line of such a comment is left unchanged, except that its indentation may be adjusted to account for the change in indentation of the first line of the comment. Straight text. All other comments are treated as straight text. indent fits as many words (separated by blanks, tabs, or newlines) on a line as possible. Blank lines break paragraphs. Comment indentation If a comment is on a line with code it is started in the `comment column', which is set by the -cn command line parameter. Otherwise, the comment is started at n indentation levels less than where code is currently being placed, where n is specified by the -dn command line parameter. If the code on a line extends past the comment column, the comment starts further to the right, and the right margin may be auto- matically extended in extreme cases. Preprocessor lines In general, indent leaves preprocessor lines alone. The only reformatting that it will do is to straighten up trailing comments. It leaves embedded comments alone. Conditional compilation (#ifdef...#endif) is recognized and indent attempts to correctly compensate for the syntac- tic peculiarities introduced. C syntax indent understands a substantial amount about the syntax of C, but it has a `forgiving' parser. It attempts to cope with the usual sorts of incomplete and misformed syntax. In particular, the use of macros like: #define forever for(;;) is handled properly. ENVIRONMENT
indent uses the HOME environment variable. FILES
./.indent.pro profile file ~/.indent.pro profile file HISTORY
The indent command appeared in 4.2BSD. BUGS
indent has even more switches than ls(1). A common mistake that often causes grief is typing: indent *.c to the shell in an attempt to indent all the C programs in a directory. This is probably a bug, not a feature. BSD
July 1, 1993 BSD
All times are GMT -4. The time now is 04:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy