emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/sesman ea2e4fa0fe 039/100: Propagate system through `sesma


From: ELPA Syncer
Subject: [nongnu] elpa/sesman ea2e4fa0fe 039/100: Propagate system through `sesman-context`
Date: Tue, 28 Dec 2021 14:06:00 -0500 (EST)

branch: elpa/sesman
commit ea2e4fa0fe5431c463fce1f6db7ba925bccea38c
Author: Vitalie Spinu <spinuvit@gmail.com>
Commit: Vitalie Spinu <spinuvit@gmail.com>

    Propagate system through `sesman-context`
---
 sesman.el | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/sesman.el b/sesman.el
index fbc37a558b..be7835f178 100644
--- a/sesman.el
+++ b/sesman.el
@@ -113,10 +113,10 @@ Can be either a symbol, or a function returning a 
symbol.")
          (cxt-val (or cxt-val
                       (sesman--expand-path-maybe
                        (or (if cxt-type
-                               (sesman-context cxt-type)
+                               (sesman-context cxt-type system)
                              ;; use the lest specific context-type available
                              (seq-some (lambda (ctype)
-                                         (let ((val (sesman-context ctype)))
+                                         (let ((val (sesman-context ctype 
system)))
                                            (setq cxt-type ctype)
                                            val))
                                        (reverse (sesman-context-types 
system))))
@@ -142,7 +142,7 @@ Can be either a symbol, or a function returning a symbol.")
                             system
                             (format "Link with %s %s: "
                                     cxt-name (sesman--abbrev-path-maybe
-                                              (sesman-context cxt-type)))
+                                              (sesman-context cxt-type 
system)))
                             (sesman--all-system-sessions system)
                             'ask-new))))
           (sesman--link-session system session cxt-type cxt-value))
@@ -639,7 +639,8 @@ connection initializers (\"run-xyz\", \"xyz-jack-in\" 
etc.)."
          (ses-name0 (car session))
          (i 1))
     (while (sesman-session system ses-name)
-      (setq ses-name (format "%s#%d" ses-name0 i)))
+      (setq ses-name (format "%s#%d" ses-name0 i)
+            i (1+ i)))
     (setq session (cons ses-name (cdr session)))
     (puthash (cons system ses-name) session sesman-sessions-hashmap)
     (sesman--link-session system session)
@@ -725,18 +726,18 @@ buffers."
 
 
 ;;; Contexts
-(cl-defgeneric sesman-context (_cxt-type)
+(cl-defgeneric sesman-context (_cxt-type _system)
   "Given context type CXT-TYPE return the context.")
-(cl-defmethod sesman-context ((_cxt-type (eql buffer)))
+(cl-defmethod sesman-context ((_cxt-type (eql buffer)) _system)
   "Return current buffer."
   (current-buffer))
-(cl-defmethod sesman-context ((_cxt-type (eql directory)))
+(cl-defmethod sesman-context ((_cxt-type (eql directory)) _system)
   "Return current directory."
   default-directory)
-(cl-defmethod sesman-context ((_cxt-type (eql project)))
+(cl-defmethod sesman-context ((_cxt-type (eql project)) system)
   "Return current project."
   (or
-   (sesman-project (sesman--system))
+   (sesman-project (or system (sesman--system)))
    ;; Normally we would use (project-roots (project-current)) but currently
    ;; project-roots fails on nil and doesn't work on custom `('foo .
    ;; "path/to/project"). So, use vc as a fallback and don't use project.el at



reply via email to

[Prev in Thread] Current Thread [Next in Thread]