branch: elpa/fedi
commit c418288305777cd38f1ab58b1b3c5f51f58e6932
Author: marty hiatt <[email protected]>
Commit: marty hiatt <[email protected]>

    avoid recalling major mode in compose if already enabled
    
    markdown mode trashes any existing docs displayed.
---
 fedi-post.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fedi-post.el b/fedi-post.el
index aefc9fa1474..4ebbcda4e24 100644
--- a/fedi-post.el
+++ b/fedi-post.el
@@ -568,12 +568,16 @@ TYPE is a string for the buffer name."
          (previous-window-config (list (current-window-configuration)
                                        (point-marker))))
     (switch-to-buffer-other-window buffer)
-    (if major (funcall major) (text-mode))
+    ;; `markdown-mode' here breaks any existing docs display:
+    (if major
+        (unless (eq major major-mode)
+          (funcall major))
+      (text-mode))
     (or (funcall minor)
         (fedi-post-mode t))
     (when (eq major 'markdown-mode)
       ;; disable fontifying as it breaks our docs (we fontify by region below)
-      (font-lock-mode -1)
+      (unless buffer-exists (font-lock-mode -1))
       (when (member 'variable-pitch-mode markdown-mode-hook)
         ;; (make-local-variable 'markdown-mode-hook) ; unneeded if we always 
disable?
         ;; (setq markdown-mode-hook (delete 'variable-pitch-mode 
markdown-mode-hook))

Reply via email to