diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2015-05-28 00:46:59 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2015-05-28 00:54:06 -0700 |
commit | 73512b8cff21a5d92ca72b6cfa34a9210d5a5441 (patch) | |
tree | ca007c5cb2d83a984d2991b62a81c908e25596df /doc | |
parent | 4643f6c21a88d27cfb8a3410494bfd7909a98462 (diff) | |
download | emacs-73512b8cff21a5d92ca72b6cfa34a9210d5a5441.tar.gz |
New minor mode Electric Quote
This lets you easily insert quotes ‘like this’ by typing
quotes `like this', and similarly you can easily insert
quotes “like this” by typing quotes ``like this'' (Bug#20545).
* doc/emacs/basic.texi (Inserting Text):
* doc/emacs/modes.texi (Minor Modes):
* etc/NEWS: Document it.
* doc/emacs/text.texi (Quotation Marks): New section.
* lisp/electric.el (electric-quote-comment)
(electric-quote-string, electric-quote-paragraph):
New custom vars.
(electric--insertable-p)
(electric-quote-post-self-insert-function): New functions.
(electric-quote-mode, electric-quote-local-mode): New minor modes.
* lisp/progmodes/elisp-mode.el (emacs-lisp-mode):
Add curved single quotes to electric-pair-text-pairs.
Set electric-quote-string in this buffer.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/emacs/basic.texi | 6 | ||||
-rw-r--r-- | doc/emacs/modes.texi | 6 | ||||
-rw-r--r-- | doc/emacs/text.texi | 42 |
3 files changed, 54 insertions, 0 deletions
diff --git a/doc/emacs/basic.texi b/doc/emacs/basic.texi index be45856a6dd..cc9602e8c52 100644 --- a/doc/emacs/basic.texi +++ b/doc/emacs/basic.texi @@ -127,6 +127,12 @@ sign (Unicode code-point @code{U+221E}): A numeric argument to @kbd{C-q} or @kbd{C-x 8 @key{RET}} specifies how many copies of the character to insert (@pxref{Arguments}). + In some contexts, if you type a quotation using grave accent and +apostrophe @t{`like this'}, it is converted to a form @t{‘like this’} +using single quotation marks. Similarly, typing a quotation @t{``like +this''} using double grave accent and apostrophe converts it to a form +@t{“like this”} using double quotation marks. @xref{Quotation Marks}. + @node Moving Point @section Changing the Location of Point diff --git a/doc/emacs/modes.texi b/doc/emacs/modes.texi index 0e8f46a666d..e79561ac008 100644 --- a/doc/emacs/modes.texi +++ b/doc/emacs/modes.texi @@ -200,6 +200,12 @@ Auto Save mode saves the buffer contents periodically to reduce the amount of work you can lose in case of a crash. @xref{Auto Save}. @item +Electric Quote mode automatically converts quotation marks. For +example, it requotes text typed @t{`like this'} to text @t{‘like +this’}. You can control what kind of text it operates in, and you can +disable it entirely in individual buffers. @xref{Quotation Marks}. + +@item Enriched mode enables editing and saving of formatted text. @xref{Enriched Text}. diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi index 9bc5ade81a2..d891cc16870 100644 --- a/doc/emacs/text.texi +++ b/doc/emacs/text.texi @@ -69,6 +69,7 @@ for editing such pictures. * Sentences:: Moving over and killing sentences. * Paragraphs:: Moving over paragraphs. * Pages:: Moving over pages. +* Quotation Marks:: Inserting quotation marks. * Filling:: Filling or justifying text. * Case:: Changing the case of text. * Text Mode:: The major modes for editing text files. @@ -404,6 +405,47 @@ that separates pages (@pxref{Regexps}). The normal value of this variable is @code{"^\f"}, which matches a formfeed character at the beginning of a line. +@node Quotation Marks +@section Quotation Marks +@cindex Quotation marks +@cindex Electric Quote mode +@cindex mode, Electric Quote +@findex electric-quote-mode + One common way to quote is the typewriter convention, which quotes +using straight apostrophes @t{'like this'} or double-quotes @t{"like +this"}. Another common way is the curved quote convention, which uses +left and right single or double quotation marks @t{‘like this’} or +@t{“like this”}. Typewriter quotes are simple and portable; curved +quotes are less ambiguous and typically look nicer. + + Electric Quote mode makes it easier to type curved quotes. It +optionally converts a quotation's grave accent and apostrophe @t{`like +this'} to single quotation marks @t{‘like this’}. Similarly, it +converts a quotation's double grave accent and double apostrophe +@t{``like this''} to double quotation marks @t{“like this”}. These +conversions are suppressed in buffers whose coding systems cannot +represent curved quote characters. + +@vindex electric-quote-paragraph +@vindex electric-quote-comment +@vindex electric-quote-string + You can customize the behavior of Electric Quote mode by customizing +variables that control where it is active. It is active in text +paragraphs if @code{electric-quote-paragraph} is non-@code{nil}, in +programming-language comments if @code{electric-quote-comment} is +non-@code{nil}, and in programming-language strings if +@code{electric-quote-string} is non-@code{nil}. The default is +@code{nil} for @code{electric-quote-string} and @code{t} for the other +variables. + + Electric Quote mode is disabled by default. To toggle it, type +@kbd{M-x electric-quote-mode}. To toggle it in a single buffer, use +@kbd{M-x electric-quote-local-mode}. To suppress it for a single use, +type @kbd{C-q `} or @kbd{C-q '} instead of @kbd{`} or @kbd{'}. To +insert a curved quote even when Electric Quote is disabled or +inactive, use @kbd{C-x 8 @key{RET}} (@code{insert-char}). +@xref{Inserting Text}. + @node Filling @section Filling Text @cindex filling text |