How is automatic alignment of properties, in-buffer settings and similar things enabled?
I always end up with something like this and then have to align manually.
#+STARTUP: indent
#+PRIORITIES: A C B
#+COLUMNS: %ITEM %foo %bar
* section
:PROPERTIES:
:foo: foo
:barbaz: barbaz
:END:
However I found some signs alignment should happen automatically. E.g. there is this:
(defcustom org-property-format "%-10s %s"
"How property key/value pairs should be formatted by `indent-line'.
When `indent-line' hits a property definition, it will format the line
according to this format, mainly to make sure that the values are
lined-up with respect to each other."
:group 'org-properties
:type 'string)
Is there a command that will fixup a property to respect that? Shouldn't a property inserted with org-set-property follow that format? M-x org-indent-line doesn't do anything for me and indent-line doesn't exist.
org-indent-line did not do the right thing when the property keyword was right at the beginning of the line. It does now.
Also, from a fresh git pull, using C-M-\ on the region will indent the region.
To format the options header you can select the region you want to align and do
M-x align-regexp RET <space> RET
Related
In emacs org-mode, when I make a new sub-heading,(org-insert-subheading), sometimes it adds a blank line, sometimes it doesn't based on some pattern in text above.
Can I force emacs to never insert a line break?
I.e,
* Heading 1
** Heading 2 #no line breaks.
This is controlled by the variable org-blank-before-new-entry:
Should `org-insert-heading' leave a blank line before new heading/item?
The value is an alist, with `heading' and `plain-list-item' as CAR, and a boolean flag as CDR. The cdr may also be the symbol `auto', in which case Org will look at the surrounding headings/items and try to make an intelligent decision whether to insert a blank line or not.
On my version of emacs, the default for both items is auto. To never insert blank lines, set both to nil:
(setf org-blank-before-new-entry '((heading . nil) (plain-list-item . nil)))
I think this is controlled by the variable org-blank-before-new-entry. As per the Org documentation:
Should org-insert-heading leave a blank line before new heading/item?
The value is an alist, with heading and plain-list-item as CAR,
and a boolean flag as CDR. The cdr may also be the symbol `auto', in
which case Org will look at the surrounding headings/items and try to
make an intelligent decision whether to insert a blank line or not.
For plain lists, if org-list-empty-line-terminates-plain-lists is set,
the setting here is ignored and no empty line is inserted to avoid breaking
the list structure.
The default value is '((heading . auto) (plain-list-item . auto)), so it normally will insert a newline before a heading (the auto part in the heading). You can specify Never when you customize the variable, and it will not insert a newline.
I have just started using org-mode and it looks awesome. The only issue that I have so far is that when I write a text in mathmode ($...$) it appears in the standard-text font color.
So, I would like to make org-mode to identify the mathmode text and be able to present it in some other color. Note that I don't need to change the color of the actual equation, just the source text in org-mode.
Here is an example of how the text is currently presented
A paper by Rohnert, titled "Moving a disc between polygons" introduces
a structure using which one can generate a solution (path) for
a given query in $O(\log n) + k$ time.
and how I would like it to look
A paper by Rohnert, titled "Moving a disc between polygons" introduces
a structure using which one can generate a solution (path) for
a given query in $O(\log n) + k$ time.
(Note that I would prefer to display in some given color, e.g. red, and not bold face.)
In Emacs version 24.4 and later, this is controlled via the variable org-highlight-latex-and-related:
Non-nil means highlight LaTeX related syntax in the buffer. When non
nil, the value should be a list containing any of the following
symbols:
`latex' Highlight LaTeX snippets and environments.
`script' Highlight subscript and superscript.
`entities' Highlight entities.
So something like
(eval-after-load 'org
'(setf org-highlight-latex-and-related '(latex)))
in your init should help. Such code is formatted according to the face org-latex-and-related.
In earlier versions, the variable org-highlight-latex-fragments-and-specials, which is a simpler nil / non-nil variable:
(eval-after-load 'org
'(setf org-highlight-latex-fragments-and-specials t))
In this case, the face org-latex-and-export-specials is used.
In text, can I make org-mode ignore forward slashes somehow? Phonetics uses /s/ to denote a certain level of analysis.
I assume that you do not want the text to appear emphasized in the buffer, nor in the output. This is a slightly more complex answer which will achieve that result:
There is a variable defined by Org-mode called org-emphasis-alist which defines the different emphasis modes, what their plain-text syntaxes are, and how they are exported to HTML. You can achieve the result you want by changing the value of this variable before Org-mode has been loaded. That last part is critical so note it well—Org-mode reads the value of org-emphasis-alist when it is loaded and uses that value to generate a regular expression for highlighting ("font-lock") purposes.
Here are two routes to that:
Add the following lines to your .emacs file above the lines that load Org-mode:
(setq org-emphasis-alist
`(("*" bold "<b>" "</b>")
;; ("/" italic "<i>" "</i>")
("_" underline "<span style=\"text-decoration:underline;\">" "</span>")
("=" org-code "<code>" "</code>" verbatim)
("~" org-verbatim "<code>" "</code>" verbatim)
("+" ,(if (featurep 'xemacs) 'org-table '(:strike-through t))
"<del>" "</del>")))
(Notice the commented out line.)
Make the change through Emacs' customization facility:
M-x customize RET
In the search box enter Org Emphasis and click Search.
Click the down arrow next to Org Emphasis Alist to reveal its value.
Find and click the second DEL button—corresponding to the italic list item.
Click the Save for future sessions button at the top of the buffer.
You can use
#+OPTIONS: *:nil
to turn off text-emphasis (bold,italics,underline). This will however only work on export itself, the emphasis will still be visible.
See the manual for other export options.
If you like the standard emphasis functionality of the forward slashes in org-mode, you could also just define a new environment. I put something like the following in the preamble whenever I do phonetics/phonology typesetting:
\newcommand\uRep[1]{$/$\textipa{#1}$/$}
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.
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.