GNU bug report logs - #864
23.0.60; Info-dir-remove-duplicates fails to remove duplicates

Previous Next

Package: emacs;

Reported by: "Joshua S." <viking_r <at> george24.com>

Date: Tue, 2 Sep 2008 15:35:03 UTC

Severity: normal

Done: martin rudalics <rudalics <at> gmx.at>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: martin rudalics <rudalics <at> gmx.at>
To: "Joshua S." <viking_r <at> george24.com>, 864 <at> debbugs.gnu.org
Subject: bug#864: 23.0.60;	Info-dir-remove-duplicates fails to remove duplicates
Date: Wed, 03 Sep 2008 08:43:34 +0200
[Message part 1 (text/plain, inline)]
> I did bellow patch to fix this. (You know, I am not a good Lisp
> programmer.)
>
> Index: lisp/info.el
> ===================================================================
> RCS file: /sources/emacs/emacs/lisp/info.el,v
> retrieving revision 1.541
> diff -u -d -w -r1.541 info.el
> --- lisp/info.el    30 Aug 2008 20:16:36 -0000    1.541
> +++ lisp/info.el    2 Sep 2008 15:05:54 -0000
> @@ -1222,9 +1222,10 @@
>            ;; Fold case straight away; `member-ignore-case' here wasteful.
>            (let ((x (downcase (match-string 1))))
>            (if (member x seen)
> -              (delete-region (match-beginning 0)
> +              (progn (delete-region (match-beginning 0)
>                       (progn (re-search-forward "^[^ \t]" nil t)
>                          (match-beginning 0)))
> +                   (forward-line 0))
>              (push x seen))))))))))
>
>  ;; Note that on entry to this function the current-buffer must be the

Looks good to me.  However, could you try the attached patch instead
which also does away with the quite obscure "limit" thing.

martin
[864.diff (text/plain, inline)]
*** info.el.~1.541.~	2008-08-31 09:48:43.390625000 +0200
--- info.el	2008-09-03 08:33:07.734375000 +0200
***************
*** 1213,1231 ****
  	      (delete-region (1- (point)) (point))))

  	  ;; Now remove duplicate entries under the same heading.
! 	  (let ((seen nil)
! 		(limit (point-marker)))
! 	    (goto-char start)
! 	    (while (and (> limit (point))
! 			(re-search-forward "^* \\([^:\n]+:\\(:\\|[^.\n]+\\).\\)"
! 					   limit 'move))
! 	      ;; Fold case straight away; `member-ignore-case' here wasteful.
! 	      (let ((x (downcase (match-string 1))))
! 	  	(if (member x seen)
! 	  	    (delete-region (match-beginning 0)
! 	  			   (progn (re-search-forward "^[^ \t]" nil t)
! 	  				  (match-beginning 0)))
! 	  	  (push x seen))))))))))

  ;; Note that on entry to this function the current-buffer must be the
  ;; *info* buffer; not the info tags buffer.
--- 1213,1232 ----
  	      (delete-region (1- (point)) (point))))

  	  ;; Now remove duplicate entries under the same heading.
! 	  (let (seen)
! 	    (save-restriction
! 	      (narrow-to-region start (point))
! 	      (goto-char (point-min))
! 	      (while (re-search-forward "^* \\([^:\n]+:\\(:\\|[^.\n]+\\).\\)" nil 'move)
! 		;; Fold case straight away; `member-ignore-case' here wasteful.
! 		(let ((x (downcase (match-string 1))))
! 		  (if (member x seen)
! 		      (delete-region
! 		       (match-beginning 0)
! 		       (if (re-search-forward "^[^ \t]" nil 'move)
! 			   (goto-char (match-beginning 0))
! 			 (point-max)))
! 		    (push x seen)))))))))))

  ;; Note that on entry to this function the current-buffer must be the
  ;; *info* buffer; not the info tags buffer.

This bug report was last modified 16 years and 258 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.