[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/hyperdrive a4c847b5a7: Fix: (h/dir--entry-at-point) Return
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/hyperdrive a4c847b5a7: Fix: (h/dir--entry-at-point) Return nil when hyperdrive is empty |
Date: |
Fri, 27 Sep 2024 04:00:25 -0400 (EDT) |
branch: elpa/hyperdrive
commit a4c847b5a7e13eb8f8e1481e6ff499e1310f9539
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>
Fix: (h/dir--entry-at-point) Return nil when hyperdrive is empty
Previously, when the hyperdrive was empty and point was below the
column headers, h/dir--entry-at-point returned
hyperdrive-current-entry. Now, hyperdrive-current-entry is only
returned when point is on the column header.
---
hyperdrive-dir.el | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/hyperdrive-dir.el b/hyperdrive-dir.el
index 42cbe790ba..a0181a74d6 100644
--- a/hyperdrive-dir.el
+++ b/hyperdrive-dir.el
@@ -224,21 +224,20 @@ To be used as the pretty-printer for `ewoc-create'."
(defun h/dir--entry-at-point (&optional no-error)
"Return entry at point.
-With point on header, returns directory entry.
-With point below last entry or on column headers, signal error.
-With non-nil NO-ERROR, return nil in that case."
+With point on header, returns directory entry. If directory ewoc
+is empty, or point is below last entry or on column headers,
+signal error. With non-nil NO-ERROR, return nil in that case."
(let ((current-line (line-number-at-pos))
(last-entry (ewoc-nth h/ewoc -1)))
- (cond ((or (not last-entry) (= 1 current-line))
- ;; Hyperdrive is empty or point is on header line
+ (cond ((= 1 current-line) ; Point is on header line.
h/current-entry)
- ((or (> current-line (line-number-at-pos (ewoc-location last-entry)))
+ ((or (not last-entry)
+ (> current-line (line-number-at-pos (ewoc-location last-entry)))
(= 2 current-line))
- ;; Point is below the last entry or on column headers
+ ;; Ewoc is empty, or point is below last entry or on column headers.
(unless no-error
(h/user-error "No file/directory at point")))
- (t
- ;; Point on a file entry: return its entry.
+ (t ; Point on a file entry: return its entry.
(ewoc-data (ewoc-locate h/ewoc))))))
;;;; Mode
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/hyperdrive a4c847b5a7: Fix: (h/dir--entry-at-point) Return nil when hyperdrive is empty,
ELPA Syncer <=