每个输入前都会自动加一个字符,有没有人遇到过?

肯定可以的。

BTW,这个问题昨天在 master 分支已经修了,emacs-plus 用户直接 brew install emacs-plus@29 就好。

5 个赞

也就是说不用 patch 啦?好,我这就再编译一遍(

必须大赞,坛子里藏龙卧虎啊 :+1:

感谢大佬,这就重新编译。

大赞,我今天也重新编译了 emacs-plus@29。

现在如果编译 28 应该打哪个补丁?

1

2

3

老bug了,说是升级至emacs29就好了

From 47b377f64bef8c3da519b3aa9c5c90b7199ba524 Mon Sep 17 00:00:00 2001
From: Po Lu <[email protected]>
Date: Sun, 13 Nov 2022 09:03:51 +0800
Subject: [PATCH] Prevent non-local exits from ns-in-echo-area

* src/nsterm.m (ns_in_echo_area_1):
(ns_in_echo_area_2):
(ns_in_echo_area): New functions.
([EmacsView firstRectForCharacterRange:]): Call them instead.
(syms_of_nsterm): New defsym.
---
 src/nsterm.m | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index 17f40dc7e37..507f2a9e7da 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -7056,6 +7056,36 @@ - (void)unmarkText
   processingCompose = NO;
 }
 
+static Lisp_Object
+ns_in_echo_area_1 (void *ptr)
+{
+  Lisp_Object in_echo_area;
+  specpdl_ref count;
+
+  count = SPECPDL_INDEX ();
+  specbind (Qinhibit_quit, Qt);
+  in_echo_area = safe_call (1, Qns_in_echo_area);
+
+  return unbind_to (count, in_echo_area);
+}
+
+static Lisp_Object
+ns_in_echo_area_2 (enum nonlocal_exit exit, Lisp_Object error)
+{
+  return Qnil;
+}
+
+static bool
+ns_in_echo_area (void)
+{
+  Lisp_Object in_echo_area;
+
+  in_echo_area
+    = internal_catch_all (ns_in_echo_area_1, NULL,
+			  ns_in_echo_area_2);
+
+  return !NILP (in_echo_area);
+}
 
 /* Used to position char selection windows, etc.  */
 - (NSRect)firstRectForCharacterRange: (NSRange)theRange
@@ -7069,7 +7099,7 @@ - (NSRect)firstRectForCharacterRange: (NSRange)theRange
   if (NS_KEYLOG)
     NSLog (@"firstRectForCharRange request");
 
-  if (WINDOWP (echo_area_window) && ! NILP (call0 (intern ("ns-in-echo-area"))))
+  if (WINDOWP (echo_area_window) && ns_in_echo_area ())
     win = XWINDOW (echo_area_window);
   else
     win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
@@ -11012,6 +11042,7 @@ Nil means use fullscreen the old (< 10.7) way.  The old way works better with
   DEFSYM (Qcondensed, "condensed");
   DEFSYM (Qreverse_italic, "reverse-italic");
   DEFSYM (Qexpanded, "expanded");
+  DEFSYM (Qns_in_echo_area, "ns-in-echo-area");
 
 #ifdef NS_IMPL_COCOA
   Fprovide (Qcocoa, Qnil);
-- 
2.41.0

无论你的 fix-ghost-key-v4.patch 还是 polu 的补丁都无法直接应用到 emacs-28.2。需要手动添加最后一行修改。

polu 的补丁打完之后编译失败,显示新添加的函数参数类型错误之类的,我没有细看,然后用了你的 v4 补丁。


我现在用的是 polu 的不定。

先前打补丁的过程出了点问题,实际上不管用哪个不定都需要修改:

- +  specpdl_ref count;
+ +  ptrdiff_t count;

28.2 里没有定义 specpdl_ref