abo-abo / avy

Jump to things in Emacs tree-style
1.71k stars 109 forks source link

Make line deletion not remove letters in avy-linum-mode #305

Open xcapegoat opened 4 years ago

xcapegoat commented 4 years ago

I have a column of single digit letters so all I have to do is press prefix:key to goto a line, without any other thought process. The user lane-s described this approach well. But when deleting lines, the letters assigned there are replaced by letters representing lines below, as the lines move up, leaving a space at the bottom.

E.g. if we suppose g is the last letter, when I delete the line of character d from here:

a b c d e f g

I'm left with:

a b c e f

So the d and the g is gone.

Is it possible to make the line characters static/unchanging? My key list fills the height of the whole window (fortunately I use small monitor with large font), so I don't want it to change, except for some characters not to be visible if I make the window smaller.

In case it is the issue, my avy config section:

(use-package avy
  :ensure t
  :config
  (setq avy-all-windows nil)
  (setq avy-keys '(?q ?w ?e ?r ?t ?y ?u ?i ?o ?p ?a ?s ?d ?f ?g ?h ?j ?k ?l ?z ?x ?c ?v ?b ?n ?m ?1 ?2))
  (avy-linum-mode)
  :general
  (:states '(normal motion visual)
  "SPC" 'avy-goto-line))
abo-abo commented 4 years ago

Is it possible to make the line characters static/unchanging?

I don't think it's useful to do so. avy-linum-mode reflects the lines avy-goto-line can go to. If the buffer has 10 lines, I don't think it makes sense to pretend it has 20.

xcapegoat commented 4 years ago

If the buffer has 10 lines, I don't think it makes sense to pretend it has 20.

I see your point.

The issue is avy characters are not assigned to "new" lines (lines replacing empty spaces left by deletion). There is no update, as there surely is in the normal line mode when you are activating it each time.

Supposing that the object of linum mode is to retain a constantly visible list, could it be possible to reset the list when lines are deleted? (Edit: I'm very new to emacs by the way)

Thanks by the way, for creating and sharing this.

Your mode is a lot better for me because, due to eye strain I use a space-limited eink screen, and with your mode I can limit it to one character (unlike with emacs line-number-mode, where the current line number is potentially wider)