electric-quote mode no longer worries about coding

* doc/emacs/text.texi (Quotation Marks), etc/NEWS: Document this.
* lisp/electric.el (electric--insertable-p): Remove.
All uses removed (Bug#24759).
This commit is contained in:
Paul Eggert 2016-10-23 01:14:23 -07:00
parent c2a17924a5
commit 6f1325ed92
3 changed files with 11 additions and 20 deletions

View file

@ -422,9 +422,7 @@ portable; curved quotes are less ambiguous and typically look nicer.
Electric Quote mode makes it easier to type curved quotes. As you Electric Quote mode makes it easier to type curved quotes. As you
type characters it optionally converts @t{`} to @t{}, @t{'} to @t{}, type characters it optionally converts @t{`} to @t{}, @t{'} to @t{},
@t{``} to @t{“}, and @t{''} to @t{”}. These conversions are @t{``} to @t{“}, and @t{''} to @t{”}.
suppressed in buffers whose coding systems cannot represent curved
quote characters.
@vindex electric-quote-paragraph @vindex electric-quote-paragraph
@vindex electric-quote-comment @vindex electric-quote-comment

View file

@ -38,6 +38,12 @@ fontsets if the default font supports these characters. Set this
variable to nil to disable the new behavior and get back the old variable to nil to disable the new behavior and get back the old
behavior. behavior.
+++
** 'electric-quote-mode' is no longer suppressed in a buffer whose
whose coding system cannot represent curved quote characters.
Instead, users can deal with the unrepresentable characters in the
usual way when they save the buffer.
--- ---
** New variable 'inhibit-compacting-font-caches'. ** New variable 'inhibit-compacting-font-caches'.
Set this variable to a non-nil value to speed up display of characters Set this variable to a non-nil value to speed up display of characters

View file

@ -430,12 +430,6 @@ The variable `electric-layout-rules' says when and how to insert newlines."
:version "25.1" :version "25.1"
:type 'boolean :safe 'booleanp :group 'electricity) :type 'boolean :safe 'booleanp :group 'electricity)
(defun electric--insertable-p (string)
(or (not buffer-file-coding-system)
(eq (coding-system-base buffer-file-coding-system) 'undecided)
(not (unencodable-char-position nil nil buffer-file-coding-system
nil string))))
(defun electric-quote-post-self-insert-function () (defun electric-quote-post-self-insert-function ()
"Function that `electric-quote-mode' adds to `post-self-insert-hook'. "Function that `electric-quote-mode' adds to `post-self-insert-hook'.
This requotes when a quoting key is typed." This requotes when a quoting key is typed."
@ -460,8 +454,7 @@ This requotes when a quoting key is typed."
(when start (when start
(save-excursion (save-excursion
(if (eq last-command-event ?\`) (if (eq last-command-event ?\`)
(cond ((and (electric--insertable-p "") (cond ((search-backward "`" (- (point) 2) t)
(search-backward "`" (- (point) 2) t))
(replace-match "") (replace-match "")
(when (and electric-pair-mode (when (and electric-pair-mode
(eq (cdr-safe (eq (cdr-safe
@ -469,16 +462,13 @@ This requotes when a quoting key is typed."
(char-after))) (char-after)))
(delete-char 1)) (delete-char 1))
(setq last-command-event ?“)) (setq last-command-event ?“))
((and (electric--insertable-p "") ((search-backward "`" (1- (point)) t)
(search-backward "`" (1- (point)) t))
(replace-match "") (replace-match "")
(setq last-command-event ?))) (setq last-command-event ?)))
(cond ((and (electric--insertable-p "") (cond ((search-backward "'" (- (point) 2) t)
(search-backward "'" (- (point) 2) t))
(replace-match "") (replace-match "")
(setq last-command-event ?”)) (setq last-command-event ?”))
((and (electric--insertable-p "") ((search-backward "'" (1- (point)) t)
(search-backward "'" (1- (point)) t))
(replace-match "") (replace-match "")
(setq last-command-event ?))))))))) (setq last-command-event ?)))))))))
@ -497,9 +487,6 @@ and text paragraphs, and these are selectively controlled with
`electric-quote-comment', `electric-quote-string', and `electric-quote-comment', `electric-quote-string', and
`electric-quote-paragraph'. `electric-quote-paragraph'.
Electric quoting is suppressed in a buffer whose coding system
cannot represent the replacement characters.
This is a global minor mode. To toggle the mode in a single buffer, This is a global minor mode. To toggle the mode in a single buffer,
use `electric-quote-local-mode'." use `electric-quote-local-mode'."
:global t :group 'electricity :global t :group 'electricity