all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Decebal <CLDWesterhof@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Extra info in modeline (tip and questions)
Date: Tue, 14 Apr 2009 22:53:57 -0700 (PDT)	[thread overview]
Message-ID: <a38f66b7-b0a7-4820-af14-00040e90719b@r33g2000yqn.googlegroups.com> (raw)
In-Reply-To: mailman.5329.1239724470.31690.help-gnu-emacs@gnu.org

On Apr 14, 5:54 pm, Nikolaj Schumacher <m...@nschum.de> wrote:
> Decebal <CLDWester...@gmail.com> wrote:
> > At the end of the post is the code.
> > I have a few questions:
> > - Can the code be written better? (I am relative new to elisp.)
>
> It can be "written" "better" by not giving closing parentheses their own
> line.  It's a fairly accepted convention, so I'd suggest to warm up to
> it. ;)

I meant more codewise. I expect that I did not use the best code, not
knowing the language very well.
The reason I put the closing parentheses on its own line, is that I
find that more readable. I would even prefer:
    (defun a-function()
      .
      .
      .
    )
above:
    (defun a-function()
      .
      .
      .
      )
But maybe I should conform to the standard.


> 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?


> > - I tried to generalize. For example there is a function buffer-count-
> > words, which I would like to use also on a region of the buffer. But
> > when I call it interactively, it does not return anything. What do I
> > need to change?
>
> You never call anything interactively for its return value.  You should
> pass the region points (region-beginning) and (region-end) as
> parameters when (region-active-p), if that's what you want to do...

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 <return-value>)
Is there a way to know if the function called interactively?

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?


  parent reply	other threads:[~2009-04-15  5:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-14 14:03 Extra info in modeline (tip and questions) Decebal
2009-04-14 15:54 ` Nikolaj Schumacher
     [not found] ` <mailman.5329.1239724470.31690.help-gnu-emacs@gnu.org>
2009-04-15  5:53   ` Decebal [this message]
2009-04-15 13:14     ` Nikolaj Schumacher
     [not found]     ` <mailman.5377.1239801271.31690.help-gnu-emacs@gnu.org>
2009-04-28  7:55       ` Decebal
2009-04-28 10:27         ` Decebal
2009-04-28  8:04       ` Decebal
2009-04-28  8:23         ` Decebal
2009-04-15 11:06 ` Decebal
2009-04-15 13:23   ` Nikolaj Schumacher
     [not found]   ` <mailman.5379.1239801830.31690.help-gnu-emacs@gnu.org>
2009-04-15 16:13     ` Decebal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a38f66b7-b0a7-4820-af14-00040e90719b@r33g2000yqn.googlegroups.com \
    --to=cldwesterhof@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.