* Need help to debug bugs(#22989, #23412)
[not found] <21859cd7-8e0a-4fe4-952e-b0a94305a573@Spark>
@ 2019-10-27 3:10 ` HaiJun Zhang
2019-10-27 5:23 ` HaiJun Zhang
2019-10-27 5:43 ` Eli Zaretskii
0 siblings, 2 replies; 8+ messages in thread
From: HaiJun Zhang @ 2019-10-27 3:10 UTC (permalink / raw
To: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 977 bytes --]
They are related with the Chinese or Japanese input method on macOS. The bug appeared after this commit: http://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-25.1&id=9e77c1b7bcfd0807be7fe67daf73c2320e864309.
The workaround is setting `redisplay-dont-pause’ to nil. But this variable is obsolete since 24.5.
I think the cause may be like this:
On every char inputting, the input method triggers two events to emacs. The first event causes emacs to redisplay the window with cursor at the original position. The second event causes emacs to redisplay the window with cursor at the new position. The two redisplay make the cursor flicker. The problem is the first redisplay which is not wanted.
If `redisplay-dont-pause’ is t, the first redisplay may be cancelled or merged with the second one?
How to debug this problem? I want to first print the value of the variable `c’ in read_char() in keybord.c. Its type is Lisp_Object. How to print its value?
[-- Attachment #2: Type: text/html, Size: 2537 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Need help to debug bugs(#22989, #23412)
2019-10-27 3:10 ` Need help to debug bugs(#22989, #23412) HaiJun Zhang
@ 2019-10-27 5:23 ` HaiJun Zhang
2019-10-27 5:43 ` Eli Zaretskii
1 sibling, 0 replies; 8+ messages in thread
From: HaiJun Zhang @ 2019-10-27 5:23 UTC (permalink / raw
To: Emacs developers
[-- Attachment #1.1: Type: text/plain, Size: 1471 bytes --]
Now I describe the problem with the attachment picture.
There are two red arrows in the picture. The left one is the original position. The right one is the new position. And the cursor is at the right one.
After input another char, the cursor first goes to the left arrow position, and then quickly goes to the right arrow position, which makes the flicker.
[cid:DC9C37FA7C0B4BDFAECDF6E4B950D182]
在 2019年10月27日 +0800 AM11:11,HaiJun Zhang <netjune@outlook.com>,写道:
They are related with the Chinese or Japanese input method on macOS. The bug appeared after this commit: http://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-25.1&id=9e77c1b7bcfd0807be7fe67daf73c2320e864309.
The workaround is setting `redisplay-dont-pause’ to nil. But this variable is obsolete since 24.5.
I think the cause may be like this:
On every char inputting, the input method triggers two events to emacs. The first event causes emacs to redisplay the window with cursor at the original position. The second event causes emacs to redisplay the window with cursor at the new position. The two redisplay make the cursor flicker. The problem is the first redisplay which is not wanted.
If `redisplay-dont-pause’ is t, the first redisplay may be cancelled or merged with the second one?
How to debug this problem? I want to first print the value of the variable `c’ in read_char() in keybord.c. Its type is Lisp_Object. How to print its value?
[-- Attachment #1.2: Type: text/html, Size: 3449 bytes --]
[-- Attachment #2: Pasted Graphic.tiff --]
[-- Type: image/tiff, Size: 134506 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Need help to debug bugs(#22989, #23412)
2019-10-27 3:10 ` Need help to debug bugs(#22989, #23412) HaiJun Zhang
2019-10-27 5:23 ` HaiJun Zhang
@ 2019-10-27 5:43 ` Eli Zaretskii
2019-10-27 7:00 ` HaiJun Zhang
2019-10-27 7:12 ` HaiJun Zhang
1 sibling, 2 replies; 8+ messages in thread
From: Eli Zaretskii @ 2019-10-27 5:43 UTC (permalink / raw
To: HaiJun Zhang; +Cc: emacs-devel
> From: HaiJun Zhang <netjune@outlook.com>
> Date: Sun, 27 Oct 2019 03:10:56 +0000
>
> They are related with the Chinese or Japanese input method on macOS. The bug appeared after this
> commit:
> http://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-25.1&id=9e77c1b7bcfd0807be7fe67daf73c2320e864309.
>
>
> The workaround is setting `redisplay-dont-pause’ to nil. But this variable is obsolete since 24.5.
If your analysis is correct, then maybe input methods (or their users,
if you mean a non-Emacs input method) should set redisplay-dont-pause
nil, and we should un-obsolete that variable.
But the question is: do both events you mention arrive with any time
interval between them, or do they arrive together? IOW, the issue is
about timing, not about the number of events.
> I think the cause may be like this:
> On every char inputting, the input method triggers two events to emacs. The first event causes emacs to
> redisplay the window with cursor at the original position. The second event causes emacs to redisplay the
> window with cursor at the new position. The two redisplay make the cursor flicker. The problem is the first
> redisplay which is not wanted.
>
> If `redisplay-dont-pause’ is t, the first redisplay may be cancelled or merged with the second one?
>
> How to debug this problem? I want to first print the value of the variable `c’ in read_char() in keybord.c. Its type
> is Lisp_Object. How to print its value?
You mean, print in C? You can use the safe_debug_print function.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Need help to debug bugs(#22989, #23412)
2019-10-27 5:43 ` Eli Zaretskii
@ 2019-10-27 7:00 ` HaiJun Zhang
2019-10-27 7:12 ` Eli Zaretskii
2019-10-27 7:12 ` HaiJun Zhang
1 sibling, 1 reply; 8+ messages in thread
From: HaiJun Zhang @ 2019-10-27 7:00 UTC (permalink / raw
To: Eli Zaretskii; +Cc: emacs-devel@gnu.org
[-- Attachment #1: Type: text/plain, Size: 975 bytes --]
在 2019年10月27日 +0800 PM1:43,Eli Zaretskii <eliz@gnu.org>,写道:
If your analysis is correct, then maybe input methods (or their users,
if you mean a non-Emacs input method) should set redisplay-dont-pause
nil, and we should un-obsolete that variable.
Yes, non-Emacs input method.
Setting redisplay-dont-pause to t causes other problem for emacs after 26.2, which is worse than this one.
See https://lists.gnu.org/archive/html/emacs-devel/2019-01/msg00495.html
But the question is: do both events you mention arrive with any time
interval between them, or do they arrive together? IOW, the issue is
about timing, not about the number of events.
Yes, agreed.
Maybe the first redisplay is interrupted by the second event when redisplay-dont-pause is nil. And the result of the first redisplay doesn’t show on screen. So no flicker. It is just my guess.
You mean, print in C? You can use the safe_debug_print function.
Yes. Thanks.
[-- Attachment #2: Type: text/html, Size: 1981 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Need help to debug bugs(#22989, #23412)
2019-10-27 7:00 ` HaiJun Zhang
@ 2019-10-27 7:12 ` Eli Zaretskii
2019-10-27 8:39 ` HaiJun Zhang
2019-10-27 11:43 ` HaiJun Zhang
0 siblings, 2 replies; 8+ messages in thread
From: Eli Zaretskii @ 2019-10-27 7:12 UTC (permalink / raw
To: HaiJun Zhang; +Cc: emacs-devel
> From: HaiJun Zhang <netjune@outlook.com>
> CC: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
> Date: Sun, 27 Oct 2019 07:00:04 +0000
>
> Setting redisplay-dont-pause to t causes other problem for emacs after 26.2, which is worse than this one.
> See https://lists.gnu.org/archive/html/emacs-devel/2019-01/msg00495.html
Sounds like all of this is specific to NS. So maybe the solution
should also be specific to NS, like maybe the change that you say
started all this should be disable on NS.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Need help to debug bugs(#22989, #23412)
2019-10-27 5:43 ` Eli Zaretskii
2019-10-27 7:00 ` HaiJun Zhang
@ 2019-10-27 7:12 ` HaiJun Zhang
1 sibling, 0 replies; 8+ messages in thread
From: HaiJun Zhang @ 2019-10-27 7:12 UTC (permalink / raw
To: Eli Zaretskii; +Cc: emacs-devel@gnu.org
[-- Attachment #1: Type: text/plain, Size: 459 bytes --]
在 2019年10月27日 +0800 PM1:43,Eli Zaretskii <eliz@gnu.org>,写道:
But the question is: do both events you mention arrive with any time
interval between them, or do they arrive together? IOW, the issue is
about timing, not about the number of events.
I guess that the two events arrive with very small time interval or together. They are processed by emacs one by one, and cause emacs to redisplay twice when redisplay-dont-pause is t.
[-- Attachment #2: Type: text/html, Size: 903 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Need help to debug bugs(#22989, #23412)
2019-10-27 7:12 ` Eli Zaretskii
@ 2019-10-27 8:39 ` HaiJun Zhang
2019-10-27 11:43 ` HaiJun Zhang
1 sibling, 0 replies; 8+ messages in thread
From: HaiJun Zhang @ 2019-10-27 8:39 UTC (permalink / raw
To: Eli Zaretskii; +Cc: emacs-devel@gnu.org
[-- Attachment #1: Type: text/plain, Size: 699 bytes --]
在 2019年10月27日 +0800 PM3:12,Eli Zaretskii <eliz@gnu.org>,写道:
From: HaiJun Zhang <netjune@outlook.com>
CC: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Date: Sun, 27 Oct 2019 07:00:04 +0000
Setting redisplay-dont-pause to t causes other problem for emacs after 26.2, which is worse than this one.
See https://lists.gnu.org/archive/html/emacs-devel/2019-01/msg00495.html
Sounds like all of this is specific to NS. So maybe the solution
should also be specific to NS, like maybe the change that you say
started all this should be disable on NS.
Yes. All these problems only happen on macOS. Then it is hard for me to debug. I’m not familiar with NS development.
[-- Attachment #2: Type: text/html, Size: 1376 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Need help to debug bugs(#22989, #23412)
2019-10-27 7:12 ` Eli Zaretskii
2019-10-27 8:39 ` HaiJun Zhang
@ 2019-10-27 11:43 ` HaiJun Zhang
1 sibling, 0 replies; 8+ messages in thread
From: HaiJun Zhang @ 2019-10-27 11:43 UTC (permalink / raw
To: Eli Zaretskii; +Cc: emacs-devel@gnu.org
[-- Attachment #1: Type: text/plain, Size: 2525 bytes --]
After some debugging work, I think I find the cause.
When the input method is active, every char inputting triggers two events to emacs.
The first one is ‘(ns-unput-working-text), which will finally executes the lisp command ns-unput-working-text, which clears the current working text in buffer.
The second is ‘(ns-put-working-text), which will finally excutes the lisp command ns-put-working-text, which insert the new working text into the buffer.
PS: The working text is the tip chars of the input method. It is not the finally input content. It is the intermediate content of the user input.
The above two operations cause the flicker.
The resolution:
Don’t redisplay on the first event. Is it possible to disable redisplay for a command?
A workaround:
Because ns-put-working-text can also clear the old working text. So in ns-unput-working-text, we can clear the working text only when really needed and give the other work to ns-put-working-text.
I modified the ns-unput-working-text. And it works.
(defun ns-unput-working-text ()
(interactive)
(cond
((and (overlayp ns-working-overlay)
;; Still alive?
(overlay-buffer ns-working-overlay))
(with-current-buffer (overlay-buffer ns-working-overlay)
(let ((text (buffer-substring-no-properties
(overlay-start ns-working-overlay)
(overlay-end ns-working-overlay))))
(when (equal text ns-working-text)
(delete-region (overlay-start ns-working-overlay)
(overlay-end ns-working-overlay))
(delete-overlay ns-working-overlay)
(setq ns-working-overlay nil)))))
((integerp ns-working-overlay)
(let* ((msg (current-message))
(text (substring msg (- (length msg) ns-working-overlay)))
message-log-max)
(when (equal text ns-working-text)
(setq msg (substring msg 0 (- (length msg) ns-working-overlay)))
(message “%s” msg)
(setq ns-working-overlay nil))))))
在 2019年10月27日 +0800 PM3:12,Eli Zaretskii <eliz@gnu.org>,写道:
From: HaiJun Zhang <netjune@outlook.com>
CC: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Date: Sun, 27 Oct 2019 07:00:04 +0000
Setting redisplay-dont-pause to t causes other problem for emacs after 26.2, which is worse than this one.
See https://lists.gnu.org/archive/html/emacs-devel/2019-01/msg00495.html
Sounds like all of this is specific to NS. So maybe the solution
should also be specific to NS, like maybe the change that you say
started all this should be disable on NS.
[-- Attachment #2: Type: text/html, Size: 4504 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2019-10-27 11:43 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <21859cd7-8e0a-4fe4-952e-b0a94305a573@Spark>
2019-10-27 3:10 ` Need help to debug bugs(#22989, #23412) HaiJun Zhang
2019-10-27 5:23 ` HaiJun Zhang
2019-10-27 5:43 ` Eli Zaretskii
2019-10-27 7:00 ` HaiJun Zhang
2019-10-27 7:12 ` Eli Zaretskii
2019-10-27 8:39 ` HaiJun Zhang
2019-10-27 11:43 ` HaiJun Zhang
2019-10-27 7:12 ` HaiJun Zhang
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.