Книга: Learning GNU Emacs, 3rd Edition
7.1.6 Changing Tabs to Spaces (and Vice Versa)
7.1.6 Changing Tabs to Spaces (and Vice Versa)
We've just talked about a way to make sure that Emacs inserts spaces instead of tabs. But what if you inherit a file and it has tabs that you want to change to spaces?
Emacs provides a command to banish tabs from your files. You can use tabs for editing and then convert all of the tabs to the appropriate number of spaces so that the appearance of your file doesn't change. Unlike tabs, a space is almost always well defined. The command for eliminating tabs is M-x untabify. There's a corresponding command to convert spaces into tabs: tabify. However, we trust that you'll take our advice and forget about it.
The untabify command works on a region. Therefore, to use it, you must put the mark somewhere in the buffer (preferably at the beginning), move to some other place in the buffer (preferably the end), and type M-x untabify Enter. The command C-x h (for mark-whole-buffer) automatically puts the cursor at the beginning of the buffer and the mark at the end. It makes untabification a bit easier because you can do it all at once with the simple sequence C-x h M-x untabify Enter.
Table 7-1 shows the tab commands we've covered in this section.
Table 7-1. Tab commands
Keystrokes | Command name | Action |
---|---|---|
(none) | edit-tab-stops | Open a buffer called *Tab Stops* where you can change the tab settings. |
(none) | untabify | Change all tabs into the equivalent number of spaces. |
(none) | tabify | Change groups of three or more spaces to tabs where possible without affecting the text placement. |
- 7.1.5 Tabs and Spaces
- 7.1 Using Tabs
- Разработка приложений баз данных InterBase на Borland Delphi
- Open Source Insight and Discussion
- Introduction to Microprocessors and Microcontrollers
- Chapter 6. Traversing of tables and chains
- Chapter 8. Saving and restoring large rule-sets
- Chapter 11. Iptables targets and jumps
- Chapter 5 Installing and Configuring VirtualCenter 2.0
- Chapter 16. Commercial products based on Linux, iptables and netfilter
- Appendix A. Detailed explanations of special commands
- Appendix B. Common problems and questions