From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Gustavo Barros Newsgroups: gmane.emacs.bugs Subject: bug#36309: 26.2; Interaction between electric-pair and electric-quote Date: Thu, 20 Jun 2019 10:20:00 -0300 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="234351"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 To: 36309@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 20 16:43:07 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hdyHJ-000yjT-HL for geb-bug-gnu-emacs@m.gmane.org; Thu, 20 Jun 2019 16:43:05 +0200 Original-Received: from localhost ([::1]:48500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdyHI-0002lp-DW for geb-bug-gnu-emacs@m.gmane.org; Thu, 20 Jun 2019 10:43:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34943) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdyCV-0006ya-Jp for bug-gnu-emacs@gnu.org; Thu, 20 Jun 2019 10:38:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdyCS-0000ys-3p for bug-gnu-emacs@gnu.org; Thu, 20 Jun 2019 10:38:07 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35576) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hdyCQ-0000vi-Az for bug-gnu-emacs@gnu.org; Thu, 20 Jun 2019 10:38:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hdyCQ-0001HM-68 for bug-gnu-emacs@gnu.org; Thu, 20 Jun 2019 10:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gustavo Barros Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Jun 2019 14:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 36309 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15610414344846 (code B ref -1); Thu, 20 Jun 2019 14:38:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Jun 2019 14:37:14 +0000 Original-Received: from localhost ([127.0.0.1]:49120 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hdyBd-0001G5-TD for submit@debbugs.gnu.org; Thu, 20 Jun 2019 10:37:14 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:34330) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hdwzP-0007Zi-CT for submit@debbugs.gnu.org; Thu, 20 Jun 2019 09:20:31 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:52329) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdwzD-00056W-E7 for bug-gnu-emacs@gnu.org; Thu, 20 Jun 2019 09:20:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdwz3-0008CL-O5 for bug-gnu-emacs@gnu.org; Thu, 20 Jun 2019 09:20:16 -0400 Original-Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:38633) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hdwz3-0008Br-Gw for bug-gnu-emacs@gnu.org; Thu, 20 Jun 2019 09:20:09 -0400 Original-Received: by mail-qk1-x743.google.com with SMTP id a27so1862179qkk.5 for ; Thu, 20 Jun 2019 06:20:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:subject:from:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=GiK1G4bJJOjm17wDh0KfZtz++dQA2n6PHwETFk7ktcQ=; b=SXFhe33aQwxDUMO72dksoWoX+AAM+sK18veP8LBHq86Tlv+MuveXcUsXLGC6XXqVBZ ozd90FpgwG8FxUz+UAcBZE/wL0GxPM7LOwtWleCgjtexcZcFUUzl1KROj202CIT79RMr JOqRPIlTcoA8/4LwwnP6Jvzw2KruPH6wdpy0bTG/OBdCMFS5yIZ+guFlrPxmOkFfbPsY hmp22cizMIVXk/nm3DiX7UezZJw8PHR6QPB9+PHUbuFCPFXqS1FaYDTrjixUcFNgXjsh s8mi091Fbku2+iwG/hRANdqfNpLvei/rJVxtSbDPT1ViXHssrWQwVFzFyC5nuQRL6nPL TXeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:subject:from:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=GiK1G4bJJOjm17wDh0KfZtz++dQA2n6PHwETFk7ktcQ=; b=EiyRsRvsLO75xyo1w7dMRh5fImqkRmzIcivl4OV3MDv2dzDwSADrISlc4+dRpMjpBs +GACywDa8MLQ1pjyT3dY30u4bDTegCRrvJOnofeaaUmhnIuqtYujBxyuBLRyZxOuUG24 WQjR/hvzuFB45tlIvn/gMoHtkNL9OHZLXG80nqDq0wypTxLW8bQVqnb8faPNJPWIfHvU SeqWsJMiP5JN5FJkQF9LlWyPdsjjnUHpG3i/Zt9x46E1nYQiV83hE+hfYzIefwhOasrP F/Ou0DZ4bZJRfC+hIqdPHYgMPhuYE/BVZ4R82AXRTQ/7y/Xk8ZF8/fgNeuANzzhM6XVo zWyg== X-Gm-Message-State: APjAAAUsjHmtnNHIElgZdKWIM6szAH6gcOAoovM9rMNHuBJrWiAT4XAo Nu41PKAsIoTBs20EPanqrZRqzFXJOE0= X-Google-Smtp-Source: APXvYqxhEUsg3FUV9agWBxPEBAau1Vqj+fkk/w2zJDyTfaKc/Va23iV0Lc0UF1k4jhK7MwYk0zxG2A== X-Received: by 2002:a05:620a:5a:: with SMTP id t26mr11181440qkt.201.1561036805779; Thu, 20 Jun 2019 06:20:05 -0700 (PDT) Original-Received: from [10.2.11.6] (ip-99-2-52-196.nyc.us.northamericancoax.com. [196.52.2.99]) by smtp.gmail.com with ESMTPSA id q56sm15837421qtq.64.2019.06.20.06.20.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 06:20:05 -0700 (PDT) Content-Language: pt-BR X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Mailman-Approved-At: Thu, 20 Jun 2019 10:37:12 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:160903 Archived-At: I've been using both 'electric-pair-mode' and 'electric-quote-mode' for some time, and they mostly come in really handy. So they are appreciated. But their interaction still leaves some things to be desired for: in sum, electric-quotes do not behave as other electric-pairs. Thus this report. I don't think I can exhaust all the cases involved in their interaction, but I try to document some specific ones I've identified more precisely. So, in the examples bellow, I'll consider mostly two cases: quote insertion on a left word boundary, and quote insertion on an active region. In them, I use "|" to denote point position and "|foo|" to denote an active region. Steps followed: #+begin_src bash emacs -Q #+end_src Then: #+begin_src emacs-lisp (text-mode) (electric-pair-mode) (electric-quote-mode) (setq electric-pair-inhibit-predicate 'electric-pair-conservative-inhibit) #+end_src With this settings in hand, and in the following situations (as described above): #+begin_example foo |bar baz foo |bar| baz #+end_example If we type ` (one backtick), the result is: #+begin_example foo ‘’bar baz foo ‘bar’ baz #+end_example But the expected result would be: #+begin_example foo ‘bar baz foo ‘bar’ baz #+end_example Well, this is 'expected' as far as I can see. Its worth noting though that it is the same behavior exhibited by inserting " (a double quote), thus independently of electric-quote. That is, the pair is inserted in the left boundary of 'bar' for a double quote. This happens in text-mode, but not in emacs-lisp-mode, code or comments, or in org-mode. The pairing in this position also does not happen for other electric-pair symbols, such as braces, parentheses etc. So I don't really know if I'm missing something, and this is expected behavior of the selected 'electric-pair-inhibit-predicate' in text mode, or if there is something else in play. Now, if we type `` (two backticks), we get: #+begin_example foo “”bar baz foo “”bar’ baz #+end_example But the expected result would be: #+begin_example foo “bar baz foo “bar” baz #+end_example Yet, if we further add 'delete-selection' to the bunch: #+begin_src emacs-lisp (delete-selection-mode) #+end_src If we type ` (one backtick), the result is: #+begin_example foo ‘’bar baz foo ‘’ baz #+end_example And, if we type `` (two backticks), we get: #+begin_example foo “”bar baz foo “” baz #+end_example The expectation here is that results should not be affected by 'delete-selection-mode'. As is the case for other electric-pair pairs. Well, this is the report describing the relevant behavior, that I believe not to be expected. But, beyond that, I'd like to add a related suggestion, which I think is pertinent to the issue at hand. The typing strategy adopted by 'electric-quote-mode' relies on the typing of two keys (' single quote; ` backtick), which have to be typed twice to get to a double curved quote. (True, electric-pair can reduce this typing, but that's independent.) Now, the fact that double curved quotes are inserted by the sequential typing of either key complicates their pairing in the active region case. For, as is expected, after the first (single) quote is inserted, the region is no longer active. There might be ways around this, I don't know. Still, making 'electric-quote-mode' (more) context-sensitive may relieve it of the sequencial key pressing, and help solve this technical difficulty. E.g. on a left word boundary, insert a left curved quote; on a right word boundary, insert a right curved quote, and so on. Of course, the relevant cases would have to be thought through. And, of course, a way to force desired behavior in case context-sensitivity doesn't get it right would also have to be provided. But, in this fashion, 'electric-quote-mode' could rely on a single key-pressing for each kind of quote (' single quote and " double quote seem natural candidates), this would likely streamline curved quotes to behave in similar fashion as their other electric-pair relatives. In my view, it would also improve editing experience. Best regards, Gustavo Barros. In GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-04-19 built on gusbrs-laptop Windowing system distributor 'The X.Org Foundation', version 11.0.11906000 System Description: Linux Mint 19.1 Tessa Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Mark set [2 times] nil t [2 times] electric-pair-conservative-inhibit t Configured using: 'configure --with-mailutils --with-xwidgets --with-modules' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LIBSYSTEMD LCMS2 Important settings: value of $LC_MONETARY: pt_BR.UTF-8 value of $LC_NUMERIC: pt_BR.UTF-8 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Text Minor modes in effect: delete-selection-mode: t electric-pair-mode: t tooltip-mode: t global-eldoc-mode: t electric-quote-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils delsel elec-pair time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting xwidget-internal move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 95028 8687) (symbols 48 20427 2) (miscs 40 57 129) (strings 32 28461 1206) (string-bytes 1 748945) (vectors 16 14089) (vector-slots 8 502824 10466) (floats 8 51 322) (intervals 56 225 0) (buffers 992 11))