-
Notifications
You must be signed in to change notification settings - Fork 14
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
editing plain source code blocks as well #15
Comments
Idea/code are Welcome. Although it is not directly supported yet, but we can simply wrap a function to do it: (defun separedit/edit-org-src-block ()
"Edit org src code block."
(interactive)
(when-let* ((datum (when (org-in-src-block-p)
(org-element-context)))
(content-info (org-src--contents-area datum)))
(separedit
(separedit-mark-region (nth 0 content-info)
(nth 1 content-info)
(org-src-get-lang-mode
(plist-get (cadr datum) :language))))))
|
This looks good! I have other ideas as well but I'll create separate issues for them. |
(defun separedit/edit-org-src-block ()
"Edit org src code block."
(interactive)
(when-let* ((datum (when (org-in-src-block-p) (org-element-context)))
(content-info (org-src--contents-area datum)))
(lexical-let*
((ov (when (string-empty-p (nth 2 content-info))
(make-overlay (nth 1 content-info)
(nth 1 content-info) nil nil t)))
(ad (when ov
(lambda ()
(with-current-buffer (overlay-buffer ov)
(save-excursion
(goto-char (overlay-end ov))
(delete-overlay ov)
(unless (= (point) (point-at-bol))
(insert "\n")))))))
(buf (separedit
(separedit-mark-region (nth 0 content-info)
(nth 1 content-info)
(org-src-get-lang-mode
(plist-get (cadr datum) :language))))))
(when ad
(with-current-buffer buf
(setq-local kill-buffer-hook (append (list ad) kill-buffer-hook))))))) |
I still get the same problem with the new version. When I have time I'll try my Question: would you accept a PR to bring this into separedit? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be nice if separedit could also edit code blocks--regular code blocks I
mean that are not in a string.
org-edit-src-code
is not as simple and easilycustomizable as
edit-indirect
buffers. Also, it would be more consistent ifevery "separate" edit were done using the same backend--
edit-indirect
.Before I knew of this project I had been working on using
edit-indirect
instead of
org-edit-src-code
so I have some code on this I could offer. Pleaselet me know what you think of this idea.
The text was updated successfully, but these errors were encountered: