emacsorphanage / helm-swoop

Efficiently hopping squeezed lines powered by Emacs helm interface
GNU General Public License v3.0
689 stars 55 forks source link

`helm-multi-swoop-all' throws error from `recenter' #70

Closed cosmicexplorer closed 9 years ago

cosmicexplorer commented 9 years ago

When running helm-multi-swoop-all and pressing up/down to move over the results, recenter (called from within the defsubst helm-swoop--recenter) throws an error when switching from a result from one buffer to another, which is easily ignored, but if debug-on-error is set to t, it's not and freezes emacs up for a minute or so.

I've been able to reproduce this on an empty emacs installation by running: emacs --no-init, then (package-initialize), (require 'helm) and (require 'helm-swoop), then using M-x helm-multi-swoop-all. When pressing up or down to iterate over the results of the swoop, no errors occur, but when pressing up or down changes the buffer that the result is in, `recenter'ing a window that does not display current-buffer. shows up.

I've made a pull request that fixes this issue, which I will upload immediately.

ShingoFukuyama commented 9 years ago

Thank you for the pull request, but it looks like your fix disables recenter functionality, and the error might specific to v24.4.50 on TTY.

Could you try below and the error still occurs?

(defun helm-multi-swoop--move-line-action ()
  (with-helm-window
    (let* (($key (buffer-substring (point-at-bol) (point-at-eol)))
           ($num (when (string-match "^[0-9]+" $key)
                   (string-to-number (match-string 0 $key))))
           ($source (helm-get-current-source))
           ($buf (get-buffer (assoc-default 'name $source))))
      ;; Synchronizing line position
      (with-selected-window helm-swoop-synchronizing-window
        (with-current-buffer $buf
          (when (not (eq $buf helm-multi-swoop-move-line-action-last-buffer))
            (set-window-buffer nil $buf)
            (helm-swoop--pattern-match))
          (helm-swoop--goto-line $num)
          (helm-multi-swoop--overlay-move $buf)
          (helm-swoop--recenter)) ;; <- here 
        (setq helm-multi-swoop-move-line-action-last-buffer $buf))
      (setq helm-swoop-last-line-info (cons $buf $num)))))
cosmicexplorer commented 9 years ago

Replacing the function with the code you've provided seems to still fix it; I don't see errors anymore when switching the file multi swoop is focused on.

Why would the error be specific to that version? I'm running version 25 in graphical mode (as an X window) from git. I tried compiling earlier releases, but they didn't support parts of helm so I couldn't test that.

ShingoFukuyama commented 9 years ago

Thank you for checking the code. I've updated to fix `recenter'ing error. The tty thing was my misunderstanding from similar error fixed before.