From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Robert Cochran Newsgroups: gmane.emacs.bugs Subject: bug#24427: 25.1.50; end-of-defun jumps too far Date: Sat, 01 Oct 2016 22:12:14 -0700 Message-ID: <8737kftjv5.fsf@cochranmail.com> References: <87fup4q7ut.fsf@mbork.pl> <87d1k7a6lo.fsf@cochranmail.com> <8760pza6g2.fsf@cochranmail.com> <871t0etod0.fsf@cochranmail.com> <87twd9vxaj.fsf@mbork.pl> <87r38cw7bp.fsf@mbork.pl> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1475385212 13290 195.159.176.226 (2 Oct 2016 05:13:32 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 2 Oct 2016 05:13:32 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) Cc: 24427@debbugs.gnu.org To: Marcin Borkowski Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 02 07:13:28 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bqZ5Q-0001gi-RQ for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Oct 2016 07:13:18 +0200 Original-Received: from localhost ([::1]:58075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqZ5P-00046r-8H for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Oct 2016 01:13:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqZ5J-00046k-AL for bug-gnu-emacs@gnu.org; Sun, 02 Oct 2016 01:13:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bqZ5C-0004LV-LX for bug-gnu-emacs@gnu.org; Sun, 02 Oct 2016 01:13:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35252) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqZ5C-0004LL-F2 for bug-gnu-emacs@gnu.org; Sun, 02 Oct 2016 01:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bqZ5C-0000IN-4H for bug-gnu-emacs@gnu.org; Sun, 02 Oct 2016 01:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Cochran Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 Oct 2016 05:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24427 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24427-submit@debbugs.gnu.org id=B24427.14753851511095 (code B ref 24427); Sun, 02 Oct 2016 05:13:02 +0000 Original-Received: (at 24427) by debbugs.gnu.org; 2 Oct 2016 05:12:31 +0000 Original-Received: from localhost ([127.0.0.1]:41442 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bqZ4h-0000Ha-AT for submit@debbugs.gnu.org; Sun, 02 Oct 2016 01:12:31 -0400 Original-Received: from mail.workgrouplinux.net ([207.195.177.82]:55162) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bqZ4e-0000HP-Vw for 24427@debbugs.gnu.org; Sun, 02 Oct 2016 01:12:29 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=simple; d=cochranmail.com; h=from:to :cc:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=dkim1; bh=I62tiJpO03PfNF/wv6iXdsbI7S0=; b=rb4Iu kfjSqxTn4nT4IBh8nMVCjERdB6PrFdnZyTHzTiMuy6MCujjrbhuRkhYU43DA+LEq S34s1TN1T29U3PHxnEG4cEbpIEtHG4+H5azdryCrlLQQJ60wv6zXdtQ0TwnGm+cF o40lE1mzkjMMEJ4dlyu3WqEmUitAdDTZsW/73AelQudTtK8tc++0Ig2l9kASbkNI H/xgPNSvt2IYEsSm9dCB78XCDNLSOZ8st1pwF/OiBkCkxxBFoeBdk/66GuW+fShO x4x0YF/S3lDDtbWZab+5fgodGqW6QBwAv6b0c8uYMXaieTBNJ+SlpkHrlKJp4F57 PYOJpyOG5FM4CyYeg== Original-Received: (qmail 9374 invoked by uid 0); 2 Oct 2016 05:12:26 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=private; d=cochranmail.com; b=hRE6Li8eEQsQIHDXIE0hDnhcwXb0B2f5eTd1QFtwpJV5V2cpkfPkRXzr9+gwJWtDIE+SNRCdfihi6iuU0CTbtg==; Original-Received: from 131-191-86-130.as.clicknet.org (HELO SoraLaptop) (robert@cochranmail.com@131.191.86.130) by mail.cochrantribe.org with ESMTPA; 2 Oct 2016 05:12:26 -0000 In-Reply-To: <87r38cw7bp.fsf@mbork.pl> (Marcin Borkowski's message of "Thu, 22 Sep 2016 12:35:22 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:123885 Archived-At: Marcin Borkowski writes: > OK, so here's the problem I found when running my personal tests for my > `mark-defun'. > > Consider this Elisp buffer: > > ;; Comment header > > (defun func-1 (arg) > "docstring" > body) > -!- > ;; Comment before a defun > (defun func-2 (arg) > "docstring" > body) > > (defun func-3 (arg) > "docstring" > body) > (defun func-4 (arg) > "docstring" > body) > > ;; end > > where -!- means the point location. Now press C-u 2 C-M-e, and you > moved by one defun instead of two. This particular problem is the result of this bit in the body of `end-of-defun`: #+BEGIN_SRC emacs-lisp (if (> (point) pos) ;; We already moved forward by one because we started from ;; within a function. (setq arg (1- arg)) ;; We started from after the end of the previous function. (goto-char pos)) #+END_SRC When the whitespace is skipped after doing the initial position calculations, point, which ends up either on or after the > ;; Comment before a defun line, is indeed after `pos`, a recording of point before doing any movement. The assumption that we were in a function body, as stated in the comment, doesn't hold. So the definition count is erroneously decreased. Nothing has come to mind for a method to fix it without breaking other things. Perhaps the solution is obvious for someone else? Suggestions would be nice if you have them. (As an aside, to vent a little, it's rather frustrating that both pre- and post-patch do what you regard as TRT in different circumstances. Especially so because pre-patch is only doing TRT as a result of what I would say is two bugs canceling each other out. Obviously not your fault, but still frustrating.) Thanks, -- ~Robert Cochran GPG Fingerprint - E778 2DD4 FEA6 6A68 6F26 AD2D E5C3 EB36 4886 8871