From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: phillip.lord@newcastle.ac.uk (Phillip Lord) Newsgroups: gmane.emacs.help Subject: Re: Counting SLOC in Emacs Date: Fri, 28 Nov 2014 16:46:20 +0000 Message-ID: <87zjbb5l43.fsf@newcastle.ac.uk> References: <877fyfk1qn.fsf@wmi.amu.edu.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1417193225 8304 80.91.229.3 (28 Nov 2014 16:47:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 28 Nov 2014 16:47:05 +0000 (UTC) Cc: Help Gnu Emacs mailing list To: Marcin Borkowski Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 28 17:47:00 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 1XuOh9-0006cg-O5 for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Nov 2014 17:46:59 +0100 Original-Received: from localhost ([::1]:45110 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XuOh8-0001Pb-Np for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Nov 2014 11:46:58 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XuOgt-0001PS-HU for help-gnu-emacs@gnu.org; Fri, 28 Nov 2014 11:46:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XuOgm-0004oO-QZ for help-gnu-emacs@gnu.org; Fri, 28 Nov 2014 11:46:43 -0500 Original-Received: from cheviot22.ncl.ac.uk ([128.240.234.22]:50046) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XuOgm-0004lO-LJ for help-gnu-emacs@gnu.org; Fri, 28 Nov 2014 11:46:36 -0500 Original-Received: from smtpauth-vm.ncl.ac.uk ([10.8.233.129] helo=smtpauth.ncl.ac.uk) by cheviot22.ncl.ac.uk with esmtp (Exim 4.63) (envelope-from ) id 1XuOgg-0007L6-Dz; Fri, 28 Nov 2014 16:46:30 +0000 Original-Received: from jangai.ncl.ac.uk ([10.66.67.223] helo=localhost) by smtpauth.ncl.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1XuOgW-0005Pr-G4; Fri, 28 Nov 2014 16:46:20 +0000 In-Reply-To: <877fyfk1qn.fsf@wmi.amu.edu.pl> (Marcin Borkowski's message of "Fri, 28 Nov 2014 12:23:28 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 128.240.234.22 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:101279 Archived-At: My own m-buffer.el was designed (partly) for this form of manipulation. So, it would be something like... (- (length (m-buffer-match-line (current-buffer))) (length (m-buffer-match-empty-line (current-buffer)))) I haven't written a "match-comment" function yet, but will probably add it now that you mention it. It's easy enough to do. Phil Marcin Borkowski writes: > Hello, > > there is count-lines-region, but I'd like to exclude empty lines and > lines with only comments. Is there anything like that? (If not, I'll > try to hack it myself and share.) > > TIA, -- Phillip Lord, Phone: +44 (0) 191 208 7827 Lecturer in Bioinformatics, Email: phillip.lord@newcastle.ac.uk School of Computing Science, http://homepages.cs.ncl.ac.uk/phillip.lord Room 914 Claremont Tower, skype: russet_apples Newcastle University, twitter: phillord NE1 7RU