GithubHelp home page GithubHelp logo

avy-goto-line with numbers about avy HOT 4 CLOSED

abo-abo avatar abo-abo commented on July 22, 2024
avy-goto-line with numbers

from avy.

Comments (4)

abo-abo avatar abo-abo commented on July 22, 2024

Did you customize avy-keys? 49 aka ?1 must not be in avy-keys.

from avy.

DamienCassou avatar DamienCassou commented on July 22, 2024

avy-keys's value is (97 115 100 102 106 107 108 59 32)

so, no.

from avy.

abo-abo avatar abo-abo commented on July 22, 2024

Strange. What's your Emacs version?

The code looks like this:

(let ((avy-handler-function
       (lambda (char)
         (if (or (< char ?0)
                 (> char ?9))
             (avy-handler-default char)
           (let ((line (read-from-minibuffer
                        "Goto line: " (string char))))
             (when line
               (goto-char (point-min))
               (forward-line (1- (string-to-number line)))
               (throw 'done 'exit)))))))
  (avy--goto (avy--line arg)))

Maybe you could extract it like so:

(defun avy--handler-line (char)
  (if (or (< char ?0)
          (> char ?9))
      (avy-handler-default char)
    (let ((line (read-from-minibuffer
                 "Goto line: " (string char))))
      (when line
        (goto-char (point-min))
        (forward-line (1- (string-to-number line)))
        (throw 'done 'exit)))))

(defun avy-goto-line (&optional arg)
  "Jump to a line start in current buffer.
The window scope is determined by `avy-all-windows' (ARG negates it)."
  (interactive "P")
  (avy--with-avy-keys avy-goto-line
    (let ((avy-handler-function #'avy--handler-line))
      (avy--goto (avy--line arg)))))

Then edebug avy--handler-line to see what's happening.

from avy.

DamienCassou avatar DamienCassou commented on July 22, 2024

Without changing anything it now works fine. I will reopen if I can reproduce.

from avy.

Related Issues (20)

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.