Enhance table.el editing in markdown-mode

Pandoc supports grid tables, which are supported in Emacs via `table.el`.
By default, the alignment markers for those tables (:) are not
recognized in table.el, so let's add those.  Furthermore, editing grid
tables in `markdown-mode` does not work, since `jit-lock-mode`
overwrites the `keymap` text property that `table.el` relies on to
enable table editing.  Using `edit-indirect` to edit those tables in an
indirect buffer where everything works nicely.  Indeed, editing
`table.el` tables in Org also uses an indirect buffer, for the exact
same reason.
This commit is contained in:
Daniel Borchmann 2024-10-09 20:37:23 +02:00
parent a67e64a906
commit 212c3664ff
No known key found for this signature in database
GPG Key ID: 784AA8DF0CCDF625

View File

@ -2820,6 +2820,9 @@ eventuelly be set to nil, however)."
(add-to-list 'major-mode-remap-alist '(latex-mode . LaTeX-mode)) (add-to-list 'major-mode-remap-alist '(latex-mode . LaTeX-mode))
(require 'db-latex)) (require 'db-latex))
(use-package edit-indirect ; to allow code editing in markdown-mode
:ensure t)
(use-package edit-list (use-package edit-list
:ensure t :ensure t
:commands edit-list) :commands edit-list)
@ -2922,6 +2925,12 @@ eventuelly be set to nil, however)."
shr-image-animate nil shr-image-animate nil
shr-width (current-fill-column))) shr-width (current-fill-column)))
(use-package table
:init (progn
;; Pandoc supports colons in grid tables to denote alignments, so let's have table.el
;; recognize those too.
(setq table-cell-horizontal-chars "-=:")))
(use-package textile-mode (use-package textile-mode
:config (progn :config (progn
;; Do not wrap lines automatically in textile mode, as text produced ;; Do not wrap lines automatically in textile mode, as text produced