|
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.
;; 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’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.
[Prev in Thread] | Current Thread | [Next in Thread] |