From unknown Sun Jun 22 11:34:34 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#17183 <17183@debbugs.gnu.org> To: bug#17183 <17183@debbugs.gnu.org> Subject: Status: can't insert a quote pair before another Reply-To: bug#17183 <17183@debbugs.gnu.org> Date: Sun, 22 Jun 2025 18:34:34 +0000 retitle 17183 can't insert a quote pair before another reassign 17183 emacs submitter 17183 Stefan Monnier severity 17183 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 04 11:04:32 2014 Received: (at submit) by debbugs.gnu.org; 4 Apr 2014 15:04:33 +0000 Received: from localhost ([127.0.0.1]:35525 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WW5fU-0003B9-89 for submit@debbugs.gnu.org; Fri, 04 Apr 2014 11:04:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43486) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WW5fR-0003B1-Je for submit@debbugs.gnu.org; Fri, 04 Apr 2014 11:04:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WW5fH-0003CF-Ah for submit@debbugs.gnu.org; Fri, 04 Apr 2014 11:04:29 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:46136) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WW5fH-0003CA-8L for submit@debbugs.gnu.org; Fri, 04 Apr 2014 11:04:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45108) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WW5f8-0002OB-W3 for bug-gnu-emacs@gnu.org; Fri, 04 Apr 2014 11:04:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WW5f0-00038o-KB for bug-gnu-emacs@gnu.org; Fri, 04 Apr 2014 11:04:10 -0400 Received: from mercure.iro.umontreal.ca ([132.204.24.67]:47961) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WW5f0-00038e-G6 for bug-gnu-emacs@gnu.org; Fri, 04 Apr 2014 11:04:02 -0400 Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id A9E7984E0A for ; Fri, 4 Apr 2014 11:04:01 -0400 (EDT) Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 79AF51E5B74 for ; Fri, 4 Apr 2014 11:03:33 -0400 (EDT) Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id 4D170B4287; Fri, 4 Apr 2014 11:03:33 -0400 (EDT) From: Stefan Monnier To: bug-gnu-emacs@gnu.org Subject: can't insert a quote pair before another Date: Fri, 04 Apr 2014 11:03:33 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Package: Emacs Version: 24.3.50 emacs -Q -f electric-pair-mode -f text-mode SPC SPC SPC " C-a " The first " inserts a pair of double quotes, like I expect, but the second refuses to insert anything and instead it jumps forward to after the first double quote. Maybe there are cases where that makes sense, but that's much too clever for me. The situation where I bumped into it was that I had the text I suggest you write "blabla" instead of and I wanted to turn it into I suggest you write "blibli" and "blabla" instead of so I put point after "write" and wanted to type SPC "blibli" SPC and but instead I had to use C-q " twice, which was rather unpleasant. Stefan In GNU Emacs 24.3.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.22) of 2014-01-07 on faina From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 05 21:26:22 2014 Received: (at 17183) by debbugs.gnu.org; 6 Apr 2014 01:26:22 +0000 Received: from localhost ([127.0.0.1]:37215 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWbqn-0006T0-CV for submit@debbugs.gnu.org; Sat, 05 Apr 2014 21:26:22 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:43708) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWbql-0006Sr-FC for 17183@debbugs.gnu.org; Sat, 05 Apr 2014 21:26:20 -0400 Received: by mail-wi0-f172.google.com with SMTP id hi2so3220727wib.5 for <17183@debbugs.gnu.org>; Sat, 05 Apr 2014 18:26:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=vWpxGZvMjbqGm4CWjc1Ww14syIHcSPAIqBV595UgL+I=; b=Wz36xG04t63hqeM/7Kliaw7lokxcQMqLNwuWg5FXpWVT3urig5KGPb/CVu9zCysLu8 /UXM2VeF+wM/DWmMOYnqjTkbAZj4om44YTxFCWd7BMDNdVrSmqpeKwDcHU1kP8XbA4se FIdsr+0WJuNdmoWcIr7FW9Euy+GT9hOphBAaNt2G4pz5CYS8lrusYFGGEvq9M5W/FKkk CJ8AZuI5I0PVuQDDnbPkpq9QuZ6r8LRzJY2rY1Bw044I1MHBsEb0t6rUsYj017ZXL+Nr bGVrJ7/oV07hR+sV2lwsO69SyZrvPGajZbhqSIcSVJ/eif1OwHQbrcIyj35qpghVpwKZ UUUg== X-Received: by 10.180.205.204 with SMTP id li12mr15247025wic.34.1396747578586; Sat, 05 Apr 2014 18:26:18 -0700 (PDT) Received: from kitaj.lan.yourcompany.com (66.207.108.93.rev.vodafone.pt. [93.108.207.66]) by mx.google.com with ESMTPSA id jd2sm14099417wic.9.2014.04.05.18.26.17 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 05 Apr 2014 18:26:17 -0700 (PDT) From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) To: Stefan Monnier Subject: Re: bug#17183: can't insert a quote pair before another References: Date: Sun, 06 Apr 2014 02:26:15 +0100 In-Reply-To: (Stefan Monnier's message of "Fri, 04 Apr 2014 11:03:33 -0400") Message-ID: <87bnwf8czs.fsf@kitaj.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 17183 Cc: 17183@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Stefan Monnier writes: > Package: Emacs > Version: 24.3.50 > but instead I had to use C-q " twice, which was rather unpleasant. Yes seen it. Rather unpleasant indeed. How does this look?=20 =3D=3D=3D modified file 'lisp/ChangeLog' *** lisp/ChangeLog 2014-04-04 23:31:02 +0000 --- lisp/ChangeLog 2014-04-06 01:23:51 +0000 *************** *** 1,3 **** --- 1,11 ---- + 2014-04-06 Jo=C3=A3o T=C3=A1vora +=20 + * elec-pair.el (electric-pair--skip-whitespace): With quote + syntax, ensure not outside string before insertion started. . + (electric-pair-post-self-insert-function): Pass char and syntax to + electric-pair--skip-whitespace. Save point instead of + `save-excursion'. (Bug#17183) +=20 2014-04-04 Jo=C3=A3o T=C3=A1vora =20=20 * elec-pair.el: =3D=3D=3D modified file 'lisp/elec-pair.el' *** lisp/elec-pair.el 2014-04-04 23:31:02 +0000 --- lisp/elec-pair.el 2014-04-06 01:19:47 +0000 *************** *** 151,163 **** (const :tag "Newline" ?\n)) (list character))) =20=20 ! (defun electric-pair--skip-whitespace () "Skip whitespace forward, not crossing comment or string boundaries." ! (let ((saved (point)) ! (string-or-comment (nth 8 (syntax-ppss)))) ! (skip-chars-forward (apply #'string electric-pair-skip-whitespace-cha= rs)) ! (unless (eq string-or-comment (nth 8 (syntax-ppss))) ! (goto-char saved)))) =20=20 (defvar electric-pair-text-syntax-table prog-mode-syntax-table "Syntax table used when pairing inside comments and strings. --- 151,171 ---- (const :tag "Newline" ?\n)) (list character))) =20=20 ! (defun electric-pair--skip-whitespace (char syntax) "Skip whitespace forward, not crossing comment or string boundaries." ! (let* ((saved (point)) ! (ppss (syntax-ppss)) ! (string-or-comment (nth 8 ppss))) ! (unless (and ! (eq syntax ?\") ! (unwind-protect ! (progn ! (delete-char -1) ! (not (nth 3 (syntax-ppss)))) ! (insert-char char))) ! (skip-chars-forward (apply #'string electric-pair-skip-whitespace-c= hars)) ! (unless (eq string-or-comment (nth 8 (syntax-ppss))) ! (goto-char saved))))) =20=20 (defvar electric-pair-text-syntax-table prog-mode-syntax-table "Syntax table used when pairing inside comments and strings. *************** *** 502,521 **** (if (functionp electric-pair-skip-self) (funcall electric-pair-skip-self last-command-= event) electric-pair-skip-self)) ! (save-excursion (when (setq skip-whitespace-info (if (functionp electric-pair-skip-whites= pace) (funcall electric-pair-skip-whitespa= ce) electric-pair-skip-whitespace)) ! (electric-pair--skip-whitespace)) ! (eq (char-after) last-command-event)))) ;; This is too late: rather than insert&delete we'd want to only ;; skip (or insert in overwrite mode). The difference is in what ;; goes in the undo-log and in the intermediate state which might ;; be visible to other post-self-insert-hook. We'll just have to ;; live with it for now. (when skip-whitespace-info ! (electric-pair--skip-whitespace)) (delete-region (1- pos) (if (eq skip-whitespace-info 'chomp) (point) pos)) --- 510,531 ---- (if (functionp electric-pair-skip-self) (funcall electric-pair-skip-self last-command-= event) electric-pair-skip-self)) ! (let ((saved (point))) (when (setq skip-whitespace-info (if (functionp electric-pair-skip-whites= pace) (funcall electric-pair-skip-whitespa= ce) electric-pair-skip-whitespace)) ! (electric-pair--skip-whitespace last-command-event= syntax)) ! (prog1 ! (eq (char-after) last-command-event) ! (goto-char saved))))) ;; This is too late: rather than insert&delete we'd want to only ;; skip (or insert in overwrite mode). The difference is in what ;; goes in the undo-log and in the intermediate state which might ;; be visible to other post-self-insert-hook. We'll just have to ;; live with it for now. (when skip-whitespace-info ! (electric-pair--skip-whitespace last-command-event syntax)) (delete-region (1- pos) (if (eq skip-whitespace-info 'chomp) (point) pos)) From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 06 08:39:32 2014 Received: (at 17183) by debbugs.gnu.org; 6 Apr 2014 12:39:32 +0000 Received: from localhost ([127.0.0.1]:37493 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWmMG-0004LF-15 for submit@debbugs.gnu.org; Sun, 06 Apr 2014 08:39:32 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:49074) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWmMC-0004L4-9W for 17183@debbugs.gnu.org; Sun, 06 Apr 2014 08:39:29 -0400 Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id s36CdQRt028044; Sun, 6 Apr 2014 08:39:26 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 44986AE1A3; Sun, 6 Apr 2014 08:39:26 -0400 (EDT) From: Stefan Monnier To: joaotavora@gmail.com (=?windows-1252?B?Sm/jbyBU4XZvcmE=?=) Subject: Re: bug#17183: can't insert a quote pair before another Message-ID: References: <87bnwf8czs.fsf@kitaj.lan> Date: Sun, 06 Apr 2014 08:39:26 -0400 In-Reply-To: <87bnwf8czs.fsf@kitaj.lan> (=?windows-1252?Q?=22Jo=E3o_T=E1vo?= =?windows-1252?Q?ra=22's?= message of "Sun, 06 Apr 2014 02:26:15 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4904=0 X-NAI-Spam-Version: 2.3.0.9378 : core <4904> : inlines <693> : streams <1152964> : uri <1722056> X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: 17183 Cc: 17183@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.6 (-) > + (unwind-protect > + (progn > + (delete-char -1) > + (not (nth 3 (syntax-ppss)))) > + (insert-char char))) Yuck! Why not (save-excursion (not (nth 3 (syntax-ppss (-1 (point))))))? Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 06 11:02:11 2014 Received: (at 17183) by debbugs.gnu.org; 6 Apr 2014 15:02:11 +0000 Received: from localhost ([127.0.0.1]:38181 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWoaI-000056-3R for submit@debbugs.gnu.org; Sun, 06 Apr 2014 11:02:10 -0400 Received: from mail-qc0-f178.google.com ([209.85.216.178]:50941) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWoaD-00004s-42 for 17183@debbugs.gnu.org; Sun, 06 Apr 2014 11:02:05 -0400 Received: by mail-qc0-f178.google.com with SMTP id i8so5339261qcq.23 for <17183@debbugs.gnu.org>; Sun, 06 Apr 2014 08:02:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=3FhU0twfMDVWp9PTWriO/uKqpZlHjMW2L99BkdyTX5E=; b=YIRfu0nbv6zCF//DMh7eWDrcG/APmC1gr06Cdt1mqPfPbwOv8zC2pvmuM9g+K9RZ1J jZogff5CSA8R0Ta+AXSQrSM1XaDu5pR9F1Vty5SItG5r4oqfhA+kt7Zong8UQ+cRANDP vMvwhxdRCdbT1qYw5Jp3lBBDIxp6LWYATU/JmruX9hf3bSkiP0H2/CLdHxVT43BgAXpi IVgWm/cT/bbex6CbYnNhi6AiYualbLKYis0A5i8d8dfr0mx40K3mDleQu0G6KAlYMwSC S3fAOLmBYwOcqpeKSjMUvNjSFaLM0Y6/VtvG5ZC2C5brg6kHSGUsQOVh7PKW8rTw6Lwc YmJA== X-Received: by 10.140.105.118 with SMTP id b109mr15016617qgf.28.1396796524461; Sun, 06 Apr 2014 08:02:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.46.199 with HTTP; Sun, 6 Apr 2014 08:01:44 -0700 (PDT) In-Reply-To: References: <87bnwf8czs.fsf@kitaj.lan> From: =?ISO-8859-1?Q?Jo=E3o_T=E1vora?= Date: Sun, 6 Apr 2014 16:01:44 +0100 Message-ID: Subject: Re: bug#17183: can't insert a quote pair before another To: Stefan Monnier Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 17183 Cc: 17183@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) That's precisely what I proposed in my last message that didn't yet make it to you (gmane authorization). Also, we should probably use electric-pair--syntax-ppss so that the trick works inside comments, too. On Sun, Apr 6, 2014 at 1:39 PM, Stefan Monnier w= rote: >> + (unwind-protect >> + (progn >> + (delete-char -1) >> + (not (nth 3 (syntax-ppss)))) >> + (insert-char char))) > > Yuck! Why not (save-excursion (not (nth 3 (syntax-ppss (-1 (point))))))? > > > Stefan --=20 Jo=E3o T=E1vora From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 06 11:05:31 2014 Received: (at submit) by debbugs.gnu.org; 6 Apr 2014 15:05:32 +0000 Received: from localhost ([127.0.0.1]:38188 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWodW-0000Ay-VF for submit@debbugs.gnu.org; Sun, 06 Apr 2014 11:05:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42956) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWodT-0000Al-F5 for submit@debbugs.gnu.org; Sun, 06 Apr 2014 11:05:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WWodK-0004br-Pm for submit@debbugs.gnu.org; Sun, 06 Apr 2014 11:05:24 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:60555) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWodK-0004bn-Ml for submit@debbugs.gnu.org; Sun, 06 Apr 2014 11:05:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWodE-0005pY-Vo for bug-gnu-emacs@gnu.org; Sun, 06 Apr 2014 11:05:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WWod9-0004Vp-Pt for bug-gnu-emacs@gnu.org; Sun, 06 Apr 2014 11:05:12 -0400 Received: from plane.gmane.org ([80.91.229.3]:32854) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWod9-0004Uy-Ez for bug-gnu-emacs@gnu.org; Sun, 06 Apr 2014 11:05:07 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WWod6-0007sZ-5b for bug-gnu-emacs@gnu.org; Sun, 06 Apr 2014 17:05:04 +0200 Received: from 66.207.108.93.rev.vodafone.pt ([93.108.207.66]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Apr 2014 17:05:04 +0200 Received: from joaotavora by 66.207.108.93.rev.vodafone.pt with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Apr 2014 17:05:04 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) Subject: Re: bug#17183: can't insert a quote pair before another Date: Sun, 06 Apr 2014 13:46:59 +0100 Lines: 178 Message-ID: <87vbum7hh8.fsf@kitaj.lan> References: <87bnwf8czs.fsf@kitaj.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 66.207.108.93.rev.vodafone.pt User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) Cancel-Lock: sha1:bez/6PPtb7J5D/Lhihj0IVRaUBs= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) joaotavora@gmail.com (João Távora) writes: > Stefan Monnier writes: > >> Package: Emacs >> Version: 24.3.50 > >> but instead I had to use C-q " twice, which was rather unpleasant. > > Yes seen it. Rather unpleasant indeed. How does this look? Actually, this is slightly simpler. New tests should make my intention clear as well === modified file 'lisp/ChangeLog' *** lisp/ChangeLog 2014-04-05 18:33:55 +0000 --- lisp/ChangeLog 2014-04-06 12:43:30 +0000 *************** *** 1,3 **** --- 1,10 ---- + 2014-04-06 João Távora + + * elec-pair.el (electric-pair--skip-whitespace): With quote + syntax, ensure not outside string before insertion started. . + (electric-pair-post-self-insert-function): Pass syntax to + electric-pair--skip-whitespace. (Bug#17183) + 2014-04-05 Glenn Morris * help.el (view-lossage): Doc tweak. === modified file 'lisp/elec-pair.el' *** lisp/elec-pair.el 2014-02-23 00:19:11 +0000 --- lisp/elec-pair.el 2014-04-06 12:33:49 +0000 *************** *** 151,163 **** (const :tag "Newline" ?\n)) (list character))) ! (defun electric-pair--skip-whitespace () "Skip whitespace forward, not crossing comment or string boundaries." ! (let ((saved (point)) ! (string-or-comment (nth 8 (syntax-ppss)))) ! (skip-chars-forward (apply #'string electric-pair-skip-whitespace-chars)) ! (unless (eq string-or-comment (nth 8 (syntax-ppss))) ! (goto-char saved)))) (defvar electric-pair-text-syntax-table prog-mode-syntax-table "Syntax table used when pairing inside comments and strings. --- 151,168 ---- (const :tag "Newline" ?\n)) (list character))) ! (defun electric-pair--skip-whitespace (syntax) "Skip whitespace forward, not crossing comment or string boundaries." ! (let* ((saved (point)) ! (ppss (syntax-ppss)) ! (string-or-comment (nth 8 ppss))) ! (unless (and ! (eq syntax ?\") ! (not (nth 3 (save-excursion ! (syntax-ppss (1- (point))))))) ! (skip-chars-forward (apply #'string electric-pair-skip-whitespace-chars)) ! (unless (eq string-or-comment (nth 8 (syntax-ppss))) ! (goto-char saved))))) (defvar electric-pair-text-syntax-table prog-mode-syntax-table "Syntax table used when pairing inside comments and strings. *************** *** 489,495 **** (if (functionp electric-pair-skip-whitespace) (funcall electric-pair-skip-whitespace) electric-pair-skip-whitespace)) ! (electric-pair--skip-whitespace)) (eq (char-after) last-command-event)))) ;; This is too late: rather than insert&delete we'd want to only ;; skip (or insert in overwrite mode). The difference is in what --- 494,500 ---- (if (functionp electric-pair-skip-whitespace) (funcall electric-pair-skip-whitespace) electric-pair-skip-whitespace)) ! (electric-pair--skip-whitespace syntax)) (eq (char-after) last-command-event)))) ;; This is too late: rather than insert&delete we'd want to only ;; skip (or insert in overwrite mode). The difference is in what *************** *** 497,503 **** ;; be visible to other post-self-insert-hook. We'll just have to ;; live with it for now. (when skip-whitespace-info ! (electric-pair--skip-whitespace)) (delete-region (1- pos) (if (eq skip-whitespace-info 'chomp) (point) pos)) --- 502,508 ---- ;; be visible to other post-self-insert-hook. We'll just have to ;; live with it for now. (when skip-whitespace-info ! (electric-pair--skip-whitespace syntax)) (delete-region (1- pos) (if (eq skip-whitespace-info 'chomp) (point) pos)) === modified file 'test/ChangeLog' *** test/ChangeLog 2014-03-25 07:34:30 +0000 --- test/ChangeLog 2014-04-06 12:44:19 +0000 *************** *** 1,3 **** --- 1,11 ---- + 2014-04-06 João Távora + + * automated/electric-tests.el (electric-pair-define-test-form): + More readable test docstrings. + (whitespace-skipping-for-quotes-not-ouside) + (whitespace-skipping-for-quotes-only-inside) + (whitespace-skipping-for-quotes-in-text-mode): New tests. + 2014-03-24 Barry O'Reilly * automated/undo-tests.el (undo-test-marker-adjustment-nominal): === modified file 'test/automated/electric-tests.el' *** test/automated/electric-tests.el 2014-01-01 07:43:34 +0000 --- test/automated/electric-tests.el 2014-04-06 12:41:35 +0000 *************** *** 114,121 **** mode extra-desc)) () ! ,(format "With \"%s\", try input %c at point %d. \ ! Should %s \"%s\" and point at %d" fixture char (1+ pos) --- 114,121 ---- mode extra-desc)) () ! ,(format "With |%s|, try input %c at point %d. \ ! Should %s |%s| and point at %d" fixture char (1+ pos) *************** *** 341,346 **** --- 341,371 ---- :test-in-code nil :test-in-comments t) + (define-electric-pair-test whitespace-skipping-for-quotes-not-ouside + " \" \"" "\"-----" :expected-string "\"\" \" \"" + :expected-point 2 + :bindings '((electric-pair-skip-whitespace . chomp)) + :test-in-strings nil + :test-in-code t + :test-in-comments nil) + + (define-electric-pair-test whitespace-skipping-for-quotes-only-inside + " \" \"" "---\"--" :expected-string " \"\"" + :expected-point 5 + :bindings '((electric-pair-skip-whitespace . chomp)) + :test-in-strings nil + :test-in-code t + :test-in-comments nil) + + (define-electric-pair-test whitespace-skipping-for-quotes-in-text-mode + " \" \"" "---\"--" :expected-string " \"\"\" \"" + :expected-point 5 + :modes '(text-mode) + :bindings '((electric-pair-skip-whitespace . chomp)) + :test-in-strings nil + :test-in-code t + :test-in-comments nil) + ;;; Pairing arbitrary characters ;;; From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 06 15:39:16 2014 Received: (at 17183) by debbugs.gnu.org; 6 Apr 2014 19:39:17 +0000 Received: from localhost ([127.0.0.1]:38371 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWsuS-0003dN-C2 for submit@debbugs.gnu.org; Sun, 06 Apr 2014 15:39:16 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:35901) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWsuP-0003dC-PR for 17183@debbugs.gnu.org; Sun, 06 Apr 2014 15:39:14 -0400 Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id s36Jd9hI016525; Sun, 6 Apr 2014 15:39:10 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 12C08AE27C; Sun, 6 Apr 2014 15:39:09 -0400 (EDT) From: Stefan Monnier To: joaotavora@gmail.com (=?windows-1252?B?Sm/jbyBU4XZvcmE=?=) Subject: Re: bug#17183: can't insert a quote pair before another Message-ID: References: <87bnwf8czs.fsf@kitaj.lan> <87vbum7hh8.fsf@kitaj.lan> Date: Sun, 06 Apr 2014 15:39:09 -0400 In-Reply-To: <87vbum7hh8.fsf@kitaj.lan> (=?windows-1252?Q?=22Jo=E3o_T=E1vo?= =?windows-1252?Q?ra=22's?= message of "Sun, 06 Apr 2014 13:46:59 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.2 X-NAI-Spam-Rules: 2 Rules triggered GEN_SPAM_FEATRE=0.2, RV4904=0 X-NAI-Spam-Version: 2.3.0.9378 : core <4904> : inlines <693> : streams <1153099> : uri <1722279> X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: 17183 Cc: 17183@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.6 (-) > Actually, this is slightly simpler. New tests should make my intention > clear as well Looks good, thanks, Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 06 20:04:54 2014 Received: (at 17183-done) by debbugs.gnu.org; 7 Apr 2014 00:04:54 +0000 Received: from localhost ([127.0.0.1]:38557 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWx3V-00025d-O1 for submit@debbugs.gnu.org; Sun, 06 Apr 2014 20:04:54 -0400 Received: from mail-wg0-f43.google.com ([74.125.82.43]:33343) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WWx3T-00025L-8i; Sun, 06 Apr 2014 20:04:52 -0400 Received: by mail-wg0-f43.google.com with SMTP id x13so5992738wgg.2 for ; Sun, 06 Apr 2014 17:04:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=Zx2qekBV8sPYx7fM6cK+4QhJ4OingccPvNH4jrM/usQ=; b=pSdJ/vIDGrj6myp99Yc0NPZFdSohgM+oF/hrOfrkDY/r2VyOOjLMU/y9HxntNLpvPx oCxyYUw09+ugwoa9i6cfZYQADW8KmH4EDr9xDocjOn+w/CLacbIkEvGsi/nrO5/Zx4je 1lGMvb7XCfPZ4h3xiilWkKCN463MgGYq8smRtUGjgDO2VnDp6qLnVhl00ZB0Oel+fC01 TcMZxLj2EsuK/QdBnZi+AFhlX9j34z10Oo0oKXt1VZVbfFoL1iFT01Jyk1TEx226KD6u BOFwwF+IHC6kJOHPp89KDIQKdP6l9cJc7OnnnDEM1MKC1zKuYMk0gVduS5t0fPtBpoO1 4pZg== X-Received: by 10.194.201.73 with SMTP id jy9mr38335777wjc.51.1396829087339; Sun, 06 Apr 2014 17:04:47 -0700 (PDT) Received: from kitaj.lan.yourcompany.com (66.207.108.93.rev.vodafone.pt. [93.108.207.66]) by mx.google.com with ESMTPSA id hi1sm23834161wjb.17.2014.04.06.17.04.45 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 06 Apr 2014 17:04:46 -0700 (PDT) From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) To: Stefan Monnier Subject: Re: bug#16981: 24.3.50; electric-pair-delete-adjacent-pairs broken in c-mode, python-mode, maybe-others References: <87fvlsq977.fsf@kitaj.lan> <877g738buc.fsf@kitaj.lan> Date: Mon, 07 Apr 2014 01:04:35 +0100 In-Reply-To: (Stefan Monnier's message of "Sun, 06 Apr 2014 08:48:21 -0400") Message-ID: <87zjjyovho.fsf@kitaj.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 17183-done Cc: 16981-done@debbugs.gnu.org, 17192-done@debbugs.gnu.org, 17183-done@debbugs.gnu.org, Alan Mackenzie X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Stefan Monnier writes: > Just take the corresponding diffs (IIRC you can use > "bzr merge -r116925..r116926 .../trunk" for that) and commit them into > emacs-24. > > Bzr doesn't really know about cherry picking, but if you put > "backported" into your commit message, our bzrmerge.el script > will know that this commit is already in the trunk and will know how to > avoid the corresponding conflicts when merging emacs-24 back into trunk. > >> - Three different fixes (bugs 16981,17192 and 17183) not yet pushed that >> I think you want me to only push to emacs-24, since that will be merged >> back to trunk later. > > Right. These three I did successfully, but failed miserably in the backporting. Oh git where art thou... Now I'm downloading a new repo (with sharing properly setup hopefully), since I must have done something that messed up my bzr conf, apparently I shouldn't have moved my repo dir. Should be done tomorrow morning, so I'll backport r116926 and r116940 then. From unknown Sun Jun 22 11:34:34 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 05 May 2014 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator