Browse Source

Merge branch 'master' of jao/navigel into master

tags/v0.7.0
Damien Cassou Gitea 3 months ago
parent
commit
1531a497be
2 changed files with 18 additions and 1 deletions
  1. +7
    -0
      examples/navigel-ex-fs.el
  2. +11
    -1
      navigel.el

+ 7
- 0
examples/navigel-ex-fs.el View File

@@ -144,6 +144,13 @@
;; buffer width. Read the documentation of `tabulated-list-format' to
;; get more information about the column format specification.

;; By default, navigel first sets the header information and then
;; proceeds to read the children of the current entity to display
;; them. If you need to use the list of children to decide the format
;; of the header, you can override `navigel-tablist-format-children',
;; which is called _after_ the entities returned by `navigel-children'
;; are available.

;; As a final step, we might want to be able to delete files from the
;; file system. This can be done by overriding `navigel-delete':



+ 11
- 1
navigel.el View File

@@ -185,7 +185,7 @@ a list with just the entity at point."
&optional at-point-if-empty)
"Return a list with marked entities for MAJOR-MODE derived from a tablist.

AT-POINT-IF-EMPTY indicates if we use the entity at point if none
AT-POINT-IF-EMPTY indicates whether to return the entity at point if none
is marked."
;; `tablist-get-marked-items' automatically includes the entity at
;; point if no entity is marked. We have to remove it unless
@@ -213,6 +213,12 @@ The default name is based on `navigel-app' and `navigel-buffer-name'."
The return value is set as `tabulated-list-format'."
(vector (list "Name" 0 t)))

(cl-defgeneric navigel-tablist-format-children (_entity &optional _children)
"Return a vector specifying columns to display ENTITY's CHILDREN.
The return value is set as `tabulated-list-format' after the list
of children has been retrieved, unless this call returns nil."
nil)

(cl-defgeneric navigel-entity-to-columns (entity)
"Return the column descriptors to display ENTITY in a tabulated list.
The return value is a vector for `tabulated-list-entries'.
@@ -341,6 +347,10 @@ refreshed."
(navigel-children
entity
(lambda (children)
(let ((new-format (navigel-tablist-format-children entity children)))
(when new-format
(setq-local tabulated-list-format new-format)
(tabulated-list-init-header)))
;; restore navigel-app
(let ((navigel-app app) state)
(with-current-buffer (get-buffer-create (navigel-entity-buffer entity))


Loading…
Cancel
Save