all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: HaiJun Zhang <netjune@outlook.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: Need help to debug bugs(#22989, #23412)
Date: Sun, 27 Oct 2019 11:43:49 +0000	[thread overview]
Message-ID: <PS1PR03MB36064B2644910C20479925E8B7670@PS1PR03MB3606.apcprd03.prod.outlook.com> (raw)
In-Reply-To: <83y2x6sluz.fsf@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 --]

  parent reply	other threads:[~2019-10-27 11:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
2019-10-27  7:12     ` HaiJun Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PS1PR03MB36064B2644910C20479925E8B7670@PS1PR03MB3606.apcprd03.prod.outlook.com \
    --to=netjune@outlook.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.