Skip to content

Instantly share code, notes, and snippets.

@pokehanai
Created July 22, 2016 09:35
Show Gist options
  • Save pokehanai/e98bbcc9dc780c61a1ba22228ac3e388 to your computer and use it in GitHub Desktop.
Save pokehanai/e98bbcc9dc780c61a1ba22228ac3e388 to your computer and use it in GitHub Desktop.
Emacs config for markdown-mode with orgtbl-mode
(use-package markdown-mode
:defer t
:commands (org-table-begin org-table-end orgtbl-mode)
:config
(progn
(require 'org-table)
(eval-when-compile
(require 'whitespace))
(defun advice:org-table-align:markdown ()
"Replace \"+\" sign with \"|\" in org-table."
(save-excursion
(save-restriction
(narrow-to-region (org-table-begin) (org-table-end))
(goto-char (point-min))
(while (search-forward "-+-" nil t)
(replace-match "-|-")))))
(add-hook 'markdown-mode-hook
(lambda ()
(whitespace-mode 1)
(set (make-local-variable 'whitespace-action) nil)
(setq indent-tabs-mode nil)
(setq markdown-indent-on-enter nil)
(orgtbl-mode)
(advice-add 'org-table-align :after 'advice:org-table-align:markdown)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment