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 00:55:32 -0700 (PDT) Organization: http://groups.google.com Message-ID: <95e9ef05-7da0-4900-a68a-bc539f1302be@w31g2000prd.googlegroups.com> References: <533fdd2a-8d26-47ce-9413-1bd2300ee2d1@s20g2000yqh.googlegroups.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: ger.gmane.org 1240908090 15050 80.91.229.12 (28 Apr 2009 08:41:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Apr 2009 08:41:30 +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 10:41:21 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 1LyisQ-00074A-US for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Apr 2009 10:41:20 +0200 Original-Received: from localhost ([127.0.0.1]:34559 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LyisQ-0006Bu-Be for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Apr 2009 04:41:18 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!w31g2000prd.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 72 Original-NNTP-Posting-Host: 84.53.123.169 Original-X-Trace: posting.google.com 1240905333 818 127.0.0.1 (28 Apr 2009 07:55:33 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 28 Apr 2009 07:55:33 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: w31g2000prd.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:168793 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:64068 Archived-At: On 15 apr, 15:14, Nikolaj Schumacher wrote: > It probably is. =A0I do it in C myself. =A0But with Lisp you have so many > parentheses that you lose too much vertical space. I now also put all the parentheses on the same line. I still need a little bit to get used to it, but at saves a lot off lines. (Up to 25%.) > > What I would like is that when I call the function interactively, that > > instead of returning the value, the value is displayed in the > > minibuffer. For this I need to know if the function is called > > interactively. If that is the case, I should do: > > =A0 =A0 (message ) > > Is there a way to know if the function called interactively? > > Well, there is `called-interactively-p', but I would just add another I changed them to: (defun buffer-count(expression &optional start end) (interactive "sExpression: \nr") (if (equal start end) (setq start (point-min) end (point-max)) (setq start (or start (point-min))) (setq end (or end (point-max)))) (let ((ret-val (how-many expression start end))) (if (interactive-p) (message (format "%d" ret-val)) ret-val))) (defun buffer-count-chars(&optional start end) (interactive "r") (let ((ret-val (number-to-string (buffer-count ".\\|\n" start end)))) (if (interactive-p) (message ret-val) ret-val))) (defun buffer-count-functions(&optional start end) (interactive "r") (let ((ret-val (number-to-string (buffer-count "^(defun " start end)))) (if (interactive-p) (message ret-val) ret-val))) (defun buffer-count-lines(&optional start end) (interactive "r") (let ((ret-val (number-to-string (+ (buffer-count "\n" start end) 1)))) (if (interactive-p) (message ret-val) ret-val))) ;;; ### possibillity to give word-type (defun buffer-count-words(&optional start end) (interactive "r") (let ((regexp "\\w+") (ret-val)) (cond ((equal word-type "lisp") (setq regexp "[[:word:]\-]+"))) (setq ret-val (number-to-string (buffer-count regexp start end))) (if (interactive-p) (message ret-val) ret-val))) 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?