[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Redisplay: NS port, high CPU load

From: Anders Lindgren
Subject: Re: Redisplay: NS port, high CPU load
Date: Thu, 9 Jun 2016 20:52:44 +0200

> 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’s the `insert’ 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))

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

I don’t understand this pre-write-conversion function.  According to the documentation of   `define-coding-system’, why would it make a new buffer and switch to it?

> VALUE must be a function to call after all functions in
> ‘write-region-annotate-functions’ and ‘buffer-file-format’ 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))

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

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

* Completion: If a directory contains files like "åäö.txt" and "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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]