forked from lukehoersten/haskell-snippets
-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
(add-hook 'haskell-interactive-mode-hook 'yas-minor-mode)
(add-hook 'interactive-haskell-mode-hook
(defun my-interactive-haskell-use-snippets ()
(yas-activate-extra-mode 'haskell-mode)))
turns it on in interactive-haskell-mode, but most of the snippets don't expand because they test (current-column)
(to check that we're writing "imp" at the start of the line) which gets offset due to the repl prompt. One solution would be to have a helper like doing something like
(defun haskell-snippets-current-column ()
(let ((prompt-len (if (eq major-mode 'haskell-interactive-mode)
(save-excursion
(goto-char (line-beginning-position))
(cond ((looking-at-p (regexp-quote
haskell-interactive-prompt))
(length haskell-interactive-prompt))
((looking-at-p (regexp-quote
haskell-interactive-prompt2))
(length haskell-interactive-prompt2))
(t 0)))
0)))
(- (current-column) prompt-len)))
(and using that instead of current-column
in the snippets) but maybe there's a built-in thing like that in emacs? (or one could use haskell-interactive-mode-bol
)
Metadata
Metadata
Assignees
Labels
No labels