emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/hyperdrive 590c4878c2 4/6: Fix: (hyperdrive-dir--entry-at-


From: ELPA Syncer
Subject: [nongnu] elpa/hyperdrive 590c4878c2 4/6: Fix: (hyperdrive-dir--entry-at-point) Handle empty hyperdrive
Date: Sat, 7 Oct 2023 01:00:59 -0400 (EDT)

branch: elpa/hyperdrive
commit 590c4878c2db9494384c6fed10fd1a5271ed1809
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>

    Fix: (hyperdrive-dir--entry-at-point) Handle empty hyperdrive
    
    Previously, this function signaled an error when the directory was
    empty, preventing hyperdrive-menu from opening.
---
 hyperdrive-dir.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/hyperdrive-dir.el b/hyperdrive-dir.el
index 356524ccfb..6154869685 100644
--- a/hyperdrive-dir.el
+++ b/hyperdrive-dir.el
@@ -215,12 +215,16 @@ To be used as the pretty-printer for `ewoc-create'."
 With point below last entry, returns nil.
 With point on header, returns directory entry."
   (let ((current-line (line-number-at-pos))
-        (last-line (line-number-at-pos (ewoc-location (ewoc-nth 
hyperdrive-ewoc -1)))))
-    (cond ((= 1 current-line)
+        (last-entry (ewoc-nth hyperdrive-ewoc -1)))
+    (cond ((or (not last-entry) (= 1 current-line))
+           ;; Hyperdrive is empty or point is on header line
            hyperdrive-current-entry)
-          ((or (> current-line last-line) (= 2 current-line))
+          ((or (> current-line (line-number-at-pos (ewoc-location last-entry)))
+               (= 2 current-line))
+           ;; Point is below the last entry or on column headers
            nil)
           (t
+           ;; Point on a file entry: return its entry.
            (ewoc-data (ewoc-locate hyperdrive-ewoc))))))
 
 ;;;; Mode



reply via email to

[Prev in Thread] Current Thread [Next in Thread]