I never knew of the existence of stylesheets until the copyedit came back for my first novel. They struck me as such a good idea that ever since I’ve tried (and failed) to keep one up to date as I’m writing a novel.
The reason why they fail is that I change my mind as to what style to use as I’m writing. For example, I couldn’t decide whether the antagonists in DREAM PARIS were pierrots or Pierrots. In COSMOPOLITAN PREDATORS!, I couldn’t decide whether a character was named young man or Young Man.
I came about the solution by using the occur function.
M-x occur pierrot
occur lists lines containing a regexp in a separate buffer. Since Emacs regexps are case insensitive by default, the above finds both pierrot and Pierrot. It opens a buffer rather like the one in the self referential example below:
7 matches in 5 lines for "pierrot" in buffer: workout.org 16:The reason why they fail is that I change my mind as to what style to use as I'm writing. For example, I couldn't decide whether the antagonists in my most recently completed novel, DREAM PARIS were pierrots or Pierrots. In COSMOPOLITAN PREDATORS!, I couldn't decide whether a character was named young man or Young Man. 21:M-x occur pierrot 24:Emacs regexps are case insensitive by default, so the above finds pierrot and Pierrot. It opens a buffer rather like the example below: 31:M-s h l pierrot 34:highlights lines with pierrot in.
Clicking or hitting enter on a line in the Occur buffer jumps you to the original location in the text.
A big advantage of occur is that you can look at the words in situ before deciding on the final style and running a query-replace-regexp to replace them all.
Another useful mode in when looking at styles is hi-lock mode.
M-s h l pierrot
The above highlights lines containing the regexp pierrot.
A really useful feature of hi-lock mode is that it highlights on the fly, highlighting lines as you type in the words. I use this feature to act as a reminder of whether I’m typing in the right (or wrong) style.
As a bonus, hi-lock mode allows you to choose from a pallete of colours. Use M-n and M-p to scroll through the choices, or enter your own choice – very useful when tracking more than one style.