Skip to content

Instantly share code, notes, and snippets.

@reinh
Last active April 19, 2017 19:35
Show Gist options
  • Save reinh/f7cbe38904b896516ebb808bbd542ae9 to your computer and use it in GitHub Desktop.
Save reinh/f7cbe38904b896516ebb808bbd542ae9 to your computer and use it in GitHub Desktop.
(defun agda/comment-in ()
(interactive)
(save-excursion
(search-backward "{-+}")
(forward-char 4)
(backward-delete-char 2)
(insert-string "(-}")
(search-forward "{+-}")
(backward-delete-char 3)
(insert-string "-)-}")
(search-backward "{-(-}")
(next-line)
(agda2-load)))
(defun agda/comment-out ()
(interactive)
(save-excursion
(search-backward "{-(-}")
(forward-char 4)
(backward-delete-char 2)
(insert-string "+")
(search-forward "-)-}")
(backward-delete-char 4)
(insert-string "+-}")
(next-line)
(agda2-load)))
@reinh
Copy link
Author

reinh commented Apr 19, 2017

A slightly modified version of @pigworker's comment region twidding idiom, as seen here: https://github.com/pigworker/CS410-16/blob/master/exercises/Ex1.agda#L160-L163

Changes:

  • Added save-excursion.
  • Modified agda/comment-in to expect the point to start inside the region rather than above it.

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