From: Andrea Greselin <greselin.andrea@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Make ‘electric-quote-mode’ not merge single quotes
Date: Wed, 3 Aug 2022 14:50:54 +0200 [thread overview]
Message-ID: <CAJ_oJbaKK6+Bs8o9F98-hqJVEvmC0zswRz8M6O-N60ebMewdVA@mail.gmail.com> (raw)
In-Reply-To: <CAJ_oJbZ8xdViKHfXG_qz5mU64QG-BZDPWYYTZQvK_6arYx-KjQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1928 bytes --]
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)
[-- Attachment #2: Type: text/html, Size: 2522 bytes --]
prev parent reply other threads:[~2022-08-03 12:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-02 10:42 Make ‘electric-quote-mode’ not merge single quotes Andrea Greselin
2022-08-03 12:50 ` Andrea Greselin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJ_oJbaKK6+Bs8o9F98-hqJVEvmC0zswRz8M6O-N60ebMewdVA@mail.gmail.com \
--to=greselin.andrea@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).