Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bdio-mode
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Antonino D'Anna
bdio-mode
Commits
9b593247
Commit
9b593247
authored
May 08, 2026
by
Antonino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First working version
parents
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
0 deletions
+96
-0
bdio-mode.el
bdio-mode.el
+96
-0
No files found.
bdio-mode.el
0 → 100644
View file @
9b593247
;;; bdio-mode.el --- View .bdio files using lsbdio
(
require
's
)
(
defvar
bdio-mode-hook
nil
)
(
defun
bdio--render-file
(
file
)
"Render FILE using lsbdio into current buffer."
(
let
((
inhibit-read-only
t
))
(
erase-buffer
)
(
let
((
exit-code
(
call-process
"lsbdio"
nil
t
nil
file
"-c 0"
)))
(
unless
(
eq
exit-code
0
)
(
insert
(
format
"Error running lsbdio on %s\n"
file
))))
(
goto-char
(
point-min
))
(
while
(
re-search-forward
"^\\([0-9]+\\)\\s-"
nil
t
)
(
let
((
record
(
string-to-number
(
match-string
1
))))
(
put-text-property
(
line-beginning-position
)
(
line-end-position
)
'bdio-record
record
)
))))
(
defun
bdio-open-file
()
"Open .bdio file using lsbdio."
(
let
((
file
(
buffer-file-name
)))
(
when
file
(
rename-buffer
(
format
"*BDIO* %s"
(
file-name-nondirectory
file
))
t
)
;(set-visited-file-name nil t)
(
bdio-mode
)
(
bdio--render-file
file
)
(
set-buffer-modified-p
nil
))))
(
defun
get-properties
()
(
interactive
)
(
let
((
properties
(
text-properties-at
(
point
))))
(
while
properties
(
print
(
car
properties
))
(
setq
properties
(
cdr
properties
)))))
;; (defun bdio-revert-buffer (_ignore-auto _noconfirm)
;; (bdio--render-file buffer-file-name))
(
defun
bdio-toggle-record
()
"Expand/collapse current record."
(
interactive
)
(
setq
bdio-file
buffer-file-name
)
(
setq
lstart
(
line-beginning-position
)
lend
(
line-end-position
)
cpoint
(
point
))
(
let*
((
record
(
get-text-property
lstart
'bdio-record
))
(
inhibit-read-only
t
))
(
when
record
(
if
(
get-text-property
lstart
'bdio-expanded
)
(
let
((
start
(
line-end-position
))
(
end
(
+
(
next-single-property-change
(
line-end-position
)
'bdio-record
nil
(
point-max
))
-1
)
))
(
delete-region
start
end
)
(
put-text-property
lstart
lend
'bdio-expanded
nil
))
(
let
()
(
end-of-line
)
(
insert
"\n"
)
(
let
((
output-start
(
point
)))
;; insert command output
(
call-process
"lsbdio"
nil
t
nil
bdio-file
"-d"
(
number-to-string
record
)))
;; mark inserted region
(
put-text-property
lstart
lend
'bdio-expanded
t
)))))
(
goto-char
cpoint
))
;; ;; optional face
;; (add-text-properties
;; output-start
;; (point)
;; '(face shadow)))))))))
(
setq-local
revert-buffer-function
#'
bdio-revert-buffer
)
;;;###autoload
(
add-to-list
'auto-mode-alist
'
(
"\\.bdio\\'"
.
bdio-open-file
))
(
defvar
bdio-mode-map
(
let
((
map
(
make-sparse-keymap
)))
(
keymap-set
map
"<tab>"
#'
bdio-toggle-record
)
map
))
(
define-derived-mode
bdio-mode
special-mode
"BDIO"
"Major mode for viewing BDIO files via lsbdio."
(
use-local-map
bdio-mode-map
)
(
setq
buffer-read-only
t
))
(
provide
'bdio-mode
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment