Skip to content

Instantly share code, notes, and snippets.

@ExpHP
Created April 2, 2017 17:08
Show Gist options
  • Select an option

  • Save ExpHP/50e6ac9957b1406f9cdc2aefc84d533f to your computer and use it in GitHub Desktop.

Select an option

Save ExpHP/50e6ac9957b1406f9cdc2aefc84d533f to your computer and use it in GitHub Desktop.
save-excursion: wrong number of arguments
save-excursion: Wrong number of arguments: (1 . 1), 0
^ the number of arguments is... A DOTTED PAIR!?
am I reading this right!? O_o
(defun dotspacemacs//haskell-toggle-qualified ()
"toggle the qualified-ness of a single import in haskell"
;; TODO: sensible behavior when multiple lines are marked
(interactive)
(save-excursion
(move-beginning-of-line)
(let ((from-qual "^import[:space:]+qualified[:space]+")
(from-unqual "^import[:space:]+")
(to-qual "import qualified ")
(to-unqual "import "))
;; (if it isn't an import line, don't do anything at all)
(if (looking-at-p "import")
(if (looking-at-p from-qual)
(evil-ex-substitute "." "." from-qual to-unqual)
(evil-ex-substitute "." "." from-unqual to-qual))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment