Commit c47b5bbe authored by Dave Love's avatar Dave Love
Browse files

(Info-search): Don't lose with empty regexp.

parent 2f9e343b
......@@ -958,60 +958,61 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
(if (equal regexp "")
(setq regexp Info-last-search)
(setq Info-last-search regexp))
(let ((found ()) current
(onode Info-current-node)
(ofile Info-current-file)
(opoint (point))
(ostart (window-start))
(osubfile Info-current-subfile))
(save-excursion
(save-restriction
(widen)
(if (null Info-current-subfile)
(progn (re-search-forward regexp) (setq found (point)))
(condition-case err
(when regexp
(let ((found ()) current
(onode Info-current-node)
(ofile Info-current-file)
(opoint (point))
(ostart (window-start))
(osubfile Info-current-subfile))
(save-excursion
(save-restriction
(widen)
(if (null Info-current-subfile)
(progn (re-search-forward regexp) (setq found (point)))
(search-failed nil)))))
(if (not found) ;can only happen in subfile case -- else would have erred
(unwind-protect
(let ((list ()))
(save-excursion
(set-buffer (marker-buffer Info-tag-table-marker))
(goto-char (point-min))
(search-forward "\n\^_\nIndirect:")
(save-restriction
(narrow-to-region (point)
(progn (search-forward "\n\^_")
(1- (point))))
(condition-case err
(progn (re-search-forward regexp) (setq found (point)))
(search-failed nil)))))
(if (not found) ;can only happen in subfile case -- else would have erred
(unwind-protect
(let ((list ()))
(save-excursion
(set-buffer (marker-buffer Info-tag-table-marker))
(goto-char (point-min))
(search-forward (concat "\n" osubfile ": "))
(beginning-of-line)
(while (not (eobp))
(re-search-forward "\\(^.*\\): [0-9]+$")
(goto-char (+ (match-end 1) 2))
(setq list (cons (cons (read (current-buffer))
(buffer-substring
(match-beginning 1) (match-end 1)))
list))
(goto-char (1+ (match-end 0))))
(setq list (nreverse list)
current (car (car list))
list (cdr list))))
(while list
(message "Searching subfile %s..." (cdr (car list)))
(Info-read-subfile (car (car list)))
(setq list (cdr list))
;; (goto-char (point-min))
(if (re-search-forward regexp nil t)
(setq found (point) list ())))
(if found
(message "")
(signal 'search-failed (list regexp))))
(if (not found)
(progn (Info-read-subfile osubfile)
(goto-char opoint)
(Info-select-node)
(set-window-start (selected-window) ostart)))))
(search-forward "\n\^_\nIndirect:")
(save-restriction
(narrow-to-region (point)
(progn (search-forward "\n\^_")
(1- (point))))
(goto-char (point-min))
(search-forward (concat "\n" osubfile ": "))
(beginning-of-line)
(while (not (eobp))
(re-search-forward "\\(^.*\\): [0-9]+$")
(goto-char (+ (match-end 1) 2))
(setq list (cons (cons (read (current-buffer))
(buffer-substring
(match-beginning 1) (match-end 1)))
list))
(goto-char (1+ (match-end 0))))
(setq list (nreverse list)
current (car (car list))
list (cdr list))))
(while list
(message "Searching subfile %s..." (cdr (car list)))
(Info-read-subfile (car (car list)))
(setq list (cdr list))
;;; (goto-char (point-min))
(if (re-search-forward regexp nil t)
(setq found (point) list ())))
(if found
(message "")
(signal 'search-failed (list regexp))))
(if (not found)
(progn (Info-read-subfile osubfile)
(goto-char opoint)
(Info-select-node)
(set-window-start (selected-window) ostart)))))
(widen)
(goto-char found)
(Info-select-node)
......@@ -1019,7 +1020,7 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
(or (and (string-equal onode Info-current-node)
(equal ofile Info-current-file))
(setq Info-history (cons (list ofile onode opoint)
Info-history)))))
Info-history))))))
;; Extract the value of the node-pointer named NAME.
;; If there is none, use ERRORNAME in the error message;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment