Function: haskell-mode-try-insert-scc-at-point
haskell-mode-try-insert-scc-at-point is a natively compiled function
defined in haskell-mode.el.
Signature
(haskell-mode-try-insert-scc-at-point)
Documentation
Try to insert an SCC annotation at point. Return true if successful, nil otherwise.
Source Code
;; Defined in /nix/store/9lz2mhw95f9fqxr9mnq46k3f6qz3aq83-emacs-packages-deps/share/emacs/site-lisp/elpa/haskell-mode-20260904.1042/haskell-mode.el
;; From Bryan O'Sullivan's blog:
;; http://www.serpentine.com/blog/2007/10/09/using-emacs-to-insert-scc-annotations-in-haskell-code/
(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]\\|$")
;; 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)
(looking-at "[ \t]")))
(insert " "))
(insert "{-# SCC \"\" #-}")
(unless space-at-point
(insert " "))
(forward-char (if space-at-point -5 -6))
t )))