-
-
Notifications
You must be signed in to change notification settings - Fork 158
Support sheband and tangle mode header tag #939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Support sheband and tangle mode header tag #939
Conversation
113cc16
to
67667a8
Compare
67667a8
to
160fe5f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Generally looks good, but I have some questions and suggestions.
lua/orgmode/babel/tangle.lua
Outdated
local shebang = info.header_args[':shebang'] | ||
if shebang then | ||
shebang = shebang:gsub('[\'"]', '') | ||
table.insert(parsed_content, 1, shebang) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is already done above on line 64. Is there a reason why it's needed twice?
lua/orgmode/babel/tangle.lua
Outdated
if mode_str and mode_str:sub(1, 1) == 'o' then | ||
mode_str = mode_str:sub(2) | ||
local mode_num = tonumber(mode_str, 8) | ||
vim.loop.fs_chmod(filename, mode_num) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing chmod
after the file is created, lets pass down the mode as an argument to utils.writefile
and pass it there when creating the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sound good, I'm make the changes
Add the ability to include a shebang line at the beginning of tangled code files by supporting the `:shebang` header argument. The shebang value is cleaned of quotes and inserted as the first line of the tangled content.
This header allow the creator to change the generated file permissions.
When tangling code blocks to files, automatically create parent directories when the :mkdirp header argument is set to 'yes'.
Coding style requires single quotes
Add the ability to include a shebang line at the beginning of tangled code files by supporting the `:shebang` header argument. The shebang value is cleaned of quotes and inserted as the first line of the tangled content.
They keep showing up.
e84d8a8
to
fdfb3c8
Compare
The orgmode docs describe 3 styles of tangle-mode values: ls-style, chmod style, and octal. All three style are now supported, however, I'm still using the example of the three modes
|
Summary
Add shebang and tangle-mode source block header tags
Related Issues
New features to enable features in org-mode
Related #
https://orgmode.org/manual/Extracting-Source-Code.html
Closes #
Changes
Changes the structure of the tangle_info table.