all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Bob Proulx <bob@proulx.com>,
	Oleksandr Gavenko <gavenkoa@gmail.com>,
	Phil <p.stephani2@gmail.com>
Cc: 21751@debbugs.gnu.org
Subject: bug#21751: 24.5; Undesirable sh-mode indent
Date: Sat, 26 Aug 2017 08:18:09 -0400	[thread overview]
Message-ID: <874lsua5fi.fsf@users.sourceforge.net> (raw)
In-Reply-To: <87y4esm6js.fsf@hysteria.proulx.com> (Bob Proulx's message of "Sat, 24 Oct 2015 13:04:55 -0600")

Bob Proulx <bob@proulx.com> writes:

> In 24.5.1 from Debian Sid I am now getting an undesirable indent that
> is no longer controlled by sh-basic-offset.  In 23 this worked.
>
> emacs -Q /tmp/trial.sh
>
> M-: (setq sh-basic-offset 2)
>
> if true; then
>     true
>     ^ indent should be 2 not 4 here
>
> C-c ?
> Rules used: :elem basic -> 4, :before "then" -> 0, :after "then" -> nil
>
> Anyone know what is happening here?  I have reviewed the NEWS and the
> latest manual but I didn't find any intentionally noted changes.

Doing M-: (setq sh-indentation 2 sh-basic-offset 2) gives the expected
result.  The smie indentation code is using sh-indentation for
default/basic offset, and sh-basic-offset indirectly for other offsets.
I'm not sure why both sh-indentation and sh-basic-offset exist
(sh-basic-offset was added in [1: f964dfcb0d], sh-indentation in [2:
133693bc90]).  The only other place that uses sh-indentation is
sh-basic-indent-line (which is only used for shells lacking any
indentation rules).  I guess sh-indentation should be made into an
obsolete alias for sh-basic-offset?

    (defcustom sh-basic-offset 4
      "The default indentation increment.
    This value is used for the `+' and `-' symbols in an indentation variable."

    (defcustom sh-indentation 4
      "The width for further indentation in Shell-Script mode."

    (defun sh-basic-indent-line ()
      "Indent a line for Sh mode (shell script mode).
    Indent as far as preceding non-empty line, then by steps of `sh-indentation'.

    (defun sh-set-shell (shell &optional no-query-flag insert-flag)
      "Set this buffer's shell to SHELL (a string)."
      ...
      (if (setq-local sh-indent-supported-here
                      (sh-feature sh-indent-supported))
          (progn
            (message "Setting up indent for shell type %s" sh-shell)
            ...)
        (message "No indentation for this shell type.")
        (setq-local indent-line-function 'sh-basic-indent-line)))

[1: f964dfcb0d]: 1999-10-12 12:30:38 +0000
  Added support for indenting existing scripts.
  http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=f964dfcb0d9dca156cbb29009bf4e399828f9b13

[2: 133693bc90]: 1995-07-07 19:48:24 +0000
  restructured, largely rewritten without the bugs and extended to cover over 15 shells.
  http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=133693bc904830ab88908d7f9806326543264f24





  reply	other threads:[~2017-08-26 12:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-24 19:04 bug#21751: 24.5; Undesirable sh-mode indent Bob Proulx
2017-08-26 12:18 ` npostavs [this message]
2017-08-30 23:50   ` npostavs
2017-09-02 12:57     ` Eli Zaretskii
2017-09-25 23:43       ` Noam Postavsky

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

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

  git send-email \
    --in-reply-to=874lsua5fi.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=21751@debbugs.gnu.org \
    --cc=bob@proulx.com \
    --cc=gavenkoa@gmail.com \
    --cc=p.stephani2@gmail.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.