[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: |PATCH| describe-minor-mode and describe-minor-mode-from-indicator
From: |
Stefan Monnier |
Subject: |
Re: |PATCH| describe-minor-mode and describe-minor-mode-from-indicator |
Date: |
Mon, 31 Mar 2003 12:14:56 -0500 |
> > > +(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