Emacs was created to do such things--in fact the name E-macs is a terse form of Editor-Macros {originally a derivative of TECO} {There is a huge list of what Emacs should stand for--my fave is: Emacs Makes All Computing Simple} Now, what I'm suggesting is you make a macro, and store and reuse it--to get you started, I suggest something like this Cs* Cn C@ Cs** Cx ( replace-string Cqj Return \n Return Cx ) name-last-macro Give it a name & save it & re-use it and/or EXTEND it later On Mon, May 11, 2020 at 7:05 PM John Kitchin wrote: > Hi everyone, > > I am trying to get the body of a heading up to the next subheading. For > example with this org file, > > * quiz one > > This is the description. > Use emacs for this. > > ** question 1 > what is 40 + 2 > > If the point is in the first heading, I want to run a function that would > return the string "This is the description.\nUse emacs for this." > > I thought there was a simple way to do that, but so far it has eluded my > google fu. Any hints? > > John > > ----------------------------------- > Professor John Kitchin > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > @johnkitchin > http://kitchingroup.cheme.cmu.edu > >