Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
If I want compactness in emacs I usually break into the next line
my @headings = ( { key => 'k', name => 'Kanji', class => 'kanji'}, { key => 'skip', name => 'SKIP', class => 'skip-code'}, { key => 'co', name => 'Suggestion', class => 'skip-code'}, { key => 'disc', name => 'Discussion'}, );

I don't know where you got the break after the opening curly from

{ key => 'disc', name => 'Discussion'},

(Update: *I can't reproduce this!* I can now, see reply )

BUT cperl-mode offers 8 indent-styles (also available from the menu)

M-x cperl-set-style BSD C++ CPerl Current GNU K&R PerlStyle Whitesmith

... and plenty of customizations

Cperl Indentation Details group: Indentation. State : something in this group has been changed outside custom +ize. Show Value Cperl Brace Imaginary Offset Imagined indentation of a Perl open brace that actually follows a s +tatement. Hide An open brace following other text is treated as if it were this fa +r to the right of the start of its line. Show Value Cperl Brace Offset Extra indentation for braces, compared with other text in same cont +ext. Show Value Cperl Break One Line Blocks When Indent Non-nil means that one-line if/unless/while/until/for/foreach BLOCK +s Hide need to be reformatted into multiline ones when indenting a region. Show Value Cperl Close Paren Offset Extra indent for substatements that start with close-parenthesis. Hide Cperl Comment Column: 40 State : SAVED and set. Column to put comments in CPerl (use M-x cperl-indent to lineup wit +h code). Show Value Cperl Continued Brace Offset Extra indent for substatements that start with open-braces. Hide This is in addition to cperl-continued-statement-offset. Show Value Cperl Continued Statement Offset Extra indent for lines not starting new statements. Show Value Cperl Fix Hanging Brace When Indent Non-nil means that BLOCK-end `}' may be put on a separate line Hide when indenting a region. Braces followed by else/elsif/while/until are excepted. Show Value Cperl Indent Comment At Column 0 Non-nil means that comment started at column 0 should be indentable +. Show Value Cperl Indent Left Aligned Comments Non-nil means that the comment starting in leftmost column should i +ndent. Hide Cperl Indent Level: 2 State : CHANGED outside Customize. Indentation of CPerl statements with respect to containing block. Show Value Cperl Indent Parens As Block Non-nil means that non-block ()-, {}- and []-groups are indented as + blocks, Hide but for trailing "," inside the group, which won't increase indenta +tion. One should tune up `cperl-close-paren-offset' as well. Show Value Cperl Indent Region Fix Constructs Amount of space to insert between `}' and `else' or `elsif' Hide in `cperl-indent-region'. Set to nil to leave as is. Values other than 1 and nil will probably not work. Show Value Cperl Indent Wrt Brace Non-nil means indent statements in if/etc block relative brace, not + if/etc. Hide Versions 5.2 ... 5.20 behaved as if this were `nil'. Show Value Cperl Label Offset Offset of CPerl label lines relative to usual indentation. Show Value Cperl Lineup Step `cperl-lineup' will always lineup at multiple of this number. Hide If nil, the value of `cperl-indent-level' will be used. Show Value Cperl Merge Trailing Else Non-nil means that BLOCK-end `}' followed by else/elsif/continue Hi +de may be merged to be on the same line when indenting a region. Show Value Cperl Min Label Indent Minimal offset of CPerl label lines. Show Value Cperl Regexp Indent Step Indentation used when beautifying regexps. Hide If nil, the value of `cperl-indent-level' will be used. Show Value Cperl Tab Always Indent Non-nil means TAB in CPerl mode should always reindent the current +line, Hide regardless of where in the line point is when the TAB command is us +ed.

you might wanna read the micro-docs in the menu and experiment.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery


In reply to Re: How would you indent this? (emacs) by LanX
in thread How would you indent this? by no longer just digit

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (7)
As of 2024-04-25 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found