From 9fdb22ab8a2b71fe15e6951fcdd4b697a6580ef9 Mon Sep 17 00:00:00 2001 From: MitchMarq42 Date: Wed, 2 Nov 2022 13:59:22 -0800 Subject: [PATCH] Spruce up org-electric-pairs, see commit --- lisp/mitch-packages.el | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/lisp/mitch-packages.el b/lisp/mitch-packages.el index 799de28..6c4e34c 100644 --- a/lisp/mitch-packages.el +++ b/lisp/mitch-packages.el @@ -471,17 +471,20 @@ targets." (add-hook 'after-save-hook #'(lambda () (if (equal major-mode 'org-mode) (org-babel-tangle)))) - (defvar org-electric-pairs `( - (,(string-to-char "_") . ,(string-to-char "_")) - (,(string-to-char "/") . ,(string-to-char "/")) - (,(string-to-char "*") . ,(string-to-char "*")) - (,(string-to-char "+") . ,(string-to-char "+")) - (,(string-to-char "+") . ,(string-to-char "+")) - (,(string-to-char "=") . ,(string-to-char "=")))) + (defvar org-electric-pairs '( + (?_ . ?_) + (?/ . ?/) + (?* . ?*) + (?+ . ?+) + (?+ . ?+) + (?= . ?=)) + "Electric pairs for org-mode. - (dolist (pair org-electric-pairs) - (add-to-list 'electric-pair-pairs - pair)) +See https://emacs.stackexchange.com/questions/2538/how-to-define-additional-mode-specific-pairs-for-electric-pair-mode") + (defun org-add-electric-pairs () + (setq-local electric-pair-pairs (append electric-pair-pairs org-electric-pairs)) + (setq-local electric-pair-text-pairs electric-pair-pairs)) + (add-hook 'org-mode-hook 'org-add-electric-pairs) (require 'mitch-orgstuff) :hook (org-mode . turn-off-line-numbers)