[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sesman 27bd3bf457 020/100: Remove disambiguation defcustom
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/sesman 27bd3bf457 020/100: Remove disambiguation defcustom and simplify sesman-ensure-linked-session |
Date: |
Tue, 28 Dec 2021 14:05:59 -0500 (EST) |
branch: elpa/sesman
commit 27bd3bf4575f09417c7353f0c1b1788f050aee20
Author: Vitalie Spinu <spinuvit@gmail.com>
Commit: Vitalie Spinu <spinuvit@gmail.com>
Remove disambiguation defcustom and simplify sesman-ensure-linked-session
---
README.md | 2 +-
sesman.el | 42 +++++++++++++-----------------------------
2 files changed, 14 insertions(+), 30 deletions(-)
diff --git a/README.md b/README.md
index c6db29d8f8..4ad1bdb730 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ Consists of
- lifecycle management commands (`sesman-start`, `sesman-kill` and
`sesman-restart`), and
- association management commands (`sesman-link-with-buffer`,
`sesman-link-with-directory`, `sesman-link-with-project` and `sesman-unlink`).
-From the user's prospective the work-flow is as follow. Start a session,
either with `sesman-start` (`C-c C-s C-s`) or some of the system specific
commands (`run-xyz`, `xyz-jack-in` etc). On startup each session is
automatically associated with the least specific context (commonly a project).
In the most common case the user has only one session open per project. In such
case, no ambiguity arises when a system retrieves the current session. If
multiple sessions are associated with the cu [...]
+From the user's prospective the work-flow is as follow. Start a session,
either with `sesman-start` (`C-c C-s C-s`) or some of the system specific
commands (`run-xyz`, `xyz-jack-in` etc). On startup each session is
automatically associated with the least specific context (commonly a project).
In the most common case the user has only one session open per project. In such
case, no ambiguity arises when a system retrieves the current session. If
multiple sessions are associated with the cu [...]
By default links with projects and directories are many-to-many in the sense
that any session can be linked to multiple context and each context can be
associated with multiple sessions. Buffers instead are 1-to-many. One buffer
can be associated with only one session and a session can be associated with
multiple buffers. This behavior is controlled by a custom
`sesman-single-link-context-types`.
diff --git a/sesman.el b/sesman.el
index c0d5c44b93..9fe6cc5ae7 100644
--- a/sesman.el
+++ b/sesman.el
@@ -49,14 +49,14 @@
:prefix "sesman-"
:group 'tools)
-(defcustom sesman-disambiguate-by-relevance t
- "If t choose most relevant session in ambiguous situations, otherwise ask.
-Ambiguity arises when multiple sessions are associated with current context.
By
-default only projects could be associated with multiple sessions. See
-`sesman-single-link-contexts' in order to change that. Relevance is decided by
-system's implementation, see `sesman-more-relevant-p'."
- :group 'sesman
- :type 'boolean)
+;; (defcustom sesman-disambiguate-by-relevance t
+;; "If t choose most relevant session in ambiguous situations, otherwise ask.
+;; Ambiguity arises when multiple sessions are associated with current
context. By
+;; default only projects could be associated with multiple sessions. See
+;; `sesman-single-link-contexts' in order to change that. Relevance is
decided by
+;; system's implementation, see `sesman-more-relevant-p'."
+;; :group 'sesman
+;; :type 'boolean)
(defcustom sesman-single-link-context-types '(buffer)
"List of context types to which at most one session can be linked."
@@ -508,28 +508,12 @@ list returned from `sesman-context-types'."
(gethash (car assoc) sesman-sessions-hashmap))
(sesman-current-links system cxt-types))))
-(defun sesman-ensure-linked-session (system &optional prompt ask-new ask-all)
+(defun sesman-ensure-linked-session (system)
"Ensure that at least one SYSTEM session is linked to the current context.
-If there is an unambiguous link in place, return that session, otherwise
-ask for a session with PROMPT. ASK-NEW and ASK-ALL have an effect only when
-there are multiple associations and `sesman-disambiguate-by-relevance' is
-nil, in which case ASK-NEW and ASK-ALL are passed directly to
-`sesman-ask-for-session'."
- (let ((prompt (or prompt (format "%s session: " (sesman--cap-system-name
system))))
- (sessions (sesman-linked-sessions system)))
- (cond
- ;; 0. No sessions; throw
- ((null sessions)
- (user-error "No linked %s sessions in current context" system))
- ;; 1. Single association, or auto-disambiguate; return first
- ((or sesman-disambiguate-by-relevance
- (eq (length sessions) 1))
- (if ask-all
- sessions
- (car sessions)))
- ;; 2. Multiple ambiguous associations; ask
- (sessions
- (sesman-ask-for-session system prompt sessions ask-new ask-all)))))
+If there is at least one linked session, return the most relevant session.
+Otherwise throw an error."
+ (or (car (sesman-linked-sessions system))
+ (user-error "No %s sessions linked to current context" system)))
(defun sesman-session-links (system session &optional as-string)
"Retrieve all links for SYSTEM's SESSION from the global `SESSION-LINKS'.
- [nongnu] elpa/sesman 563ebeaafb 098/100: Fix broken link in README.md, (continued)
- [nongnu] elpa/sesman 563ebeaafb 098/100: Fix broken link in README.md, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 26931e1e64 094/100: Add menu for browser, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman b16ba94386 097/100: Make sesman-unlink to take optional LINKS argument (#22), ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman e0f555f963 100/100: Rename sesman-get-system and defalias sesman--system, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 37b9b50f8f 014/100: Get rid of -get- qualifier, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman e06a40589d 010/100: Move back from cider new-connection branch, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman ec275e2e10 009/100: Readme, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 8f2784a4ba 001/100: Initial commit, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 7987deb2c4 011/100: Makefile, tests, travis, checkdoc, .dir-locals, .gitignore etc., ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman b839a2379a 005/100: More bulk updates, ELPA Syncer, 2021/12/28
- [nongnu] elpa/sesman 27bd3bf457 020/100: Remove disambiguation defcustom and simplify sesman-ensure-linked-session,
ELPA Syncer <=
- [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