From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Magne Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#6157: narrow-to-defun fix when point is on function beginning Date: Wed, 21 Sep 2011 22:03:24 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1316635675 5512 80.91.229.12 (21 Sep 2011 20:07:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 21 Sep 2011 20:07:55 +0000 (UTC) Cc: 6157@debbugs.gnu.org To: Lennart Borgman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 21 22:07:51 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 1R6T5C-0007rb-PQ for geb-bug-gnu-emacs@m.gmane.org; Wed, 21 Sep 2011 22:07:50 +0200 Original-Received: from localhost ([::1]:54142 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6T5C-0004dl-4p for geb-bug-gnu-emacs@m.gmane.org; Wed, 21 Sep 2011 16:07:50 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:60860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6T59-0004cm-Ak for bug-gnu-emacs@gnu.org; Wed, 21 Sep 2011 16:07:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R6T58-0005Ti-38 for bug-gnu-emacs@gnu.org; Wed, 21 Sep 2011 16:07:47 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43452) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6T57-0005TP-Um for bug-gnu-emacs@gnu.org; Wed, 21 Sep 2011 16:07:46 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1R6T5O-0004Ua-Dz for bug-gnu-emacs@gnu.org; Wed, 21 Sep 2011 16:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Magne Ingebrigtsen Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 21 Sep 2011 20:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6157 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 6157-submit@debbugs.gnu.org id=B6157.131663564517219 (code B ref 6157); Wed, 21 Sep 2011 20:08:02 +0000 Original-Received: (at 6157) by debbugs.gnu.org; 21 Sep 2011 20:07:25 +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 1R6T4n-0004Tb-1Q for submit@debbugs.gnu.org; Wed, 21 Sep 2011 16:07:25 -0400 Original-Received: from hermes.netfonds.no ([80.91.224.195]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R6T4j-0004TN-Hx for 6157@debbugs.gnu.org; Wed, 21 Sep 2011 16:07:22 -0400 Original-Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1R6T4M-0005Vu-Iw; Wed, 21 Sep 2011 22:06:58 +0200 In-Reply-To: (Lennart Borgman's message of "Mon, 10 May 2010 16:51:11 +0200") User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) X-Now-Playing: Colder's _Heat_: "Tonight" X-MailScanner-ID: 1R6T4M-0005Vu-Iw MailScanner-NULL-Check: 1317240418.67907@IuQoIWfoHW9AHxbEF49h5A X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 21 Sep 2011 16:08:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) 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:51590 Archived-At: Lennart Borgman writes: > `beginning-of-defun' goes to previous function when point is on the > first character of a function. This is not currently taken care of in > `narrow-to-defun'. This patch fixes this: > > c:\emacs-lp\bld\emacs\emacsw32\lisp\emacs-lisp>bzr diff --old > c:\emacs-lp\bld\emacs\trunk -p trunk/:patched/ lisp.el > === modified file 'lisp/emacs-lisp/lisp.el' > --- trunk/lisp/emacs-lisp/lisp.el 2010-04-27 17:57:32 +0000 > +++ patched/lisp/emacs-lisp/lisp.el 2010-05-10 14:21:59 +0000 > @@ -438,7 +438,20 @@ > ;; Try first in this order for the sake of languages with nested > ;; functions where several can end at the same place as with > ;; the offside rule, e.g. Python. > - (beginning-of-defun) > + > + ;; Finding the start of the function is a bit problematic since > + ;; `beginning-of-defun' when we are on the first character of > + ;; the function might go to the previous function. > + ;; > + ;; Therefor we first move one character forward and then call > + ;; `beginning-of-defun'. However now we must check that we did > + ;; not move into the next function. > + (let ((here (point))) > + (unless (eobp) (forward-char)) > + (beginning-of-defun) > + (when (< (point) here) > + (goto-char here) > + (beginning-of-defun))) > (setq beg (point)) > (end-of-defun) > (setq end (point)) This patch was apparently approved by Stefan, but not applied, as far as I can tell. Did it turn out to not be correct after all? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/