In my emacs setup, if I have smartparens-mode
enabled with smartparens-latex
and I open a latex document, type some text then select it and type any latex special command (such as $
, "
, \{
, etc...) the text gets surrounded by these symbols as expected.
However, if I have delete-selection-mode
enabled, then the text is deleted instead. Other symbols like {
, (
, [
still work as expected even when delete-selection-mode
is enabled.
The weird thing is that this used to work flawlessly before a recent update that I cannot quite track. In fact a question was posted here in 2016 and an update to AUCTeX was supposed to fix this issue.
Below is the minimum init.el code that produces this problem
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(defun require-package (package)
"Install PACKAGE unless already installed."
(unless (package-installed-p package)
(package-install package))
)
(package-initialize)
(package-refresh-contents)
(require-package 'auctex)
(require-package 'smartparens)
(require 'smartparens)
(require 'smartparens-latex)
(delete-selection-mode t)
(defun latex-mode-defaults ()
(smartparens-mode)
)
(add-hook 'LaTeX-mode-hook 'latex-mode-defaults)