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 17:46:57 +0400 Message-ID: <541C33D1.6020707@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> 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 1411134528 23612 80.91.229.3 (19 Sep 2014 13:48:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Sep 2014 13:48:48 +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 15:48:42 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 1XUyYE-0004jz-Dm for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Sep 2014 15:48:42 +0200 Original-Received: from localhost ([::1]:58350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUyYE-0007xK-11 for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Sep 2014 09:48:42 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33058) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUyXn-0007WV-Sh for bug-gnu-emacs@gnu.org; Fri, 19 Sep 2014 09:48:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUyXg-0001FD-D5 for bug-gnu-emacs@gnu.org; Fri, 19 Sep 2014 09:48:15 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUyXg-0001Es-AV for bug-gnu-emacs@gnu.org; Fri, 19 Sep 2014 09:48:08 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XUyXa-0006OX-Ej for bug-gnu-emacs@gnu.org; Fri, 19 Sep 2014 09:48: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 13:48:02 +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.141113442624510 (code B ref 18504); Fri, 19 Sep 2014 13:48:02 +0000 Original-Received: (at 18504) by debbugs.gnu.org; 19 Sep 2014 13:47:06 +0000 Original-Received: from localhost ([127.0.0.1]:45270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XUyWf-0006NF-D7 for submit@debbugs.gnu.org; Fri, 19 Sep 2014 09:47:05 -0400 Original-Received: from mail-la0-f42.google.com ([209.85.215.42]:41412) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XUyWc-0006N4-Nf for 18504@debbugs.gnu.org; Fri, 19 Sep 2014 09:47:03 -0400 Original-Received: by mail-la0-f42.google.com with SMTP id hz20so3202405lab.15 for <18504@debbugs.gnu.org>; Fri, 19 Sep 2014 06:47: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=Y32YN4HLa94llrzKmEo7OqgHT7Mp9SzUMypACxp8pkk=; b=C1CbSZQxs7h3jJxL9W33hVOHsDc+JQPPjSMLWAx7NFgt3zBSs/rshQ5IESiahqznSF QutyFRv/CI8G7wM/1cuo+4MQGXDw7wIWKfpsGcXXKoPwzgB+4bWPD0nQsYWNQQeSbbiq cM8Bxnms0ZtndczvyP0AVWPO68gMuu+/xeRGqvi91A02YHQsTHED+NEnwOnivySd+DfI 2Rp3o5OJsdyDuvHAOoyjPdMtTK4dou4kaBqYswdPvPydsFOBsSOVwTYJ2pSaX3QktRZS ABUCAxNMEBTv0zVvPggze/G2QLg+XHFsadtyQS4W109sl+Vt2ejzNzbdVPByasX/CETf ORvg== X-Received: by 10.152.26.133 with SMTP id l5mr7246263lag.4.1411134421553; Fri, 19 Sep 2014 06:47:01 -0700 (PDT) Original-Received: from [192.168.1.3] ([178.252.98.87]) by mx.google.com with ESMTPSA id f9sm649920lbh.14.2014.09.19.06.46.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Sep 2014 06:47:00 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 In-Reply-To: <837g0z20oc.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:93517 Archived-At: On 09/19/2014 05:35 PM, Eli Zaretskii wrote: > Btw, why is it important what happens when the user types C-g, i.e. if > she abandons the completion? Or does the problem happen without C-g > as well? I'm not quite sure how we get to that point, to be honest. The code gets called from `company-post-command' (which is in post-command-hook), but this-command is nil when that happens. >> If `posn-at-point' is itself stateless (and doesn't modify any relevant >> caches), why not call it again at that point? > > Because it will most probably produce the correct result. > > But you can try that yourself: insert a second call under the > conditions that you know are evidence of the problem. If that is > repeatable, i.e. if that second call always produces the wrong result, > then I have what I need. It is. Try this: diff --git a/company.el b/company.el index fdf09f7..01a3cb5 100644 --- a/company.el +++ b/company.el @@ -782,7 +782,13 @@ 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))) + (let ((posn (posn-at-point pos))) + ;; Completion should be invoked at column > 1. + (when (zerop (car (posn-x-y posn))) + (message "company--col-row zero!") + (message "then:") + (message "%s" (posn-x-y (posn-at-point pos)))) + (company--posn-col-row posn))) (defun company--row (&optional pos) (cdr (company--col-row pos))) I get: company--col-row zero! then: (0 . 198)