abo-abo / swiper

Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!
https://oremacs.com/swiper/
2.3k stars 338 forks source link

pdf-annot-add-markup-annotation with ivy-mode on not working as expected #375

Closed ardpp closed 8 years ago

ardpp commented 8 years ago

I want to annotate a pdf-file using pdf-tools. One way to do that is to mark something in the file and call pdf-annot-add-markup-annotation Then completing read in the minibuffer is activated and one can choose between ‘squiggly’, ‘underline’, ‘strike-out’ or ‘highlight’.

When ivy-mode is disabled it does work as described above. With ivy-mode on there are no matches. In the minibuffer it says (1/0) Markup type (default highlight):

The same happens when I use hydra-pdftools. I don't know on which side (pdf-tools or ivy) the relevant things changed, but I'm pretty sure that it used to work.

abo-abo commented 8 years ago

It appears that pdf-annot-add-markup-annotation does not conform to the API standard in its use of compelting-read:

COLLECTION can be a list of strings, an alist, an obarray or a hash table. COLLECTION can also be a function to do the completion itself.

Here's the offending call:

(completing-read "Markup type (default highlight): "
                 '(squiggly highlight underline strike-out)
                 nil t)

Note that a list of symbols does not fall into any category mentioned in the documentation. Somehow, completing-read-default supports a list of symbols even though it's not documented.

I can add a work-around in ivy, but I also suggest a fix in pdf-tools.

ardpp commented 8 years ago

Thanks! I'll open an issue there and paste my question and parts of your answer.

ardpp commented 8 years ago

Just want to let you know that it has been also fixed on pdf-tools side.