From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Lars Hansen Newsgroups: gmane.emacs.devel Subject: Re: [BUG] widget-field-overlay becomes wrong Date: Sun, 04 Jul 2004 11:47:37 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <40E7D239.3040403@math.ku.dk> References: <40E28BE8.4030300@math.ku.dk> <40E46F50.5080204@math.ku.dk> <40E4FA8B.9070602@math.ku.dk> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090802030804060706030609" X-Trace: sea.gmane.org 1088934851 12793 80.91.224.253 (4 Jul 2004 09:54:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 4 Jul 2004 09:54:11 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun Jul 04 11:54:02 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Bh3hC-0004HF-00 for ; Sun, 04 Jul 2004 11:54:02 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1Bh3hC-0001EB-00 for ; Sun, 04 Jul 2004 11:54:02 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bh3j6-0006K0-VN for emacs-devel@quimby.gnus.org; Sun, 04 Jul 2004 05:56:01 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1Bh3j4-0006JN-Lg for emacs-devel@gnu.org; Sun, 04 Jul 2004 05:55:58 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1Bh3j2-0006J9-QH for emacs-devel@gnu.org; Sun, 04 Jul 2004 05:55:58 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bh3j2-0006J6-N6 for emacs-devel@gnu.org; Sun, 04 Jul 2004 05:55:56 -0400 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1Bh3gq-0006zO-M9; Sun, 04 Jul 2004 05:53:40 -0400 Original-Received: from [213.170.224.162] (helo=smtp.kabelnettet.dk) by mx20.gnu.org with esmtp (Exim 4.34) id 1Bh3bq-0002Fp-HO; Sun, 04 Jul 2004 05:48:37 -0400 Original-Received: from math.ku.dk (0x52b410e6.dhcp.kabelnettet.dk [82.180.16.230]) by smtp.kabelnettet.dk (Postfix) with ESMTP id 95E2D60987C; Sun, 4 Jul 2004 11:47:36 +0200 (CEST) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021213 Debian/1.2.1-2.bunk X-Accept-Language: en Original-To: rms@gnu.org In-Reply-To: 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: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:25435 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:25435 This is a multi-part message in MIME format. --------------090802030804060706030609 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Richard Stallman wrote: >What will happen if the user deletes all the text in the editable field, >then inserts new text? Will that newly inserted text be treated >as part of a neighboring widget? It seems likely. > > You are right, zero-sized overlays cannot be ignored as I did. Such overlays should only go in overlays-after. This is done in the patch attached. >I don't think it is worth spending a lot of time to fix this, >because I think it is fundamentally impossible, and there are >more important things to do. > I don't see why it should be fundamentally impossible to fix this bug. AFAICS a widget cannot have zero size, and if it has a zero-sized overlay at one end, it is at the start. I want to fix this bug because it annoys me in some tests I am doing. I suggest we install my patch. It can always be removed if it has undesirable consequences. >For instance, would you be interested >in working on making saving of text properties in files more >convenient? That is more important. > I would be happy to work much more on Emacs. However, that requires someone to finance it :-). Right now I don't have the time :-(. --------------090802030804060706030609 Content-Type: text/plain; name="wid-edit.el.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="wid-edit.el.diff" *** wid-edit.el.~1.128.~ Tue Jun 8 21:50:16 2004 --- wid-edit.el Sun Jul 4 10:34:13 2004 *************** *** 414,426 **** (widget-put widget :doc-overlay overlay))) (defmacro widget-specify-insert (&rest form) ! "Execute FORM without inheriting any text properties." `(save-restriction (let ((inhibit-read-only t) ! (inhibit-modification-hooks t)) (narrow-to-region (point) (point)) (prog1 (progn ,@form) ! (goto-char (point-max)))))) (defface widget-inactive-face '((((class grayscale color) (background dark)) --- 414,444 ---- (widget-put widget :doc-overlay overlay))) (defmacro widget-specify-insert (&rest form) ! "Execute FORM without inheriting any text properties. ! Furthermore, ensure overlays ending at point or starting at point ! does not include text inserted." `(save-restriction (let ((inhibit-read-only t) ! (inhibit-modification-hooks t) ! overlays-before ! overlays-after) ! (mapc (lambda (overlay) ! (when (and (= (point) (overlay-end overlay)) ! (not (= (point) (overlay-start overlay)))) ! (setq overlays-before (cons overlay overlays-before))) ! (when (= (point) (overlay-start overlay)) ! (setq overlays-after (cons overlay overlays-after)))) ! (overlays-in (if (= (point) (point-min)) (point) (1- (point))) ! (if (= (point) (point-max)) (point) (1+ (point))))) (narrow-to-region (point) (point)) (prog1 (progn ,@form) ! (mapc (lambda (overlay) ! (move-overlay overlay (overlay-start overlay) (point-min))) ! overlays-before) ! (mapc (lambda (overlay) ! (move-overlay overlay (point-max) (overlay-end overlay))) ! overlays-after) ! (goto-char (point-max)))))) (defface widget-inactive-face '((((class grayscale color) (background dark)) *************** *** 1530,1538 **** (if (>= old-pos (1- to)) (- old-pos to 1) (- old-pos from))))) - ;;??? Bug: this ought to insert the new value before deleting the old one, - ;; so that markers on either side of the value automatically - ;; stay on the same side. -- rms. (save-excursion (goto-char (widget-get widget :from)) (widget-apply widget :delete) --- 1548,1553 ---- --------------090802030804060706030609 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --------------090802030804060706030609--