Skip to content

Instantly share code, notes, and snippets.

@al3xandru
Forked from mikeonly/markdown-edit-mode.el
Last active March 13, 2016 07:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save al3xandru/86375ad91ec03ad40d76 to your computer and use it in GitHub Desktop.
Save al3xandru/86375ad91ec03ad40d76 to your computer and use it in GitHub Desktop.
;;; markdown-edit-mode.el --- provide markdown-editing environment
(make-local-variable
(defvar markdown-prev-theme spacemacs--cur-theme))
(defcustom markdown-edit-mode-hook nil
"The hook to run when markdown-edit-mode is toggled."
:type 'hook)
(defcustom markdown-edit-theme 'leuven
"Theme to load for markdown environment."
:type 'symbol)
(defcustom markdown-edit-margin 20
"Window margin for markdown environment."
:type 'integer)
(defcustom markdown-font-size 140
"Font size in markdown environment."
:type 'number)
;;;###autoload
(define-minor-mode markdown-edit-mode
"Toggle markdown-edit-mode.
With ARG, turn markdown-edit-mode on if ARG is positive."
:global nil
:lighter " me"
(if markdown-edit-mode
(progn
(switch-to-buffer-other-frame (current-buffer))
(load-theme markdown-edit-theme t)
(spacemacs/toggle-line-numbers-off)
(spacemacs/disable-hl-line-mode)
(set-window-margins (selected-window) markdown-edit-margin markdown-edit-margin)
(set-face-attribute 'default (selected-frame) :height 140)
(set-frame-size (selected-frame)
(+ (* 2 markdown-edit-margin) (window-body-width (selected-window)))
(window-total-height (selected-window))))
(progn
(delete-frame)
(mapc 'disable-theme custom-enabled-themes)
(load-theme markdown-prev-theme t))
)
(provide 'markdown-edit-mode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment