From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#18504: 24.3.93; posn-at-point intermittently returns wrong value for a valid buffer position Date: Fri, 19 Sep 2014 23:33:58 +0400 Message-ID: <541C8526.8010204@yandex.ru> References: <86mw9wfmxn.fsf@yandex.ru> <83ha041677.fsf@gnu.org> <541C0481.3050101@yandex.ru> <83a95v21qr.fsf@gnu.org> <541C2FBB.3030008@yandex.ru> <837g0z20oc.fsf@gnu.org> <541C33D1.6020707@yandex.ru> <834mw31zix.fsf@gnu.org> <541C3877.2010107@yandex.ru> <8338bn1yjw.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1411155344 2855 80.91.229.3 (19 Sep 2014 19:35:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Sep 2014 19:35:44 +0000 (UTC) Cc: 18504@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 19 21:35:36 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XV3xv-0000zL-E6 for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Sep 2014 21:35:35 +0200 Original-Received: from localhost ([::1]:60220 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XV3xv-0007PA-2Q for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Sep 2014 15:35:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53047) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XV3xe-0007O2-Vd for bug-gnu-emacs@gnu.org; Fri, 19 Sep 2014 15:35:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XV3xU-00086a-5n for bug-gnu-emacs@gnu.org; Fri, 19 Sep 2014 15:35:18 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54479) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XV3xU-0007zv-2m for bug-gnu-emacs@gnu.org; Fri, 19 Sep 2014 15:35:08 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XV3xO-0007jW-3O for bug-gnu-emacs@gnu.org; Fri, 19 Sep 2014 15:35:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Sep 2014 19:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18504 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18504-submit@debbugs.gnu.org id=B18504.141115525029658 (code B ref 18504); Fri, 19 Sep 2014 19:35:01 +0000 Original-Received: (at 18504) by debbugs.gnu.org; 19 Sep 2014 19:34:10 +0000 Original-Received: from localhost ([127.0.0.1]:46043 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XV3wX-0007iF-Bh for submit@debbugs.gnu.org; Fri, 19 Sep 2014 15:34:09 -0400 Original-Received: from mail-lb0-f172.google.com ([209.85.217.172]:33632) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XV3wR-0007i2-7W for 18504@debbugs.gnu.org; Fri, 19 Sep 2014 15:34:07 -0400 Original-Received: by mail-lb0-f172.google.com with SMTP id p9so3143480lbv.17 for <18504@debbugs.gnu.org>; Fri, 19 Sep 2014 12:34:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=fWdjCwljGYaJfhpwFC2d9SPAra+JyMzuqgTsjZY/PX0=; b=zKiq+zCSbRO9o2mZd5LElTrGavh2wfIXNLex95bK3Dj0h1+2qIeqR1PBUcVEjPtMot 7M0v/ght87aYLWS6xMiekLNszs8zSA8c9453Jbz3PQoU5z+SygAGIhJNofWz6wzp01eh 6aOBWZPG2KWuxI2Xe1dMX6DoLRNR3V0zdp6Yze4VAAUDX1K9H8iOw4ebVbBrFX178aCQ YYVPo5P2odPzSXEp5EIe4lrr3RIcHq5qw+wOKkPmGZX5TwNZByR+orvCk1lmovoMwELz QB+eqdg3sL1zzxggKNaCT3kCN+vZIiB/mjxJazcEtMqwJ10VRfxlIUkIO8jUgODo0MZB MsHw== X-Received: by 10.152.198.204 with SMTP id je12mr9124117lac.52.1411155241740; Fri, 19 Sep 2014 12:34:01 -0700 (PDT) Original-Received: from [192.168.1.3] ([178.252.98.87]) by mx.google.com with ESMTPSA id rl6sm935997lac.17.2014.09.19.12.33.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Sep 2014 12:34:00 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 In-Reply-To: <8338bn1yjw.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:93535 Archived-At: On 09/19/2014 06:21 PM, Eli Zaretskii wrote: >> Yes. I'm not sure how we get there code-wise, though. > > So I'm asking again: why does it matter what happens after a C-g, > i.e. after the user abandons the completion? 1. I'm not 100% sure yet if the problem happens after C-/ or C-g. Just that both need to be pressed at least once. 2. Apparently, one of the last C-g presses (probably the last one) calls `keyboard-quit' instead of `company-abort', which in the command, bound in `company-active-map', that aborts completion. So, I haven't wrapped my head around it yet, but on the odd chance I won't manage to do that before Emacs 24.4 release and it's not actually a bug in company-mode, maybe it's worth investigating whether `posn-at-point' behaves improperly anyway, first. >> Same as previously described, no change there. Just make sure to (setq >> bidi-display-reordering nil). > > Can you show the full value of posn-at-point in that case? With this code: diff --git a/company.el b/company.el index fdf09f7..5c901c6 100644 --- a/company.el +++ b/company.el @@ -782,7 +782,12 @@ means that `company-mode' is always turned on except in `message-mode' buffers." (cons (+ col (window-hscroll)) row))) (defun company--col-row (&optional pos) - (company--posn-col-row (posn-at-point pos))) + (message "foofoo\nfoo") + (let ((posn (posn-at-point pos))) + (when (zerop (car (posn-x-y posn))) + (message "posn at %s #1 %s" pos posn) + (message "posn at %s #2 %s" pos (posn-at-point pos))) + (company--posn-col-row posn))) (defun company--row (&optional pos) (cdr (company--col-row pos))) I get the following output: <...> foofoo foo posn at nil #1 (# 206 (0 . 270) 0 nil 206 (0 . 15) nil (0 . 0) (9 . 18)) posn at nil #2 (# 206 (0 . 270) 0 nil 206 (0 . 15) nil (0 . 0) (0 . 0)) foofoo foo posn at 195 #1 (# 206 (0 . 270) 0 nil 206 (0 . 15) nil (0 . 0) (0 . 0)) posn at 195 #2 (# 206 (0 . 270) 0 nil 206 (0 . 15) nil (0 . 0) (0 . 0)) <...> foofoo foo posn at nil #1 (# 206 (0 . 270) 0 nil 206 (0 . 15) nil (0 . 0) (0 . 0)) posn at nil #2 (# 206 (0 . 270) 0 nil 206 (0 . 15) nil (0 . 0) (0 . 0)) foofoo foo posn at 195 #1 (# 206 (0 . 270) 0 nil 206 (0 . 15) nil (0 . 0) (0 . 0)) posn at 195 #2 (# 206 (0 . 270) 0 nil 206 (0 . 15) nil (0 . 0) (0 . 0)) <...> Point is indeed at 195. Note that the last element is sometimes different between `posn-at-point' invocations ((9 . 18) vs (0 . 0)), but sometimes not (both pairs of zeros)).