unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Harry Putnam <reader@newsguy.com>
Subject: indentation - always a pita
Date: Tue, 24 Jun 2003 15:28:43 -0700	[thread overview]
Message-ID: <m3r85j9ls1.fsf@newsguy.com> (raw)

Maybe its just because I only have 3 brain cells to rub together. But
it always seems like a massive undertaking to do anything about
indentation in some of the scripting or language modes.

In the instant case its Shell-script (bash)
Pressing Ctrl-Alt \ to format the entire buffer.

Gives me something like:

if [ ];then
    if [ ];then
	case $opt in
	    t) cmd
		if  [ ];then 
		    cmd
		fi
		;;
	    h) cmd
		if [ ];then
		    case $otheropt in
			a) cmd
			    if [ ];then
				cmd
			    fi
			    ;;
			b) cmd
                            ::
	            esac
                fi
        esac
	if [];then
	    cmd
	fi
    fi
fi

Admittedly a bit contrived but this seems a little extreme to me.  Now
to do something about this, I dimmly recall starting to before and
quickly discovering its quite complicated.

I'd like something closer to what cperl does.  Also I'd like there to
be NO TABS whatever.  Using tabs in code is guaranteed to cause a
problem sooner or later, when one is forced to edit with something
besides emacs.

So what is the simplist route to getting something like
if [ ];then
  if [ ];then
    if [];then
      cmd
    fi
  fi
fi

Two spaces per clause and 2 spaces for actions inside clause.
No tabs at all.

             reply	other threads:[~2003-06-24 22:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-24 22:28 Harry Putnam [this message]
     [not found] <mailman.8589.1056493977.21513.help-gnu-emacs@gnu.org>
2003-06-25  6:14 ` indentation - always a pita Kai Großjohann
2003-06-25 13:30   ` Harry Putnam
2003-06-25 14:15     ` Harry Putnam
2003-06-25 17:13     ` Kai Großjohann
2003-06-26  4:13       ` Harry Putnam
     [not found]       ` <mailman.8648.1056600891.21513.help-gnu-emacs@gnu.org>
2003-06-26  9:13         ` Jens Schmidt
2003-06-26 18:21           ` Harry Putnam
2003-06-26 18:35           ` Harry Putnam
     [not found]           ` <mailman.8693.1056654403.21513.help-gnu-emacs@gnu.org>
2003-06-27 10:21             ` Jens Schmidt
2003-06-27 20:35               ` Harry Putnam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3r85j9ls1.fsf@newsguy.com \
    --to=reader@newsguy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).