From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Anders Lindgren Newsgroups: gmane.emacs.devel Subject: Re: Redisplay: NS port, high CPU load Date: Thu, 9 Jun 2016 20:52:44 +0200 Message-ID: References: <9793F9E3-979A-4888-8662-F6E0C27C8B37@gmail.com> <20160608195552.GA66865@breton.holly.idiocy.org> <7B0CAF99-689D-4128-8E33-7D9BA8F1823E@gmail.com> <41E503B6-5048-4E20-92CE-1FAD4C05A279@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a114b4642708f5c0534dcedcf X-Trace: ger.gmane.org 1465498472 20128 80.91.229.3 (9 Jun 2016 18:54:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 9 Jun 2016 18:54:32 +0000 (UTC) Cc: Alan Third , Emacs-Devel devel To: David Reitter Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 09 20:54:30 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bB55w-0006uZ-ED for ged-emacs-devel@m.gmane.org; Thu, 09 Jun 2016 20:54:20 +0200 Original-Received: from localhost ([::1]:36496 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bB55v-0000kp-GO for ged-emacs-devel@m.gmane.org; Thu, 09 Jun 2016 14:54:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bB54R-0008Hk-Tk for emacs-devel@gnu.org; Thu, 09 Jun 2016 14:52:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bB54P-00028R-CO for emacs-devel@gnu.org; Thu, 09 Jun 2016 14:52:46 -0400 Original-Received: from mail-vk0-x234.google.com ([2607:f8b0:400c:c05::234]:34332) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bB54P-00028C-5A for emacs-devel@gnu.org; Thu, 09 Jun 2016 14:52:45 -0400 Original-Received: by mail-vk0-x234.google.com with SMTP id e4so67782014vkb.1 for ; Thu, 09 Jun 2016 11:52:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=FOC4cH/+dhKi5ebQWBq4gmWpXwnhSlrv7jlSUYr6xnk=; b=fbjJ5RvJ0XguSebnzt/H3aA+V9TkkXeT+3XXuSD6zEQmTIESgoPHrjGV6OYRqSN+Aj rR6MTo5FqJ5unoyTw+fdJUMMCSl94KD1VMqMIeYdzPkrvWok+PhHIzO56RPcQRPCQ+mA UZ6EyGOey05cugJoV9BRkAstXBO3OHvdnPaWIEdo+kx3p1Yy2Bn5QNsncdMWlzlx6bHb aZKsCc1/wTZrQPWtGqulGWg+/bHMT5p6QbSw2fP2eeeySpYPzMIh25sGb9UYd04qgWx9 Ylvv9XarSI7thJKWhdLkJ6kFnkukhdeuL52dd5Khx0q5cGsC+a7Wafg37kLiezaH7rAt FPDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=FOC4cH/+dhKi5ebQWBq4gmWpXwnhSlrv7jlSUYr6xnk=; b=KVWA+aL7oQaWwC8lRQv6mDnKi+uP0oXUt9Pj9/wfFtjyu6arB+0a2Uzfm1NTe1sy3E Dok+hUuKVLFN5FLj0o1u/p50YhHjnISKApkDkvfzzuYTIjsNfbNK+7+5fEn488HDvFZU Cv26foMuHjo6Wq3d1WrdTwK4uDWpWRu8X0tNFuareyTY5YPRzyCfiPtTzFsqGBmhOuQE LLA7gqf0EsEfMt+CE5oaej5v7mAgu94S/OFH7PRmXVfwJaLF3Y9l/AGYIsEZVSqFjOd/ 0ElavzVLl0o/1DDHbyOFJPWQZ1Gyux+cFKrMXj9J/yo40uQRQaBMgM+8TDg64v57hF2/ lKeA== X-Gm-Message-State: ALyK8tLGJ8aNuH6+eTPwpZzpl3HuwO7KKmVVIIvQN2SocPqJkote+35Q1CWneQ4P1q8hSrw443YquTIfwORa4Q== X-Received: by 10.159.41.196 with SMTP id s62mr5500306uas.47.1465498364578; Thu, 09 Jun 2016 11:52:44 -0700 (PDT) Original-Received: by 10.31.216.195 with HTTP; Thu, 9 Jun 2016 11:52:44 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400c:c05::234 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:204258 Archived-At: --001a114b4642708f5c0534dcedcf Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable > > > Try to clear out one of :post-read-conversion and :pre-write-conversion > to see which of the two is the culprit. (While you're at it, try to clear > out both first just to make sure we're barking up the right tree.) > > Bingo. I had a look at the function and it=E2=80=99s the `insert=E2=80= =99 into the > temporary buffer that is causing this. > Great news! > ;; Pre-write conversion for `utf-8-hfs'. > (defun ucs-normalize-hfs-nfd-pre-write-conversion (from to) > (let ((old-buf (current-buffer))) > (set-buffer (generate-new-buffer " *temp*")) > (if (stringp from) > (insert from) > (insert-buffer-substring old-buf from to)) > (ucs-normalize-HFS-NFD-region (point-min) (point-max)) > nil)) > > > old-buf here is *code-conversion-work*. > > I don=E2=80=99t understand this pre-write-conversion function. According= to the > documentation of `define-coding-system=E2=80=99, why would it make a ne= w buffer > and switch to it? > > > VALUE must be a function to call after all functions in > > =E2=80=98write-region-annotate-functions=E2=80=99 and =E2=80=98buffer-f= ile-format=E2=80=99 are > > called, and before the text is encoded by the coding system > > itself. This function should convert the whole text in the > > current buffer. For backward compatibility, this function is > > passed two arguments which can be ignored. > > It looks like this function needs to be modernized. (In my december rewrite I simply started using it, assuming that it was fully functional.) Given the documentation, it *should* be enough to implement it like this (with a big reservation -- this is all new to me): (defun ucs-normalize-hfs-nfd-pre-write-conversion (from to) (ucs-normalize-HFS-NFD-region (point-min) (point-max)) nil) If I remember correctly, the rewrite tried to correct two problems: * When deleting a character like "=C3=A4" (which in the HFS file system is decomposed into "a" and "=C2=A8") the full character should be deleted. Ear= lier, when pressing backspace, "=C3=A4" was converted to an "a". * Completion: If a directory contains files like "=C3=A5=C3=A4=C3=B6.txt" a= nd "aao.txt", Emacs used to say that "a" was the common start to both sequences. See the discussion in bug 22169 for more information. -- Anders --001a114b4642708f5c0534dcedcf Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
> Try to clear out one of :post-read-conversion and := pre-write-conversion to see which of the two is the culprit. (While you'= ;re at it, try to clear out both first just to make sure we're barking = up the right tree.)

Bingo.=C2=A0 I had a look at the function and it=E2=80=99s the `inse= rt=E2=80=99 into the temporary buffer that is causing this.

Great news!
=C2=A0
;; = Pre-write conversion for `utf-8-hfs'.
(defun ucs-normalize-hfs-nfd-pre-write-conversion (from to)
=C2=A0 (let ((old-buf (current-buffer)))
=C2=A0 =C2=A0 (set-buffer (generate-new-buffer " *temp*"))
=C2=A0 =C2=A0 (if (stringp from)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (insert from)
=C2=A0 =C2=A0 =C2=A0 (insert-buffer-substring old-buf from to))
=C2=A0 =C2=A0 (ucs-normalize-HFS-NFD-region (point-min) (point-max))
=C2=A0 =C2=A0 nil))


old-buf here is *code-conversion-work*.

I don=E2=80=99t understand this pre-write-conversion function.=C2=A0 Accord= ing to the documentation of=C2=A0 =C2=A0`define-coding-system=E2=80=99, why= would it make a new buffer and switch to it?

> VALUE must be a function to call after all functions in
> =E2=80=98write-region-annotate-functions=E2=80=99 and =E2=80=98buffer-= file-format=E2=80=99 are
> called, and before the text is encoded by the coding system
> itself.=C2=A0 This function should convert the whole text in the
> current buffer.=C2=A0 For backward compatibility, this function is
> passed two arguments which can be ignored.


It looks like this function needs to b= e modernized. (In my december rewrite I simply started using it, assuming t= hat it was fully functional.) Given the documentation, it *should* be enoug= h to implement it like this (with a big reservation -- this is all new to m= e):

(defun ucs-normalize-hfs-nfd-pre-write-conversion (= from to)
=C2=A0 (ucs-normalize-HFS-NFD-region (point-min) (point-max))=C2=A0 nil)

If I remember correctly, the rewrite = tried to correct two problems:

* When deleting a character like "=C3=A4"= ; (which in the HFS file system is decomposed into "a" and "= =C2=A8") the full character should be deleted. Earlier, when pressing = backspace, "=C3=A4" was converted to an "a".

* Completion: If= a directory contains files like "=C3=A5=C3=A4=C3=B6.txt" and &qu= ot;aao.txt", Emacs used to say that "a" was the common start= to both sequences.

See the discussion in bug 22169 for more information.

=C2=A0 =C2=A0= -- Anders

--001a114b4642708f5c0534dcedcf--