Skip to content

Commit

Permalink
fix second-char bug in SCC code
Browse files Browse the repository at this point in the history
Don't insert SCC if the character before point is the beginning of a
word.  Do insert SCC if the character at point is not the beginning of a
word, but the character before point is whitespace.  This occurs when
the character at point is a non-letter, such as = or {.
  • Loading branch information
bergey committed Nov 11, 2015
1 parent f1b104b commit 5c96cd1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions haskell-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -895,10 +895,12 @@ LOC = (list FILE LINE COL)"
(defun haskell-mode-try-insert-scc-at-point ()
"Try to insert an SCC annotation at point. Return true if
successful, nil otherwise."
(if (or (looking-at "\\b\\|[ \t]\\|$") (and (not (bolp))
(save-excursion
(forward-char -1)
(looking-at "\\b\\|[ \t]"))))
(if (or (looking-at "\\b\\|[ \t]\\|$")
;; Allow SCC if point is on a non-letter with whitespace to the left
(and (not (bolp))
(save-excursion
(forward-char -1)
(looking-at "[ \t]"))))
(let ((space-at-point (looking-at "[ \t]")))
(unless (and (not (bolp)) (save-excursion
(forward-char -1)
Expand Down

0 comments on commit 5c96cd1

Please sign in to comment.