Emacs anywhere: set markdown state after mode

This preserves the buffer-local value
This commit is contained in:
TEC 2021-01-16 04:26:30 +08:00
parent 516d3fdc8a
commit f54e195060
Signed by: tec
GPG Key ID: 779591AFDB81F06C
1 changed files with 4 additions and 3 deletions

View File

@ -1658,10 +1658,8 @@ Affects behaviour of `emacs-anywhere--finalise-content'")
(when-let ((selection (gui-get-selection 'PRIMARY)))
(insert selection))
(setq-local emacs-anywhere--active-markdown (markdown-window-p window-title))
;; convert buffer to org mode if markdown
(when emacs-anywhere--active-markdown
(when (markdown-window-p window-title)
(shell-command-on-region (point-min) (point-max)
"pandoc -f markdown -t org" nil t)
(deactivate-mark) (goto-char (point-max)))
@ -1673,6 +1671,9 @@ Affects behaviour of `emacs-anywhere--finalise-content'")
;; set major mode
(org-mode)
;; set markdown status
(setq-local emacs-anywhere--active-markdown (markdown-window-p window-title))
(advice-add 'ea--delete-frame-handler :before #'emacs-anywhere--finalise-content)
;; I'll be honest with myself, I /need/ spellcheck