[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/breadcrumb a44bb5ced2 17/18: Compute length of breadcru
From: |
ELPA Syncer |
Subject: |
[elpa] externals/breadcrumb a44bb5ced2 17/18: Compute length of breadcrumbs dynamically by default |
Date: |
Tue, 5 Sep 2023 06:57:43 -0400 (EDT) |
branch: externals/breadcrumb
commit a44bb5ced262baa5102083463e4f7823b1d6f825
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Compute length of breadcrumbs dynamically by default
* breadcrumb.el (bc-project-max-length): Change default value.
(bc-imenu-max-length): Change default value.
(bc--length): New helper.
(breadcrumb-imenu-crumbs): Use it.
(breadcrumb-project-crumbs): Use it.
---
breadcrumb.el | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/breadcrumb.el b/breadcrumb.el
index c814f28cbb..cf527afacc 100644
--- a/breadcrumb.el
+++ b/breadcrumb.el
@@ -107,14 +107,22 @@
:prefix "breadcrumb-"
:group 'convenience)
-(defcustom bc-project-max-length 40
- "Soft cutoff for `breadcrumb-project-crumbs'." :type 'natnum)
+(defcustom bc-project-max-length 0.3
+ "Soft cutoff for `breadcrumb-project-crumbs'.
+If a fixnum, it's a absolute number of characters. If a float, a
+percentage of `window-width'."
+ :type '(choice (natnum :tag "Number of characters")
+ (float :tag "Percent of window's width")))
(defcustom bc-project-crumb-separator "/"
"Separator for `breadcrumb-project-crumbs'." :type 'string)
-(defcustom bc-imenu-max-length 40
- "Soft cutoff for `breadcrumb-imenu-crumbs'." :type 'natnum)
+(defcustom bc-imenu-max-length 0.3
+ "Soft cutoff for `breadcrumb-imenu-crumbs'.
+If a fixnum, it's a absolute number of characters. If a float, a
+percentage of `window-width'."
+ :type '(choice (natnum :tag "Number of characters")
+ (float :tag "Percent of window's width")))
(defcustom bc-imenu-crumb-separator " > "
"Separator for `breadcrumb-project-crumbs'." :type 'string)
@@ -243,6 +251,11 @@ These structures don't have a `breadcrumb-region' property
on."
(defvar bc--header-line-key [header-line mouse-1])
(defvar bc--mode-line-key [mode-line mouse-1])
+(defun bc--length (len)
+ "Interpret LEN using `window-width' and return a number."
+ (cond ((floatp len) (* (window-width) len))
+ (t len)))
+
(defun bc--format-ipath-node (p more)
(let* ((l (lambda (&rest _event)
(interactive)
@@ -272,7 +285,7 @@ These structures don't have a `breadcrumb-region' property
on."
(cl-loop
for (p . more) on (bc-ipath alist (point))
collect (bc--format-ipath-node p more))
- bc-imenu-max-length
+ (bc--length bc-imenu-max-length)
(propertize bc-imenu-crumb-separator
'face 'bc-face)))))
@@ -343,7 +356,7 @@ propertized crumbs."
(bc--summarize
(if buffer-file-name (bc--project-crumbs-1 buffer-file-name)
(list (propertize (buffer-name) 'face 'bc-project-leaf-face)))
- bc-project-max-length
+ (bc--length bc-project-max-length)
(propertize bc-project-crumb-separator
'face 'bc-project-crumbs-face)))
- [elpa] externals/breadcrumb eb7c97d414 04/18: Add a README.md and a screenshot, (continued)
- [elpa] externals/breadcrumb eb7c97d414 04/18: Add a README.md and a screenshot, ELPA Syncer, 2023/09/05
- [elpa] externals/breadcrumb e508856a59 06/18: * breadcrumb.el (bc-jump): Replace `M-x' by its function name, ELPA Syncer, 2023/09/05
- [elpa] externals/breadcrumb 9cfc08ff6c 11/18: Add capability to jump to siblings, ELPA Syncer, 2023/09/05
- [elpa] externals/breadcrumb 85a3885b98 07/18: Change defcustom type fixnum into natnum (#4), ELPA Syncer, 2023/09/05
- [elpa] externals/breadcrumb 07b8e96ed4 09/18: Fix #7: Select window before jumping around with breadcrumbs, ELPA Syncer, 2023/09/05
- [elpa] externals/breadcrumb 2369e5b609 03/18: * breadcrumb.el: Fix todos add another one, ELPA Syncer, 2023/09/05
- [elpa] externals/breadcrumb df9e2c3678 10/18: Fix case when bc--ipath-alist results in something useless, ELPA Syncer, 2023/09/05
- [elpa] externals/breadcrumb 1cb229b87e 14/18: Clean up before ELPA submission, ELPA Syncer, 2023/09/05
- [elpa] externals/breadcrumb 9205ef62c8 15/18: Fix indentation in two places, ELPA Syncer, 2023/09/05
- [elpa] externals/breadcrumb 20bfa7407b 16/18: * breadcrumb.el (bc--format-ipath-node): Fix bug, ELPA Syncer, 2023/09/05
- [elpa] externals/breadcrumb a44bb5ced2 17/18: Compute length of breadcrumbs dynamically by default,
ELPA Syncer <=
- [elpa] externals/breadcrumb e9358a641a 13/18: Work some more in the mode-line/header-line mouse interaction, ELPA Syncer, 2023/09/05
- [elpa] externals/breadcrumb 995e1638d2 18/18: * .elpaignore: Add a basic file (#15), ELPA Syncer, 2023/09/05
- [elpa] externals/breadcrumb 64ae52c534 01/18: Initial commit, ELPA Syncer, 2023/09/05
- [elpa] externals/breadcrumb cda39e32f0 08/18: Use longhand symbol forms for autoloaded functions, ELPA Syncer, 2023/09/05
- [elpa] externals/breadcrumb 4dd49220fd 12/18: Fancy it up with some faces, ELPA Syncer, 2023/09/05