From: Decebal <CLDWesterhof@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Extra info in modeline (tip and questions)
Date: Wed, 15 Apr 2009 09:13:02 -0700 (PDT) [thread overview]
Message-ID: <3cc731f5-6f18-4c05-adee-0906864af4ea@u8g2000yqn.googlegroups.com> (raw)
In-Reply-To: mailman.5379.1239801830.31690.help-gnu-emacs@gnu.org
On 15 apr, 15:23, Nikolaj Schumacher <m...@nschum.de> wrote:
> Decebal <CLDWester...@gmail.com> wrote:
> > I understand that this is the default way to handle a break out of a
> > loop, but I found it ugly, and I expect it is also expensive.
>
> Ugly yes, but not that expensive. Depending on the list length testing
> the additional not-ready variable can even be slower.
Well, in principal I find neatness off code more important as
performance, so only when the not-ready variable has a to big
performance hit, I would use the catch again.
> If you use CL macros, something can be done about the ugliness, though.
> It could be written like this
>
> (defun get-mode-line-struct (type)
> (dotimes (i (length mode-line-array))
> (when (equal type (mode-line-struct-type (aref mode-line-array i)))
> (return (aref mode-line-array i)))))
I use cl because of the defstruct, so I could use your code, and that
is even more neat and concise.
> You're using a vector, probably because you're used to it. Since you're
> not doing random-access, a list would be more "natural" in lisp.
>
> (defun get-mode-line-struct (type)
> (dolist (s mode-line-array)
> (when (equal type (mode-line-struct-type s))
> (return s))))
I understood that vectors are much more efficient as lists. That is
why I used them. But your solution with a list is more beautifull, so
I should rewrite for using a list. (Only change mode-line-array to
mode-line-list.)
Thanks for the input. Very usefull.
By the way: anybody found my functionality usefull?
prev parent reply other threads:[~2009-04-15 16:13 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
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 [this message]
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=3cc731f5-6f18-4c05-adee-0906864af4ea@u8g2000yqn.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.