From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.devel Subject: Re: Odd behavior when moving point over invisible text Date: Mon, 05 Jun 2023 02:09:53 -0500 Message-ID: <87y1kybd1a.fsf@red-bean.com> References: <87cz2ac390.fsf@gnu.org> Reply-To: Karl Fogel Mime-Version: 1.0 Content-Type: text/plain; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13746"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: Mats Lidell Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jun 05 09:11:21 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q64N6-0003OT-Mb for ged-emacs-devel@m.gmane-mx.org; Mon, 05 Jun 2023 09:11:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q64Lq-0001TN-8B; Mon, 05 Jun 2023 03:10:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q64Lo-0001Sz-7Z for emacs-devel@gnu.org; Mon, 05 Jun 2023 03:10:00 -0400 Original-Received: from sanpietro.red-bean.com ([45.79.25.59]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q64Lm-0008H9-Ar; Mon, 05 Jun 2023 03:09:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=red-bean.com; s=202005newsp; h=Content-Type:MIME-Version:Message-ID:Date: Reply-To:References:In-Reply-To:Subject:Cc:To:From:Sender: Content-Transfer-Encoding:Content-ID:Content-Description; bh=6Xi3V5KUrMa/GdX/bYZc51LvIkpMCdbh/SMTzW9RfYQ=; t=1685948995; x=1687158595; b=QNhiKXX/uRFyWRBhMINkginBlX0utC+FneDqLBbFarIGAqkhG068wgHvCDlML89jSntXNXdF3Cq MppKcFJKHFbML3tftxDAG+40UTkKl/4rlBoGKAhzmR4+n86sBE/ASzGelJSbHMsUyTKmuNEuYrlIr vXNhKO+sQhcEb5anzqrSh/Xoeyo/FlWEXpYiYeP55qvYQdlY8etWgJPZakNdpzrbm53fdysHLt4yZ 0RxwIr3GZ65921Nn62S61iuu5H7YEWcLYkXP76ercgYuciq2QWzSMmv+ovDwS9/jGxw5eGXWgZi+i Hvkdsa/iWO6m7iDUqXZjeWT55H6pOzZT85qA==; Original-Received: from 99-112-125-163.lightspeed.cicril.sbcglobal.net ([99.112.125.163]:37258 helo=floss) by sanpietro.red-bean.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q64Li-00AUwF-BU; Mon, 05 Jun 2023 07:09:54 +0000 In-Reply-To: <87cz2ac390.fsf@gnu.org> (Mats Lidell's message of "Sun, 04 Jun 2023 23:43:39 +0200") Received-SPF: pass client-ip=45.79.25.59; envelope-from=kfogel@red-bean.com; helo=sanpietro.red-bean.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:306634 Archived-At: On 04 Jun 2023, Mats Lidell wrote: >When writing a unit test I wanted to move point over invisible >(hidden) text and >got into this strange behavior: > >1. Insert these two lines in an elisp file: > (defun func () > (point)) >2. Set outline-minor-mode { M-x outline-minor-mode } >3. Goto first line and do { M-x outline-hide-subtree } >4. Goto first . in the ellipsis after the parentheses () and try >either to use > the keyboard with C-f or use the command (forward-char) to > move over the > ellipsis. > >With C-f point is moved over the ellipsis but with forward-char >point remains >put!? I suspect it is due to point-adjustment but I was expecting >both of these >to produce the same result, i.e. move over the ellipsis. Not to >mention that >forward-char is also bound to C-f!? > >I tried this with 27.2, 28.2 and current master with the same >result. This reproduces for me with current master (`emacs-repository-version' is "f947a0219bb6e43966e0e4e61ad6a15b0ed13e18"). The reason I'm looking into your report was because I thought it might be related to a known bug in indent.c:check_display_width() that affects scan_for_column() and results in a similar "point doesn't move forward by the right amount" misbehavior [1]. I don't yet know if the problem you're describing has the same underlying cause as [1]; I'd have to trace in and I don't know when I'll get time to do that. But I thought I'd reply here in case they are related; maybe that would save you some time. I looked around in the code a bit for your bug. cmds.c:Fforward_char() just calls move_point(), which in turn looks like it boils down to calling intervals.c:set_point(), which gets us to set_point_both() and that appears to finally be where some interesting action starts. So is there a call to scan_for_column(), or something else that gets us to check_display_width(), somewhere within set_point_both() in the call stack? Maybe? I don't yet know. I also don't know why `forward-char' is behaving differently in your reproduction recipe when called via `C-f' versus other ways. That's quite odd IMHO! Both `M-x forward-char' and direct minibuffer evaluation of `(forward-char 1)' result in point staying on the first dot, just as you said, which is position 15 in the buffer. Whereas typing `C-f' moves point over the whole ellipsis and goes to position 28 in the buffer. What's up with that? There doesn't seem to be any advice added to anything by outline.el (disclaimer: I'm not very familiar with the advice mechanism in Emacs). For example, calling `(ad-has-any-advice 'forward-char)' within the reproduction buffer returns nil. Best regards, -Karl [1] https://lists.gnu.org/archive/html/emacs-devel/2022-11/msg01170.html From: Karl Fogel To: Emacs Devel Subject: An interesting line-motion bug. Date: Wed, 16 Nov 2022 23:38:32 -0600 Message-ID: <87cz9mywbr.fsf@red-bean.com>