From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Deniz Dogan Newsgroups: gmane.emacs.help Subject: Re: Adding total lines to modeline (NOT percentage)? Date: Fri, 15 Apr 2011 01:03:50 +0200 Message-ID: References: <4DA73885.8000802@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1302822265 1004 80.91.229.12 (14 Apr 2011 23:04:25 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 14 Apr 2011 23:04:25 +0000 (UTC) Cc: fork , help-gnu-emacs@gnu.org To: Scott Frazer Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Apr 15 01:04:21 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QAVaG-00070Q-M4 for geh-help-gnu-emacs@m.gmane.org; Fri, 15 Apr 2011 01:04:20 +0200 Original-Received: from localhost ([::1]:45983 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QAVaG-0004Bb-75 for geh-help-gnu-emacs@m.gmane.org; Thu, 14 Apr 2011 19:04:20 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:54072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QAVa7-00048L-ND for help-gnu-emacs@gnu.org; Thu, 14 Apr 2011 19:04:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QAVa7-0007L8-0K for help-gnu-emacs@gnu.org; Thu, 14 Apr 2011 19:04:11 -0400 Original-Received: from mail-iy0-f169.google.com ([209.85.210.169]:38904) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QAVa6-0007L4-TN for help-gnu-emacs@gnu.org; Thu, 14 Apr 2011 19:04:10 -0400 Original-Received: by iyh42 with SMTP id 42so2567843iyh.0 for ; Thu, 14 Apr 2011 16:04:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=hINX2zIixtLlRAJvEd+8l+sUebnK3xyCXmhG9bimSsM=; b=PLspmP+Y/BF13GtOTfCthN+9CBmyEDDem4NLd23AZU+izbFy4aAgKns9gQKT53By8r uNtImelDCU+xiS91wGSQA1YuPrJicLfBd3tkZtocoiHU84MR+7oxof18WqRKy1xN6SjM AU4Xh5a/m93tBNWA/VQQkSEigGkDA0fHKKACM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=cxcqdEnJmHo8MoECmu+Fu5gjmfE6SPsiwblR3IpVUrIXftRiNs1NLpffwBLfurT7hx 5fOuPETVs1EpBcTQieX3mkOlNdyKtmYmesVg55oDN0dap04gqmW+Nagyk9Rlup8Fq/wM /u75P1rDEy5N0nyIaB893PahVCOFKddgRyAUc= Original-Received: by 10.231.208.134 with SMTP id gc6mr1182461ibb.79.1302822250117; Thu, 14 Apr 2011 16:04:10 -0700 (PDT) Original-Received: by 10.231.208.71 with HTTP; Thu, 14 Apr 2011 16:03:50 -0700 (PDT) In-Reply-To: <4DA73885.8000802@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.210.169 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:80797 Archived-At: 2011/4/14 Scott Frazer : > On 4/13/11 3:11 PM, fork wrote: >> >> Is there a way to customize my modeline such that I can see the total >> number of >> lines of the current file? >> >> The percentage is not particularly interesting to me... >> >> Thanks! >> > > I use these forms in my `mode-line-format' variable to show > "current_line/total_num_lines": > > (list 'line-number-mode " =A0L%l/") > (list 'line-number-mode (:eval (int-to-string (count-lines (point-min) > (point-max))))) > > Note that this method will be affected by narrowing. To get the full number of lines in the buffer use (1+ (count-lines 1 (buffer-size))). This could also get rather sluggish when used in large buffers. The best way would probably be to use a timer to recalculate the number of lines in the buffer and then use that. --=20 Deniz Dogan