unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kevin Ryde <user42@zip.com.au>
Subject: Re: info-lookup-symbol index case sensitivity
Date: Sun, 22 Dec 2002 08:18:44 +1000	[thread overview]
Message-ID: <87r8cbaud7.fsf@zip.com.au> (raw)
In-Reply-To: <87adjdfonf.fsf@zip.com.au> (Kevin Ryde's message of "Wed, 11 Dec 2002 09:19:16 +1000")

[-- 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

      reply	other threads:[~2002-12-21 22:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87bs42ab5k.fsf@zip.com.au>
2002-12-05 15:09 ` info-lookup-symbol index case sensitivity 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 [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

  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=87r8cbaud7.fsf@zip.com.au \
    --to=user42@zip.com.au \
    /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).