From 212c3664ffbf9b0e6c9367989707a5cd6ab98ae2 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Wed, 9 Oct 2024 20:37:23 +0200 Subject: [PATCH] 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. --- init.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/init.el b/init.el index 7683970..03a8e61 100644 --- a/init.el +++ b/init.el @@ -2820,6 +2820,9 @@ eventuelly be set to nil, however)." (add-to-list 'major-mode-remap-alist '(latex-mode . LaTeX-mode)) (require 'db-latex)) +(use-package edit-indirect ; to allow code editing in markdown-mode + :ensure t) + (use-package edit-list :ensure t :commands edit-list) @@ -2922,6 +2925,12 @@ eventuelly be set to nil, however)." shr-image-animate nil 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 :config (progn ;; Do not wrap lines automatically in textile mode, as text produced