Function: electric-quote-mode

electric-quote-mode is an interactive and byte-compiled function defined in electric.el.gz.

Signature

(electric-quote-mode &optional ARG)

Documentation

Toggle on-the-fly requoting (Electric Quote mode).

When enabled, as you type this replaces ` with ‘, ' with ’,
`` with “, and '' with ”. This occurs only in comments, strings,
and text paragraphs, and these are selectively controlled with electric-quote-comment, electric-quote-string, and electric-quote-paragraph.

Customize electric-quote-chars to use characters other than the 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.

This is a global minor mode. If called interactively, toggle the Electric-Quote mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate (default-value \=electric-quote-mode)'.

The mode's hook is called both when the mode is enabled and when it is disabled.

View in manual

Probably introduced at or before Emacs version 25.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/electric.el.gz
;;;###autoload
(define-minor-mode electric-quote-mode
  "Toggle on-the-fly requoting (Electric Quote mode).

When enabled, as you type this replaces \\=` with \\=‘, \\=' with \\=’,
\\=`\\=` with “, and \\='\\=' with ”.  This occurs only in comments, strings,
and text paragraphs, and these are selectively controlled with
`electric-quote-comment', `electric-quote-string', and
`electric-quote-paragraph'.

Customize `electric-quote-chars' to use characters other than the
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'."
  :global t :group 'electricity
  ;; :initialize #'custom-initialize-after-file-load
  :init-value nil
  (if (not electric-quote-mode)
      (unless (catch 'found
                (dolist (buf (buffer-list))
                  (with-current-buffer buf
                    (if electric-quote-mode (throw 'found t)))))
        (remove-hook 'post-self-insert-hook
                     #'electric-quote-post-self-insert-function))
    (add-hook 'post-self-insert-hook
              #'electric-quote-post-self-insert-function
              10)))