;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\210\305\306\307\310\311\312\313\314\315\316& \210\317\320\321\322\313\306%\210\317\323\324\325\313\306%\210\317\326\327\330\313\306%\210\331\332\333\334\335DD\336\313\306\337\340\341\342& \210\331\343\333\334\344DD\345\313\306\337\346\341\347& \210\350\343\351\352#\210\331\353\333\334\354DD\355\313\306\337\356\341\357& \207" [require cl-generic seq subr-x vc custom-declare-group sesman nil "Generic Session Manager." :prefix "sesman-" :group tools :link (url-link :tag "GitHub" "https://github.com/vspinu/sesman") custom-declare-face sesman-project-face ((default (:inherit font-lock-doc-face))) "Face used to mark projects." sesman-directory-face ((default (:inherit font-lock-type-face))) "Face used to mark directories." sesman-buffer-face ((default (:inherit font-lock-preprocessor-face))) "Face used to mark buffers." custom-declare-variable sesman-use-friendly-sessions funcall function #[0 "\300\207" [t] 1] "If non-nil consider friendly sessions when looking for current sessions.\nThe definition of friendly sessions is system dependent but usually means\nsessions running in dependent projects." :type boolean :package-version (sesman . "0.3.2") sesman-follow-symlinks #[0 "\300\207" [vc] 1] "When non-nil, follow symlinks during the file expansion.\nWhen nil, don't follow symlinks. When 'vc, follow symlinks only when\n`vc-follow-symlinks' is non-nil. When t, always follow symlinks." (choice (const :tag "Comply with `vc-follow-symlinks'" vc) (const :tag "Don't follow symlinks" nil) (const :tag "Follow symlinks" t)) (sesman . "0.3.3") put safe-local-variable #[257 "\211\300>\207" [(vc nil t)] 3 "\n\n(fn X)"] sesman-single-link-context-types #[0 "\300\207" [(buffer)] 1] "List of context types to which at most one session can be linked." (repeat symbol) (sesman . "0.1.0")] 10) #@80 Hash-table of all sesman sessions. Key is a cons (system-name . session-name). (defvar sesman-sessions-hashmap (make-hash-table :test 'equal) (#$ . 1946)) #@183 An alist of all sesman links. Each element is of the form (key cxt-type cxt-value) where "key" is of the form (system-name . session-name). system-name and cxt-type must be symbols. (defvar sesman-links-alist nil (#$ . 2108)) #@99 Name of the system managed by `sesman'. Can be either a symbol, or a function returning a symbol. (defvar sesman-system nil (#$ . 2340)) (byte-code "\300\301!\210\302\301\303\304#\207" [make-variable-buffer-local sesman-system put permanent-local t] 4) #@21 (fn SYSTEM WHICH) (defalias 'sesman--on-C-u-u-sessions #[514 "\211\204\301!\211\205 \211C\207\211\302\232\204\211\303=\203\304\305\"\207\211\306\232\2041\211\307=\2041\211\310=\2036\311\305\"\207\211<\203J\211@;\204G\211@9\203J\211C\207\211;\206a\2119\206a\312B\"\206a\313\314\"\207" [sesman-sessions-hashmap sesman-current-session (4) linked sesman--linked-sessions sort (16) all t sesman--all-system-sessions gethash error "Invalid which argument (%s)"] 5 (#$ . 2599)]) #@15 (fn SYSTEM) (defalias 'sesman--cap-system-name #[257 "\301!\302\303\304\305#)\266\203\203\207\306!\207" [inhibit-changing-match-data symbol-name "^[[:upper:]]" nil t string-match capitalize] 9 (#$ . 3102)]) #@15 (fn SYSTEM) (defalias 'sesman--least-specific-context #[257 "\300\301\302\"\303\304!!\"\207" [seq-some make-closure #[257 "\301\300\"\211\205 B\207" [V0 sesman-context] 4 "\n\n(fn CTYPE)"] reverse sesman-context-types] 6 (#$ . 3326)]) #@33 (fn SESSION CXT-TYPE CXT-VAL) (defalias 'sesman--link-session-interactively #[771 "\300 \204\301!\211@\262\211A\262\210\302!\303!\235\203>\2065\304\305\306\307\310\n \"!#\311\312\"\313$\314$\207\315\305\316\317!#!\207" [sesman--system sesman--least-specific-context symbol-name sesman-context-types sesman-ask-for-session format "Link with %s %s: " sesman--abbrev-path-maybe sesman-context sesman--all-system-sessions sort ask-new sesman-link-session error "%s association not allowed for this system (%s)" capitalize] 14 (#$ . 3575)]) #@12 (fn OBJ) (defalias 'sesman--abbrev-path-maybe #[257 "\211;\203 \300!\207\207" [abbreviate-file-name] 3 (#$ . 4144)]) #@25 (fn &optional BUFFER) (defalias 'sesman--system-in-buffer #[256 "r\211\206pq\210\301!\203 \202)\207" [sesman-system functionp] 3 (#$ . 4271)]) (defalias 'sesman--system #[0 "\203\301!\203  \207\207\302\303p\"\207" [sesman-system functionp error "No `sesman-system' in buffer `%s'"] 3]) #@40 (fn SYSTEM &optional SORT CXT-TYPES) (defalias 'sesman--linked-sessions #[769 "\206\300 \206 \301!\302 \210\303\304\305\306\307 $\"!\207" [sesman--system sesman-context-types sesman--clear-links delete-dups mapcar #[257 "\301@\"\207" [sesman-sessions-hashmap gethash] 4 "\n\n(fn ASSOC)"] sesman-current-links nil] 13 (#$ . 4581)]) #@30 (fn SYSTEM &optional SORT) (defalias 'sesman--friendly-sessions #[513 "\300\301\302\"\303!\"\203\304\"\207\207" [seq-filter make-closure #[257 "\301\300\"\207" [V0 sesman-friendly-session-p] 4 "\n\n(fn SES)"] sesman--all-system-sessions sesman--sort-sessions] 6 (#$ . 4932)]) #@124 Return a list of sessions registered with SYSTEM. If SORT is non-nil, sort in relevance order. (fn &optional SYSTEM SORT) (defalias 'sesman--all-system-sessions #[512 "\206\301 \302C\303\304\305#\"\210\203\306\242\"\207\211\242\207" [sesman-sessions-hashmap sesman--system nil maphash make-closure #[514 "\302@\300\"\205\301\301\242B\240\207" [V0 V1 eql] 5 "\n\n(fn K S)"] sesman--sort-sessions] 9 (#$ . 5225)]) #@53 (fn &optional SYSTEM SES-NAME CXT-TYPE CXT-VAL X) (defalias 'sesman--link-lookup-fn #[1280 "\206\211@@\206@A\206A@\206\3008\301\302%\207" [2 make-closure #[257 "\300\203\f\211@@\300=\205;\301\203\211@A\301\232\205;\302\2031\302<\203)\211A@\302\235\202.\211A@\302=\205;\303?\206;\3048\303\232\207" [V0 V1 V2 V3 2] 3 "\n\n(fn EL)"]] 15 (#$ . 5659)]) #@10 (fn X) (defalias 'sesman--unlink #[257 "\301\302\303\211\211\211%\"\211\207" [sesman-links-alist seq-remove sesman--link-lookup-fn nil] 8 (#$ . 6045)]) (defalias 'sesman--clear-links #[0 "\301\302\"\211\207" [sesman-links-alist seq-filter #[257 "\301@\"\207" [sesman-sessions-hashmap gethash] 4 "\n\n(fn X)"]] 3]) #@37 (fn SYSTEM SESSION &optional SEP) (defalias 'sesman--format-session-objects #[770 "\300\"\211<\203.\301@!\203.@\206\302\303\304\"\206%\305\306\303\307\"\"\310\311\312\"#\207\313\314\"\207" [sesman-session-info keywordp " " plist-get :strings mapcar #[257 "\300\301\"\207" [format "%s"] 4 "\n\n(fn X)"] :objects mapconcat make-closure #[257 "\301\300\302\303\304%\207" [V0 replace-regexp-in-string "%%s" nil t] 7 "\n\n(fn STR)"] format "%s"] 11 (#$ . 6375)]) #@36 (fn SYSTEM SES &optional PREFIX) (defalias 'sesman--format-session #[770 "\300\301\302\303\304#\206 \305\301@\303\304#\301\306\307#\303\310#\311\312\211$%\207" [format propertize "%s%s [%s] linked-to %s" face bold "" sesman--format-session-objects ", " italic sesman-grouped-links t] 13 (#$ . 6859)]) #@13 (fn LINK) (defalias 'sesman--format-link #[257 "\301!\302@\"\303\304\305!\306\307\310!!\311\312#\306\313!\311\312#\203,\314\"\202-\315%\207" [sesman-sessions-hashmap sesman--lnk-system-name gethash format "%s(%s) -> %s [%s]" sesman--lnk-context-type propertize sesman--abbrev-path-maybe sesman--lnk-value face bold sesman--lnk-session-name sesman--format-session-objects "invalid"] 11 (#$ . 7179)]) #@39 (fn PROMPT LINKS &optional ASK-ALL) (defalias 'sesman--ask-for-link #[770 "\300\301\"\302\205G\303V\205\304\"\300\305\"\306\307\310\307\211@&\211\311\230\203,\207\2037\312\"AC\207\312\"A\207" [mapcar #[257 "\300!B\207" [sesman--format-link] 3 "\n\n(fn LINK)"] append 1 (("*all*")) car completing-read nil t "*all*" assoc] 14 (#$ . 7601)]) #@24 (fn SYSTEM SESSIONS) (defalias 'sesman--sort-sessions #[514 "\300\301\302\"\"\207" [seq-sort make-closure #[514 "\301\300#\207" [V0 sesman-more-relevant-p] 6 "\n\n(fn X1 X2)"]] 6 (#$ . 7973)]) #@21 (fn SYSTEM LINKS) (defalias 'sesman--sort-links #[514 "\300\301\302\"\"\207" [seq-sort make-closure #[514 "\302\300\303@ \"\303@ \"#\207" [V0 sesman-sessions-hashmap sesman-more-relevant-p gethash] 8 "\n\n(fn X1 X2)"]] 6 (#$ . 8178)]) #@12 (fn LNK) (defalias 'sesman--lnk-system-name #[257 "\211@@\207" [] 2 (#$ . 8425)]) #@12 (fn LNK) (defalias 'sesman--lnk-session-name #[257 "\211@A\207" [] 2 (#$ . 8515)]) #@12 (fn LNK) (defalias 'sesman--lnk-context-type #[257 "\211A@\207" [] 2 (#$ . 8606)]) #@12 (fn LNK) (defalias 'sesman--lnk-value #[257 "\3008\207" [2] 3 (#$ . 8697)]) #@60 Normal hook ran after every state-changing Sesman command. (defalias 'sesman-post-command-hook #[0 "\300\207" ["Normal hook ran after every state-changing Sesman command."] 1 (#$ . 8782)]) #@25 Start a Sesman session. (defalias 'sesman-start #[0 "\300 \301\302\"\210\303!\304\305!\210\207" [sesman--system message "Starting new %s session ..." sesman-start-session run-hooks sesman-post-command-hook] 4 (#$ . 8977) nil]) #@353 Restart sesman session. When WHICH is nil, restart the current session; when a single universal argument or 'linked, restart all linked sessions; when a double universal argument, t or 'all, restart all sessions. For programmatic use, WHICH can also be a session or a name of the session, in which case that session is restarted. (fn &optional WHICH) (defalias 'sesman-restart #[256 "\300 \301\"\211\204\302\303\"\207\304\305G\306U\203\307\202\310\311\312\"$\313C\314\315#\216\203:\211\316 \240\210\302\317\"\210\320\314\321\"\"\210)\266\322\323!\207" [sesman--system sesman--on-C-u-u-sessions message "No %s sessions found" format "Restarting %s %s %s" 1 "session" "sessions" mapcar car nil make-closure #[0 "\300\205\301\242\203\302\303\301\242\"\207\302\304!\207" [V0 V1 message #1="%s" nil] 3] current-message #1# mapc #[257 "\301\300\"\207" [V0 sesman-restart-session] 4 "\n\n(fn S)"] run-hooks sesman-post-command-hook] 10 (#$ . 9213) "P"]) #@350 Terminate a Sesman session. When WHICH is nil, kill only the current session; when a single universal argument or 'linked, kill all linked sessions; when a double universal argument, t or 'all, kill all sessions. For programmatic use, WHICH can also be a session or a name of the session, in which case that session is killed. (fn &optional WHICH) (defalias 'sesman-quit #[256 "\300 \301\"\211\204\302\303\"\207\304\305G\306U\203\307\202\310\311\312\"$\313C\314\315#\216\203:\211\316 \240\210\302\317\"\210\320\314\321\"\"\210)\266\322\323!\207" [sesman--system sesman--on-C-u-u-sessions message "No %s sessions found" format "Killing %s %s %s" 1 "session" "sessions" mapcar car nil make-closure #[0 "\300\205\301\242\203\302\303\301\242\"\207\302\304!\207" [V0 V1 message #1="%s" nil] 3] current-message #1# mapc #[257 "\301\300\"\210\302\300\"\207" [V0 sesman-unregister sesman-quit-session] 4 "\n\n(fn S)"] run-hooks sesman-post-command-hook] 10 (#$ . 10195) "P"]) #@245 Display info for all current sessions (`sesman-current-sessions'). In the resulting minibuffer display linked sessions are numbered and the other (friendly) sessions are not. When ALL is non-nil, show info for all sessions. (fn &optional ALL) (defalias 'sesman-info #[256 "\300 \301C\203\302\303\"\202\304!\211G\301V\203\305\202\306\2032\307\310\311\312$\313#!\207\307\314\203=\306\202>\315#\207" [sesman--system 1 sesman-sessions t sesman-current-sessions " " "" message mapconcat make-closure #[257 "\303\300\"\203\304\305\301\242\"\301\211\242T\240\210\202\302\306\300#\207" [V0 V1 V2 sesman-relevant-session-p format "%d " sesman--format-session] 6 "\n\n(fn SES)"] "\n" "No %s%s sessions" "current "] 12 (#$ . 11199) "P"]) #@166 Ask for SESSION and link with BUFFER. BUFFER defaults to current buffer. On universal argument, or if BUFFER is 'ask, ask for buffer. (fn &optional BUFFER SESSION) (defalias 'sesman-link-with-buffer #[512 "\300=\204\f\301\232\203\302 \303\304p\305\306\307\"$\262\202\"\206\"p\310\311#\207" [ask (4) sesman--system read-buffer "Link buffer: " t make-closure #[257 "\300\301A!\232\207" [V0 sesman--system-in-buffer] 4 "\n\n(fn BUF-CONS)"] sesman--link-session-interactively buffer] 10 (#$ . 11968) "P"]) #@162 Ask for SESSION and link with DIR. DIR defaults to `default-directory'. On universal argument, or if DIR is 'ask, ask for directory. (fn &optional DIR SESSION) (defalias 'sesman-link-with-directory #[512 "\301=\204\f\302\232\203\303\304!\202\206\305\306#\207" [default-directory ask (4) read-directory-name "Link directory: " sesman--link-session-interactively directory] 7 (#$ . 12492) "P"]) #@217 Ask for SESSION and link with PROJECT. PROJECT defaults to current project. On universal argument, or if PROJECT is 'ask, ask for the project. SESSION defaults to the current session. (fn &optional PROJECT SESSION) (defalias 'sesman-link-with-project #[512 "\300 \301\302=\204\303\232\203\304\305\306!\"\202\206\306!!\307\310#\207" [sesman--system expand-file-name ask (4) read-directory-name "Project: " sesman-project sesman--link-session-interactively project] 8 (#$ . 12906) "P"]) #@258 Ask for SESSION and link with the least specific context available. Normally the least specific context is the project. If not in a project, link with the `default-directory'. If `default-directory' is nil, link with current buffer. (fn &optional SESSION) (defalias 'sesman-link-with-least-specific #[256 "\300\301\211#\207" [sesman--link-session-interactively nil] 5 (#$ . 13414) "P"]) #@44 Break any of the previously created links. (defalias 'sesman-unlink #[0 "\300 \301!\206\f\302\303\"\304\305\306\307\310#\"\266\311\312!\207" [sesman--system sesman-current-links user-error "No %s links found" mapc sesman--unlink sesman--ask-for-link "Unlink: " ask-all run-hooks sesman-post-command-hook] 8 (#$ . 13809) nil]) #@35 Session management prefix keymap. (defvar sesman-map (byte-code "\301\302\300!\210\303\304\305#\210\303\306\305#\210\303\307\310#\210\303\311\310#\210\303\312\313#\210\303\314\313#\210\303\315\316#\210\303\317\316#\210\303\320\321#\210\303\322\321#\210\303\323\324#\210\303\325\324#\210\303\326\327#\210\303\330\327#\210\303\331\332#\210\303\333\332#\210\303\334\335#\210\303\336\335#\210\303\337\340#\210\303\341\340#\210)\207" [sesman-map nil define-prefix-command define-key " " sesman-info "i" "" sesman-browser "w" "" sesman-start "s" "" sesman-restart "r" "" sesman-quit "q" "\f" sesman-link-with-least-specific "l" "" sesman-link-with-buffer "b" "" sesman-link-with-directory "d" "" sesman-link-with-project "p" "" sesman-unlink "u"] 4) (#$ . 14146)) #@14 Sesman Menu. (defvar sesman-menu '("Sesman" ["Show Session Info" sesman-info] "--" ["Start" sesman-start] ["Restart" sesman-restart :active (sesman-current-session (sesman--system))] ["Quit" sesman-quit :active (sesman-current-session (sesman--system))] "--" ["Link with Buffer" sesman-link-with-buffer :active (sesman-current-session (sesman--system))] ["Link with Directory" sesman-link-with-directory :active (sesman-current-session (sesman--system))] ["Link with Project" sesman-link-with-project :active (sesman-current-session (sesman--system))] "--" ["Unlink" sesman-unlink :active (sesman-current-session (sesman--system))]) (#$ . 14940)) #@43 Install `sesman-menu' into MAP. (fn MAP) (defalias 'sesman-install-menu #[257 "\301\302\300\303N$\207" [sesman-menu easy-menu-do-define seman-menu-open variable-documentation] 6 (#$ . 15593)]) (byte-code "\300\301\302\301\303\304#\305#\210\300\306\302\306\307\304#\310#\210\300\311\302\311\312\304#\313#\210\314\311\304\312\304\315%\210\300\316\302\316\317\304#\320#\210\314\316\304\317\304\321%\210\300\322\302\322\323\304#\324#\210\314\322\304\323\304\325%\210\300\326\302\326\327\304#\330#\210\314\326\304\327\304\331%\210\300\332\302\332\333\304#\334#\210\314\332\304\333\304\335%\210\300\336\302\336\337\304#\340#\210\314\336\304\337\304\341%\207" [defalias sesman-start-session cl-generic-define (system) nil "Start and return SYSTEM SESSION.\n\n(fn SYSTEM)" sesman-quit-session (system session) "Terminate SYSTEM SESSION.\n\n(fn SYSTEM SESSION)" sesman-restart-session (system session) "Restart SYSTEM SESSION.\nBy default, calls `sesman-quit-session' and then\n`sesman-start-session'.\n\n(fn SYSTEM SESSION)" cl-generic-define-method #[514 "\211@\300\"\210\301!\211\240\207" [sesman-quit-session sesman-start-session] 6 "\n\n(fn SYSTEM SESSION)"] sesman-session-info (_system session) "Return a plist with :objects key containing user \"visible\" objects.\nOptional :strings value is a list of string representations of objects. Optional\n:map key is a local keymap to place on every object in the session browser.\nOptional :buffers is a list of buffers which will be used for navigation from\nthe session browser. If :buffers is missing, buffers from :objects are used\ninstead.\n\n(fn SYSTEM SESSION)" #[514 "\300AD\207" [:objects] 4 "\n\n(fn SYSTEM SESSION)"] sesman-project (_system) "Retrieve project root in current directory (`default-directory') for SYSTEM.\nReturn a string or nil if no project has been found.\n\n(fn SYSTEM)" #[257 "\300\207" [nil] 2 "\n\n(fn SYSTEM)"] sesman-more-relevant-p (_system session1 session2) "Return non-nil if SESSION1 should be sorted before SESSION2.\nBy default, sort by session name. Systems should overwrite this method to\nprovide a more meaningful ordering. If your system objects are buffers you can\nuse `sesman-more-recent-p' utility in this method.\n\n(fn SYSTEM SESSION1 SESSION2)" #[771 "\300@@\"?\207" [string-greaterp] 6 "\n\n(fn SYSTEM SESSION1 SESSION2)"] sesman-friendly-session-p (_system _session) "Return non-nil if SESSION is a friendly session in current context.\nThe \"friendship\" is system dependent but usually means sessions running in\ndependent projects. Unless SYSTEM has defined a method for this generic, there\nare no friendly sessions.\n\n(fn SYSTEM SESSION)" #[514 "\300\207" [nil] 3 "\n\n(fn SYSTEM SESSION)"] sesman-context-types (_system) "Return a list of context types understood by SYSTEM.\nContexts must be sorted from most specific to least specific.\n\n(fn SYSTEM)" #[257 "\300\207" [(buffer directory project)] 2 "\n\n(fn SYSTEM)"]] 6) #@89 Retrieve SYSTEM's session with SESSION-NAME from global hash. (fn SYSTEM SESSION-NAME) (defalias 'sesman-session #[514 "\206\301 \302B\"\207" [sesman-sessions-hashmap sesman--system gethash] 6 (#$ . 18541)]) #@446 Return a list of sessions registered with SYSTEM. When TYPE is either 'all or nil return all sessions registered with the SYSTEM, when 'linked, only linked to the current context sessions, when 'friendly - only friendly sessions. If SORT is non-nil, sessions are sorted in the relevance order with linked sessions leading the list. CXT-TYPES is a list of context types to consider for linked sessions. (fn SYSTEM &optional SORT TYPE CXT-TYPES) (defalias 'sesman-sessions #[1025 "\206\300 \301\267\202.\302#\207\303\"\207\203*\304\305\302\306#\307\306\"\"!\207\307!\207\310\311\"\207" [sesman--system #s(hash-table size 4 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (linked 12 friendly 18 all 23 nil 23)) sesman--linked-sessions sesman--friendly-sessions delete-dups append sort sesman--all-system-sessions error "Invalid session TYPE argument %s"] 11 (#$ . 18763)]) #@410 Return a list of SYSTEM sessions active in the current context. Sessions are ordered by the relevance order and linked sessions come first. If `sesman-use-friendly-sessions' current sessions consist of linked and friendly sessions, otherwise only of linked sessions. CXT-TYPES is a list of context types to consider. Defaults to the list returned from `sesman-context-types'. (fn SYSTEM &optional CXT-TYPES) (defalias 'sesman-current-sessions #[513 "\203\301\302\303\304#\305\304\"\"!\207\303\304#\207" [sesman-use-friendly-sessions delete-dups append sesman--linked-sessions sort sesman--friendly-sessions] 8 (#$ . 19675)]) #@138 Get the most relevant current session for the SYSTEM. CXT-TYPES is a list of context types to consider. (fn SYSTEM &optional CXT-TYPES) (defalias 'sesman-current-session #[513 "\300\301#@\206\302\301\"@\207" [sesman--linked-sessions sort sesman--friendly-sessions] 6 (#$ . 20316)]) #@157 Get the most relevant linked session for SYSTEM or throw if none exists. CXT-TYPES is a list of context types to consider. (fn SYSTEM &optional CXT-TYPES) (defalias 'sesman-ensure-session #[513 "\300\"\206 \301\302\"\207" [sesman-current-session user-error "No linked %s sessions"] 5 (#$ . 20611)]) #@80 Return t if there is at least one session registered with SYSTEM. (fn SYSTEM) (defalias 'sesman-has-sessions-p #[257 "\211\206\301 \302C\3031\304\305\306#\"0\210\202\210\211\242\207" [sesman-sessions-hashmap sesman--system nil (error) maphash make-closure #[514 "@\300=\205\301\302\240\210\303\304\305\"\207" [V0 V1 t throw found nil] 5 "\n\n(fn K _)"]] 8 (#$ . 20921)]) (defvar sesman--select-session-history nil) #@343 Ask for a SYSTEM session with PROMPT. SESSIONS defaults to value returned from `sesman-sessions'. If ASK-NEW is non-nil, offer *new* option to start a new session. If ASK-ALL is non-nil offer *all* option. If ASK-ALL is non-nil, return a list of sessions, otherwise a single session. (fn SYSTEM PROMPT &optional SESSIONS ASK-NEW ASK-ALL) (defalias 'sesman-ask-for-session #[1282 "\206\300!\301\302\"\211G\204\211\303U\203\304\305 \"\2024\306\205'\307\2053\310V\2053\311#\211@@\312 \301\313\"\314\315\314\316&\211\317\230\203_\320 !\321\322@\"\210\203^\211C\207\207\211\323\230\203g\207\324\"A\324\"\203y\211C\207\207" [sesman-sessions mapcar #[257 "\211@\2119\203 \300!\202\211B\207" [symbol-name] 4 "\n\n(fn S)"] 0 error "No %s sessions found" append (("*new*")) 1 (("*all*")) completing-read car nil t sesman--select-session-history "*new*" sesman-start-session message "Started %s" "*all*" assoc] 18 (#$ . 21356)]) (defvar sesman--cxt-abbrevs '(buffer "buf" project "proj" directory "dir")) #@36 (fn CXT-TYPE CXT-VAL EXTRA-FACE) (defalias 'sesman--format-context #[771 "\301\302\303\"!\304\305\"\206J\306\307!\203\202\310D#\211\304\302\311\"\306#P\207" [sesman--cxt-abbrevs intern format "sesman-%s-face" propertize plist-get face facep font-lock-function-name-face "(%s)"] 10 (#$ . 22407)]) #@468 Retrieve all links for SYSTEM's SESSION from the global `sesman-links-alist'. Return an alist of the form ((buffer buffers..) (directory directories...) (project projects...)). When `CURRENT-FIRST' is non-nil, a cons of two lists as above is returned with car containing links relevant in current context and cdr all other links. If AS-STRING is non-nil, return an equivalent string representation. (fn SYSTEM SESSION &optional CURRENT-FIRST AS-STRING) (defalias 'sesman-grouped-links #[1026 "\206\301 \206 \302!\211@\303\304\305\306\"\"\"!\307\310\311!\"\205,\312!\313\314\315\n$\"\210\316\317\307\320\"\"\316\317\307\321\"\"\203g\322\203a\323\324#\205Y\325\323\324#Q\207\323\324#\207 \203p\211B\207\207" [sesman-links-alist sesman--system sesman-current-session reverse sesman--sort-links seq-filter sesman--link-lookup-fn mapcar #[257 "\211C\207" #1=[] 2 "\n\n(fn X)"] sesman-context-types copy-alist mapc make-closure #[257 "\303!\300\203\304!\203\305\302\"\202\305\301\"\211\205\"\211AB\241\207" [V0 V1 V2 sesman--lnk-context-type sesman-relevant-link-p assoc] 6 "\n\n(fn LINK)"] delq nil #[257 "\211A\205\211\207" #1# 2 "\n\n(fn EL)"] #[257 "\211A\205\211\207" #1# 2 "\n\n(fn EL)"] #[257 "\211@\300\301\302\"A\303#\207" [mapconcat make-closure #[257 "\301\302!!\303\300\304#\207" [V0 sesman--abbrev-path-maybe sesman--lnk-value sesman--format-context italic] 6 "\n\n(fn LNK)"] ", "] 6 "\n\n(fn TYPED-LINKS)"] mapconcat ", " " | "] 19 (#$ . 22730)]) #@376 Link SYSTEM's SESSION to context give by CXT-TYPE and CXT-VAL. If CXT-TYPE is nil, use the least specific type available in the current context. If CXT-TYPE is non-nil, and CXT-VAL is not given, retrieve it with `sesman-context'. See also `sesman-link-with-project', `sesman-link-with-directory' and `sesman-link-with-buffer'. (fn SYSTEM SESSION &optional CXT-TYPE CXT-VAL) (defalias 'sesman-link-session #[1026 "\242\206\302\303!\206*\203\304\"\202#\305!\211@\262\211A\262\206*\302\306\"\211;\2035\307!\2026\211B\211E\235\203X\211\310\311 \312 $ \"B\202l\313\311\n\n$ \"\204l\211 B\314\315!\210\207" [sesman-single-link-context-types sesman-links-alist error "SESSION must be a headed list" sesman-context sesman--least-specific-context "No local context of type %s" expand-file-name seq-remove sesman--link-lookup-fn nil seq-filter run-hooks sesman-post-command-hook] 16 (#$ . 24269)]) #@332 Retrieve all links for SYSTEM, SESSION-OR-NAME and CXT-TYPES. SESSION-OR-NAME can be either a session or a name of the session. If SORT is non-nil links are sorted in relevance order and `sesman-current-links' lead the list, otherwise links are returned in the creation order. (fn SYSTEM &optional SESSION-OR-NAME CXT-TYPES SORT) (defalias 'sesman-links #[1025 "<\203\n@\202 \301#\203'\302\303\304\"\305 \306\"\"\"!\207\306\"\207" [sesman-links-alist sesman--link-lookup-fn delete-dups append sesman-current-links sesman--sort-links seq-filter] 14 (#$ . 25209)]) #@349 Retrieve all active links in current context for SYSTEM and SESSION-OR-NAME. SESSION-OR-NAME can be either a session or a name of the session. CXT-TYPES is a list of context types to consider. Returned links are a subset of `sesman-links-alist' sorted in order of relevance if SORT is non-nil. (fn SYSTEM &optional SESSION-OR-NAME SORT CXT-TYPES) (defalias 'sesman-current-links #[1025 "<\203\n@\202 \300\301\302$\206\303!\"\207" [seq-mapcat make-closure #[257 "\304\300\302#\305\306\307# \"\301\203\310\300\"\207\207" [V0 V1 V2 sesman-links-alist sesman--link-lookup-fn seq-filter make-closure #[257 "\301!\205\f\302\300\303!\"\207" [V0 V1 sesman-relevant-context-p sesman--lnk-value] 5 "\n\n(fn L)"] sesman--sort-links] 7 "\n\n(fn CXT-TYPE)"] sesman-context-types] 11 (#$ . 25799)]) #@149 Return t if there is at least one linked session. CXT-TYPES defaults to `sesman-context-types' for current SYSTEM. (fn SYSTEM &optional CXT-TYPES) (defalias 'sesman-has-links-p #[513 "\211\206\301!\302C\3031\304\305\306$\"0\210\202\210\211\242\207" [sesman-links-alist sesman-context-types nil (error) mapc make-closure #[257 "\300\303!=\205$\304!\211\301\235\205\"\305\306!\"\205\"\302\307\240\210\310\311\312\"\262\207" [V0 V1 V2 sesman--lnk-system-name sesman--lnk-context-type sesman-relevant-context-p sesman--lnk-value t throw found nil] 6 "\n\n(fn L)"]] 10 (#$ . 26616)]) #@377 Register SESSION into `sesman-sessions-hashmap' and `sesman-links-alist'. SYSTEM defaults to current system. If a session with same name is already registered in `sesman-sessions-hashmap', change the name by appending "#1", "#2" ... to the name. This function should be called by system-specific connection initializers ("run-xyz", "xyz-jack-in" etc.). (fn SYSTEM SESSION) (defalias 'sesman-register #[514 "\206\301 @@\302\303\"\203 \304\305#\262\211T\262\202 AB\262\306B#\210\307\"\210\207" [sesman-sessions-hashmap sesman--system 1 sesman-session format "%s#%d" puthash sesman-link-session] 10 (#$ . 27223)]) #@150 Unregister SESSION. SYSTEM defaults to current system. Remove session from `sesman-sessions-hashmap' and `sesman-links-alist'. (fn SYSTEM SESSION) (defalias 'sesman-unregister #[514 "@B\301\"\210\302 \210\207" [sesman-sessions-hashmap remhash sesman--clear-links] 6 (#$ . 27869)]) #@271 Add (destructively) OBJECT to session SESSION-NAME of SYSTEM. If ALLOW-NEW is nil and session with SESSION-NAME does not exist throw an error, otherwise register a new session with session (list SESSION-NAME OBJECT). (fn SYSTEM SESSION-NAME OBJECT &optional ALLOW-NEW) (defalias 'sesman-add-object #[1027 "\206\300 \301\"\211\203\211AB\241\207\203\"\302D\"\207\303\304\305!#\207" [sesman--system sesman-session sesman-register error "%s session '%s' does not exist" sesman--cap-system-name] 10 (#$ . 28164)]) #@574 Remove (destructively) OBJECT from session SESSION-NAME of SYSTEM. If SESSION-NAME is nil, retrieve the session with `sesman-session-for-object'. If OBJECT is the last object in sesman session, `sesman-unregister' the session. If AUTO-UNREGISTER is non-nil unregister sessions of length 0 and remove all the links with the session. If NO-ERROR is non-nil, don't throw an error if OBJECT is not found in any session. This is useful if there are several "concurrent" parties which can remove the object. (fn SYSTEM SESSION-NAME OBJECT &optional AUTO-UNREGISTER NO-ERROR) (defalias 'sesman-remove-object #[1283 "\206\301 \203\302\"\202\303#\304\"\211?\2068\211G\305U\2030\2058\306\"\207\307@B#\207" [sesman-sessions-hashmap sesman--system sesman-session sesman-session-for-object delete 1 sesman-unregister puthash] 12 (#$ . 28700)]) #@199 Retrieve SYSTEM session which contains OBJECT. When NO-ERROR is non-nil, don't throw an error if OBJECT is not part of any session. In such case, return nil. (fn SYSTEM OBJECT &optional NO-ERROR) (defalias 'sesman-session-for-object #[770 "\206\300 \301!\302\303\304\"\"\206?\205\305\306#\207" [sesman--system sesman--all-system-sessions seq-find make-closure #[257 "\301\302\303\300\"A\"\207" [V0 seq-find make-closure #[257 "\300\232\207" [V0] 3 "\n\n(fn X)"]] 5 "\n\n(fn SES)"] error "%s is not part of any %s sessions"] 9 (#$ . 29568)]) #@214 Retrieve the name of the SYSTEM's session containing OBJECT. When NO-ERROR is non-nil, don't throw an error if OBJCECT is not part of any session. In such case, return nil. (fn SYSTEM OBJECT &optional NO-ERROR) (defalias 'sesman-session-name-for-object #[770 "\300#@\207" [sesman-session-for-object] 7 (#$ . 30134)]) #@287 Return t if BUFS1 is more recent than BUFS2. BUFS1 and BUFS2 are either buffers or lists of buffers. When lists of buffers, most recent buffers from each list are considered. To be used primarily in `sesman-more-relevant-p' methods when session objects are buffers. (fn BUFS1 BUFS2) (defalias 'sesman-more-recent-p #[514 "\300!\203 C\202\f\300!\203C\202\301\302\303#\304 \"\305=\207" [bufferp seq-some make-closure #[257 "\211\300\235\203\302\207\211\301\235\205\303\207" [V0 V1 1 -1] 3 "\n\n(fn B)"] buffer-list 1] 9 (#$ . 30463)]) (defvar sesman--path-cache (make-hash-table :test 'equal)) #@212 Expand PATH with optionally follow symlinks. Whether symlinks are followed is controlled by `sesman-follow-symlinks' custom variable. Always return the expansion without the trailing directory slash. (fn PATH) (defalias 'sesman-expand-path #[257 "\303\203)\304 \"\206\305\306! #\307=\204\n\203!\211\202$\310!\262\202,\310!!\207" [sesman-follow-symlinks sesman--path-cache vc-follow-symlinks directory-file-name gethash puthash file-truename t expand-file-name] 6 (#$ . 31083)]) (byte-code "\300\301\302\301\303\304#\305#\210\306\301\304\307\304\310%\210\306\301\304\311\304\312%\210\306\301\304\313\304\314%\210\300\315\302\315\316\304#\317#\210\306\315\304\320\304\321%\210\306\315\304\322\304\323%\210\306\315\304\324\304\325%\207" [defalias sesman-context cl-generic-define (_cxt-type _system) nil "Given SYSTEM and context type CXT-TYPE return the context.\n\n(fn CXT-TYPE SYSTEM)" cl-generic-define-method ((_cxt-type (eql buffer)) _system) #[514 "p\207" #1=[] 3 "Return current buffer.\n\n(fn CXT-TYPE SYSTEM)"] ((_cxt-type (eql directory)) _system) #[514 "\301!\207" [default-directory sesman-expand-path] 4 "Return current directory.\n\n(fn CXT-TYPE SYSTEM)"] ((_cxt-type (eql project)) system) #[514 "\301!\302\206 \303 !\206\304 \211\205\305!)\207" [default-directory sesman-expand-path sesman-project sesman--system vc-root-dir expand-file-name] 5 "Return current project.\n\n(fn CXT-TYPE SYSTEM)"] sesman-relevant-context-p (_cxt-type cxt) "Non-nil if context CXT is relevant to current context of type CXT-TYPE.\n\n(fn CXT-TYPE CXT)" ((_cxt-type (eql buffer)) buf) #[514 "p=\207" #1# 4 "Non-nil if BUF is `current-buffer'.\n\n(fn CXT-TYPE BUF)"] ((_cxt-type (eql directory)) dir) #[514 "\211\205\205\302\303!P\303!\304\305\306#)\266\203\207" [default-directory inhibit-changing-match-data "^" sesman-expand-path nil t string-match] 9 "Non-nil if DIR is the parent or equals the `default-directory'.\n\n(fn CXT-TYPE DIR)"] ((_cxt-type (eql project)) proj) #[514 "\211\205\205\302\303!P\303!\304\305\306#)\266\203\207" [default-directory inhibit-changing-match-data "^" sesman-expand-path nil t string-match] 9 "Non-nil if PROJ is the parent or equal to the `default-directory'.\n\n(fn CXT-TYPE PROJ)"]] 6) #@157 Return non-nil if LINK is relevant to the current context. If CXT-TYPES is non-nil, only check relevance for those contexts. (fn LINK &optional CXT-TYPES) (defalias 'sesman-relevant-link-p #[513 "\211\203\f\300!\235\205\301\300!\302!\"\207" [sesman--lnk-context-type sesman-relevant-context-p sesman--lnk-value] 6 (#$ . 33358)]) #@179 Return non-nil if SYSTEM's SESSION is relevant to the current context. If CXT-TYPES is non-nil, only check relevance for those contexts. (fn SYSTEM SESSION &optional CXT-TYPES) (defalias 'sesman-relevant-session-p #[770 "\300\301\302#\"\207" [seq-some sesman-relevant-link-p sesman-links] 9 (#$ . 33702)]) (byte-code "\300\301\302\303#\210\304\301\302\305#\210\306\307!\207" [defalias sesman-linked-sessions sesman--linked-sessions nil make-obsolete "v0.3.2" provide sesman] 4)