[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/helm 948cb1a455 3/4: Add an optional arg to helm-basedir
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/helm 948cb1a455 3/4: Add an optional arg to helm-basedir |
Date: |
Mon, 4 Jul 2022 14:58:37 -0400 (EDT) |
branch: elpa/helm
commit 948cb1a455990b498283d5b928720a2260885b9d
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Add an optional arg to helm-basedir
---
helm-lib.el | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/helm-lib.el b/helm-lib.el
index d337a46730..d8844338ad 100644
--- a/helm-lib.el
+++ b/helm-lib.el
@@ -1432,11 +1432,16 @@ unconditionally."
(file-name-sans-extension (file-name-nondirectory fname))
(file-name-nondirectory (directory-file-name fname)))))
-(defun helm-basedir (fname)
- "Return the base directory of filename ending by a slash."
+(defun helm-basedir (fname &optional parent)
+ "Return the base directory of filename ending by a slash.
+If PARENT is specified and FNAME is a directory return the parent
+directory of FNAME."
(helm-aif (and fname
(or (and (string= fname "~") "~")
- (file-name-directory fname)))
+ (file-name-directory
+ (if parent
+ (directory-file-name fname)
+ fname))))
(file-name-as-directory it)))
(defun helm-current-directory ()