[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sesman 5a9727ee82 072/100: Expand all paths with file-true
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/sesman 5a9727ee82 072/100: Expand all paths with file-truename and cache |
Date: |
Tue, 28 Dec 2021 14:06:04 -0500 (EST) |
branch: elpa/sesman
commit 5a9727ee82a74035fa6aee1e4b94829bd4260f0c
Author: Vitalie Spinu <spinuvit@gmail.com>
Commit: Vitalie Spinu <spinuvit@gmail.com>
Expand all paths with file-truename and cache
fixes clojure-emacs/cider#2433
---
sesman.el | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/sesman.el b/sesman.el
index 9d8a86b1f0..42c5e617be 100644
--- a/sesman.el
+++ b/sesman.el
@@ -868,6 +868,13 @@ buffers."
;;; Contexts
+
+(defvar sesman--path-cache (make-hash-table :test #'equal))
+;; path caching because file-truename is very slow
+(defun sesman--expand-path (path)
+ (or (gethash path sesman--path-cache)
+ (puthash path (file-truename path) sesman--path-cache)))
+
(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)
@@ -875,7 +882,7 @@ buffers."
(current-buffer))
(cl-defmethod sesman-context ((_cxt-type (eql directory)) _system)
"Return current directory."
- default-directory)
+ (sesman--expand-path default-directory))
(cl-defmethod sesman-context ((_cxt-type (eql project)) system)
"Return current project."
(let ((proj (or
@@ -886,7 +893,7 @@ buffers."
;; all for now.
(vc-root-dir))))
(when proj
- (expand-file-name proj))))
+ (sesman--expand-path proj))))
(cl-defgeneric sesman-relevant-context-p (_cxt-type cxt)
"Non-nil if context CXT is relevant to current context of type CXT-TYPE.")
@@ -896,12 +903,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 "^" dir) (expand-file-name 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 "^" proj)
- (expand-file-name 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 ea2e4fa0fe 039/100: Propagate system through `sesman-context`, (continued)
- [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
- [nongnu] elpa/sesman 163984c60e 059/100: Better handling of overlays and sensor, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 6b0d6e318d 062/100: New UI and API functions sesman-link-with-least-specific and sesman-link-session, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 2b5135c00a 064/100: Version 0.2.1, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 209d9966e5 008/100: Renaming, refactoring ..., ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 665721c52f 066/100: Move context faces to sesman.el and use for info display, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 5a9727ee82 072/100: Expand all paths with file-truename and cache,
ELPA Syncer <=
- [nongnu] elpa/sesman 14475d8192 080/100: [Fix #10] Defalias sesman-link-session, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 53efa0a9ca 086/100: Honor sesman-follow-symlinks in path expansion and project lookup, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 04df98807f 070/100: Change font of sesman-buffer-face, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 7fe522431e 068/100: Expand file-name because the backend might not do it, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 35d6562ad8 006/100: Add more link specific utilities, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 0d8d1bef45 022/100: Version 0.1.1, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman e341db8d97 095/100: Update menu, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 0d3d016732 023/100: Add autoloads for user level commands, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 2e4205c7d9 046/100: Fix return value of sesman-grouped-links, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman ae68b3facf 042/100: [#8] Improve session "info" infrastructure, ELPA Syncer, 2021/12/28