Emacs-D-Mode-Maintainers / Emacs-D-Mode

An Emacs mode for D code.
GNU General Public License v3.0
84 stars 21 forks source link

Indentation in latest emacs triggers error (with patch) #31

Closed martinez closed 7 years ago

martinez commented 9 years ago

The latest emacs versions introduce a new type of keyword which d-mode does not provide. As a result, the looking-at function receives nil and fails, inside a call to c-after-conditional. In the patch provided I define the keyword variable, with seems to solve the problem.

--- d-mode.el.orig  2014-11-07 16:58:46.786635665 +0100
+++ d-mode.el   2014-11-07 16:55:52.973297053 +0100
@@ -244,6 +244,11 @@
       "foreach" "foreach_reverse" "with" "unittest"
       "else static if" "else"))

+(c-lang-defconst c-block-stmt-1-2-kwds
+  ;; Statement keywords which may be followed by a
+  ;; paren sexp and will then be followed by a substatement.
+  d '())
+
 (c-lang-defconst c-simple-stmt-kwds
   ;; Statement keywords followed by an expression or nothing.
   d '("break" "continue" "goto" "return" "throw"))
russel commented 9 years ago

Sorry for not getting to this earlier. Do you have a sample case to show the problem? Could you turn this posted patch into a pull request?

CyberShadow commented 7 years ago

In my version of Emacs, c-block-stmt-1-2-kwds is defined as follows:

(c-lang-defconst c-block-stmt-1-2-kwds
  "Statement keywords optionally followed by a paren sexp.
Keywords here should also be in `c-block-stmt-1-kwds'."
  t nil
  java '("try"))

So it looks like it already has a default value of nil.

I'll close this as there's been near to no response for close to 2 years, but add a comment if this can still be reproduced.