[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sesman 2a1a9a4ccf 087/100: Promote sesman-expand-path into
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/sesman 2a1a9a4ccf 087/100: Promote sesman-expand-path into public API |
Date: |
Tue, 28 Dec 2021 14:06:05 -0500 (EST) |
branch: elpa/sesman
commit 2a1a9a4ccfd88127e13f2655ac130c82fe84f2f7
Author: Vitalie Spinu <spinuvit@gmail.com>
Commit: Vitalie Spinu <spinuvit@gmail.com>
Promote sesman-expand-path into public API
---
sesman-test.el | 8 ++++----
sesman.el | 24 +++++++++++++-----------
2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/sesman-test.el b/sesman-test.el
index d6ca445b8a..0a0c63c74f 100644
--- a/sesman-test.el
+++ b/sesman-test.el
@@ -260,19 +260,19 @@
(let ((sesman-follow-symlinks nil)
(vc-follow-symlinks t))
- (should (equal (sesman--expand-path dir1-link)
+ (should (equal (sesman-expand-path dir1-link)
dir1-link)))
(let ((sesman-follow-symlinks t)
(vc-follow-symlinks nil))
- (should (equal (sesman--expand-path dir1-link)
+ (should (equal (sesman-expand-path dir1-link)
dir1)))
(let ((sesman-follow-symlinks 'vc)
(vc-follow-symlinks t))
- (should (equal (sesman--expand-path dir1-link)
+ (should (equal (sesman-expand-path dir1-link)
dir1)))
(let ((sesman-follow-symlinks 'vc)
(vc-follow-symlinks nil))
- (should (equal (sesman--expand-path dir1-link)
+ (should (equal (sesman-expand-path dir1-link)
dir1-link)))
(let ((sesman-follow-symlinks nil)
diff --git a/sesman.el b/sesman.el
index e426860e9b..875f2dda73 100644
--- a/sesman.el
+++ b/sesman.el
@@ -921,13 +921,12 @@ buffers."
-1)))
(buffer-list)))))
-
-
-;;; Contexts
-
;; path caching because file-truename is very slow
(defvar sesman--path-cache (make-hash-table :test #'equal))
-(defun sesman--expand-path (path)
+(defun sesman-expand-path (path)
+ "Expand PATH with optionally follow symlinks.
+Whether symlinks are followed is controlled by `sesman-follow-symlinks' custom
+variable."
(if sesman-follow-symlinks
(let ((true-name (or (gethash path sesman--path-cache)
(puthash path (file-truename path)
sesman--path-cache))))
@@ -938,6 +937,9 @@ buffers."
(expand-file-name path)))
(expand-file-name path)))
+
+;;; Contexts
+
(cl-defgeneric sesman-context (_cxt-type _system)
"Given SYSTEM and context type CXT-TYPE return the context.")
(cl-defmethod sesman-context ((_cxt-type (eql buffer)) _system)
@@ -945,10 +947,10 @@ buffers."
(current-buffer))
(cl-defmethod sesman-context ((_cxt-type (eql directory)) _system)
"Return current directory."
- (sesman--expand-path default-directory))
+ (sesman-expand-path default-directory))
(cl-defmethod sesman-context ((_cxt-type (eql project)) system)
"Return current project."
- (let* ((default-directory (sesman--expand-path default-directory))
+ (let* ((default-directory (sesman-expand-path default-directory))
(proj (or
(sesman-project (or system (sesman--system)))
;; Normally we would use (project-roots (project-current)) but
currently
@@ -968,13 +970,13 @@ buffers."
(cl-defmethod sesman-relevant-context-p ((_cxt-type (eql directory)) dir)
"Non-nil if DIR is the parent or equals the `default-directory'."
(when (and dir default-directory)
- (string-match-p (concat "^" (sesman--expand-path dir))
- (sesman--expand-path default-directory))))
+ (string-match-p (concat "^" (sesman-expand-path dir))
+ (sesman-expand-path default-directory))))
(cl-defmethod sesman-relevant-context-p ((_cxt-type (eql project)) proj)
"Non-nil if PROJ is the parent or equal to the `default-directory'."
(when (and proj default-directory)
- (string-match-p (concat "^" (sesman--expand-path proj))
- (sesman--expand-path default-directory))))
+ (string-match-p (concat "^" (sesman-expand-path proj))
+ (sesman-expand-path default-directory))))
(defun sesman-relevant-link-p (link &optional cxt-types)
"Return non-nil if LINK is relevant to the current context.
- [nongnu] elpa/sesman df5a081689 029/100: Fix a fixme :-), (continued)
- [nongnu] elpa/sesman df5a081689 029/100: Fix a fixme :-), ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 5fc5934b5f 044/100: Extend semantics of 'which' argument in interactive commands, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman b8a1cdd20e 056/100: Add lint target for convenience, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 779c034180 082/100: Update doc of the sesman-project generic, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 81a2136489 078/100: New SORT argument to sesman-current-links, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 083cf73f3f 079/100: Version 0.3.2, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 1a6c5448cb 081/100: Don't use deleted sesman-connected-p, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 3a08e3e7de 085/100: Bump dev version, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 9c921699ce 090/100: Use elipsis instead of %%s for the common session name, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 90974f9fcf 092/100: Update README: sesman-kill* -> sesman-quit*, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 2a1a9a4ccf 087/100: Promote sesman-expand-path into public API,
ELPA Syncer <=
- [nongnu] elpa/sesman e8bfb0e379 091/100: Convert buffers to strings during formatting, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman fe92090cb6 099/100: Reformulate sesman-unlink docs, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 16fb6eca09 016/100: Fix package-lint issues, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman cdb8e0973a 018/100: Port back from CIDER, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman d8f293ff6e 024/100: Fix MELPA badge link, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman ea2e4fa0fe 039/100: Propagate system through `sesman-context`, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 47678331da 051/100: New semantics of sesman-session-info generic, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 5a11793697 054/100: Fix tests and checkdoc, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 34521cd5c2 049/100: Fix buffer lookup, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 3df33018f1 089/100: Strip trailing slash in `sesman-expand-path`, ELPA Syncer, 2021/12/28