org-mode: Visible export of drawer - emacs

What I want is really to be able to export the :PROPERTIES: of my items and somehow override the default hide behavior. That is apparently impossible. Next best thing is to define a "drawer." So :MYDRAWER: is something I can define -- and it will appear on an export. My problem is drawers don't allow the nice key:value subcategories of properties. With properties I can do this:
:PROPERTIES:
:Author: Victor Andrade
:Author2:
:Title: My Missions for Revolutionary Bolivia, 1944-1962
:Subtitle:
:Published: 1976
:Read: 2010
:Subject: History
:Area: Bolivia
:Comments:
:END:
But I can't do that with drawers. Trying to add key:value categories between :MYDRAWER: and :END: just gets treated as text. Is there any way for me to have nice properties-like layout get exported? And again, I'm not really sure what to do with the org-mode customization option either (...group Org Export\Org Export General\Org Export With Drawers. I'm guessing all drawers are exported unless you set this not to. Right?

Try something such as:
#+OPTIONS: d:(not "MYDRAWER")

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.

in org-mode, how to demote all headers in a region?

In my org-mode file, I have a bunch of level 1 headings. I want to highlight some of them and demote them by one level to level 2. How do I do this? When I highlight the region and do M-S-right, I get This command is active only in special context like tables, headlines or items.
You want to use M-right rather than M-S-right.
Here, at least, a sort-of workaround solution: use regexp-replace to change "^*" into "". That should do the job, even if not in a pure Org way.

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.

lazy loading of only the first N lines in emacs org-mode

Is there a way to tell org-mode to load only the first N lines of a long text file? I would like to keep the whole file open to be able to search through it, but have org-mode display on the first N lines of my file, which is where I edit new content.
If you have a structured outline in org-mode, you can set the global file visibility with the #+STARTUP markup, or the visibility of any heading with the VISIBILITY property, see Visibility Cycling for details. The benefit of using the built-in org-mode properties is that it's easy to have a file open up in exactly the state you want.
I have my journal file set up to accomplish something similar what I think you're asking for using these org-mode properties. The "Today" section is opened so I can see everything, but older archives are collapsed.
I'm not sure the title really fits the description?
I think you just want use buffer narrowing, which lets you hide everything outside of the specified region for as long as necessary.
You can manually narrow the buffer by marking the region and typing C-xnn
Widen the display back to the full buffer with C-xnw
I guess you could use an eval Local Variable to automate this to a pre-defined region, if you really wanted to.
There's also narrow-to-defun (C-xnd) and narrow-to-page (C-xnp). If you throw a page break into your org file (C-qC-l), the latter might prove handy.

How to display the full context of the entries in org-mode agenda tree view

In org-mode's daily/weekly agenda view, is there a way to display the full context of the entries?
My reading of the code is that it finds the first heading above the timestamp and displays that. However, in my case, that heading is often 3-4 levels deep and doesn't make sense without the bullets above it. It also doesn't seem like there are hooks to easily change that. Filtering is trivial, but not changing the fundamental presentation format.
There is no way to display all the context directly in the agenda view, but you can right click on the headline in agenda view and it will show you that headline in the main window in a sparse tree context.
You may have to collapse everything in the main window in order for the right-click-locating to show the sparse-tree view.
That seems pretty close to what you're looking for. To check, do this:
Create desired agenda view.
In main document window collapse everything to just first level headlines.
Right-click on the desired headline in the agenda view. It should show the headline in sparse tree context in the main document window.
There are several things you can do to get better information about context in agenda views, short of using the right-click function described above.
First, you can arrange your headlines themselves so that they give you more context information. It would be possible, e.g., to have numerous 4th level headlines labeled 'Tasks', each which includes tasks related to the headings above in each tree. That's not going to give good context info in agenda view, though, since each line's headline text would be the same (i.e., 'Task') and have no info in context. A simple solution would simply be to make the headlines more specific, e.g., 'Project xxxx Tasks' and 'Project yyy Tasks'.
A different way of getting more context in agenda view would be by using 'categories'. The first column in agenda view is the filename containing the headline by default, but if the headline has a category the category will be shown. To assign a category to a headline and all of its subtree you can add a category property to the main headline, like this:
:PROPERTIES:
:CATEGORY:Project xxx Stuff
:END:
Now agenda view will show 'Project xxx Stuff' in the first column for each of the agenda lines that are gathered from that headlines subtree.
Maybe an agenda is not really what you need. I would use this:
`M-x org-sparse-tree RET D'
then select the date range and navigate through the results.
HTH
Follow-mode (S-f) gets pretty close to what the OP is looking for. Credit to #armando.sano in a comment on another answer.