How do I move text back to just under the parent level - emacs

* Parent
Some text under this level
** Headline below parent
** Another Headline at the same level
I don't want this text to be a headline but be indented same as the text under the parent level without being a headline. Cannot do this.
I just cannot re-indent this text just below the parent level here
* Another top-level headline
Is there any way in org-mode to re-indent plain text back to the same indent level as the plain text just under the parent level but below several headlines under the parent?
I am trying to do something like this:
* A Section
Introductory text.....
** Subsection 1
** Subsection 2
Further Reading
Now, that "Further Reading" is not a headline, I don't want it to be one. However, I cannot "get out of" Subsection 2: Anything I type below it is a part of it. Perhaps I need to structure this some other way such as using lists instead of headlines.

There is no way to do this in org, currently - there is no syntax that ends a subheader to return you to the previous level. But you could add a subsection at the same level - e.g. in your example,
* A Section
Introductory text.....
** Subsection 1
Subsection 1 text
** Subsection 2
Subsection 2 text
** Further Reading
Some further reading
It might be nice if org had some syntax, like **-, that would end a subsection, but I'm not sure how involved a change that would be - probably pretty extensive.

Related

Org-mode [[file: ]] link to a file with specific :PROPERTIES: :ID:

I'm trying to find a way to add a clickable link in org-mode that opens another local file and scrolls to a specific property id.
It's easier to explain with an example:
$ cat file1.org
* org links that I've tried and they don't work properly
[[file:path/to/another-file.org::#d89ba6bd-7c9a-4559-9965-7a6541f1a7c5][ref]]
[[file:path/to/another-file.org:id:d89ba6bd-7c9a-4559-9965-7a6541f1a7c5][ref]]
[[file:path/to/another-file.org::d89ba6bd-7c9a-4559-9965-7a6541f1a7c5][ref]]
[[file:path/to/another-file.org::id:d89ba6bd-7c9a-4559-9965-7a6541f1a7c5][ref]]
$ cat another-file.org
* Top category
** Category X
*** Question :drill:
:PROPERTIES:
:ID: d89ba6bd-7c9a-4559-9965-7a6541f1a7c5
:END:
Content of d89ba6bd-7c9a-4559-9965-7a6541f1a7c5 entry
*** Question :drill:
:PROPERTIES:
:ID: some-other-property-uuid
:END:
Content of some-other-property-uuid entry
Unfortunately, I can't change the structure of another-file.org. I can only reference using a property id.
Just renaming "Question :drill:" would have been much easier but it is duplicated many times and as I said it is not available for updates.
Update:
With "CUSTOM_ID" property it seems to be working
*** Question :drill:
:PROPERTIES:
:CUSTOM_ID: d89ba6bd-7c9a-4559-9965-7a6541f1a7c5
:END:
Content of d89ba6bd-7c9a-4559-9965-7a6541f1a7c5 entry
[[file:path/to/another-file.org::#d89ba6bd-7c9a-4559-9965-7a6541f1a7c5][ref]]
But is there any way to make it with with default :ID: property?
Try setting org-link-search-must-match-exact-headline to nil. That makes the third type of link above [[file:path/to/another-file.org::d89ba6bd-7c9a-4559-9965-7a6541f1a7c5][ref]] do a fuzzy text search, whereas the other values (t and the default query-to-create) are biased towards headlines when the target file is an Org mode file.
Here's the doc string of org-link-search-must-match-exact-headline:
org-link-search-must-match-exact-headline is a variable defined in ‘ol.el’.
Its value is nil
Original value was ‘query-to-create’
This variable is safe as a file local variable if its value
satisfies the predicate ‘symbolp’.
You can customize this variable.
This variable was introduced, or its default value was changed, in
version 24.1 of Emacs.
Documentation:
Non-nil means internal fuzzy links can only match headlines.
When nil, the a fuzzy link may point to a target or a named
construct in the document. When set to the special value
‘query-to-create’, offer to create a new headline when none
matched.
Spaces and statistics cookies are ignored during heading searches.
BTW, I found it by reading the External Links section of the manual: look for text search and the accompanying footnote.

How to create sub-headers in org-mode (emacs)?

Hello I was wondering how to create sub-headers in an org document. I have tried this:
* header
* sub-header
Some text
The * works for the header part but will create bullets instead of sub-headers.
for these kind of questions the org-manual is the best place to check: https://orgmode.org/org.html#Headlines
Headlines define the structure of an outline tree. The headlines in Org start with one or more stars, on the left margin3. For example:
* Top level headline
** Second level
*** Third level
some text
*** Third level
more text
* Another top level headline
Hope, this helps!
As a supplement to the answer by #sanenr9, you can also enable a "clean view" that hides all but the last star in a heading if you prefer (see A Cleaner Outline View): the asterisks are still there in the buffer but they are hidden using an overlay.
Another useful hint is to examine the "Org" entry in the menu: there are many useful commands there (generally with a keyboard shortcut as well). E.g. you can add a new heading at the same level as the previous heading by clicking on the "New Heading" entry in the "Org" menu and you can then make it into a subheading by clicking on
"Org/Edit Structure/Demote heading" menu item (or you can use the indicated keyboard shortcut M-<right> which is done by holding down the Meta key and pressing the right arrow key.)

Orgmode: Show number of children under heading

I have a heading in my orgmode file. It is automatically updated periodically with new children. I want the heading line to show the number of children.
So if I have one child it would say something like (1)
* Heading (1)
** Subheading
After it gets updated with another subheading the number should automatically be changed to (2)
* Heading (2)
** Subheading
** A new added subheading
I want it to do this because the toplevel heading will normally be collapsed. I want to be able to see if any new children were added to it without having to expand it
What's most similar to what you're searching are called statistics cookies. They're described at the end of this page in the manual. At first meant for lists, but that can also count headlines. Just put [/] at the end of your header, like so :
* Main header [/]
** sub-header 1
** sub-header 2
** sub-header 3
And press C-c C-c on the cookie to update it (make it update its count). What you do need to add to what you describe to be your use-case is TODO keywords to your headers, because what the cookie will count is how many are done over how many are to do. Therefore I suggest you mark them all as DONE, like so :
* Main header [3/3]
** DONE sub-header 1
** DONE sub-header 2
** DONE sub-header 3
Then, the counter will show you what you want.
You could probably adapt these cookies' code to meet your precise needs.

Collapsing the current outline in Emacs org-mode

Say I am in org-mode in a document with the following structure:
* First headline
* Second headline
** Section A
Here is one line
Here is another line
blah, blah
** Section B
Say the cursor is on the line that reads Here is another line. I would like to collapse ** Section A from this location with a keyboard shortcut.
If I press <TAB> it does not collapse ** Section A, as I would need the cursor to be on the stars for this to work.
If I press <Shift-TAB> it collapses all outlines, and not the current one.
Is there any way to cycle through the collapsing of the outline in scope (i.e. the "current outline")?
You can customize the behaviour of the org-cycle command (which is bound to <TAB>) by changing the value of org-cycle-emulate-tab.
To get it to collapse ** Section A when your cursor is on Here is another line add the following line to your .emacs file:
(setq org-cycle-emulate-tab 'white)
The white will allow you to still use <TAB> to indent in empty lines. From org-mode Github:
org-cycle-emulate-tab's value is t
Documentation:
Where should `org-cycle' emulate TAB.
nil Never
white Only in completely white lines
whitestart Only at the beginning of lines, before the first non-white char
t Everywhere except in headlines
exc-hl-bol Everywhere except at the start of a headline
If you don't mind doing this in two steps:
C-c C-p: move the cursor to the previous heading (** Section A in your example)
TAB: fold the section
This method doesn't require any configuration, as long as you get used to it.

How can I repeat a beamer frame with Org-mode?

With Beamer frames can be repeated by labeling the frame that should be repeated such as
\begin{frame}[label=framelabel]
...
\end{frame}
and then using \againframe{framelabel} at the place where that frame is to be repeated.
How can this method be used with Org-mode's Beamer export? The label can obviously be added by putting it in BEAMER_envargs such as:
* Org-mode section
:PROPERTIES:
:BEAMER_envargs: [label=questions]
:END:
But there are two problems in using \againframe via Org-mode:
\againframe is placed badly both if it is placed under an Org-mode section and if it is put directly in an Org-mode section. The problem is that in the former case is that is is placed inside a frame when it should be placed between. The problem in the latter case is that it is placed inside \frametitle.
\againframe is either swallowed by Org-mode sections or it is marked as one. Both are poor logical representations of its function.
So is there some effective way of using \againframe with Beamer or is there some other way to repeat frames with Org-mode that I have overlooked?
I have already looked at http://lists.gnu.org/archive/html/emacs-orgmode/2011-05/msg00954.html in trying to work this out.
I am running Org-mode 7.6 in Emacs 23.3.1 and I use Beamer 3.13.
The current org-mode has support for againframe. Just create a frame and add the beamer option BEAMER_env = againframe to the corresponding section. Or use C-c C-b a to insert it if you initialized the beamer mode on org-startup.
More information can be found in the org-mode documentation.
An example is available in the original proposal of the syntax:
* section
** My frame title :B_frame:
:PROPERTIES:
:BEAMER_env: frame
:END:
Some text. Some text. Some text. Some text.
Some text. Some text. Some text. Some text.
** section :B_againframe:
:PROPERTIES:
:BEAMER_env: againframe
:BEAMER_act: 2
:BEAMER_ref: *My frame title
:END:
This section will create "\againframe<2>{sec-1-2}".
** Following frame
etc.
I don't think this is currently possible. The limitation lies in the tree structure of an org document. As far as I understood from your question, the \againframe{...} command basically repeats a slide as is. In org terms, that means the original tree used to generate the slide is repeated. Since the org document format doesn't let you have any content which is not part of a tree (other than the frontmatter/header at the top of a file), I believe this is not possible. This has been discussed on the mailing list a few times, from what I understood there are no plans to implement something like this.