Subject: Re: bug#23177: Inserting $ with delete-selection-mode set

From: Mosè Giordano <[email-masked]>
Date: Thu, 31 Mar 2016 23:57:25 +0200

close 23177
tags 23177 notabug
thanks

Hi Roger,

2016-03-31 23:37 GMT+02:00 Roger Lipsett <[email-masked]>:
>
> tex.el, at line 6315, contains the code
>
>   ;; delsel.el, `delete-selection-mode'
>   (put 'TeX-newline 'delete-selection t)
>   (put 'TeX-insert-quote 'delete-selection t)
>   (put 'TeX-insert-backslash 'delete-selection t)
>
> Should this also include a line for 'TeX-insert-dollar?

No.  That line was there until a few years ago but was removed on
purpose in order to provide a new feature:
http://git.savannah.gnu.org/cgit/auctex.git/commit/tex.el?id=d59628f1ee02abccc179c463214baddb5a17bf71

> The problem I'm seeing is that if I'm in TeX (or LaTeX) mode, running with delete-selection-mode t, and type a $ when a region is selected, the selected region is not killed.

If `TeX-electric-math' is non-nil, when you press `$' with an active
region, it will wrap the selection with opening and closing inline
equation symbols.  This is a feature AUCTeX provides, like for
parentheses in most other programming languages.  If you want to lose
this feature and be able to delete the region when inserting a dollar,
then these lines in your init file

    (setq TeX-electric-math nil)
    (put 'TeX-insert-dollar 'delete-selection t)

should do the trick.  Note that `TeX-electric-math' defaults to nil,
the first line shouldn't be actually needed.

Bye,
Mosè