all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#18158: Fix extra indent of d-mode "else static if" statements in cc-engine.el
@ 2014-07-31 15:33 Liran Zvibel
  2020-01-20 21:18 ` Stefan Kangas
  2020-02-02 11:56 ` bug#18158: D Mode: Getting rid of the ugly advice on looking-at Alan Mackenzie
  0 siblings, 2 replies; 9+ messages in thread
From: Liran Zvibel @ 2014-07-31 15:33 UTC (permalink / raw)
  To: 18158

Hi,

I’m not subscribed to this list (or to -devel), so please reply also to my email when responding.

Thanks,
Liran Zvibel.

** Description:

Fix extra indent of d-mode  "else static if" statements 

The D programming language has a notion of “static if” conditionals.
The d-mode (from https://github.com/Emacs-D-Mode-Maintainers/Emacs-D-Mode.git)
requires cc-mode.
When writing “else static if” blocks, the code block is getting indented twice,
as well as all future “else static if”s that come later. This is very annoying.

This simple fix was originally suggested here: 
http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport/EmacsDMode/ElseStaticIf
The simple fix treats "static if" same as “if" that comes right after an “else".

I fixed it locally in my installed emacs long time ago, but today when downloading 
trunk to test 24.4 I was disappointed it was not already fixed by someone else. 
I know many D programmers that apply this change locally to their installed Emacs, 
hopefully not for long.

** ChangeLog

2014-07-31 Liran Zvibel <liranz@gmail.com>

	* Small cc-mode change to make sure “else static if” does not get 
	deeper and deeper indentation the same way that “else if” is treated 
	for d-mode that requires cc-mode.

** The patch :

=== modified file 'lisp/progmodes/cc-engine.el'
*** lisp/progmodes/cc-engine.el	2014-06-29 11:26:47 +0000
--- lisp/progmodes/cc-engine.el	2014-07-31 15:22:15 +0000
*************** comment at the start of cc-engine.el for
*** 9053,9061 ****
  			     (looking-at "else\\>[^_]")
  			     (save-excursion
  			       (goto-char old-pos)
! 			       (looking-at "if\\>[^_]")))
  			;; Special case to avoid deeper and deeper indentation
! 			;; of "else if" clauses.
  			)

  		       ((and (not stop-at-boi-only)
--- 9053,9062 ----
  			     (looking-at "else\\>[^_]")
  			     (save-excursion
  			       (goto-char old-pos)
!                                (or (looking-at "if\\>[^_]")
! 				   (looking-at "static\\>[^_]"))))
  			;; Special case to avoid deeper and deeper indentation
! 			;; of "else if"/"static else if" clauses.
  			)

  		       ((and (not stop-at-boi-only)









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

end of thread, other threads:[~2020-02-13 13:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-31 15:33 bug#18158: Fix extra indent of d-mode "else static if" statements in cc-engine.el Liran Zvibel
2020-01-20 21:18 ` Stefan Kangas
2020-01-26 15:29   ` Alan Mackenzie
2020-01-29  1:26     ` Liran Zvibel
2020-01-31 19:41       ` Alan Mackenzie
2020-02-02 11:56 ` bug#18158: D Mode: Getting rid of the ugly advice on looking-at Alan Mackenzie
2020-02-02 16:59   ` Vladimir Panteleev
2020-02-07 21:31     ` Alan Mackenzie
     [not found]     ` <20200207213100.GB8591@ACM>
2020-02-13 13:37       ` Vladimir Panteleev

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.