From: "Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu>
Cc: monnier+gnu/emacs@rum.cs.yale.edu
Subject: Re: |PATCH| describe-minor-mode and describe-minor-mode-from-indicator
Date: Mon, 31 Mar 2003 12:14:56 -0500 [thread overview]
Message-ID: <200303311714.h2VHEvUt017435@rum.cs.yale.edu> (raw)
In-Reply-To: 20030401.013509.115912667.jet@gyve.org
> > > +(defun lookup-minor-mode-from-indicator (indicator)
> > > + "Return a minor mode symbol from its indicator on the modeline."
> > > + (if (and (< 0 (length indicator))
> > > + (not (string= " " (substring indicator 0 1))))
> > > + (setq indicator (concat " " indicator)))
> >
> > I'd rather not assume that indicators start with a space.
>
> What can I do?
>
> (defun lookup-minor-mode-from-indicator (indicator)
> "Return a minor mode symbol from its indicator on the modeline."
> (if (and (< 0 (length indicator))
> (not (eq (aref indicator 0) ?\ )))
> (setq indicator (concat " " indicator)))
> (let ((minor-modes minor-mode-alist)
> result)
> (while minor-modes
> (let* ((minor-mode (car (car minor-modes)))
> (anindicator (car (cdr (car minor-modes)))))
> (setq anindicator (format-mode-line anindicator))
> (if (and (stringp anindicator)
> (string= anindicator indicator))
>
> Should I use string-match instead of string= to compare indicator
> and anindicator?
>
> (concat " " indicator) is wrong idea?
How about
(if (> (length anindicator) 0)
(equal indicator (if (eq (aref anindicator 0) ?\ )
(substring anindicator 1) anindicator)))
I.e. apply the exact same transformation to `anindicator' as you did
to `indicator'.
Stefan
next prev parent reply other threads:[~2003-03-31 17:14 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-18 7:35 |PATCH| describe-minor-mode and describe-minor-mode-from-indicator Masatake YAMATO
2003-01-18 14:12 ` Masatake YAMATO
2003-01-20 0:49 ` Richard Stallman
2003-01-20 16:06 ` Masatake YAMATO
2003-01-21 6:00 ` Masatake YAMATO
2003-01-22 9:59 ` Richard Stallman
2003-01-23 17:40 ` Masatake YAMATO
2003-01-25 19:23 ` Richard Stallman
2003-01-30 16:04 ` Masatake YAMATO
[not found] ` <E18eghV-0000MM-00@fencepost.gnu.org>
2003-03-30 7:51 ` Masatake YAMATO
2003-03-31 15:51 ` Stefan Monnier
2003-03-31 16:35 ` Masatake YAMATO
2003-03-31 17:14 ` Stefan Monnier [this message]
2003-04-01 9:38 ` Richard Stallman
2003-04-01 12:27 ` Masatake YAMATO
2003-04-01 12:58 ` Masatake YAMATO
2003-04-02 9:19 ` Richard Stallman
2003-04-07 15:46 ` Masatake YAMATO
2003-04-08 2:30 ` Richard Stallman
2003-04-10 8:36 ` Masatake YAMATO
2003-04-10 13:21 ` Stefan Monnier
2003-04-11 8:51 ` Richard Stallman
2003-04-11 19:30 ` Masatake YAMATO
2003-04-12 17:08 ` Richard Stallman
2003-04-02 9:18 ` Richard Stallman
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200303311714.h2VHEvUt017435@rum.cs.yale.edu \
--to=monnier+gnu/emacs@rum.cs.yale.edu \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).