 
 ;; Used for a few things.
 (require 'org)
+(require 'hydra)
 
 ;; Basic settings.
 (custom-set-variables

  (pjones:markdown-slide-fenced-code-block t t))
(put 'pjones:markdown-slide-fenced-code-insert 'no-self-insert t)

(defun pjones:markdown-visual-line ()
  "Don't wrap lines.  Needed for most web forms."
  (interactive)

     (file-name-nondirectory name)
     (file-relative-name dest))))

(defhydra hydra-markdown (:hint nil :color blue) "
^Links^                ^Cleanup^            ^Headings and Lists^
-----------------------------------------------------------------
_i_: insert            _r_: renumber        _f_: demote
_j_: jump              _/_: complete        _b_: promote
_c_: check             ^ ^                  _n_: down
_a_: attach            ^ ^                  _p_: up
^ ^                    ^ ^                  _N_: move down
^ ^                    ^ ^                  _P_: move up

^Render^               ^Insert^
-----------------------------------------------------------------
_l_: preview           _; i_: fence insert
_L_: live              _; c_: fence block
^ ^                    _; n_: note
^ ^                    ^   ^
"
  ("i" markdown-insert-link)
  ("j" markdown-do)
  ("c" markdown-check-refs)
  ("a" pjones:markdown-attach-file)
  ("r" markdown-cleanup-list-numbers)
  ("n" markdown-outline-next :color red)
  ("p" markdown-outline-previous :color red)
  ("f" markdown-demote :color red)
  ("b" markdown-promote :color red)
  ("N" markdown-move-down :color red)
  ("P" markdown-move-up :color red)
  ("/" markdown-complete)
  ("l" markdown-preview)
  ("L" markdown-live-preview-mode)
  ("; i" pjones:markdown-slide-fenced-code-insert)
  ("; c" pjones:markdown-slide-fenced-code-block)
  ("; n" pjones:markdown-slide-notes))

(defun pjones:markdown-mode-hook ()
  "Set up key bindings and other crap for markdown-mode."
  (local-set-key (kbd "C-c C-a")    #'pjones:markdown-attach-file)
  (local-set-key (kbd "C-c C-o")    #'pjones:markdown-follow-thing-at-point)
  (local-set-key (kbd "C-c /")      #'markdown-complete)
  (local-set-key (kbd "C-<return>") #'markdown-insert-header-dwim)
  (local-set-key (kbd "M-<return>") #'pjones:markdown-insert-list-item)
  (local-set-key (kbd "C-c C-h")    #'hydra-markdown/body)
  (whitespace-mode)
  (orgstruct-mode)
  (orgtbl-mode)
  (pjones:add-fixme-lock)

  ;; Completion configuration:
  (make-local-variable 'company-backends)
  (add-to-list 'company-backends '(company-ispell
                                   company-dabbrev))

  ;; Files in /tmp that are *.txt are from my browser and most
  ;; websites don't like it when text you submit has newlines.
