From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Odd behavior when moving point over invisible text Date: Mon, 05 Jun 2023 16:05:31 +0300 Message-ID: <83h6rm3vqc.fsf@gnu.org> References: <87cz2ac390.fsf@gnu.org> <87y1kybd1a.fsf@red-bean.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30634"; mail-complaints-to="usenet@ciao.gmane.io" Cc: matsl@gnu.org, emacs-devel@gnu.org To: Karl Fogel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jun 05 15:06:23 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 1q69ug-0007dG-Cs for ged-emacs-devel@m.gmane-mx.org; Mon, 05 Jun 2023 15:06:22 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q69ty-0006rf-Ap; Mon, 05 Jun 2023 09:05:38 -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 1q69tw-0006rV-Pf for emacs-devel@gnu.org; Mon, 05 Jun 2023 09:05:36 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q69tw-0001FS-7O; Mon, 05 Jun 2023 09:05:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=NNex/eB817IYb9Aw3kcMp3T/bZm+/m/X6dnKQYDj+rU=; b=ho7NRQvLaY/n MmUtWpT2jk3GIe4xyD0DynqGUz2MF5SN+s4E6VzpaKBKswEN2QdD9bo6e9u1KrJfyzrK7SV6cOAPY aV/jaHudj/2qh6e/nfdDwpDeLxseC+dnN7Y25RtiSJ+qi8zRAgTIs2ZuzkEJ5aou+lOxdMg4LSHBo 7l3ZJWIrpiCA1ttosKnt7CpzaBNmM0GmtVJ6iKkTlJm6hkz/+sXmsvmGp8sIG+S78RDOEo3gVc7tN gdJnMwjLJBzjf5bCEOMA63G+PRXU4XKhLmA2zjdXu47/3g4wL78C6fka/NAUwoXaV6b/+/lchsdlq /9CNw1z09CO9HuBkmeUa+g==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q69tt-0008EW-Ta; Mon, 05 Jun 2023 09:05:34 -0400 In-Reply-To: <87y1kybd1a.fsf@red-bean.com> (message from Karl Fogel on Mon, 05 Jun 2023 02:09:53 -0500) 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:306650 Archived-At: > From: Karl Fogel > Cc: emacs-devel@gnu.org > Date: Mon, 05 Jun 2023 02:09:53 -0500 > > 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() It isn't. > 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. No, those are not relevant. What happens here is the feature known as "point-adjustment" kicks in, and attempts to move point out of invisible text. See disable-point-adjustment for more details. > 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. It's a bug. Bugs are often odd. The point-adjustment feature needs to record the previous position of point, to know in which direction to move it in order to exit the invisible area: if point moved to a larger buffer position and entered invisible text, point-adjustment wants to move it further forward; if it moved towards lower position, point-adjustment wants to move it back. The bug was that last point position was recorded in a global variable, and M-x enters recursive-edit, which clobbered that variable's value with the value from the minibuffer.