branch: elpa/hyperdrive commit 590c4878c2db9494384c6fed10fd1a5271ed1809 Author: Joseph Turner <jos...@ushin.org> Commit: Joseph Turner <jos...@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