branch: externals/blist
commit 950a21445629591c0ff8c1178db247f78859ccc8
Author: JSDurand <[email protected]>
Commit: JSDurand <[email protected]>
New option: blist-use-header-p
* blist.el (blist-use-header-p, blist-list-bookmarks): Now the user
can choose to display column names in the header line.
---
ChangeLog | 5 +++++
blist.el | 26 ++++++++++++++++++++++++--
blist.elc | Bin 46200 -> 46699 bytes
3 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fdd5c18da0..7c3d6e572c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2021-12-22 李俊緯 <[email protected]>
+
+ New user option: blist-use-header-p. Now the user can choose to
+ use the header line to display the column names.
+
2021-12-21 李俊緯 <[email protected]>
Fix errors discovered by flymake.
diff --git a/blist.el b/blist.el
index 13e7d3fe5b..657d4339b7 100644
--- a/blist.el
+++ b/blist.el
@@ -232,6 +232,13 @@ list; they are simply ignored."
:group 'blist
:type 'string)
+;;;; Whether to use header or not
+
+(defcustom blist-use-header-p nil
+ "If non-nil, show a header of column names as well."
+ :group 'blist
+ :type 'boolean)
+
;;; Variables
;;;; Sorter
@@ -347,7 +354,8 @@ used as a `revert-buffer-function'."
;; load the bookmark if needed
(bookmark-maybe-load-default-file)
(let ((buffer (get-buffer-create blist-buffer-name))
- (first-time-generated t))
+ (first-time-generated t)
+ blist-header-line-format)
(with-current-buffer buffer
(let ((inhibit-read-only t)
front rear group pos)
@@ -412,6 +420,12 @@ used as a `revert-buffer-function'."
blist-sorter
t))
(goto-char (point-min))
+ ;; set the header if necessary
+ (cond
+ (blist-use-header-p
+ (setq blist-header-line-format
+ (buffer-substring-no-properties
+ (point) (line-end-position)))))
(cond
((and
(stringp rear)
@@ -438,7 +452,15 @@ used as a `revert-buffer-function'."
(select-window (get-buffer-window blist-buffer-name))
;; if generated for the first time, advance a line
(cond
- (first-time-generated (ilist-forward-line 1 nil t)))))
+ (first-time-generated (ilist-forward-line 1 nil t)))
+ (cond (blist-header-line-format
+ (setq header-line-format blist-header-line-format)
+ (with-silent-modifications
+ (add-text-properties
+ (point-min)
+ (save-excursion
+ (goto-char (point-min)) (forward-line 2) (point))
+ (list (intern "invisible") t)))))))
;;; Major mode
diff --git a/blist.elc b/blist.elc
index 8d7e887bdc..3dc54fa5cb 100644
Binary files a/blist.elc and b/blist.elc differ