[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sesman 665721c52f 066/100: Move context faces to sesman.el
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/sesman 665721c52f 066/100: Move context faces to sesman.el and use for info display |
Date: |
Tue, 28 Dec 2021 14:06:03 -0500 (EST) |
branch: elpa/sesman
commit 665721c52f205b5b8e26d8f26109d0c026c7477b
Author: Vitalie Spinu <spinuvit@gmail.com>
Commit: Vitalie Spinu <spinuvit@gmail.com>
Move context faces to sesman.el and use for info display
---
sesman-browser.el | 41 +++++++----------------------------------
sesman.el | 41 ++++++++++++++++++++++++++++++++++-------
2 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/sesman-browser.el b/sesman-browser.el
index 5e2e1898f6..efd084f8aa 100644
--- a/sesman-browser.el
+++ b/sesman-browser.el
@@ -50,26 +50,6 @@
"Face used to highlight currently selected object."
:group 'sesman-browser)
-(defface sesman-browser-project-face
- '((default (:inherit font-lock-comment-face)))
- "Face used to mark projects."
- :group 'sesman-browser)
-
-(defface sesman-browser-directory-face
- '((default (:inherit font-lock-constant-face)))
- "Face used to mark directories."
- :group 'sesman-browser)
-
-(defface sesman-browser-buffer-face
- '((default (:inherit font-lock-keyword-face)))
- "Face used to mark buffers."
- :group 'sesman-browser)
-
-(defface sesman-browser-project-face
- '((default (:inherit font-lock-comment-face)))
- "Face used to mark projects."
- :group 'sesman-browser)
-
(defvar-local sesman-browser--sort-types '(name relevance))
(defcustom sesman-browser-sort-type 'name
"Default sorting type in sesman browser buffers.
@@ -392,23 +372,13 @@ on a session object."
(let ((link-groups (sesman-grouped-links system ses))
(vert-stop))
(dolist (grp link-groups)
- (let* ((type (car grp))
- (face (intern (format "sesman-browser-%s-face" type)))
- (short-type (propertize (or (plist-get sesman--cxt-abbrevs type)
- (symbol-value type))
- 'face (list (if (facep face)
- face
-
'font-lock-function-name-face)
- 'sesman-browser-button))))
+ (let* ((type (car grp)))
(dolist (link (cdr grp))
(when (> (current-column) fill-column)
(insert "\n" (format head-template " "))
(setq vert-stop nil))
- (let ((link-spec (propertize (format "(%s)"
- (sesman--abbrev-path-maybe
- (sesman--lnk-value link)))
- 'face 'sesman-browser-button)))
- (insert (propertize (concat short-type link-spec)
+ (let ((val (sesman--abbrev-path-maybe (sesman--lnk-value link))))
+ (insert (propertize (sesman--format-context type val
'sesman-browser-button)
:sesman-stop (car link)
:sesman-vertical-stop (unless vert-stop
(setq vert-stop t))
:sesman-link link
@@ -475,7 +445,10 @@ See `sesman-browser-mode' for more details."
(_ (error "Invalid `sesman-browser-sort-type'"))))
(i 0))
(erase-buffer)
- (insert (format "\n %s Sessions:\n\n" system))
+ (insert "\n ")
+ (insert (propertize (format "%s Sessions:" system)
+ 'face '(bold font-lock-keyword-face)))
+ (insert "\n\n")
(dolist (ses sessions)
(setq i (1+ i))
(sesman-browser--insert-session system ses i))
diff --git a/sesman.el b/sesman.el
index f72f26c4b8..57d01845f9 100644
--- a/sesman.el
+++ b/sesman.el
@@ -49,6 +49,21 @@
:group 'tools
:link '(url-link :tag "GitHub" "https://github.com/vspinu/sesman"))
+(defface sesman-project-face
+ '((default (:inherit font-lock-doc-face)))
+ "Face used to mark projects."
+ :group 'sesman)
+
+(defface sesman-directory-face
+ '((default (:inherit font-lock-type-face)))
+ "Face used to mark directories."
+ :group 'sesman)
+
+(defface sesman-buffer-face
+ '((default (:inherit font-lock-keyword-face)))
+ "Face used to mark buffers."
+ :group 'sesman)
+
;; (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
@@ -228,7 +243,7 @@ If SORT is non-nil, sort in relevance order."
(or prefix "")
(propertize (car ses) 'face 'bold)
(propertize (sesman--format-session-objects system ses ", ") 'face
'italic)
- (propertize (sesman-grouped-links system ses t t) 'face 'italic)))
+ (sesman-grouped-links system ses t t)))
(defun sesman--format-link (link)
(let* ((system (sesman--lnk-system-name link))
@@ -611,9 +626,22 @@ CXT-TYPES is as in `sesman-linked-sessions'."
(user-error "No linked %s sessions" system)))
(defvar sesman--cxt-abbrevs '(buffer "buf" project "proj" directory "dir"))
+(defun sesman--format-context (cxt-type cxt-val extra-face)
+ (let* ((face (intern (format "sesman-%s-face" cxt-type)))
+ (short-type (propertize (or (plist-get sesman--cxt-abbrevs cxt-type)
+ (symbol-value cxt-type))
+ 'face (list (if (facep face)
+ face
+ 'font-lock-function-name-face)
+ extra-face))))
+ (concat short-type
+ (propertize (format "(%s)" cxt-val)
+ 'face extra-face))))
+
(defun sesman-grouped-links (system session &optional current-first as-string)
"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...)).
@@ -645,17 +673,16 @@ AS-STRING is non-nil, return an equivalent string
representation."
(out-rel (delq nil (mapcar (lambda (el) (and (cdr el) el))
out-rel))))
(if as-string
(let ((fmt-fn (lambda (typed-links)
- (let* ((type (car typed-links))
- (short-type (or (plist-get
sesman--cxt-abbrevs type) type)))
+ (let* ((type (car typed-links)))
(mapconcat (lambda (lnk)
- (format "%s(%s)" short-type
- (sesman--abbrev-path-maybe
- (sesman--lnk-value lnk))))
+ (let ((val (sesman--abbrev-path-maybe
+ (sesman--lnk-value lnk))))
+ (sesman--format-context type val
'italic)))
(cdr typed-links)
", ")))))
(if out-rel
(concat (mapconcat fmt-fn out-rel ", ")
- (when out " | ")
+ (when out " ")
(mapconcat fmt-fn out ", "))
(mapconcat fmt-fn out ", ")))
(if current-first
- [nongnu] elpa/sesman d8f293ff6e 024/100: Fix MELPA badge link, (continued)
- [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
- [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 <=
- [nongnu] elpa/sesman 5a9727ee82 072/100: Expand all paths with file-truename and cache, ELPA Syncer, 2021/12/28
- [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