Sams Teach Yourself Emacs in 24 Hours

ContentsIndex

Hour 11: Editing Utilities

Previous HourNext Hour

Sections in this Hour:

 

Q&A

Q When I want to replace a word throughout an entire document (during spell-checking), is there a way to select one of the words from a list of suggestions, rather than having to type it myself?

A Yes and no. There is no nice way to do it but, because the minibuffer is a buffer and the window with the suggestions is a buffer, you can switch to this window with C-x o (other-window), and cut-and-paste from it to the minibuffer.

Q Should I insert the line (sams-write-abbrev-at-once) into my .emacs file as you suggest? If it's that smart, why isn't it the default?

A The reason that this is not the default is due to taste. Some people might like it, whereas others might not. If you add it, abbreviations are saved as soon as they are defined. If you do not add it, abbreviations are saved only when you exit Emacs. This means that if you forget to exit Emacs before you shut down your computer, they are never written! This is not the whole truth, actually. They are also saved when you press C-x s (save-some-buffers), but the problem is still there.

Q I have a project where I have some specialized abbreviations. Is there any way I can make these abbreviations local to a single directory?

A Unfortunately, abbreviations are not developed with that in mind, so there is no clean way to do that. There is a hack, though. Insert something such as the following at the end of the file for which these abbreviations are to be defined:


; Local Variables:
; abbrev-file-name: "~/Project/.abbrevs"
; eval: (read-abbrev-file abbrev-file-name)
; End:

This makes Emacs read the abbreviations from this file. When you later save abbreviations, they are saved to this file, too. Be aware, however, that you will not have access to your global abbreviations from the standard abbreviations file.

Q I have defined some abbreviations, but, nevertheless, nothing happens! Why is that?

A You have most likely forgotten to turn on abbrev-mode. (You have forgotten if the word Abbrev is not part of your mode-line). Simply press M-x and type abbrev-mode.

Sams Teach Yourself Emacs in 24 Hours

ContentsIndex

Hour 11: Editing Utilities

Previous HourNext Hour

Sections in this Hour: