3

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)
Drew
  • 75,699
  • 9
  • 109
  • 225
Tohiko
  • 1,589
  • 1
  • 10
  • 22
  • Sounds like an AUCTex bug. If you don't get a definitive answer here, please consider filing a bug report. – Drew Feb 20 '18 at 15:03
  • Any updates on this? Any reasonable workarounds? I'm running into the same problem and it's driving me nuts. – apc Jan 08 '20 at 02:40
  • 2
    EDIT: Actually, going back to this (with more LISP knowledge), it seems setting `(put 'TeX-insert-quote 'delete-selection nil)` and `(put 'TeX-insert-dollar 'delete-selection nil)` works! – Tohiko Jan 08 '20 at 12:56

0 Answers0