I don't know what is happening and how to debug this.
I moved my Emacs config from Fedora to Xubuntu 22.04 (that use older version of GNU Emacs) and now each time I open markdown file (only once per open file) Emacs generates HTML output of the markdown?
What may be responsible for this behavior?
THis it the only configuration for markdown files that I have in my .emacs file:
(dolist (pair '(("\\.\\(cs\\)\\'" . csharp-mode)
("\\.\\(css\\)\\'" . web-mode)
("\\.\\(ejs\\)\\'" . web-mode)
;; ("\\.\\(xml\\|rss\\|xsl\\|svg\\|glade\\|rng\\|kml\\|html\\|xhtml\\)\\'" . nxml-mode)
("\\.\\(php\\|php\\.in\\|xml\\|twig\\|rss\\|xsl\\|svg\\|glade\\|rng\\|kml\\|html\\|xhtml\\)\\'" . web-mode)
("\\.\\(md\\)\\'" . markdown-mode)
("\\.\\(prisma\\)\\'" . prisma-mode)
("\\.markdown$" . jekyll-markdown-mode)
("\\.\\(template\\|tpl\\)\\'" . mustache-mode)
("\\.jsx\\'" . web-mode)
("\\.\\(gs\\)\\'" . ruby-mode)
("\\.\\(js\\)\\'" . javascript-mode)))
(add-to-list 'auto-mode-alist pair))
(require 'ispell)
(defun markdown ()
(setq fill-column 100)
(ispell-change-dictionary
(if (let ((name (buffer-file-name)))
(or (string-match-p "jcubic/www/blog/repo" name)
(string-match-p "jcubic/www/jankiewicz" name)
(string-match-p "jcubic/astek/blog" name)
(string-match-p "/pl/" name)))
"polish"
"english"))
(flyspell-mode)
(flyspell-buffer))
(setq flyspell-generic-check-word-predicate 'flyspell-generic-textmode-verify)
(defun flyspell-generic-textmode-verify ()
"Used for `flyspell-generic-check-word-predicate' in text modes."
(eq major-mode 'markdown-mode))
(defun flyspell-clear ()
(interactive)
(flyspell-delete-all-overlays))
(defun lang (lang)
(interactive "sLanguage: ")
(ispell-change-dictionary lang)
(flyspell-buffer))
(defun english ()
(interactive)
(lang "english"))
(add-hook 'markdown-mode-hook 'markdown)
Besides this code I also have some highlighting modes enabled but they are not executed when opening the file. But I've checked that they do work, they are added to:
(add-hook 'after-change-major-mode-hook 'highlight-selected-modes)
(add-hook 'after-change-major-mode-hook
(lambda ()
(if (null (memql major-mode whitespace-mode-disable))
(whitespace-mode))))
When I switch to fundamental
mode and then run M-x markdown-mode
it works as expected.
Do you have a clue what could be generating that HTML output?
emacs -q
i.e. without your init file and make sure that that works properly. If that is the case, then bisect your init file to find the culprit. See this question and answer for more details."\\.\\(cs\\)\\'"
instead of"\\.cs\\'"
? 🤔