help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Extra info in modeline (tip and questions)


From: Decebal
Subject: Re: Extra info in modeline (tip and questions)
Date: Tue, 14 Apr 2009 22:53:57 -0700 (PDT)
User-agent: G2/1.0

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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]