From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Antipov Newsgroups: gmane.emacs.devel Subject: Re: refactoring DEFUN Date: Mon, 25 Mar 2013 17:48:41 +0400 Message-ID: <515055B9.4070103@yandex.ru> References: <51503B6D.1060203@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1364219328 6310 80.91.229.3 (25 Mar 2013 13:48:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Mar 2013 13:48:48 +0000 (UTC) Cc: Andy Moreton To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 25 14:49:14 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UK7ly-0006Fx-IP for ged-emacs-devel@m.gmane.org; Mon, 25 Mar 2013 14:49:14 +0100 Original-Received: from localhost ([::1]:56461 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UK7la-0005bk-Qu for ged-emacs-devel@m.gmane.org; Mon, 25 Mar 2013 09:48:50 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UK7lW-0005Xj-Ph for emacs-devel@gnu.org; Mon, 25 Mar 2013 09:48:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UK7lV-0007mS-3B for emacs-devel@gnu.org; Mon, 25 Mar 2013 09:48:46 -0400 Original-Received: from forward9.mail.yandex.net ([2a02:6b8:0:202::4]:58023) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UK7lU-0007m4-KK for emacs-devel@gnu.org; Mon, 25 Mar 2013 09:48:45 -0400 Original-Received: from smtp9.mail.yandex.net (smtp9.mail.yandex.net [77.88.61.35]) by forward9.mail.yandex.net (Yandex) with ESMTP id 579ADCE10D5; Mon, 25 Mar 2013 17:48:42 +0400 (MSK) Original-Received: from smtp9.mail.yandex.net (localhost [127.0.0.1]) by smtp9.mail.yandex.net (Yandex) with ESMTP id 292A4152075A; Mon, 25 Mar 2013 17:48:41 +0400 (MSK) Original-Received: from unknown (unknown [37.139.80.10]) by smtp9.mail.yandex.net (nwsmtp/Yandex) with ESMTP id mf8KK5dp-mf8ilumw; Mon, 25 Mar 2013 17:48:41 +0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1364219321; bh=lTANyrgrcdjqcCr9opTUZYseiWbkdbNf32HIRHtf/To=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=CuapvgMKStZqHSE9bQfZPuXIC9jVW0jFatf28gmg53DWGZiKCY97iWYYkz6EQPPT6 dXjJz3NyLGPwU0JBQ1QEKU/Q3Iiey92g6hjEN0S+u9FupJIN6Ans9ifWjbog5gLmDw 1bkzEYZvB7z02nE6W/hti8A3cmZ//UckXrPTznRg= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a02:6b8:0:202::4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:158130 Archived-At: On 03/25/2013 04:55 PM, Andy Moreton wrote: > It would help to show the elisp program you used to generate the patch, > as that would make it easier to check that the results of the transform > are correct. This is just about mastering the monster regexp: (defun defun-replace () (set-buffer (find-file-noselect (car (last command-line-args)))) (while (re-search-forward "DEFUN \(\\(\".+\"\\),[ \n\t]+F\\(\[A-Za-z0-9_\]+\\),[ \n\t]+S\\(\[A-Za-z0-9_\]+\\),[ \n\t]+\\([^,]+, [^,]+, [^,]+,\\)" nil t) (replace-match "DEFUN \(\\1, \\3, \\4")) (save-buffer)) And then do it in batch mode: for f in src/*.[cm]; do emacs -Q -batch -l ../misc/defun-replace.el -f defun-replace $f; done The regexp above can't handle complex interactive specs like in Frename_buffer. However defun-replace doesn't change such a functions at all, so the whole procedure yields to a few compilation errors which may be fixed manually. Finally, too long lines may be found with something like: grep -nH DEFUN *.[cm] | awk 'length > 70' and fixed manually too. The whole change passes full bootstrap and basic editing tests. > Did you find any cases where the names did not match up ? I believe that I've fixed the last mismatch in r112124 :-). Dmitry