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

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.

Related

org-mode: Visible export of drawer

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")

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

* 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.

Dired: don't show file permissions

At my new job I'm using Emacs 24 on Windows, and its chief use for me in these particular circumstances is as a file manager.
I'd like to jettison everything from the Dired display except filename, size, and date. This question showed me how to use ls-lisp-verbosity to remove most of the detail that I don't want.
But I haven't found a way to keep from displaying the permissions. I've checked the documentation for ls and for dir, and there doesn't seem to be a flag for "don't show permissions". And so far I haven't found anything in Dired that will omit the permissions. Can this be done?
Your best option is to change the ls switches so that Dired does not list those fields. See M-x man ls for your particular platform, to see what ls switches are available to you.
dired-details.el (and dired-details+.el) are no longer needed if you have Emacs 24.4 (or a pre-release development snapshot). Just use ( to toggle between showing and hiding details.
And in that case you at least have two options to control whether symbolic-link targets or all lines except header and file lines are considered details to hide: dired-hide-details-hide-symlink-targets and
dired-hide-details-hide-information-lines.
If changing ls switches does not help in your case, then you would need to tweak function dired-details-make-current-line-overlay from dired-details.el. The details to be hidden are determined by the first cond clause, which is this (wrapped in ignore-errors):
(dired-move-to-filename t)
That moves point to the beginning of the file name. The next line is this:
(make-overlay (+ 2 bol) (point))
That creates the invisibility overlay from the beginning of the line (bol here) up to the beginning of the file name (point).
If you want something different then you need to get the limits that you want for the overlay. For example, if you want invisibility to start at the file size, then you would search forward with a regexp that finds the beginning of the file size.
You can come up with such a regexp by working from the regexp for dired-move-to-filename-regexp (in library dired.el). It is a very complex regexp that matches everything up to the file name. But you can use it to find the date+time portion, which is either the 7th matching regexp subgroup or the 2nd, depending on whether the date+time is expressed using a locale (western or eastern) or using ISO representation.
You can see how this is handled in the code defining variable diredp-font-lock-keywords-1 of library dired+.el.
But again, the best approach, if it does what you want, is to try to use ls switches to control which fields are listed in the first place. You can easily experiment with switches by using a prefix argument with C-x d - you are prompted for the switches to use.

matching property in agenda view

I want collect and create a block containing headlines which only has "ID" property in the headlines.
i.e The headlines to be filtered looks like
* Headline
:PROPERTIES:
:ID: my-id
:END:
I am using the following code to configure the custom agenda command which does not work
(setq org-agenda-custom-commands
'(("c" "MY Agenda"
((tags "ID")))))
I have read the org manual http://orgmode.org/manual/Matching-tags-and-properties.html#Matching-tags-and-properties but still unable to figure out how to do it.
Your code as such is asking it to find all headlines that have a :ID: tag on the headline. To look for properties you have to use the property match feature which is listed a bit lower on the linked manual page.
Since I'm assuming you need it to match any ID and not just a specific ID you'll have to use the regexp matching by either matching (=) or not matching (<>) the regexp that follows in curly brackets.
To match your ID property you'll need the regexp to be ID={.+}. If you used .* as the match it would also match headlines without any ID property. If you have some a set of IDs you want to match that have something in common you can adjust the regexp to match them.
So your custom agenda command will have to be:
(setq org-agenda-custom-commands
'(("c" "MY Agenda"
((tags "ID={.+}")))))

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.