From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Cursor positioning with `after-string' overlays Date: Sat, 03 Apr 2010 00:16:52 +0300 Message-ID: <836349wo57.fsf@gnu.org> References: <83bpe3xqjj.fsf@gnu.org> <83ljd6w9p1.fsf@gnu.org> <837hopwvgl.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1270243090 31755 80.91.229.12 (2 Apr 2010 21:18:10 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 2 Apr 2010 21:18:10 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 02 23:18:06 2010 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.69) (envelope-from ) id 1NxoFi-0001J2-05 for ged-emacs-devel@m.gmane.org; Fri, 02 Apr 2010 23:18:06 +0200 Original-Received: from localhost ([127.0.0.1]:54544 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NxoFg-00043F-Ty for ged-emacs-devel@m.gmane.org; Fri, 02 Apr 2010 17:18:04 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NxoFc-000434-5j for emacs-devel@gnu.org; Fri, 02 Apr 2010 17:18:00 -0400 Original-Received: from [140.186.70.92] (port=38049 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NxoFa-00042n-UT for emacs-devel@gnu.org; Fri, 02 Apr 2010 17:17:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NxoEX-0001j6-Lq for emacs-devel@gnu.org; Fri, 02 Apr 2010 17:16:56 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:58831) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NxoEV-0001ii-RB for emacs-devel@gnu.org; Fri, 02 Apr 2010 17:16:53 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0L0900100PMCX800@a-mtaout20.012.net.il> for emacs-devel@gnu.org; Sat, 03 Apr 2010 00:16:50 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([77.124.92.42]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0L09001BWPS1R010@a-mtaout20.012.net.il>; Sat, 03 Apr 2010 00:16:50 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) 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:123080 Archived-At: > From: Stefan Monnier > Cc: emacs-devel@gnu.org > Date: Fri, 02 Apr 2010 16:35:50 -0400 > > > The minibuffer completion use-case is different: there, we have no > > text that comes from a buffer beyond the place where the cursor is > > displayed. IOW, there're no glyphs to the right of the cursor that > > came from the minibuffer. So there are no buffer positions that > > "compete" for the cursor position, only the overlay with the > > completion message. > > I can imagine using the same kind of message for in-buffer completion. Then you need to use the "integer as `cursor' property value" feature. I.e., don't just set the property's value non-nil, set it to the integer number that specifies how many buffer positions are ``covered'' by that cursor positions. That's what CUA Mode does in cua-rect.el. Integer property values do override the "exact match for point always wins" strategy. > > There's no "memory" in the glyphs of where the string came from, > > that's true. But that doesn't mean we cannot resurrect that > > knowledge. We already do something like that, see the call to the > > function string_buffer_position_lim inside set_cursor_from_row. If > > required, we could extend that function, or call it for other similar > > jobs when we position the cursor. Or we could record the buffer > > position where we found the string, and remove the need to look it up > > again during cursor positioning. > > The position is not enough because we need to find the actual overlay > where it came from and there can be several overlays at that buffer > position. Right, but we have the string, so we could look for the overlay that specifies the same string. > But I do not object at all to your general argument "I think this kind > of problems should be fixed, not worked around with the `cursor' > property". I seem to remember making the same observation, then jumping > to the C code, and finally deciding "too hard for me, I'll live with the > workaround for now". So if you can fix it, that would be great. I'd need to see the requirements first.