branch: externals/dicom
commit 7f36f2ae2c91b0d9c8de317e35830e44e7c93372
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>

    Improve dicom-next
---
 dicom.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dicom.el b/dicom.el
index 6b16b72935..b8b839c703 100644
--- a/dicom.el
+++ b/dicom.el
@@ -576,12 +576,14 @@ The command is specified as FMT string with ARGS."
                     (pt (next-single-property-change
                          (point) 'dicom--file nil (point-max))))
           (goto-char pt)
-          (cl-decf n))
+          (when (or (eobp) (get-text-property pt 'dicom--file))
+            (cl-decf n)))
       (while-let (((< n 0))
                   (pt (previous-single-property-change
                        (point) 'dicom--file nil (point-min))))
         (goto-char pt)
-        (cl-incf n)))
+        (when (or (bobp) (get-text-property pt 'dicom--file))
+          (cl-incf n))))
     (dicom-open
      (or (get-text-property (point) 'dicom--file)
          (user-error "DICOM: No image found")))))

Reply via email to