* info-lookup-symbol index case sensitivity
@ 2002-12-04 0:19 Kevin Ryde
2002-12-05 15:09 ` Richard Stallman
0 siblings, 1 reply; 6+ messages in thread
From: Kevin Ryde @ 2002-12-04 0:19 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 2520 bytes --]
In GNU Emacs 21.1.1 (i386-debian-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2001-12-07 on raven, modified by Debian
configured using `configure i386-debian-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --with-x=yes --with-x-toolkit=athena --without-gif'
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: nil
locale-coding-system: nil
default-enable-multibyte-characters: t
When the help-data in info-lookup-alist specifies that symbols are
case-sensitive, the index search performed by info-lookup-symbol (C-h
C-i) is instead case-insensitive when searching through index entries.
I'm not aware of any of the manuals in the supplied info-look.el which
have two index entries differing only in case. But I encountered the
problem while setting up some sh-mode data. bash.info has a variable
"GROUPS", and sh-utils.info has the program "groups".
The problem can be illustrated with a contrived foo.info below, having
index entries "foo" and "FOO". Put it and the foo.el below in an
otherwise empty directory and run
emacs -q -no-site-file -l foo.el
foo.el sets up foo.info as case-sensitive help for fundamental-mode,
and leaves such a buffer with "FOO" and "foo" ready to be looked up
with C-h C-i.
Press C-h C-i on either "FOO" or "foo" and notice that both bring up
the node for lower case "foo", whereas I believe for "FOO" it ought to
bring up the upper case FOO node.
I think this is just a problem with the searching in info-lookup,
since info-lookup-cache records the available index entries in their
correct case.
In fact I believe the use of Info-menu in info-lookup might be the
problem, since it forcibly binds case-fold-search to t. No doubt
that's good for interactive use, but it's not what info-lookup wants.
I get some joy from the info-lookup.el.diff below, doing a
case-sensitive search in the index node to get to the right spot.
* info-look.el (info-lookup): Replace Info-menu call with a case
sensitive search of the index, to preserve sensitivity requested
by the help data.
I believe this is correct for case-insensitive help modes too, since
the index entries in info-lookup-cache are recorded with their case
unchanged, only the symbols to which they refer are downcased.
[-- Attachment #2: foo.info --]
[-- Type: application/octet-stream, Size: 726 bytes --]
[-- Attachment #3: foo.el --]
[-- Type: application/emacs-lisp, Size: 293 bytes --]
[-- Attachment #4: info-look.el.diff --]
[-- Type: text/plain, Size: 766 bytes --]
*** info-look.el.~1.27.~ Sat Jul 27 08:07:16 2002
--- info-look.el Tue Dec 3 19:41:37 2002
*************** (defun info-lookup (topic item mode)
*** 356,362 ****
nil))
(condition-case nil
(progn
! (Info-menu (or (cdr entry) item))
(setq found t)
(if (or prefix suffix)
(let ((case-fold-search
--- 356,366 ----
nil))
(condition-case nil
(progn
! ;; Don't use Info-menu, it forces case-fold-search to nil
! (let ((case-fold-search nil))
! (re-search-forward
! (concat "^\\* " (regexp-quote (or (cdr entry) item)) ":")))
! (Info-follow-nearest-node)
(setq found t)
(if (or prefix suffix)
(let ((case-fold-search
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: info-lookup-symbol index case sensitivity
2002-12-04 0:19 info-lookup-symbol index case sensitivity Kevin Ryde
@ 2002-12-05 15:09 ` Richard Stallman
2002-12-07 0:36 ` Kevin Ryde
0 siblings, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2002-12-05 15:09 UTC (permalink / raw)
Cc: emacs-devel
It is a good thing for index search to ignore case. That should make
it far easier to use, especially for beginners. As for occasional
conflicts, that is less of an issue.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: info-lookup-symbol index case sensitivity
2002-12-05 15:09 ` Richard Stallman
@ 2002-12-07 0:36 ` Kevin Ryde
2002-12-07 1:13 ` Miles Bader
[not found] ` <E18LCzP-0004Kq-00@fencepost.gnu.org>
0 siblings, 2 replies; 6+ messages in thread
From: Kevin Ryde @ 2002-12-07 0:36 UTC (permalink / raw)
Richard Stallman <rms@gnu.org> writes:
>
> It is a good thing for index search to ignore case. That should make
> it far easier to use, especially for beginners. As for occasional
> conflicts, that is less of an issue.
But I would assert that if I ask for "C-h C-i FOO" then I should be
shown the doco for "FOO" and not for "foo".
I'm pretty sure this is just a matter of the second visit to the index
nodes being case insensitive whereas the first visit (building the
cache) was sensitive.
(Arguably the cache would be better off holding the actual target node
name, rather than re-scanning the indexes to get it. Might use up a
bit more memory though.)
A nice way to establish some leeway for case, in a case sensitive
mode, might be to look first for a symbol in the case given, and if
that fails then look again with a case-fold.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: info-lookup-symbol index case sensitivity
2002-12-07 0:36 ` Kevin Ryde
@ 2002-12-07 1:13 ` Miles Bader
[not found] ` <E18LCzP-0004Kq-00@fencepost.gnu.org>
1 sibling, 0 replies; 6+ messages in thread
From: Miles Bader @ 2002-12-07 1:13 UTC (permalink / raw)
Cc: emacs-devel
On Sat, Dec 07, 2002 at 10:36:23AM +1000, Kevin Ryde wrote:
> > It is a good thing for index search to ignore case. That should make
> > it far easier to use, especially for beginners. As for occasional
> > conflicts, that is less of an issue.
>
> But I would assert that if I ask for "C-h C-i FOO" then I should be
> shown the doco for "FOO" and not for "foo".
It seems reasonable to use the same heuristic that searching does -- if the
search term is all lowercase, then ignore case in the lookup, otherwise (if
there some capital letters in the search term) do a case-sensitive lookup.
-Miles
--
Come now, if we were really planning to harm you, would we be waiting here,
beside the path, in the very darkest part of the forest?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: info-lookup-symbol index case sensitivity
[not found] ` <E18LCzP-0004Kq-00@fencepost.gnu.org>
@ 2002-12-10 23:19 ` Kevin Ryde
2002-12-21 22:18 ` Kevin Ryde
0 siblings, 1 reply; 6+ messages in thread
From: Kevin Ryde @ 2002-12-10 23:19 UTC (permalink / raw)
Richard Stallman <rms@gnu.org> writes:
>
> That would be reasonable. Want to do it?
Yes I might have a go at that.
It might be possible to cooperate with Info-index-next to show
alternatives to the best match. The same perhaps for duplicate
matches, like when say "echo" is in the bash manual and the coreutils
manual. But that'd probably need a change to the way the info-look
caching is done (if I'm not mistaken duplicates are suppressed).
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: info-lookup-symbol index case sensitivity
2002-12-10 23:19 ` Kevin Ryde
@ 2002-12-21 22:18 ` Kevin Ryde
0 siblings, 0 replies; 6+ messages in thread
From: Kevin Ryde @ 2002-12-21 22:18 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 299 bytes --]
My effort at this, incorporating an amended fix for the bug that
started this.
* info-look.el (info-lookup): For ease of use try item
case-insensitive if not found case-sensitive.
Do case sensitive search in index nodes, so items differing only in
case go correctly to their respective nodes.
[-- Attachment #2: info-look.el.lazy-case.diff --]
[-- Type: text/plain, Size: 4013 bytes --]
*** info-look.el.~1.27.~ Sat Jul 27 08:07:16 2002
--- info-look.el Mon Dec 16 16:33:16 2002
*************** (defun info-lookup (topic item mode)
*** 318,330 ****
(or mode (setq mode (info-lookup-select-mode)))
(or (info-lookup->mode-value topic mode)
(error "No %s help available for `%s'" topic mode))
! (let ((entry (or (assoc (if (info-lookup->ignore-case topic mode)
! (downcase item) item)
! (info-lookup->completions topic mode))
! (error "Not documented as a %s: %s" topic (or item ""))))
! (modes (info-lookup->all-modes topic mode))
! (window (selected-window))
! found doc-spec node prefix suffix doc-found)
(if (or (not info-lookup-other-window-flag)
(eq (current-buffer) (get-buffer "*info*")))
(info)
--- 318,331 ----
(or mode (setq mode (info-lookup-select-mode)))
(or (info-lookup->mode-value topic mode)
(error "No %s help available for `%s'" topic mode))
! (let* ((completions (info-lookup->completions topic mode))
! (ignore-case (info-lookup->ignore-case topic mode))
! (entry (or (assoc (if ignore-case (downcase item) item) completions)
! (assoc-ignore-case item completions)
! (error "Not documented as a %s: %s" topic (or item ""))))
! (modes (info-lookup->all-modes topic mode))
! (window (selected-window))
! found doc-spec node prefix suffix doc-found)
(if (or (not info-lookup-other-window-flag)
(eq (current-buffer) (get-buffer "*info*")))
(info)
*************** (defun info-lookup (topic item mode)
*** 356,362 ****
nil))
(condition-case nil
(progn
! (Info-menu (or (cdr entry) item))
(setq found t)
(if (or prefix suffix)
(let ((case-fold-search
--- 357,368 ----
nil))
(condition-case nil
(progn
! ;; Don't use Info-menu, it forces case-fold-search to t
! (let ((case-fold-search nil))
! (re-search-forward
! (concat "^\\* " (regexp-quote (or (cdr entry) (car entry)))
! ":")))
! (Info-follow-nearest-node)
(setq found t)
(if (or prefix suffix)
(let ((case-fold-search
*************** (defun info-lookup (topic item mode)
*** 364,375 ****
(buffer-read-only nil))
(goto-char (point-min))
(re-search-forward
! (concat prefix (regexp-quote item) suffix))
(goto-char (match-beginning 0))
(and (display-color-p) info-lookup-highlight-face
;; Search again for ITEM so that the first
;; occurrence of ITEM will be highlighted.
! (re-search-forward (regexp-quote item))
(let ((start (match-beginning 0))
(end (match-end 0)))
(if (overlayp info-lookup-highlight-overlay)
--- 370,381 ----
(buffer-read-only nil))
(goto-char (point-min))
(re-search-forward
! (concat prefix (regexp-quote (car entry)) suffix))
(goto-char (match-beginning 0))
(and (display-color-p) info-lookup-highlight-face
;; Search again for ITEM so that the first
;; occurrence of ITEM will be highlighted.
! (re-search-forward (regexp-quote (car entry)))
(let ((start (match-beginning 0))
(end (match-end 0)))
(if (overlayp info-lookup-highlight-overlay)
*************** (defun info-lookup (topic item mode)
*** 382,387 ****
--- 388,398 ----
(error nil)))
(setq doc-spec (cdr doc-spec)))
(setq modes (cdr modes)))
+ ;; Alert the user if case was munged, and do this after bringing up the
+ ;; info buffer since that can print messages
+ (unless (or ignore-case
+ (string-equal item (car entry)))
+ (message "Found in differnt case: %s" (car entry)))
(or doc-found
(error "Info documentation for lookup was not found"))
;; Don't leave the Info buffer if the help item couldn't be looked up.
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-12-21 22:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-04 0:19 info-lookup-symbol index case sensitivity Kevin Ryde
2002-12-05 15:09 ` Richard Stallman
2002-12-07 0:36 ` Kevin Ryde
2002-12-07 1:13 ` Miles Bader
[not found] ` <E18LCzP-0004Kq-00@fencepost.gnu.org>
2002-12-10 23:19 ` Kevin Ryde
2002-12-21 22:18 ` Kevin Ryde
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.