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.
Related
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.
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.)
I write this in org-mode
SomeTopic
Anything I can click here to automatically create the below 1.
Anything I can click here to automatically create the below 1. automatically indented below?
1.
For example, I have this line (non header, text):
1. some item
I want to click something so it will open 2. so after I click that something I will have:
1. some item
2.
Try M-RET which is bound to org-meta-return which in list context calls
org-insert-item. E.g.
* foo
Let's have a list:
1. itemX
where X marks the position of the cursor.
Now press M-RET:
* foo
Let's have a list:
1. item
2.
The Plain lists section of the manual explains this and many other things that you can do with lists.
* 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.
I probably have some broken config but I can't figure out what I set to break this.
If I have an outline like
* Heading
** Subheading1
** Subheading2
If I hit M-return or C-return when the cursor is at subheading1 I end up with
* Heading
** Subheading1
**
** Subheading2
It should be producing a new subheading, but instead produces something indented which is not treated as a sub heading.
Anyone know how I broke my org mode?