From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Decebal Newsgroups: gmane.emacs.help Subject: Re: Extra info in modeline (tip and questions) Date: Tue, 28 Apr 2009 03:27:32 -0700 (PDT) Organization: http://groups.google.com Message-ID: <04d0104c-90b6-4e22-84a8-5f86b7d44388@p6g2000pre.googlegroups.com> References: <533fdd2a-8d26-47ce-9413-1bd2300ee2d1@s20g2000yqh.googlegroups.com> <95e9ef05-7da0-4900-a68a-bc539f1302be@w31g2000prd.googlegroups.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 1240915293 6983 80.91.229.12 (28 Apr 2009 10:41:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Apr 2009 10:41:33 +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 Apr 28 12:41:24 2009 Return-path: Envelope-to: geh-help-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 1Lykke-0007Up-BN for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Apr 2009 12:41:24 +0200 Original-Received: from localhost ([127.0.0.1]:41887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lykkd-0008LT-Mh for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Apr 2009 06:41:23 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!p6g2000pre.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 37 Original-NNTP-Posting-Host: 84.53.123.169 Original-X-Trace: posting.google.com 1240914452 28978 127.0.0.1 (28 Apr 2009 10:27:32 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 28 Apr 2009 10:27:32 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p6g2000pre.googlegroups.com; posting-host=84.53.123.169; posting-account=K-cdeAoAAAD_0d505kUtHXJaT5LFIu-3 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; nl; rv:1.9.0.8) Gecko/2009032600 SUSE/3.0.8-1.1.1 Firefox/3.0.8,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:168799 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:64072 Archived-At: On 28 apr, 09:55, Decebal wrote: > The only thing lacking is that when the function is called with C-u > prepended, it should be put at point in the current buffer instead of > in the minibuffer. How would I do that? I solved that one also. I only found it more usefull to put it in the kill-ring instead of the current buffer. The function buffer-count- chars becomes: (defun buffer-count-chars(do-yank &optional start end) (interactive "P\nr") (let ((ret-val (number-to-string (buffer-count nil ".\\|\n" start end)))) (buffer-count-exit do-yank (interactive-p) ret-val nil))) I also defined the function buffer-count-exit (I like DRY): (defun buffer-count-exit(do-yank is-interactive ret-val is-number) (let ((yank-val)) (if is-number (setq yank-val (format "%d" ret-val)) (setq yank-val ret-val)) (if do-yank (kill-new yank-val) (if is-interactive (message yank-val) ret-val)))) The function get-mode-line-field should also be changed: (defun get-mode-line-field(type) (let ((field (format "*%s*" type)) (this-struct (get-mode-line-struct type))) (if this-struct (setq field (format "%s: %s " (mode-line-struct-display this-struct) (funcall (mode-line-struct-function this- struct) nil)))) field))