Closed stsquad closed 10 years ago
This change fixed it but I'm not quite sure what the function was trying to achieve:
(defun helm-swoop--keep-nearest-position ()
(with-helm-window
(let (($p (point-min)) $list $bound
$nearest-line $target-point
($buf (buffer-name (car helm-swoop-last-line-info))))
(save-excursion
(goto-char $p)
(while (if $p (setq $p (re-search-forward (concat "^"
(rx-to-string $buf t) "$") nil t)))
(when (get-text-property (point-at-bol) 'helm-header)
(forward-char 1)
(setq $bound (next-single-property-change (point) 'helm-header))
(while (re-search-forward "^[0-9]+" $bound t)
(setq $list (cons
(string-to-number (match-string 0))
$list)))
(setq $nearest-line (helm-swoop--nearest-line
(cdr helm-swoop-last-line-info)
$list))
(goto-char $p)
(re-search-forward (concat "^"
(number-to-string $nearest-line)
"\\s-") $bound t)
(setq $target-point (point))
(setq $p nil))))
(when $target-point
(goto-char $target-point)
(helm-mark-current-line)
(if (equal helm-swoop-buffer (buffer-name (current-buffer)))
(helm-swoop--move-line-action)
(helm-multi-swoop--move-line-action))))))
Thank you @stsquad, rx-to-string
is what it needs to!
When I active helm-swoop in my mu4e:compose window I get the following reported:
Looking at the code:
I think the re-search-forward is going to break if the buffer name contains any special characters, which in my case it does as it's: