From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#8667: 24.0.50; `bounds-of-thing-at-point' returns (N . N) for `comment' Date: Thu, 12 May 2011 20:00:50 -0700 Message-ID: <5328177EA0C84361A654BB5EEB201D1C@us.oracle.com> References: <1273A111E1924DE9BAB49AFE6257D462@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1305255731 6461 80.91.229.12 (13 May 2011 03:02:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 13 May 2011 03:02:11 +0000 (UTC) To: <8667@debbugs.gnu.org> Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 13 05:02:07 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QKidj-0005tC-I2 for geb-bug-gnu-emacs@m.gmane.org; Fri, 13 May 2011 05:02:07 +0200 Original-Received: from localhost ([::1]:56097 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QKidj-0005zd-4Q for geb-bug-gnu-emacs@m.gmane.org; Thu, 12 May 2011 23:02:07 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:36274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QKidg-0005zM-D5 for bug-gnu-emacs@gnu.org; Thu, 12 May 2011 23:02:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QKidf-0000TF-0H for bug-gnu-emacs@gnu.org; Thu, 12 May 2011 23:02:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QKide-0000TB-Tl for bug-gnu-emacs@gnu.org; Thu, 12 May 2011 23:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QKide-0005sv-Ah; Thu, 12 May 2011 23:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 May 2011 03:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8667 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8667-submit@debbugs.gnu.org id=B8667.130525567022557 (code B ref 8667); Fri, 13 May 2011 03:02:02 +0000 Original-Received: (at 8667) by debbugs.gnu.org; 13 May 2011 03:01:10 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QKico-0005rm-34 for submit@debbugs.gnu.org; Thu, 12 May 2011 23:01:10 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QKicl-0005rI-5X for 8667@debbugs.gnu.org; Thu, 12 May 2011 23:01:07 -0400 Original-Received: from rtcsinet22.oracle.com (rtcsinet22.oracle.com [66.248.204.30]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id p4D30xZu026066 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for <8667@debbugs.gnu.org>; Fri, 13 May 2011 03:01:01 GMT Original-Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by rtcsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p4D30wCF017878 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for <8667@debbugs.gnu.org>; Fri, 13 May 2011 03:00:59 GMT Original-Received: from abhmt001.oracle.com (abhmt001.oracle.com [141.146.116.10]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p4D30qbC008792 for <8667@debbugs.gnu.org>; Thu, 12 May 2011 22:00:52 -0500 Original-Received: from dradamslap1 (/10.159.43.79) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 12 May 2011 20:00:52 -0700 X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcwRBzTGFN+OJvRwQ7e0FsXqpu3eKwADFs5g X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6090 In-Reply-To: <1273A111E1924DE9BAB49AFE6257D462@us.oracle.com> X-Source-IP: rtcsinet22.oracle.com [66.248.204.30] X-CT-RefId: str=0001.0A090201.4DCC9EED.00AA:SCFSTAT5015188,ss=1,fgs=0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 12 May 2011 23:02:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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:46440 Archived-At: > The problem is that there is no `beginning-op' or `end-op' and all of > the calls to `forward-thing' (with 1 and -1) do not move point at all, > and return nil. So the code falls through to the end: > > (let ((end (point)) > (real-beg > (progn > (funcall > (or (get thing 'beginning-op) > (lambda () (forward-thing thing -1)))) > (point)))) > ;; real-beg = end = (point). Result is (cons 3061 . 3061). > (if (and real-beg end (<= real-beg orig) (<= orig end)) > (cons real-beg end))) > > `bounds-of-thing-at-point' should foresee such a case (that > `forward-THING' does nothing). IOW, it should of course be > fixed for this problem. This should be all that's needed, if it wasn't obvious: - (if (and beg real-end (<= beg orig) (<= orig real-end)) - (cons beg real-end)) + (and beg real-end (<= beg orig) (<= orig real-end) + (/= beg read-end) + (cons beg real-end)) and - (if (and real-beg end (<= real-beg orig) (<= orig end)) - (cons real-beg end))) + (and real-beg end (<= real-beg orig) (<= orig end) + (/= real-beg end) + (cons real-beg end)) (Dunno why some people insist on using `(if (and...) singleton)'. It gets in the way of readability and just represents extra noise. Binary `if' is generally an impediment to readability and communicating intention.) > But it sounds like `forward-comment' should also be fixed so > that it acts like other `forward-THING' functions, and not > just be a no-op when outside a comment. And it seems that `forward-comment' is otherwise buggy, in that it moves only over whitespace when point is within a comment. E.g.: ;; Some comment with some whitespace somewhere. Put point before any of the whitespace and (forward-comment 1) moves to the end of the whitespace. Put point after any of the whitespace and (forward-comment -1) moves to the beginning of that whitespace. And in these cases swapping 1 and -1 produces a no-op. The only time `forward-comment' actually moves over a whole (Lisp) comment is when point is before `;'. And even then, if point is between the two `;' above, then (forward-comment -1) is a no-op. `forward-comment' should behave the way other `forward-THING' functions behave. It should do what we expect of a `forward-*' function. Yes, I have read the `forward-comment' doc string. If it really needs to behave this way then it should have a different name. That is, after fixing the bugged behavior, if we still need a function that does what `forward-comment' does now, then it needs a different name. No, it's not too late to change, even if renaming would be bothersome. The way it is now breaks `thing-at-point' functions, and they should work regardless of the `forward-*' functions. Thing-at-point depends on this naming convention.