Instantly share code, notes, and snippets.

Embed
What would you like to do?
markdown.el
(defun insert-until-last (string)
"Insert string until column"
(let* ((end (save-excursion
(previous-line)
(end-of-line)
(current-column)))
(count (if (not (zerop (current-column)))
(- end (current-column))
end)))
(dotimes (c count)
(insert string))))
(defun insert-equals (&optional arg)
"Insert equals until the same column number as last line"
(interactive)
(insert-until-last "="))
(defun insert-hyphens (&optional arg)
"Insert hyphens until the same column number as last line"
(interactive)
(insert-until-last "-"))
(defun insert-backticks (&optional arg)
"Insert three backticks for Markdown use"
(interactive)
(insert "``````")
(backward-char 3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment