wolray / symbol-overlay

Highlight symbols with keymap-enabled overlays
346 stars 42 forks source link

symbol-overlay-jump-first/last does not work #111

Open andsunds opened 4 months ago

andsunds commented 4 months ago

The functions symbol-overlay-jump-first and symbol-overlay-jump-last do not seem to work for me in symbol-overlay-mode.

As far as I can tell this is caused when setting the before variable with (symbol-overlay-get-list -1 symbol) which returns nil, thus rendering the (count (length before)) to zero.

Changing the call to symbol-overlay-get-list to (symbol-overlay-get-list -1) seems to fix the issue. So my temporary work-around is to create the additional functions:

(defun symbol-overlay-mode-jump-first ()
  "Jump to the first location in symbol-overlay-mode."
  (interactive)
  (symbol-overlay-adjust-position)
  (let* ((before (symbol-overlay-get-list -1))
         (count (length before)))
    (symbol-overlay-jump-call #'symbol-overlay-basic-jump (- count))))

(defun symbol-overlay-mode-jump-last ()
  "Jump to the last location in symbol-overlay-mode."
  (interactive)
  (symbol-overlay-adjust-position)
  (let* ((after (symbol-overlay-get-list 1))
         (count (length after)))
    (symbol-overlay-jump-call #'symbol-overlay-basic-jump (- count 1))))