* Check for broken links in org-mode?
@ 2010-11-06 8:22 Magnus Nilsson
2010-11-09 20:58 ` David Maus
0 siblings, 1 reply; 2+ messages in thread
From: Magnus Nilsson @ 2010-11-06 8:22 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 1115 bytes --]
Dear all,
Is there any nice way to check for broken links of different kinds in org
files?
For example by parsing the file and reporting the lines with broken links in
a separate buffer so they can be fixed one after another? If not, I imagine
this is possible to implement (at least to some extent) as a lisp-function.
What do you all think? :)
My incentive for having this function is the following:
I have started using org mode to organize things at work.
One of the nice uses of org-mode is to keep link reminders together with my
notes, so that I quickly can find where information is located when I need
to retrieve it months/years later.
However, paths to where I keep files may be renamed as projects develop,
servers are changed, or as I "brainstorm" my way through different projects.
As my org-files can be quite large now, I have no way of remembering which
links I need to rename.
It would be great to (org-check-for-broken-links &optional org-files-list)
once in a while to keep links up-to-date. This could make it easier for me
and perhaps the next person that sometime will take over my job.
[-- Attachment #1.2: Type: text/html, Size: 1183 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Check for broken links in org-mode?
2010-11-06 8:22 Check for broken links in org-mode? Magnus Nilsson
@ 2010-11-09 20:58 ` David Maus
0 siblings, 0 replies; 2+ messages in thread
From: David Maus @ 2010-11-09 20:58 UTC (permalink / raw)
To: Magnus Nilsson; +Cc: emacs-orgmode
At Sat, 6 Nov 2010 09:22:25 +0100,
Magnus Nilsson wrote:
> Is there any nice way to check for broken links of different kinds in org
> files?
Well, you would have to write it by yourself but the functions are
available.
You can use `org-next-link' to make point jump to the next
link in buffer. This function will throw an error if there is no next
link, so wrap it in a (condition case ...) statement.
For each link, look what type of link it is. Assuming all links in
question are bracket links, use `org-bracket-link-analytic-regexp', a
variable with a regexp that breaks down the parsed link into its
parts.
(when (looking-at org-bracket-link-analytic-regexp)
...
)
Check the link type (it is a match string, check the doc string of
org-bracket-link-analytic-regexp), grab the link (another match
string). Now normalize the link to the file by stripping a possible
fragment part (e.g. it might be: foo.org#id, strip the #id)
(if (string-match "\\([^#]*\\)#" <path>)
(setq <path> (match-string 1 <path>)))
Now use (file-exist-p <path>) to check if the file exist and do
something.
HTH,
-- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-11-09 21:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-06 8:22 Check for broken links in org-mode? Magnus Nilsson
2010-11-09 20:58 ` David Maus
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).