From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Info-isearch-skip-history Date: Fri, 07 May 2010 21:19:12 +0300 Organization: JURTA Message-ID: <87ocgr90mm.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1273256938 24093 80.91.229.12 (7 May 2010 18:28:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 7 May 2010 18:28:58 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 07 20:28:56 2010 connect(): No such file or directory Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OASIB-00037i-Op for ged-emacs-devel@m.gmane.org; Fri, 07 May 2010 20:28:56 +0200 Original-Received: from localhost ([127.0.0.1]:37755 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OASIA-0006Xj-UU for ged-emacs-devel@m.gmane.org; Fri, 07 May 2010 14:28:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OASI5-0006Vt-KW for emacs-devel@gnu.org; Fri, 07 May 2010 14:28:49 -0400 Original-Received: from [140.186.70.92] (port=56850 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OASI4-0006Un-6p for emacs-devel@gnu.org; Fri, 07 May 2010 14:28:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OASI1-0007sV-AQ for emacs-devel@gnu.org; Fri, 07 May 2010 14:28:48 -0400 Original-Received: from smtp-out1.starman.ee ([85.253.0.3]:49617 helo=mx1.starman.ee) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OASI1-0007sL-0O for emacs-devel@gnu.org; Fri, 07 May 2010 14:28:45 -0400 X-Virus-Scanned: by Amavisd-New at mx1.starman.ee Original-Received: from mail.starman.ee (62.65.209.247.cable.starman.ee [62.65.209.247]) by mx1.starman.ee (Postfix) with ESMTP id 5141A3F41E6 for ; Fri, 7 May 2010 21:28:40 +0300 (EEST) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:124620 Archived-At: Isearch in Info encumbers the Info history with unnecessary nodes visited while searching. This new option allows to add only the last node to the history: === modified file 'lisp/info.el' --- lisp/info.el 2010-05-05 21:56:15 +0000 +++ lisp/info.el 2010-05-07 18:18:01 +0000 @@ -265,7 +265,18 @@ (defcustom Info-isearch-search t :type 'boolean :group 'info) +(defcustom Info-isearch-skip-history nil + "If non-nil, Isearch in Info doesn't add intermediate nodes to the history. +During Isearch Info visits nodes with matches. All nodes visited while +searching are recorded in the Info history. However, when this variable is +non-nil, only the last node (where Isearch ended) is added to the history." + :version "24.1" + :type 'boolean + :group 'info) + (defvar Info-isearch-initial-node nil) +(defvar Info-isearch-orig-history nil) +(defvar Info-isearch-orig-history-list nil) (defcustom Info-mode-hook ;; Try to obey obsolete Info-fontify settings. @@ -1914,7 +1925,27 @@ (defun Info-isearch-start () (setq Info-isearch-initial-node ;; Don't stop at initial node for nonincremental search. ;; Otherwise this variable is set after first search failure. - (and isearch-nonincremental Info-current-node))) + (and isearch-nonincremental Info-current-node)) + (when Info-isearch-skip-history + (setq Info-isearch-orig-history Info-history + Info-isearch-orig-history-list Info-history-list) + (add-hook 'isearch-mode-end-hook 'Info-isearch-end nil t))) + +(defun Info-isearch-end () + (when Info-isearch-skip-history + (if (> (length Info-history) + (length Info-isearch-orig-history)) + (setq Info-history + (nthcdr (- (length Info-history) + (length Info-isearch-orig-history) + 1) + Info-history))) + (if (> (length Info-history-list) + (length Info-isearch-orig-history-list)) + (setq Info-history-list + (cons (car Info-history-list) + Info-isearch-orig-history-list)))) + (remove-hook 'isearch-mode-end-hook 'Info-isearch-end t)) (defun Info-isearch-filter (beg-found found) "Test whether the current search hit is a visible useful text. -- Juri Linkov http://www.jurta.org/emacs/