From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: Counting SLOC in Emacs Date: Tue, 02 Dec 2014 23:10:13 +0100 Message-ID: <87sigxg0u2.fsf@wmi.amu.edu.pl> References: <871tonjpuw.fsf@wmi.amu.edu.pl> <87fvcxg4u3.fsf@robertthorpeconsulting.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1417558266 12958 80.91.229.3 (2 Dec 2014 22:11:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Dec 2014 22:11:06 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 02 23:11:01 2014 Return-path: Envelope-to: geh-help-gnu-emacs@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 1Xvves-0004nh-Az for geh-help-gnu-emacs@m.gmane.org; Tue, 02 Dec 2014 23:10:58 +0100 Original-Received: from localhost ([::1]:38943 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xvver-0008Jz-NR for geh-help-gnu-emacs@m.gmane.org; Tue, 02 Dec 2014 17:10:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59495) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvveY-0008Jk-QX for help-gnu-emacs@gnu.org; Tue, 02 Dec 2014 17:10:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XvveS-0001fS-S1 for help-gnu-emacs@gnu.org; Tue, 02 Dec 2014 17:10:38 -0500 Original-Received: from msg.wmi.amu.edu.pl ([2001:808:114:2::50]:41985) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvveS-0001eQ-BR for help-gnu-emacs@gnu.org; Tue, 02 Dec 2014 17:10:32 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by msg.wmi.amu.edu.pl (Postfix) with ESMTP id A3B0042066 for ; Tue, 2 Dec 2014 23:10:27 +0100 (CET) Original-Received: from msg.wmi.amu.edu.pl ([127.0.0.1]) by localhost (msg.wmi.amu.edu.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id If9pEddiPX1p for ; Tue, 2 Dec 2014 23:10:27 +0100 (CET) Original-Received: from localhost (117-116.echostar.pl [213.156.117.116]) by msg.wmi.amu.edu.pl (Postfix) with ESMTPSA id 4B5EC42061 for ; Tue, 2 Dec 2014 23:10:27 +0100 (CET) In-reply-to: <87fvcxg4u3.fsf@robertthorpeconsulting.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:808:114:2::50 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:101382 Archived-At: On 2014-12-02, at 21:43, Robert Thorpe wrote: > Marcin Borkowski writes: > >>> (* foo bar >>> * baz *) >>> >>> will count as 1 lines, IIUC. And similarly >>> >>> printf ("toto\n"); (* foo bar >>> * baz *) >>> >>> will count as 2 lines. You might want to try something like: >> >> Hm. Didn't think of this. (I'm not really accustomed to multi-line >> comments, I guess.) > > I think for practical purposes it's best to use script like David > Wheeler's SLOCount called from Emacs. Not really: Elisp-only solution has a few benefits: 1. portability 2. it adapts itself automatically to langauges which can be parsed by Emacs modes. 3. maybe speed (C might be faster, but with Elisp you don't have to start a process - this might require some measurement, though). > Re-writing it in Elisp is an interesting exercise though. 4. Exactly, a good way to learn/teach something about how Emacs (and its language modes) work. > BR, > Robert Thorpe Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University