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: Fri, 13 May 2011 08:49:27 -0700 Message-ID: <08CF598C172E4666AC252C93A5D1F869@us.oracle.com> References: <1273A111E1924DE9BAB49AFE6257D462@us.oracle.com><5328177EA0C84361A654BB5EEB201D1C@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 1305301813 24828 80.91.229.12 (13 May 2011 15:50:13 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 13 May 2011 15:50:13 +0000 (UTC) Cc: 8667@debbugs.gnu.org To: "'Stefan Monnier'" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 13 17:50:09 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 1QKucy-0004Yz-TM for geb-bug-gnu-emacs@m.gmane.org; Fri, 13 May 2011 17:50:09 +0200 Original-Received: from localhost ([::1]:57427 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QKucy-0003Sm-GM for geb-bug-gnu-emacs@m.gmane.org; Fri, 13 May 2011 11:50:08 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:42671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QKucv-0003RB-DY for bug-gnu-emacs@gnu.org; Fri, 13 May 2011 11:50:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QKucu-00078t-D3 for bug-gnu-emacs@gnu.org; Fri, 13 May 2011 11:50:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50304) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QKucu-00078U-6S for bug-gnu-emacs@gnu.org; Fri, 13 May 2011 11:50:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QKuct-0006nK-FR; Fri, 13 May 2011 11:50:03 -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 15:50:03 +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.130530179126096 (code B ref 8667); Fri, 13 May 2011 15:50:03 +0000 Original-Received: (at 8667) by debbugs.gnu.org; 13 May 2011 15:49:51 +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 1QKucg-0006mq-AY for submit@debbugs.gnu.org; Fri, 13 May 2011 11:49:50 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QKuca-0006mU-6k for 8667@debbugs.gnu.org; Fri, 13 May 2011 11:49:48 -0400 Original-Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id p4DFnaG6011693 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 13 May 2011 15:49:38 GMT Original-Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p4DFnZiX004184 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 May 2011 15:49:36 GMT Original-Received: from abhmt012.oracle.com (abhmt012.oracle.com [141.146.116.21]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p4DFnUxL007989; Fri, 13 May 2011 10:49:30 -0500 Original-Received: from dradamslap1 (/10.159.43.79) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 May 2011 08:49:30 -0700 X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcwRd6HJv2A24lJdRIWUxCkIM8ix7AACsfXg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6090 In-Reply-To: X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090203.4DCD5312.00BC:SCFMA922111,ss=1,fgs=0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 13 May 2011 11:50:03 -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:46449 Archived-At: > > And it seems that `forward-comment' is otherwise buggy, in > > that it moves only over whitespace when point is within a comment. > > Not only over whitespace: also over a nested comment. > What would you want it to do instead? Jump to the end of the comment? > Kind of like an `up-comment'? > > The forward- functions all share the following property AFAIK: > when called with a positive argument with point *before* some > , they will skip over that many and when called > with a negative argument with point *after* some they will > skip over that many . > > E.g. just like forward-comment, forward-sexp from within a > sexp will not skip to the end of that sexp. And just like forward-sexp, > forward-comment called in front of a nested comment will jump > over that nested comment. > > All calls with point elsewhere than before/after a behave in > somewhat arbitrary ways which mostly depend on how the function is > implemented and what kind of structure have (e.g. can they > nest? Can we easily tell when we're in the middle of a ?). You're right, and I was aware of that. While dealing with the `bounds-of-thing-at-point' bug I mistakenly got the impression that `forward-char' was also misbehaving. Let's please fix `bounds-of-thing-at-point', though. The fix is trivial. It's OK for `b-o-t-a-p' to return a purely whitespace thing (`whitespace' is even a proper thing), but it's not OK for it to return an empty thing (""), IMO. -- BTW (do I need to create a separate bug report for this?), I think `forward-whitespace' is incorrect: \n should be \n+, like this: (defun forward-whitespace (arg) (interactive "p") (if (natnump arg) (re-search-forward "[ \t]+\\|\n+" nil 'move arg) (while (< arg 0) (if (re-search-backward "[ \t]+\\|\n+" nil 'move) (or (eq (char-after (match-beginning 0)) 10) (skip-chars-backward " \t"))) (setq arg (1+ arg))))) Try `(bounds-of-thing-at-point 'whitespace)' at various places, in particular at the end of a line followed by an empty line. The current definition does not consider contiguous whitespace from newlines to be part of the same whitespace thing - it treats \n as separating whitespace things. Dunno whether that was the intention (why?). Without any indication of the reason/intention (no doc string), I'd say that any sequence of contiguous whitespace, including newlines, should form a single whitespace thing. Can we also please add doc strings to functions such as `forward-whitespace'? They are missing, generally, in thingatpt.el.