GNU bug report logs - #78756
Difference in indentation behavior between elisp-mode and sh-mode

Previous Next

Package: emacs;

Reported by: Christopher Dimech <dimech <at> gmx.com>

Date: Wed, 11 Jun 2025 13:55:03 UTC

Severity: normal

To reply to this bug, email your comments to 78756 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#78756; Package emacs. (Wed, 11 Jun 2025 13:55:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christopher Dimech <dimech <at> gmx.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 11 Jun 2025 13:55:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Dimech <dimech <at> gmx.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Difference in indentation behavior between elisp-mode and sh-mode
Date: Wed, 11 Jun 2025 15:53:40 +0200
When defining a function in elisp-mode, the text following 
the function is not indented, regardless of where the closing 
parenthesis is placed:

(defun lana ()
  "Desc"

  (interactive)
  (message "lana"))

;; lana ends here

But in sh-mode, the text after the function is indented by
1 character.

opcon ()
 {
   echo "TODO"
 }

 ## opcon ends here

In elisp-mode, this does not happen—the next line of 
text is never indented, regardless of the closing 
parenthesis's position.

It appears that the correct approach is not to indent 
the following text.  This discrepancy may also exist 
in other programming modes.

It would be ideal if indentation behavior were made 
consistent across all programming modes in Emacs.






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78756; Package emacs. (Wed, 11 Jun 2025 16:08:05 GMT) Full text and rfc822 format available.

Message #8 received at 78756 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Dimech <dimech <at> gmx.com>
To: dimech <at> gmx.com
Cc: 78756 <at> debbugs.gnu.org
Subject: Re: bug#78756: Difference in indentation behavior between
 elisp-mode and sh-mode
Date: Wed, 11 Jun 2025 18:07:42 +0200

> Sent: Thursday, June 12, 2025 at 1:53 AM
> From: "Christopher Dimech via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> To: 78756 <at> debbugs.gnu.org
> Subject: bug#78756: Difference in indentation behavior between elisp-mode and sh-mode
>
> When defining a function in elisp-mode, the text following 
> the function is not indented, regardless of where the closing 
> parenthesis is placed:
> 
> (defun lana ()
>   "Desc"
> 
>   (interactive)
>   (message "lana"))
> 
> ;; lana ends here
> 
> But in sh-mode, the text after the function is indented by
> 1 character.
> 
> opcon ()
>  {
>    echo "TODO"
>  }
> 
>  ## opcon ends here
> 
> In elisp-mode, this does not happen—the next line of 
> text is never indented, regardless of the closing 
> parenthesis's position.

It is worth noting that awk-mode handles this correctly - text 
following a function definition is not indented.

It appears that the correct approach is not to indent the following
text.
 
> It appears that the correct approach is not to indent 
> the following text.  This discrepancy may also exist 
> in other programming modes.
> 
> It would be ideal if indentation behavior were made 
> consistent across all programming modes in Emacs.
> 
> 
> 
> 
> 
>




This bug report was last modified 2 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.