Skip to content

Commit

Permalink
Ensure invisible spec in info buffers is inserted (#1503).
Browse files Browse the repository at this point in the history
* helm-info.el (helm-info-init): Do it.
  • Loading branch information
Thierry Volpiatto committed May 17, 2016
1 parent ec90fde commit fa9b3ac
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions helm-info.el
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,28 @@ files with `helm-info-at-point'."
(save-window-excursion
(info file)
(let ((tobuf (helm-candidate-buffer 'global))
(infobuf (current-buffer))
Info-history
start end)
start end line)
(cl-dolist (node (Info-index-nodes))
(Info-goto-node node)
(goto-char (point-min))
(while (search-forward "\n* " nil t)
(unless (search-forward "Menu:\n" (1+ (point-at-eol)) t)
(setq start (point-at-bol)
end (point-at-eol))
;; Fix issue #1503 by getting the invisible
;; info displayed on next line in long strings.
;; e.g "* Foo.\n (line 12)" instead of
;; "* Foo.(line 12)"
end (or (save-excursion
(goto-char (point-at-bol))
(re-search-forward "(line +[0-9]+)" nil t))
(point-at-eol))
;; Long string have a new line inserted before the
;; invisible spec, remove it.
line (replace-regexp-in-string
"\n" "" (buffer-substring start end)))
(with-current-buffer tobuf
(insert-buffer-substring infobuf start end)
(insert line)
(insert "\n")))))))))

(defun helm-info-goto (node-line)
Expand Down

0 comments on commit fa9b3ac

Please sign in to comment.