[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole 76f8bd05f4 3/3: hpath:substitute-dir - Accoun
From: |
ELPA Syncer |
Subject: |
[elpa] externals/hyperbole 76f8bd05f4 3/3: hpath:substitute-dir - Account for when "./" or "../" is removed from 'rest-of-path' |
Date: |
Sun, 2 Jan 2022 10:57:34 -0500 (EST) |
branch: externals/hyperbole
commit 76f8bd05f407ff891f3d9c1a359036cdd5031d11
Author: Robert Weiner <rsw@gnu.org>
Commit: Robert Weiner <rsw@gnu.org>
hpath:substitute-dir - Account for when "./" or "../" is removed from
'rest-of-path'
---
ChangeLog | 3 ++-
hpath.el | 7 ++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7b215af1b6..0116a986c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,7 +10,8 @@
* hpath.el (hpath:substitute-dir): Fix to handle when part of the directory is
included in 'rest-of-path' in which case only the preceding part of the dir
- should be returned.
+ should be returned. Also, account for when "./" or "../" is removed from
+ 'rest-of-path', thereby lengthening the directory to return.
2021-12-31 Mats Lidell <matsl@gnu.org>
diff --git a/hpath.el b/hpath.el
index 1b8703725e..a0d1e04bcd 100644
--- a/hpath.el
+++ b/hpath.el
@@ -2164,7 +2164,12 @@ local pathname."
hpath:suffixes))))
(dir (when path
(substring path 0 (- (+ (length rest-of-path)
- (if suffix-added (length
suffix-added) 0)))))))
+ (if (string-match
"\\`\\.+[\\/]" rest-of-path)
+ (- (length (match-string 0
rest-of-path)))
+ 0)
+ (if suffix-added
+ (length suffix-added)
+ 0)))))))
(if dir
(directory-file-name dir)
(error "(hpath:substitute-dir): Can't find match for \"%s\""