all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Info-isearch-skip-history
@ 2010-05-07 18:19 Juri Linkov
  2010-05-08 15:59 ` Info-isearch-skip-history Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2010-05-07 18:19 UTC (permalink / raw)
  To: emacs-devel

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/




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Info-isearch-skip-history
  2010-05-07 18:19 Info-isearch-skip-history Juri Linkov
@ 2010-05-08 15:59 ` Stefan Monnier
  2010-05-10 19:12   ` Info-isearch-skip-history Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2010-05-08 15:59 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel

> +(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)

I'm not sure this deserves a config var.  Just skip unconditionally.


        Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Info-isearch-skip-history
  2010-05-08 15:59 ` Info-isearch-skip-history Stefan Monnier
@ 2010-05-10 19:12   ` Juri Linkov
  2010-05-11  1:12     ` Info-isearch-skip-history Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2010-05-10 19:12 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

>> +(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)
>
> I'm not sure this deserves a config var.  Just skip unconditionally.

Agreed.  It was rather a "defensive" variable (just in case
somebody might want).  Now the patch is installed without it.

-- 
Juri Linkov
http://www.jurta.org/emacs/



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Info-isearch-skip-history
  2010-05-10 19:12   ` Info-isearch-skip-history Juri Linkov
@ 2010-05-11  1:12     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2010-05-11  1:12 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel

>> I'm not sure this deserves a config var.  Just skip unconditionally.
> Agreed.  It was rather a "defensive" variable (just in case
> somebody might want).  Now the patch is installed without it.

Thank you,


        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-11  1:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-07 18:19 Info-isearch-skip-history Juri Linkov
2010-05-08 15:59 ` Info-isearch-skip-history Stefan Monnier
2010-05-10 19:12   ` Info-isearch-skip-history Juri Linkov
2010-05-11  1:12     ` Info-isearch-skip-history Stefan Monnier

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.