Here's a patch that implements the changes described in my previous message. It defaults to the current behaviour. Andrea --- electric--v28.1.el 2022-08-02 14:41:09.578483586 +0200 +++ electric--modified.el 2022-08-02 14:47:17.712875776 +0200 @@ -534,6 +534,11 @@ :version "26.1" :type 'boolean :safe #'booleanp :group 'electricity) +(defcustom electric-quote-replace-consecutive t + "Non-nil means to replace two consecutive electric single quotes +with the corresponding (opening or closing) double quote." + :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 @@ -586,7 +591,8 @@ (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 @@ -600,7 +606,8 @@ ((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)