From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.devel Subject: undo bug? Date: Tue, 01 Apr 2008 20:06:46 +0900 Organization: Emacsen advocacy group Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1207048033 18997 80.91.229.12 (1 Apr 2008 11:07:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Apr 2008 11:07:13 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 01 13:07:45 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JgeLA-00084X-0y for ged-emacs-devel@m.gmane.org; Tue, 01 Apr 2008 13:07:44 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JgeKY-0008IM-0e for ged-emacs-devel@m.gmane.org; Tue, 01 Apr 2008 07:07:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JgeKT-0008Hw-2D for emacs-devel@gnu.org; Tue, 01 Apr 2008 07:07:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JgeKS-0008Hk-89 for emacs-devel@gnu.org; Tue, 01 Apr 2008 07:07:00 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JgeKS-0008Hh-3m for emacs-devel@gnu.org; Tue, 01 Apr 2008 07:07:00 -0400 Original-Received: from orlando.hostforweb.net ([216.246.45.90]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JgeKR-0002zR-E2 for emacs-devel@gnu.org; Tue, 01 Apr 2008 07:06:59 -0400 Original-Received: from [66.225.201.151] (port=37885 helo=mail.jpl.org) by orlando.hostforweb.net with esmtpa (Exim 4.68) (envelope-from ) id 1JgeKN-00076c-R4 for emacs-devel@gnu.org; Tue, 01 Apr 2008 06:06:56 -0500 X-Hashcash: 1:20:080401:emacs-devel@gnu.org::h/TzkfzR90Tf1vhG:0000000000000000000000000000000000000000001n9A X-Face: #kKnN,xUnmKia.'[pp`; Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu; B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:kRXx+31+6Au0Bu7PYG1WUwgLqQo= X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - orlando.hostforweb.net X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:94103 Archived-At: Hi, I use egg[1] for writing Japanese text in Emacs buffers and have a problem that the point jumps to an improper position when performing `undo' after writing Japanese text. This happens with Emacs 22.1 and newer. The following functions emulate what egg does when writing Japanese text in order to reproduce the problem. The scene it expresses is that I enter the ascii character `a' within the fence (i.e. |...|) and convert it into the Japanese character `A'. Could you try evaluating those Lisp forms, and performing `M-x x1', `M-x x2', and `M-x undo'? You will see that the point does not stay at the position where there was the Japanese character `A'. --8<---------------cut here---------------start------------->8--- (defun x1 () (interactive) (funcall (if (and (get-buffer "*testing*") (prog1 (string-equal (buffer-name) "*testing*") (kill-buffer "*testing*"))) #'switch-to-buffer #'pop-to-buffer) (generate-new-buffer "*testing*")) (text-mode) (use-local-map (copy-keymap (current-local-map))) (local-set-key "\C-m" 'x3) (insert "12345678") (goto-char 3)) (defun x2 () (interactive) (insert "|a|") (sit-for 1) (setq unread-command-events '(?\C-m))) (defun x3 () (interactive) (delete-backward-char 3) (setq buffer-undo-list nil) (insert "A") (message "%s" buffer-undo-list)) --8<---------------cut here---------------end--------------->8--- Before performing `undo', `buffer-undo-list' has the value `(nil (3 . 4) 6)', which means that `undo' will delete the thing existing in the area (3 . 4) and move the point to 6. Where does `6' come from? I'm not sure of it but it might be due to the way to run the interactive command `x3'. I.e., it is done by setting `unread-command-events' to the key which is bound to the `x3' command. It doesn't happen in Emacs 21 and 20 anyway. Now I use the following workaround just after inserting Japanese text in order to remove `6' from `buffer-undo-list'. But nothing can be better than not using such one. Could anyone look into it? (if (car buffer-undo-list) (if (numberp (cadr buffer-undo-list)) (setcdr buffer-undo-list (nthcdr 2 buffer-undo-list))) (if (numberp (nth 2 buffer-undo-list)) (setcdr (cdr buffer-undo-list) (nthcdr 3 buffer-undo-list)))) Thanks in advance. Regards, [1] Egg v3 was first developed in 1988 for Nemacs, which was the enhanced version of Emacs 18 so as to be able to handle Japanese text. It still survives as Emcws, sj3-egg, wnn7egg, and the egg-its XEmacs package.