Skip to content

Commit

Permalink
Remove mmm-mode support as it has side effects in markdown-mode
Browse files Browse the repository at this point in the history
this mode seems to be misconfigured and is
killing markdown-mode font handling.

As I did not noticed a lost of functionality
I have removed it from now.

If anyone is willing to reconfigure the mode
I am open to add it back.

Fixes syl20bnr#16170
  • Loading branch information
smile13241324 committed Jan 4, 2024
1 parent b6c976c commit 35cc1a6
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 67 deletions.
16 changes: 0 additions & 16 deletions layers/+lang/markdown/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
- [[#install][Install]]
- [[#configuration][Configuration]]
- [[#live-preview][Live preview]]
- [[#automatic-mmm-mode-generation][Automatic MMM-Mode Generation]]
- [[#usage][Usage]]
- [[#generate-a-toc][Generate a TOC]]
- [[#key-bindings][Key bindings]]
Expand Down Expand Up @@ -89,21 +88,6 @@ Additionally there is =flymd= package in =chrome= layer that allows to preview
markdown buffer in Chrome. Please refer to =chrome= layer documentation for more
information.

** Automatic MMM-Mode Generation
To generate MMM-Modes for languages set the value of the variable
=markdown-mmm-auto-modes= to a list of the languages. For languages where the
mode name directly relates to the language name, use a string. Otherwise, use a
list of `("language" "mode")`:

#+BEGIN_SRC emacs-lisp
dotspacemacs-configuration-layers '(
(markdown :variables markdown-mmm-auto-modes '("c" "c++" "python" "scala" ("elisp" "emacs-lisp"))))
#+END_SRC

*Note:* Spacemacs already defines the variable =markdown-mmm-auto-modes= to a
bunch of languages. Consider opening a PR on the Spacemacs repository to add
new languages instead of overriding the variable in your dotfile.

* Usage
** Generate a TOC
To generate a table of contents type on top of the buffer:
Expand Down
21 changes: 0 additions & 21 deletions layers/+lang/markdown/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,5 @@
(defvar markdown-live-preview-engine 'eww
"Possibe values are `eww' (built-in browser) or `vmd' (installed with `npm').")

(defvar markdown-mmm-auto-modes
'(
;; in alphabetical order, symbols first then lists
"c"
"c++"
"css"
"java"
"javascript"
"python"
"ruby"
"rust"
"scala"

("elisp" "emacs-lisp")
("ess" "R")
("ini" "conf-unix")
("html" "web")
)
"List of language names or lists of language and mode names for which to
generate mmm classes.")

(defvar markdown--key-bindings-modes '(markdown-mode gfm-mode)
"Modes using markdown key bindings.")
20 changes: 0 additions & 20 deletions layers/+lang/markdown/funcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
;; along with this program. If not, see <http://www.gnu.org/licenses/>.


(defun spacemacs/activate-mmm-mode ()
(unless (bound-and-true-p git-commit-mode)
;; Enable `mmm-mode'.
(mmm-mode 1)))

;; Insert key for org-mode and markdown a la C-h k
;; Based on SE https://emacs.stackexchange.com/a/2208
(defun spacemacs/insert-keybinding-markdown (key)
Expand All @@ -39,21 +34,6 @@ Will work on both org-mode and any mode that accepts plain html."
(insert (format tag ""))
(forward-char -6))))

;; from Jason Blevins http://jblevins.org/log/mmm
(defun markdown/mmm-auto-class (lang)
(let* ((l (if (listp lang) (car lang) lang))
(s (if (listp lang) (cadr lang) lang))
(class (intern (concat "markdown-" l)))
(submode (intern (concat s "-mode")))
(front (concat "^```" l "[\n\r]+"))
(back "^```$"))
(mmm-add-classes (list (list class
:submode submode
:front front
:back back)))
(dolist (mode markdown--key-bindings-modes)
(mmm-add-mode-ext-class mode nil class))))

(defun spacemacs//markdown-hjkl-promotion-demotion (style)
"Set promotion/demotiion on 'hjkl' for the given editing STYLE."
(when (or (eq 'vim style)
Expand Down
10 changes: 0 additions & 10 deletions layers/+lang/markdown/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
gh-md
markdown-mode
markdown-toc
mmm-mode
smartparens
valign
(vmd-mode :toggle (eq 'vmd markdown-live-preview-engine))))
Expand Down Expand Up @@ -195,15 +194,6 @@
(spacemacs/set-leader-keys-for-major-mode mode
"it" 'markdown-toc-generate-toc))))

(defun markdown/init-mmm-mode ()
(use-package mmm-mode
:commands mmm-mode
:init (add-hook 'markdown-mode-hook 'spacemacs/activate-mmm-mode)
;; Automatically add mmm class for languages
:config
(mapc 'markdown/mmm-auto-class markdown-mmm-auto-modes)
(spacemacs|hide-lighter mmm-mode)))

(defun markdown/init-vmd-mode ()
(use-package vmd-mode
:defer t
Expand Down

0 comments on commit 35cc1a6

Please sign in to comment.