I am starting to use org-mode, to organise... well everything.
I am following the manual.
Is there a binding in org-mode to insert items and checkboxes ?
Ie. something like this :
* TODO Organize party [2/4]
- [-] call people [1/3]
- [ ] Peter
- [X] Sarah
- [ ] Sam
- [X] order food
- [ ] think about what music to play
- [X] talk to the neighbors [CURSOR HERE]
And now if I do M-x insert-checkbox-item (or similar, I haven't found the command) :
* TODO Organize party [2/4]
- [-] call people [1/3]
- [ ] Peter
- [X] Sarah
- [ ] Sam
- [X] order food
- [ ] think about what music to play
- [X] talk to the neighbors
- [ ] [CURSOR HERE]
If possible, it would respect the indentation too. This would mean keeping the new item at the level of indentation of the item where the cursor was when invoking the command. Which means that it may have to skip a few lines of lower-level items.
Assuming point is already in a list like in your example, use org-insert-todo-heading, bound to M-S-return in Org by default. When point is in a checklist item C-c C-c will toggle its state.
This same binding will do other things depending on where point is, e.g. if you are at the end of a heading it will add another heading at the same level with a TODO keyword.
Just C-u C-c C-c would do wherever your cursor on that line
Ref: https://orgmode.org/manual/Checkboxes.html
For continuing checkbox lists (and ordinary lists) in org-mode I use org-autolist.
This should do exactly what you want.
Also, for creating a new checkbox item I defined an emacs abbrev like so:
("rr" "- [ ]")
This means that I can type "rr " and emacs inserts "- [ ] " which is great.
Related
I want to do something like that in my snippets for visual studio code:
"V.G.${1|BLOCK_NR,MASS_MM,MASS_360,I,J,K,R,FEEDRATE,FEEDRATE_SCALE,MERR[${2}]|}"
So after choose the option MERR[] I will see the cursor inside the brackets.
and how i have to manage sub choices like:
"V.G.${1|choice${2|subchoiceA,subchoiceB|},choice, choice......}"
If I choose MERR[] Option I will jump into [Cursor should be here]. How can i handle this?
Here is a workaround to your subchoiceA/B question because you cannot have anything except plain text as choices - no tabstops or subchoices, etc. Your example:
V.G.${1|choice${2|subchoiceA,subchoiceB|},choice, choice......}"
This can be achieved however with 2 snippets:
"choices with subchoices": {
"prefix": "_choices", // whatever prefix you want
"body": [
"V.G.${1|choice1, _subchoices,choice2,choice3|}"
],
"description": "variables in a choice element"
},
"my subchoice list": {
"prefix": "_subchoices", // this prefix must be what you used in the main snippet
// as your subchoice option
"body": [ "${1|subchoiceA,subchoiceB|}" ],
"description": "subChoices"
},
What happens is that when you choose the subchoices option in the main snippet it will see it as the prefix for the second snippet - that is pretty neat. But it will not do so until you trigger that recognition with Ctrl+Space the usual intellisense trigger and then tab to select the second snippet.
It is only one or two extra keystrokes to get subchoices working inside of a parent choice element when otherwise it can't be done at all.
The only issue is that your second prefix - here subchoices cannot be a continuation of another string with no spaces otherwise it won't be recognized as a standalone snippet prefix by vscode. That is why I added the space before subchoices in the main snippet since your example has "V.G.${1....} with no space before the option would be inserted.
Here is a demo:
To organize reading tasks, I use org-mode checkboxes in the following way:
* TODO author, book_title [3/12]
- [X] chapter_01
- [X] chapter_02
- [X] chapter_03
...
- [ ] chapter_12
Since it is tedious to write this up for every book, I was thinking of using yasnippets to come up with some interactive snippet that would take as argument the "n" number of chapters and produce something of this sort:
- [ ] ${1:chapter_title_01}
- [ ] ${2:chapter_title_02}
...
- [ ] ${n:chapter_title_0n}
that would allow me to input the chapter titles one by one.
My elisp knowledge is limited, so the question is: Has anybody succeeded in implementing something similar with yasnippets or else? Thanks!
You probably don't need a snippet or a function. Try the following workflow:
Enter the headline with the title of the book.
Enter a '-' and then press M-S-RET: the dash moved down to the next line and you get a checkboxed list item.
Enter the title of the first chapter ending with M-S-RET and continue on like this until you've run ouf of chapters.
Finally delete the dash at the end.
That'd be enough for me, but YMMV: try it and see!
I switched from command prompt to Emacs GUI mode, I removed annoying menu/tool/scrollbars, I want to have smoother colors which works on GUI version.
Problem is that my eyes are bleeding when I see regular buttons inserted into text (ui widgets) and I'd like to have text version of them. I'd like to use Emacs GUI as "better cmd to run emacs -nw". I have tried unsuccessfully to switch to Linux on my main computer (as others run Linux) but at this point I don't feel like dual booting all the time.
TL;DR: Graphical UI widgets (buttons, checkboxes) -> Text version (like in emacs -nw)
Try setting (setq custom-raised-buttons nil). This will make buttons in customize buffers look more like flat text. You can change other attributes by putting the cursor on the thing you think is ugly and doing M-x customize-face RET. Finally, you may want to try out some themes; there are dozens in Melpa (search for "-theme").
The 'buttons' you are seeing are really just text with some font tricks to make them looked raised or 'boxed'. Completely getting rid of them may be a little tricky, but you should be able to remove most of them.
Emacs uses (in some places) an inheritance method to define 'faces', which means sometimes you may need to find the parent face to fix how it looks. These faces have attributes such as underline and box. For example, here is the definition for the 'button' face on my system.
Hide Button face: [sample]
State : THEMED.
Default face used for buttons.
[ ] Font Family: --
[ ] Font Foundry: --
[ ] Width: --
[ ] Height: --
[ ] Weight: --
[ ] Slant: --
[X] Underline: Value Menu On:
Color: Value Menu Foreground Color
Style: Value Menu Line
[ ] Overline: --
[ ] Strike-through: --
[ ] Box around text: --
[ ] Inverse-video: --
[ ] Foreground: --
[ ] Distant Foreground: --
[ ] Background: --
[ ] Stipple: --
[ ] Inherit: --
Hide Unused Attributes
and here is the definition for
Hide Custom Button face: [sample]
State : THEMED.
Face for custom buffer buttons if ‘custom-raised-buttons’ is non-nil.
[ ] Font Family: --
[ ] Font Foundry: --
[ ] Width: --
[ ] Height: --
[ ] Weight: --
[ ] Slant: --
[ ] Underline: --
[ ] Overline: --
[ ] Strike-through: --
[X] Box around text: Value Menu Box:
Width: 2
Color: Value Menu *
Style: Value Menu Raised
[ ] Inverse-video: --
[X] Foreground: #93a1a1 Choose (sample)
[ ] Distant Foreground: --
[X] Background: #073642 Choose (sample)
[ ] Stipple: --
[ ] Inherit: --
Hide Unused Attributes
Note the underline and box attributes used by these two faces.
What you need to do is change the attributes so that the face doesn't cause your eyes to bleed. There are two ways (actaully ther are more, but two are easy to describe!) you can do this.
M-x list-faces-display
list-faces-display is an interactive compiled Lisp function in
‘faces.el’.
It is bound to , .
(list-faces-display &optional REGEXP)
List all faces, using the same sample text in each. The sample text is
a string that comes from the variable ‘list-faces-sample-text’.
If REGEXP is non-nil, list only those faces with names matching this
regular expression. When called interactively with a prefix argument,
prompt for a regular expression using ‘read-regexp’.
and M-x customize-face (point needs to be on the face you want to customise or you need to know the name of it)
customize-face is an interactive autoloaded compiled Lisp function in
‘cus-edit.el’.
It is bound to .
(customize-face &optional FACE OTHER-WINDOW)
Customize FACE, which should be a face name or nil. If FACE is nil,
customize all faces. If FACE is actually a face-alias, customize the
face it is aliased to.
If OTHER-WINDOW is non-nil, display in another window.
Interactively, when point is on text which has a face specified,
suggest to customize that face, if it’s customizable.
My suggestion would be to use list-faces-display and go through the list to identify those faces which you don't like and then change them to something acceptable. This should get most of them. Then, when using emacs, when you find another 'button' hyou don't like, put the cursor on it and use customize-face to change it.
Note that loading themes can also change face settings, so you may need to get the sequence of things right to get consistent behaviour.
I really want to use org-mode.
But, I want to use org-mode to understand structured documents that have already been written using different heading syntax,
e.g. using twiki's ---+
---+ H1
Top level
---++ H2
Nested
---+ H1 #2
Second top level
Or mediawiki like
= H1 =
Top level
== H2 ==
Nested
= H1 #2 =
Second top level
I'd like to have all of the goodness of org-mode folding, etc., just using these different heading styles.
Actually, worse that that:
I would like, say, the twiki or mediawaiki headings to take priority over org mode asterisk headings. But I would like to have both in use.
= H1 =
Top level
* this is a list
** nested
* list
** nested
== H2 ==
Nested
= H1 #2 =
Second top level
--+ What I have tried so far
I have been able to use outline mode to handle twiki,
for example via
---+ Emacs stuff
# try (defvar twiki-outline-regexp "---+\\++ \\|\\(\\(?: \\)+\\)[0-9*] ")
Local Variables: ***
outline-regexp: "^---\\++" ***
org-outline-regexp: "^---\\++" ***
End: ***
However, org-outline-regexp doesn't do hwat I would hope.
emacs' outline-mode's out-level function looks almost exactly like what I want.
(defvar outline-level 'outline-level
"*Function of no args to compute a header's nesting level in an outline.
It can assume point is at the beginning of a header line and that the match
data reflects the `outline-regexp'.")
i.e. instead of regexps, a generic function.
But I have not managed to make it work with org-mode. It looks like org-mode does not really use this, or, rather, has other stuff.
;; In Org buffers, the value of `outline-regexp' is that of
;; `org-outline-regexp'. The only function still directly relying on
;; `outline-regexp' is `org-overview' so that `org-cycle' can do its
;; job when `orgstruct-mode' is active.
(defvar org-outline-regexp "\\*+ "
"Regexp to match Org headlines.")
(defconst org-outline-regexp-bol "^\\*+ "
"Regexp to match Org headlines.
This is similar to `org-outline-regexp' but additionally makes
sure that we are at the beginning of the line.")
(defconst org-heading-regexp "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$"
"Matches an headline, putting stars and text into groups.
Stars are put in group 1 and the trimmed body in group 2.")
Failing this, well, the main thing that I want from org-mode is links, Asking another question here
How can I "linkify" a non-org-mode buffer in emacs
My frustration was simply that org-mode has different rules for what constitutes a new outline section than outline-mode does. It requires a space after the asterisks, so it doesn't work on my extensive collection of notes, which forgo those spaces.
I resolved that by removing the trailing space in the not-well-documented org-outline-regexp variable, which is used to initialize the buffer-local variable outline-regexp, and that seems to be working for me. E.g. (set-variable 'org-outline-regexp "\\*+")
As to your actual question, my guess is that other regexp's and code would have to change to handle radically different stuff like twiki or mediawiki headings.
I have a list of TODO items, and I'm trying to have 2 TODO lists in the same file, but can't seem to end the first one.
FIRST LIST: TODAY
* TODO Item 1
Description
* TODO Item 2
Description
SECOND LIST: TOMORROW
* TODO Item 3
Description
* TODO Item 4
Description
Unfortunately, SECOND LIST: TOMORROW is now part of the description of TODO Item 2. By this, I mean that when I hit shift-tab, I no longer see the text SECOND LIST: TOMORROW because it folds under TODO Item 2. What I see is..
FIRST LIST: TODAY
* TODO Item 1
* TODO Item 2
* TODO Item 3
* TODO Item 4
While what I'd like to see is...
FIRST LIST: TODAY
* TODO Item 1
* TODO Item 2
SECOND LIST: TOMORROW
* TODO Item 3
* TODO Item 4
How can I escape out of the description mode and start a new, independent list?
EDIT/UPDATE I added spaces in between the lists in response to comments. From here, 'A list ends whenever every item has ended, which means before any line less or equally indented than items at top level. It also ends before two blank lines'---From this, I suspect there must be a way to have more than one list in a .org file. However, in my example, I notice 2 blank lines is not ending the list, but continues on as if a description.
Is this a feature of it being somehow an agenda rather than a plain list? I know that the following enumerated /does/ end the list on the other hand:
FIRST LIST: TODAY
1. Item 1
Description
2. Item 2
Description
Second LIST: Tomorrow
1. Item 3
Description
2. Item 4
Description
I really don't mean any disrespect to you emacs wizards (who amaze me) in that I keep insisting on finding a way to do this, and I understand there's a lot of power to this tool I don't understand yet. But I would like to have 2 independent non-enumerated todo lists in one .org file, so I can quickly (for me) shuffle unfinished tasks from today to tomorrow without going into depth setting dependencies and due dates.
Very simple, just make the two headers become list items themselves., like so:
* first todo list.
** first item in list.
** second item in list
* second todo list
** first item and so on...
This additionally gives you the ability to fold the lists.
You cannot do so within a single file. Org treats all content under a headline as belonging to it until you reach another headline of the same level. There is no way to end a headline short of starting a new one.
This does have a few shortcomings in that you have to use blank headlines if you want a sub-heading and then to return to the parent level without any new headline. This means the only text that does not belong to a headline is the text before the first heading, which essentially is the equivalent of an abstract.
The two solutions I can think of would be
Use a solution such as the one offered by daramarak
Use 2 separate Org files then use the Agenda as a way of keeping track of the multiple TODOs in independent lists that can still be put together to see an overview.
Plain lists start with '-' and they end at white-space lines:
First list
- Item 1
- Item 2
Second List
- Item 1
- Item 2
But TODO's can only be recognized in a headlines (starting with a *). I think this is a part of the org-mode design. You can quickly turn a list into headings by marking the lines and pressing C-c *.
A similar but more light-weight feature to TODO's, "checkboxes", can however be used in plain lists for having a list of subtask.
List a
- [X] Item 1
- [ ] Item 2
List B
- [ ] Item 1
- [ ] Item 2
C-c C-c Toggles a list item. Also lists can be nested and show the satus of their children.
- [ ] List A
- [ ] Item 1
- [ ] Item 2
- [-] List B
- [X] Item 1
- [ ] Item 2
Another possibility is using inline tasks C-c C-x t they have a specific ending
List 1
*************** TODO Item 1
*************** END
*************** TODO Item 2
*************** END
List 2
*************** TODO Item 1
*************** END
*************** TODO Item 2
*************** END
*************** TODO
*************** END
More discussion can be found here