all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#68995: [PATCH] 30.0.50; electric-pair-mode and read-char-from-minibuffer
@ 2024-02-08 22:52 Paul Nelson
  2024-02-09  6:47 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Nelson @ 2024-02-08 22:52 UTC (permalink / raw)
  To: 68995

[-- Attachment #1: Type: text/plain, Size: 3867 bytes --]

Steps to reproduce:

1. Emacs -Q
2. M-x electric-pair-mode
3. M-: (read-char-from-minibuffer "test: ")
4. Hit "(".

The minibuffer then reads "()"; to get "(" accepted, we need to backspace.

If we instead hit ")", then we get the error "No matching parenthesis found".

I noticed this bug because it complicates using zap-to-char with
electric-pair-mode.

The bug was introduced in 68dd520e39eccb1be9366add1e3298318e5010de, in
response to https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65805.  In
that commit, the line that remaps self-insert-command was commented.
Uncommenting that line fixes the issue.



In GNU Emacs 30.0.50 (build 1, aarch64-apple-darwin23.2.0, NS
 appkit-2487.30 Version 14.2.1 (Build 23C71)) of 2024-01-24 built on
 d51735
Repository revision: 87cf30fba37346a179c6307a29d5d39b39311cef
Repository branch: HEAD
Windowing system distributor 'Apple', version 10.3.2487
System Description:  macOS 14.2.1

Configured using:
 'configure --with-ns --with-native-compilation --with-tree-sitter
 --with-gif --with-png --with-jpeg --with-rsvg --with-tiff
 --with-imagemagick --with-x-toolkit=gtk3 --with-xwidgets'

Configured features:
ACL DBUS GLIB GNUTLS IMAGEMAGICK JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP XIM XWIDGETS ZLIB

Important settings:
  value of $LC_CTYPE: UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  electric-pair-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-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
  minibuffer-regexp-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr cl-extra pp cl-print byte-opt gv thingatpt
help-fns radix-tree help-mode compile comint ansi-osc ansi-color ring
comp-run bytecomp byte-compile comp-common rx emacsbug message mailcap
yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache
epa derived epg rfc6068 epg-config gnus-util text-property-search
time-date subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils cus-start cus-load
elec-pair rmc iso-transl tooltip cconv eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win
ucs-normalize mule-util term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine 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 emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads xwidget-internal dbusbind
kqueue cocoa ns lcms2 multi-tty make-network-process native-compile
emacs)

Memory information:
((conses 16 87854 21088) (symbols 48 7973 0) (strings 32 22998 2949)
 (string-bytes 1 674716) (vectors 16 12730)
 (vector-slots 8 172844 9781) (floats 8 27 14) (intervals 56 293 0)
 (buffers 984 13))

[-- Attachment #2: 0001-Revert-remap-self-insert-command-in-read-char-from-m.patch --]
[-- Type: application/octet-stream, Size: 947 bytes --]

From b0403e90765d52a6b859ac92e16b018fcfd9778c Mon Sep 17 00:00:00 2001
From: Paul Nelson <ultrono@gmail.com>
Date: Sun, 4 Feb 2024 06:22:55 -0800
Subject: [PATCH] Revert "remap self-insert-command" in
 read-char-from-minibuffer-map

---
 lisp/subr.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index 33de100870e..5b377bb4ea7 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3629,7 +3629,7 @@ read-char-from-minibuffer-map
   (let ((map (make-sparse-keymap)))
     (set-keymap-parent map minibuffer-local-map)
 
-    ;; (define-key map [remap self-insert-command] #'read-char-from-minibuffer-insert-char)
+    (define-key map [remap self-insert-command] #'read-char-from-minibuffer-insert-char)
     (define-key map [remap exit-minibuffer] #'read-char-from-minibuffer-insert-other)
 
     (define-key map [remap recenter-top-bottom] #'minibuffer-recenter-top-bottom)
-- 
2.39.3 (Apple Git-145)


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#68995: [PATCH] 30.0.50; electric-pair-mode and read-char-from-minibuffer
  2024-02-08 22:52 bug#68995: [PATCH] 30.0.50; electric-pair-mode and read-char-from-minibuffer Paul Nelson
@ 2024-02-09  6:47 ` Eli Zaretskii
  2024-02-09 19:10   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2024-02-09  6:47 UTC (permalink / raw)
  To: Paul Nelson, Stefan Monnier; +Cc: 68995

> From: Paul Nelson <ultrono@gmail.com>
> Date: Thu, 8 Feb 2024 23:52:50 +0100
> 
> Steps to reproduce:
> 
> 1. Emacs -Q
> 2. M-x electric-pair-mode
> 3. M-: (read-char-from-minibuffer "test: ")
> 4. Hit "(".
> 
> The minibuffer then reads "()"; to get "(" accepted, we need to backspace.
> 
> If we instead hit ")", then we get the error "No matching parenthesis found".
> 
> I noticed this bug because it complicates using zap-to-char with
> electric-pair-mode.
> 
> The bug was introduced in 68dd520e39eccb1be9366add1e3298318e5010de, in
> response to https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65805.  In
> that commit, the line that remaps self-insert-command was commented.
> Uncommenting that line fixes the issue.

Adding Stefan who made the offending commit.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#68995: [PATCH] 30.0.50; electric-pair-mode and read-char-from-minibuffer
  2024-02-09  6:47 ` Eli Zaretskii
@ 2024-02-09 19:10   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-02-09 19:49     ` Paul Nelson
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-02-09 19:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 68995, Paul Nelson

Eli Zaretskii [2024-02-09 08:47:57] wrote:

>> From: Paul Nelson <ultrono@gmail.com>
>> Date: Thu, 8 Feb 2024 23:52:50 +0100
>> 
>> Steps to reproduce:
>> 
>> 1. Emacs -Q
>> 2. M-x electric-pair-mode
>> 3. M-: (read-char-from-minibuffer "test: ")
>> 4. Hit "(".
>> 
>> The minibuffer then reads "()"; to get "(" accepted, we need to backspace.
>> 
>> If we instead hit ")", then we get the error "No matching parenthesis found".
>> 
>> I noticed this bug because it complicates using zap-to-char with
>> electric-pair-mode.
>> 
>> The bug was introduced in 68dd520e39eccb1be9366add1e3298318e5010de, in
>> response to https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65805.  In
>> that commit, the line that remaps self-insert-command was commented.
>> Uncommenting that line fixes the issue.
>
> Adding Stefan who made the offending commit.

I pushed the patch below which should fix both problems.


        Stefan


diff --git a/lisp/subr.el b/lisp/subr.el
index e53ef505522..9e92a4c457f 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3726,11 +3723,11 @@ read-char-from-minibuffer
          (this-command this-command)
          (result (minibuffer-with-setup-hook
 		     (lambda ()
+		       (setq-local post-self-insert-hook nil)
 		       (add-hook 'post-command-hook
 				 (lambda ()
-				   ;; FIXME: Should we use `<='?
-				   (if (= (1+ (minibuffer-prompt-end))
-					  (point-max))
+				   (if (<= (1+ (minibuffer-prompt-end))
+					   (point-max))
                                        (exit-minibuffer)))
 				 nil 'local))
                    ;; Disable text conversion if it is enabled.






^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#68995: [PATCH] 30.0.50; electric-pair-mode and read-char-from-minibuffer
  2024-02-09 19:10   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-02-09 19:49     ` Paul Nelson
  2024-02-09 20:13       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Nelson @ 2024-02-09 19:49 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, 68995

Thanks, works on my end.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#68995: [PATCH] 30.0.50; electric-pair-mode and read-char-from-minibuffer
  2024-02-09 19:49     ` Paul Nelson
@ 2024-02-09 20:13       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-02-09 20:13 UTC (permalink / raw)
  To: Paul Nelson; +Cc: Eli Zaretskii, 68995-done

> Thanks, works on my end.

Thank you for confirming,
Closing,


        Stefan






^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-09 20:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-08 22:52 bug#68995: [PATCH] 30.0.50; electric-pair-mode and read-char-from-minibuffer Paul Nelson
2024-02-09  6:47 ` Eli Zaretskii
2024-02-09 19:10   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-09 19:49     ` Paul Nelson
2024-02-09 20:13       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.