Skip to content

Commit

Permalink
Supply org-babel-edit-prep:racket-hash-lang; #closes #692
Browse files Browse the repository at this point in the history
  • Loading branch information
greghendershott committed Feb 2, 2024
1 parent d3ab936 commit ddd0f46
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions racket-hash-lang.el
Expand Up @@ -931,6 +931,27 @@ rhombus\"."
,input
t))))

(defun org-babel-edit-prep:racket-hash-lang (babel-info)
"Recreate back-end hash-lang object using :shebang property.
`org-edit-src-code' calls us AFTER the `racket-hash-lang-mode'
buffer is created. So if there is a :shebang property with
\"#lang foo\", we need to recreate the back end object using the
option where we can supply this."
(pcase babel-info
(`(,_racket-hash-lang ,_contents ,props . ,_)
(when-let (shebang (cdr (assq :shebang props)))
;; re-create back end hash-lang object
(racket--hash-lang-delete)
(setq-local racket--hash-lang-id
(racket--cmd/await
nil
`(hash-lang
create
,(cl-incf racket--hash-lang-next-id)
,shebang
,(buffer-substring-no-properties (point-min) (point-max)))))))))

(provide 'racket-hash-lang)

;; racket-hash-lang.el ends here

0 comments on commit ddd0f46

Please sign in to comment.