Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect window-start with ivy-avy #1004

Closed
basil-conto opened this issue May 15, 2017 · 11 comments
Closed

Incorrect window-start with ivy-avy #1004

basil-conto opened this issue May 15, 2017 · 11 comments

Comments

@basil-conto
Copy link
Collaborator

@basil-conto basil-conto commented May 15, 2017

Steps to reproduce

  1. emacs -Q
  2. M-x package-initialize RET
  3. M-x ivy-mode RET
  4. M-: (ivy-read "Pick a number: " (mapcar #'number-to-string (number-sequence 0 (ash ivy-height 1)))) RET
  5. M->
  6. C-'
  7. Select candidate a
    • Expected result: "12"
    • Actual result: "0"

I believe I have narrowed the problem down to function window-start always returning 1, even when scrolled further down the candidate list. What I find peculiar is that window-end is always correct and (pos-visible-in-window-p (window-start) is always t. I have tried calling redisplay and calling window-end as (window-end nil t) before calling window-start but the result is always the same.

@abo-abo abo-abo closed this in 97e9205 May 16, 2017
@abo-abo
Copy link
Owner

@abo-abo abo-abo commented May 16, 2017

Thanks for catching this. Please test.

@basil-conto
Copy link
Collaborator Author

@basil-conto basil-conto commented May 21, 2017

Thank you for tending to this. I do not, however, think the problem is completely fixed. Although the correct candidate is selected now, the string returned by ivy-read includes the surrounding formatting context.

Adjusting my previous steps to reproduce:

  1. emacs -Q
  2. M-x package-initialize RET
  3. M-x ivy-mode RET
  4. M-: (setq ivy-format-function #'ivy-format-function-arrow) RET
  5. M-: (ivy-read "Pick a number: " (mapcar #'number-to-string (number-sequence 0 (ash ivy-height 1)))) RET
  6. M->
  7. C-'
  8. Select candidate a
    • Expected result: "12"
    • Actual result: " 12"
@abo-abo abo-abo reopened this May 22, 2017
@abo-abo
Copy link
Owner

@abo-abo abo-abo commented May 22, 2017

Reopening. PRs welcome.

@basil-conto
Copy link
Collaborator Author

@basil-conto basil-conto commented May 22, 2017

I'd like to investigate further but I don't expect to make much progress over the next month or two (I also need to submit a copyright assignment).

@abo-abo
Copy link
Owner

@abo-abo abo-abo commented May 22, 2017

No problem, take your time.

@suryaaditya
Copy link

@suryaaditya suryaaditya commented Jul 20, 2017

hi, not sure if this behavior observed is related to this issue:
Steps:

  1. counsel-find-file
  2. C-'(ivy-avy)
  3. instead of the opening the file selected, it tries to open a brand new buffer.

C-' (ivy-avy) works as expected on commands like Counsel-M-x though and also works as expected on command 'find-file' C-xC-f.

@ryankask
Copy link

@ryankask ryankask commented Jul 27, 2017

I'm seeing the same behaviour as @suryaaditya although it doesn't appear to work anywhere for me. For example, with counsel-M-x I see apply: Wrong type argument: commandp, \ \ apropos.

@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Jul 27, 2017

@suryaaditya Your example works fine on my system. Please try to reproduce with emacs -Q (or use make plain from this repo).

@ryankask
Copy link

@ryankask ryankask commented Aug 2, 2017

@abo-abo I've taken up your suggestion and can reproduce the issue with the following setting:

(setq ivy-format-function 'ivy-format-function-arrow)

@abo-abo abo-abo closed this in 75c873b Aug 2, 2017
@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Aug 2, 2017

@ryankask Thanks. It's easy to fix once it's reproducible.

@lljr
Copy link

@lljr lljr commented Feb 6, 2019

I'm having this issue with Emacs 26.1 on macOS mojave.

  1. Launch Emacs
  2. C-x C-f (counsel-find-file)
  3. Find-file: ~/.emacs.d/
  4. "l"
  5. opens Dired by name buffer on another random file.

Weird because I had no issues before but now start to have some.

(use-package avy
  :ensure t
  :bind ("M-s" . avy-goto-word-1))

(use-package counsel
  :ensure t
  :config
  (counsel-mode))

(use-package ivy
  :ensure t
  :bind (("C-c C-r" . ivy-resume)
	 :map ivy-minibuffer-map
	 ("C-'" . ivy-avy))
  :config
  (ivy-mode 1)
  (setq ivy-use-virtual-buffers t)
  (setq ivy-count-format "%d/%d ")
  (setq ivy-display-style 'fancy))

(use-package swiper
  :ensure t
  :after (ivy avy)
  :bind ("C-s" . swiper))

  (use-package ivy-rich
    :ensure t
    :after ivy
    :init
    (setq ivy-rich-path-style 'abbrev
	  ivy-virtual-abbreviate 'full)
    :config (ivy-rich-mode 1))
;;  Actions
  ;;;;;;;;;;;;;;;
  ;;;  delete files when perusing your file system
;; (ivy-set-actions
;;  'counsel-find-file
;;  '(("d" delete-file "delete")))

(defun dired-mode-setup ()
  "Hook for dired-mode."
  (dired-hide-details-mode 1))
(add-hook 'dired-mode-hook 'dired-mode-setup)

;; allow dired to delete or copy dir
(setq dired-recursive-copies (quote always)) ; “always” means no asking
(setq dired-recursive-deletes (quote top)) ; “top” means ask once

(setq dired-dwim-target t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants