Fork me on GitHub
#emacs
<
2017-02-01
>
qqq00:02:34

I'm editing http://foo.org. I am editing a codeblock. I popped up a spcial buffer ot edit the codeblock (to get all the right major modes). Now, I want to add an item back to http://foo.org -- is there a way to do this without leaving my "special" buffer [which is editing a code-block region of http://foo.org] ?

tanzoniteblack00:02:35

if you save your special buffer, it'll save the changes you've made into the parent org file, if that's your question?

tanzoniteblack00:02:53

or do you want to edit a part of the org file that's not being edited in the "special" buffer?

qqq17:02:15

I should clarify, I want to add TODO item back to http://foo.org, while I'm editing a doe-block of http://foo.org

ag19:02:36

@qqq what exactly are you trying to achieve? If you popped-up 'edit special' buffer, do you want to “save” the progress or something?

qqq19:02:55

1. I'm in http://foo.org 2. I'm editing a #+begin_src #+end_src block in http://foo.org, in a separate buffer. 3. I think of a new todo item. 4. I want to add this new TODO item to http://foo.org without leaving my current special buffer.

caio20:02:36

idk if there’s a generic solution to this. your file could be formatted in different ways and even have different TODO/DONE statuses defined. where would the default position to add the item be?

caio20:02:54

looks like the last element on org-src-babel-info is the position of the source code on the org buffer. maybe you can write a fn to do what you want using this

caio20:02:14

@qqq (pop-to-buffer (marker-buffer (car (last org-src-babel-info)))) would send you to the org buffer you came from, maybe this helps

caio20:02:44

it won’t change its pointer position (if you moved it after going to the src buffer, for example) tho, so you’d have to write a function that would insert the TODO on the right position no matter where your pointer is initially

caio20:02:58

and then pop back to the source buffer

caio20:02:45

(let ((src-buffer (current-buffer)))
  (pop-to-buffer (marker-buffer (car (last org-src-babel-info))))
  (message "Your fn to add the TODO item here. Will be evaluated on the org buffer")
  (pop-to-buffer src-buffer))