:version "26.1"
:type 'boolean :safe #'booleanp :group 'electricity)
+(defcustom electric-quote-replace-consecutive t
+ "Non-nil means to replace a pair of single quotes with a double quote.
+Two single quotes are replaced by the corresponding double quote
+when the second quote of the pair is entered (i.e. by typing ` or
+') by default. If nil, the single quotes are not altered."
+ :version "29.1"
+ :type 'boolean
+ :safe #'booleanp
+ :group 'electricity)
+
(defvar electric-quote-inhibit-functions ()
"List of functions that should inhibit electric quoting.
When the variable `electric-quote-mode' is non-nil, Emacs will
(memq (char-syntax (char-before))
'(?\s ?\())))
(setq backtick ?\')))
- (cond ((search-backward (string q< backtick) (- (point) 2) t)
+ (cond ((and electric-quote-replace-consecutive
+ (search-backward
+ (string q< backtick) (- (point) 2) t))
(replace-match (string q<<))
(when (and electric-pair-mode
(eq (cdr-safe
((search-backward "\"" (1- (point)) t)
(replace-match (string q<<))
(setq last-command-event q<<)))
- (cond ((search-backward (string q> ?') (- (point) 2) t)
+ (cond ((and electric-quote-replace-consecutive
+ (search-backward (string q> ?') (- (point) 2) t))
(replace-match (string q>>))
(setq last-command-event q>>))
((search-backward "'" (1- (point)) t)
`electric-quote-paragraph'.
Customize `electric-quote-chars' to use characters other than the
-ones listed here.
+ones listed here. Also see `electric-quote-replace-consecutive'.
This is a global minor mode. To toggle the mode in a single buffer,
use `electric-quote-local-mode'."