Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

coffee-line-wants-indent returns f on any bol indenter #36

Closed
eboto opened this Issue Jul 19, 2011 · 1 comment

Comments

Projects
None yet
2 participants

eboto commented Jul 19, 2011

Emacs 23.2.

I find that none of the coffee-indentors-bol actually match coffee-indenters-bol-regexp while editing except when the line containing the indenter was itself at an indentation level of 0.

For example, this is the unaltered coffee-mode indentation behavior that I observe:

if happy
  if know it
  claphands() # Shouldn't this have been indented?

I find that I can make it behave as I want it to if I remove the ^ from coffee-indenters-bol-regexp, as so

;; Works
(defun coffee-indenters-bol-regexp ()
  (regexp-opt coffee-indenters-bol 'words))

instead of

;; Broken
(defun coffee-indenters-bol-regexp ()
  (concat "^" (regexp-opt coffee-indenters-bol 'words)))

Based on the ELisp manual, I think that my replacement is correct when using the looking-at function.

Has anyone else actually observed this problem? It's just so fundamental that I reasoned it must be a problem with my particular setup...

@eboto eboto closed this Jul 19, 2011

@eboto eboto reopened this Jul 19, 2011

eboto commented Jul 19, 2011

This is the diff, FWIW.

--- a/coffee-mode.el
+++ b/coffee-mode.el
@@ -515,7 +515,7 @@ next line should probably be indented.")

 (defun coffee-indenters-bol-regexp ()
   "Builds a regexp out of `coffee-indenters-bol' words."
-  (concat "^" (regexp-opt coffee-indenters-bol 'words)))
+  (regexp-opt coffee-indenters-bol 'words))

 (defvar coffee-indenters-eol '(?> ?{ ?\[)
   "Single characters at the end of a line that mean the next line

@defunkt defunkt closed this in 27df14a Jul 19, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment