Skip to content

Instantly share code, notes, and snippets.

@al3xandru
Last active March 13, 2016 02:49
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/d20d9db24b89ffd87c53 to your computer and use it in GitHub Desktop.
Save al3xandru/d20d9db24b89ffd87c53 to your computer and use it in GitHub Desktop.
(defun alpo/markdown-edit-mode ()
"Markdown writing optimized environment"
(interactive)
(unless (local-variable-p 'alpo/markdown-in-edit-mode (current-buffer))
(make-local-variable 'alpo/markdown-in-edit-mode)
(setq alpo/markdown-in-edit-mode 0)
(make-local-variable 'alpo/markdown-prev-theme)
(setq alpo/markdown-prev-theme spacemacs--cur-theme))
(message "alpo/markdown-in-edit-mode(1): %d" alpo/markdown-in-edit-mode)
(if (eq alpo/markdown-in-edit-mode 0)
(progn
(switch-to-buffer-other-frame (current-buffer))
(setq color-theme-is-global nil)
(load-theme 'leuven t)
(spacemacs/toggle-line-numbers-off)
(set-window-margins (selected-window) 20 20)
(set-face-attribute 'default (selected-frame) :height 140)
(set-frame-size (selected-frame) 125 65)
;; (redraw-frame (selected-frame))
;; (redraw-display)
;; (setq line-spacing 1.1)
(setq alpo/markdown-in-edit-mode 1)
(message "alpo/markdown-in-edit-mode(2): %d (enabled) %s" alpo/markdown-in-edit-mode alpo/markdown-prev-theme)
)
(progn
(setq line-spacing 1)
(set-window-margins (selected-window) 0 0)
(spacemacs/toggle-line-numbers-on)
(load-theme alpo/markdown-prev-theme t)
(delete-frame)
(setq alpo/markdown-in-edit-mode 0)
(message "alpo/markdown-in-edit-mode(2): %d (disabled)" alpo/markdown-in-edit-mode)
(kill-local-variable 'alpo/markdown-in-edit-mode)
(kill-local-variable 'alpo/markdown-prev-theme))
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment