From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nikolaj Schumacher Newsgroups: gmane.emacs.help Subject: Re: Extra info in modeline (tip and questions) Date: Wed, 15 Apr 2009 15:14:23 +0200 Message-ID: References: <533fdd2a-8d26-47ce-9413-1bd2300ee2d1@s20g2000yqh.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1239801309 13115 80.91.229.12 (15 Apr 2009 13:15:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 15 Apr 2009 13:15:09 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Decebal Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 15 15:16:28 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 1Lu4ya-0002d2-F6 for geh-help-gnu-emacs@m.gmane.org; Wed, 15 Apr 2009 15:16:28 +0200 Original-Received: from localhost ([127.0.0.1]:42989 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lu4xB-0003Kl-5V for geh-help-gnu-emacs@m.gmane.org; Wed, 15 Apr 2009 09:15:01 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lu4wf-0003JN-Bp for help-gnu-emacs@gnu.org; Wed, 15 Apr 2009 09:14:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lu4wd-0003Is-PR for help-gnu-emacs@gnu.org; Wed, 15 Apr 2009 09:14:28 -0400 Original-Received: from [199.232.76.173] (port=38927 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lu4wd-0003Ip-J7 for help-gnu-emacs@gnu.org; Wed, 15 Apr 2009 09:14:27 -0400 Original-Received: from dd18200.kasserver.com ([85.13.138.168]:41449) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lu4wd-00073h-Ax for help-gnu-emacs@gnu.org; Wed, 15 Apr 2009 09:14:27 -0400 Original-Received: from thursday (g227018083.adsl.alicedsl.de [92.227.18.83]) by dd18200.kasserver.com (Postfix) with ESMTP id A2C90180291D9; Wed, 15 Apr 2009 15:14:28 +0200 (CEST) In-Reply-To: (Decebal's message of "Tue, 14 Apr 2009 22:53:57 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (darwin) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:63756 Archived-At: Decebal wrote: > The reason I put the closing parentheses on its own line, is that I > find that more readable. I would even prefer: It probably is. I do it in C myself. But with Lisp you have so many parentheses that you lose too much vertical space. The trick is to read the indentation instead of trying to mentally match parentheses. Since I got used to that I actually prefer the concise representation. >> Also there are alternatives to updating the mode-line from a timer. >> The mode-line supports a special :eval form with functions that are >> called automatically, or you might update the values in >> `after-change-functions'. > > Do you have any good pointers? Just C-h v mode-line-format and C-h v after-change-functions. For an :eval example see: http://nschum.de/src/emacs/window-numbering-mode/ for hooks: http://www.emacswiki.org/emacs-en/ChangeHook > 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: > (message ) > Is there a way to know if the function called interactively? Well, there is `called-interactively-p', but I would just add another parameter like this: (defun test (beg end &optional verbose) (interactive "r\nd") (when verbose (message (buffer-substring beg end)))) > I also have another function where I need to input a boolean value > interactively. At the moment I am doing this with n and use 0 for > false and every other value for true. Is there a better way? You can use `y-or-n-p' or `yes-or-no-p'. But they don't have characters in the interactive form. So you need to do this: (interactive (list (y-or-n-p "bool: "))) Often the prefix-arg is perfect for boolean options, too. regards, Nikolaj Schumacher