1

orgmode file links can contain additional information to link to particular places within a file, i.e.:

[[file:~/code/main.c::255]]

opens main.c and jumps to line 255. Is it possible to accomplish this with non-file links? I'm particularly interested in links to man pages, provided via org-man. I'd like to be able to link directly to a line or heading within a long man page, such as man bash.

The following doesn't work:

[[man:bash::144][bash manual line 144]]

[[man:bash::OPTIONS][bash manual options section]]

Is it possible to define a link handler to incorporate searching as is done with the built-in file links?

  • You can define it by yourself. Check out function org-link-set-parameters. – stardiviner Dec 31 '17 at 9:27
1

Out-of-the-box (i.e. with org-contrib), it seems to be possible with, say, info links (where you can link to a specific section, as info:filename#nodename-or-index), but not with man links. Looking at the source corroborates that: info, man.

In principle, there is no reason why you couldn't define your own org link handler, based on org-man linked above. In particular, you'd need a custom definition of org-man-open. (If you don't care about exporting from org and don't need org-store-link to be clever, then you don't really need to modify anything else.) Since AFAICT neither man nor woman supports opening at a specific line or specific section of a manpage, directly, you'll need a function to search for a string or go to the Nth line in the opened manpage. org-link-search and org-link-line might perhaps be helpful. (Depending on whether you prefer man or woman you might be bitten by the fact that man line numbers depend on the width of your window. Searching should work without issues.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.