Git Product home page Git Product logo

Comments (1)

orgtre avatar orgtre commented on August 23, 2024

Thanks for reporting this! I can reproduce this bug. In general, to debug an error it is helpful to enable debug on error by running M-x toggle-debug-on-error before doing whatever causes the error and then reporting the contents of the *Backtrace* buffer.

The error message means that the function nth expected a number but wrongly received nil instead. The *Backtrace* shows at which call to nth the error happens. The problem is that pdf-keynav adds advice to pdf-annot-add-markup-annotation to ensure that the cursor is displayed again after markup is added. With (setq pdf-annot-activate-created-annotations t), however, pdf-annot-add-markup-annotation activates a new buffer for the annotation, while pdf-keynav-after-markup-advice assumes that the active buffer is still the pdf buffer.

One workaround is to not use (setq pdf-annot-activate-created-annotations t) and instead just press enter after adding an annotation to activate it.

Another workaround (for now) is to overwrite pdf-keynav-after-markup-advice, for example by adding the following to your :config block of (use-package pdf-tools..:

(defun pdf-keynav-after-markup-advice (&rest _arg)
  "Deactivate region and display cursor."
  (when (equal major-mode 'pdf-view-mode)
    (when pdf-keynav-transient-mark-mode
      (setq pdf-keynav-mark-active-p nil))
    (pdf-keynav-display-region-cursor)))

so that it only tries to display the cursor when in a buffer in pdf-view-mode.

A more general bug is that after one edits the text of an annotation, the cursor is gone. A workaround is to add this:

(advice-add 'pdf-annot-edit-contents-finalize :after
	    #'pdf-keynav-after-markup-advice)

But this also displays the cursor in some situations where one might want it.

I'll close this issue once I've pushed a more permanent fix.

from pdf-tools.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.