LQWiki:Emacs tips and tricks/External links formatting

This is a repository of external link formatting functions

Those functions were used when doing heavy reformatting ( think hundreds of pages ) on the wiki.

One function explanation
To get an idea of what this is all about we will take a look at one function, my-lqwiki-reformat-external-link-parenthesize-domain-name


 * External links like :
 * The page's title


 * will be formatted like this :
 * The page's title (my.domain.com)


 * Which should look like :
 * The page's title (my.domain.com)


 * An external link to be formatted :
 * Stands on one line only.
 * Is not followed by "optional spaces + (", this avoids reformatting already formatted links.
 * Is a link of the form : [address title] -- (the [address] kind of link won't be formatted).


 * Extra spaces after the enclosing "]" are removed, leaving only one or none if at the end of a line.

The key combination to launch this function is "control+alt+l" and then "u".

This is a query-replace, this will cover links from the current line to the end of page. When asked type space to format the underlined link ( a couple of other characters are too ) or "n" to skip and look for the next.

Doing all external links formatting in one go
You can run all the formatting functions in the proper order by simply running my-lqwiki-reformat-external-link-all-formatting (control+alt+l A)

The query-replace function will present you with the name of the proposed formatting in the minibuffer area.

I personnaly apply those functions on particular subsections of a buffer, but i didn't put all the code relating to that on the wiki so for now the function will apply on the whole buffer, or only on the "External links" section if any.

Please report problems in the discussion page if any.

This is for convenience only, use at your own risk ( always like to put this one. Seriously use the undo function of course :) ).