From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#2379: [PATCH?] lisp.el: beginning-of-defun Date: Thu, 19 Feb 2009 12:31:22 -0500 Message-ID: References: Reply-To: Stefan Monnier , 2379@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1235065438 3217 80.91.229.12 (19 Feb 2009 17:43:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Feb 2009 17:43:58 +0000 (UTC) Cc: 2379@emacsbugs.donarmstrong.com, bug-gnu-emacs@gnu.org To: "Aaron S. Hawley" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 19 18:45:13 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LaCxQ-0006Ex-40 for geb-bug-gnu-emacs@m.gmane.org; Thu, 19 Feb 2009 18:45:08 +0100 Original-Received: from localhost ([127.0.0.1]:41930 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LaCw5-0008I6-K1 for geb-bug-gnu-emacs@m.gmane.org; Thu, 19 Feb 2009 12:43:45 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LaCw0-0008H8-I1 for bug-gnu-emacs@gnu.org; Thu, 19 Feb 2009 12:43:40 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LaCw0-0008GN-1g for bug-gnu-emacs@gnu.org; Thu, 19 Feb 2009 12:43:40 -0500 Original-Received: from [199.232.76.173] (port=43165 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LaCvz-0008G4-Ea for bug-gnu-emacs@gnu.org; Thu, 19 Feb 2009 12:43:39 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:35141) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LaCvy-0005wQ-N8 for bug-gnu-emacs@gnu.org; Thu, 19 Feb 2009 12:43:39 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n1JHhZsX032586; Thu, 19 Feb 2009 09:43:36 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n1JHZ3sF029970; Thu, 19 Feb 2009 09:35:03 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Stefan Monnier Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Thu, 19 Feb 2009 17:35:03 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 2379 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.123506469029615 (code B ref -1); Thu, 19 Feb 2009 17:35:03 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 19 Feb 2009 17:31:30 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n1JHVQJA029599 for ; Thu, 19 Feb 2009 09:31:27 -0800 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LaCk9-0001sv-OP for bug-gnu-emacs@gnu.org; Thu, 19 Feb 2009 12:31:25 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LaCk9-0001si-28 for bug-gnu-emacs@gnu.org; Thu, 19 Feb 2009 12:31:25 -0500 Original-Received: from [199.232.76.173] (port=49520 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LaCk8-0001sc-QB for bug-gnu-emacs@gnu.org; Thu, 19 Feb 2009 12:31:24 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:1303) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LaCk8-0003rR-HZ for bug-gnu-emacs@gnu.org; Thu, 19 Feb 2009 12:31:24 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqQEAOclnUlMCpTK/2dsb2JhbACBbtFjhA4Ggz0 X-IronPort-AV: E=Sophos;i="4.38,236,1233550800"; d="scan'208";a="34094371" Original-Received: from 76-10-148-202.dsl.teksavvy.com (HELO pastel.home) ([76.10.148.202]) by ironport2-out.teksavvy.com with ESMTP; 19 Feb 2009 12:31:23 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 3F84B4B488; Thu, 19 Feb 2009 12:31:22 -0500 (EST) In-Reply-To: (Aaron S. Hawley's message of "Wed, 18 Feb 2009 21:37:39 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.90 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Thu, 19 Feb 2009 12:43:40 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:25470 Archived-At: > There's some strange programming style in `beginning-of-defun-raw' for > Emacs 22.2, perhaps this is what was meant by the use of this `progn' > syntax? > - (progn (goto-char (1- (match-end 0)))) t)) > + (progn (goto-char (1- (match-end 0))) t))) I think that was the intention. Note that it turns out that the two forms are equivalent in this context (because goto-char never returns nil). > Then, once that is figured out, why doesn't `beginning-of-defun' > manage zero arguments like many of the movement commands do? I'd rather not touch its behavior for 0. Basically, it should never be called with a 0 argument (see below). > Support for a zero argument in these functions is important for > situations where you want to be programmatic with > `beginning-of-defun', Can this be fixed? AFAICT, proper support for 0 would require a serious rethink of BOD's semantics: currently if you're inside defun number N, then (BOD i) moves to (N-(i-1)) is i is positive and to (N-i) if i is negative. I.e. it moves to N if i=1 and to N+1 if i=-1, so where should 0 move to: there is no other defun between those two. Stefan