all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Undesirable sh-mode indent
@ 2015-10-23 21:38 Bob Proulx
  2015-10-24  5:50 ` Teemu Likonen
  2015-10-24 21:06 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Bob Proulx @ 2015-10-23 21:38 UTC (permalink / raw)
  To: help-gnu-emacs

In 24.5.1 from Debian Sid I am now getting undesirable indention 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 but I
didn't find any intentionally noted changes here.

Does anyone know how to keep syntax highlighting but to disable
indentation?  Then at least I could at least stop it from doing the
wrong thing without dropping all of the way to fundamental-mode.

Thanks,
Bob



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Undesirable sh-mode indent
  2015-10-23 21:38 Undesirable sh-mode indent Bob Proulx
@ 2015-10-24  5:50 ` Teemu Likonen
  2015-10-24 19:18   ` Bob Proulx
  2015-10-24 21:06 ` Stefan Monnier
  1 sibling, 1 reply; 4+ messages in thread
From: Teemu Likonen @ 2015-10-24  5:50 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 720 bytes --]

Bob Proulx [2015-10-23 15:38:51-06] wrote:

> In 24.5.1 from Debian Sid I am now getting undesirable indention 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

There is also variable sh-indentation which I have set to the same value
as sh-basic-offset.

> Does anyone know how to keep syntax highlighting but to disable
> indentation? Then at least I could at least stop it from doing the
> wrong thing without dropping all of the way to fundamental-mode.

Some new SMIE thing is, in my opinion, doing too clever and wrong things
so I disable it: (setq sh-use-smie nil).

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Undesirable sh-mode indent
  2015-10-24  5:50 ` Teemu Likonen
@ 2015-10-24 19:18   ` Bob Proulx
  0 siblings, 0 replies; 4+ messages in thread
From: Bob Proulx @ 2015-10-24 19:18 UTC (permalink / raw)
  To: help-gnu-emacs

Teemu Likonen wrote:
> There is also variable sh-indentation which I have set to the same value
> as sh-basic-offset.

That variable seems to be an undocumented interface.  The sh-script.el
documentation talks about sh-basic-offset.

;; There are various customization variables which allow tailoring to
;; a wide variety of styles.  Most of these variables are named
;; sh-indent-for-XXX and sh-indent-after-XXX.  For example.
;; sh-indent-after-if controls the indenting of a line following
;; an if statement, and sh-indent-for-fi controls the indentation
;; of the line containing the fi.
;;
;; You can set each to a numeric value, but it is often more convenient
;; to a symbol such as `+' which uses the value of variable `sh-basic-offset'.
;; By changing this one variable you can increase or decrease how much
;; indentation there is.  Valid symbols:

I filed bug #21751 in the emacs BTS on this issue.

  https://debbugs.gnu.org/21751

> > Does anyone know how to keep syntax highlighting but to disable
> > indentation? Then at least I could at least stop it from doing the
> > wrong thing without dropping all of the way to fundamental-mode.
> 
> Some new SMIE thing is, in my opinion, doing too clever and wrong things
> so I disable it: (setq sh-use-smie nil).

This is interesting and useful.  I had not heard of sh-use-smie
before.  Thanks.  I can see the defvar for it in sh-script.el but when
I try to set it the variable appears not to exist with 'emacs -Q'.  If
I simply (setq sh-use-smie nil) it appears to have no effect for me.
But this gives me a direction to investigate.

Thanks!
Bob



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Undesirable sh-mode indent
  2015-10-23 21:38 Undesirable sh-mode indent Bob Proulx
  2015-10-24  5:50 ` Teemu Likonen
@ 2015-10-24 21:06 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2015-10-24 21:06 UTC (permalink / raw)
  To: help-gnu-emacs

> Anyone know what is happening here?  I have reviewed the NEWS but I
> didn't find any intentionally noted changes here.

   ** Shell Script mode
   *** The SMIE indentation engine is now used by default - see `sh-use-smie'.

An important detail is that sh-use-smie is just transitional and
will disappear at some point.


-- Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-24 21:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-23 21:38 Undesirable sh-mode indent Bob Proulx
2015-10-24  5:50 ` Teemu Likonen
2015-10-24 19:18   ` Bob Proulx
2015-10-24 21:06 ` Stefan Monnier

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.