From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Aaron S. Hawley" Newsgroups: gmane.emacs.bugs Subject: bug#2379: [PATCH?] lisp.el: beginning-of-defun Date: Wed, 18 Feb 2009 21:37:39 -0500 Message-ID: Reply-To: "Aaron S. Hawley" , 2379@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1235022539 20883 80.91.229.12 (19 Feb 2009 05:48:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Feb 2009 05:48:59 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 19 06:50:14 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 1La1nV-0003h4-V2 for geb-bug-gnu-emacs@m.gmane.org; Thu, 19 Feb 2009 06:50:11 +0100 Original-Received: from localhost ([127.0.0.1]:47750 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1La1mB-0005HC-R0 for geb-bug-gnu-emacs@m.gmane.org; Thu, 19 Feb 2009 00:48:47 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LZzCO-0000Vs-AJ for bug-gnu-emacs@gnu.org; Wed, 18 Feb 2009 22:03:40 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LZzCN-0000Up-K2 for bug-gnu-emacs@gnu.org; Wed, 18 Feb 2009 22:03:39 -0500 Original-Received: from [199.232.76.173] (port=49043 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LZzCN-0000UX-40 for bug-gnu-emacs@gnu.org; Wed, 18 Feb 2009 22:03:39 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:49632) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LZzCM-00041h-C1 for bug-gnu-emacs@gnu.org; Wed, 18 Feb 2009 22:03:38 -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 n1J33ZO1027862; Wed, 18 Feb 2009 19:03:36 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n1J2j4a4022763; Wed, 18 Feb 2009 18:45:04 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: "Aaron S. Hawley" Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Thu, 19 Feb 2009 02:45:04 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 2379 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.123501106621180 (code B ref -1); Thu, 19 Feb 2009 02:45:04 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 19 Feb 2009 02:37:46 +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 n1J2bg9Q021174 for ; Wed, 18 Feb 2009 18:37:44 -0800 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LZynG-0005r9-I0 for bug-gnu-emacs@gnu.org; Wed, 18 Feb 2009 21:37:42 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LZynF-0005qx-QO for bug-gnu-emacs@gnu.org; Wed, 18 Feb 2009 21:37:41 -0500 Original-Received: from [199.232.76.173] (port=35070 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LZynF-0005qu-KT for bug-gnu-emacs@gnu.org; Wed, 18 Feb 2009 21:37:41 -0500 Original-Received: from yx-out-1718.google.com ([74.125.44.154]:18619) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LZynF-0002E3-6y for bug-gnu-emacs@gnu.org; Wed, 18 Feb 2009 21:37:41 -0500 Original-Received: by yx-out-1718.google.com with SMTP id 34so88814yxf.66 for ; Wed, 18 Feb 2009 18:37:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=1ZwD/lO5umvoGnIu/dLB8mWaPOXqbdYC/Ik6cn8WAz8=; b=b8gDj/BFhkLa3mUoOskQx9CvQ4uiolH2o0fAACNoQyHyWtY7X6POkgOrUfH6jxkwV8 CRhKfDvZlPhQeZGa8we4jHHTlk+aBl02V2V9hVQdRpx6Xw+izurtmgBDWwR8XAuighaJ bvLDGvNvWtcu3sDhHA/7jhrXY8E0vqVExLK1c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=U+1iTJsqD/qFF5aWhfWLWrwa73wzm36hJ6R9gaq7HP/+5rkPKsc8YTrVFBu+W4Uzzi WozjjMJQDIXYBO2ETsSZepJqBlWyucY8VaiypYlo4mUKpmwOsELOOH1mJNP7DOA/lDEI gox1rJwGWEtQ0hNVr9rkLcQJ/rfyHL3+57Gog= Original-Received: by 10.100.143.17 with SMTP id q17mr9321451and.29.1235011059716; Wed, 18 Feb 2009 18:37:39 -0800 (PST) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Wed, 18 Feb 2009 22:03:39 -0500 X-Mailman-Approved-At: Thu, 19 Feb 2009 00:48:28 -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:25451 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? --- lisp.el 18 Feb 2009 20:56:29 -0500 1.79.2.3 +++ lisp.el 18 Feb 2009 21:07:49 -0500 @@ -234,7 +234,7 @@ "\\(?:" defun-prompt-regexp "\\)\\s(") "^\\s(") nil 'move arg) - (progn (goto-char (1- (match-end 0)))) t)) + (progn (goto-char (1- (match-end 0))) t))) ;; If open-paren-in-column-0-is-defun-start and defun-prompt-regexp ;; are both nil, column 0 has no significance - so scan forward If not, then this is what it probably should be: --- lisp.el 18 Feb 2009 20:56:29 -0500 1.79.2.3 +++ lisp.el 18 Feb 2009 21:10:21 -0500 @@ -234,7 +234,7 @@ "\\(?:" defun-prompt-regexp "\\)\\s(") "^\\s(") nil 'move arg) - (progn (goto-char (1- (match-end 0)))) t)) + (goto-char (1- (match-end 0))))) ;; If open-paren-in-column-0-is-defun-start and defun-prompt-regexp ;; are both nil, column 0 has no significance - so scan forward Then, once that is figured out, why doesn't `beginning-of-defun' manage zero arguments like many of the movement commands do? Running C-0 C-M-a seems to run `beginning-of-line' regardless. That's an easy fix with this patch: --- lisp.el 18 Feb 2009 20:56:29 -0500 1.79.2.3 +++ lisp.el 18 Feb 2009 21:25:05 -0500 @@ -204,7 +204,7 @@ (and transient-mark-mode mark-active) (push-mark)) (and (beginning-of-defun-raw arg) - (progn (beginning-of-line) t))) + (progn (if (and (integerp arg) (/= arg 0)) (beginning-of-line)) t))) (defun beginning-of-defun-raw (&optional arg) "Move point to the character that starts a defun. But then, `beginning-of-defun-raw' seems to run (forward-char -1). That requires this patch. --- lisp.el 18 Feb 2009 20:56:29 -0500 1.79.2.3 +++ lisp.el 18 Feb 2009 21:28:22 -0500 @@ -234,7 +234,7 @@ "\\(?:" defun-prompt-regexp "\\)\\s(") "^\\s(") nil 'move arg) - (progn (goto-char (1- (match-end 0)))) t)) + (progn (or (zerop arg) (goto-char (1- (match-end 0))))) t)) ;; If open-paren-in-column-0-is-defun-start and defun-prompt-regexp ;; are both nil, column 0 has no significance - so scan forward That's my best look at the situation. 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? Thanks, /a