Commit 0565dd25 authored by Antonino D'Annaç's avatar Antonino D'Annaç

cleaner approach, doesn't ask to save the buffer

parent c8d78f71
...@@ -29,26 +29,29 @@ ...@@ -29,26 +29,29 @@
(line-beginning-position) (line-beginning-position)
(line-end-position) (line-end-position)
'bdio-record record) 'bdio-record record)
)))) )))
(set-buffer-modified-p nil)
)
(defun bdio-mode--open-file () (defun bdio-mode--open-file ()
"Open .bdio file using lsbdio." "Open .bdio file using lsbdio."
;;(setq-local bdio-mode--source-file buffer-file-name) (let* ((file buffer-file-name)
(let ((file (buffer-file-name))) (buf (get-fbuffer-create
(when file (format "*BDIO* %s" (file-name-nondirectory file)))))
(rename-buffer (with-current-buffer buf
(format "*BDIO* %s" (file-name-nondirectory file)) t)
(set-visited-file-name nil t)
(bdio-mode) (bdio-mode)
(bdio-mode--render-file file)))) (setq-local bdio-mode--source-file file)
(bdio-mode--render-file file)
(pop-to-buffer buf))))
(defun bdio-mode--toggle-record () (defun bdio-mode--toggle-record ()
"Expand/collapse current record." "Expand/collapse current record."
(interactive) (interactive)
(let ((bdio-file bdio-mode--source-file) (let ((bdio-file bdio-mode--source-file)
(setq lstart (line-beginning-position)) (lstart (line-beginning-position))
(lend (line-end-position)) (lend (line-end-position))
(cpoint (point))) (cpoint (point)))
(let* ((record (get-text-property lstart 'bdio-record)) (let* ((record (get-text-property lstart 'bdio-record))
...@@ -73,7 +76,7 @@ ...@@ -73,7 +76,7 @@
(put-text-property lstart lend 'bdio-expanded t))))) (put-text-property lstart lend 'bdio-expanded t)))))
(goto-char cpoint))) (goto-char cpoint)))
(defun bdio-mode--refresh-file (&rest ARGS) (defun bdio-mode--refresh-file (ignore-auto noconfirm)
(interactive) (interactive)
(bdio-mode--render-file bdio-mode--source-file)) (bdio-mode--render-file bdio-mode--source-file))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment