Книга: Learning GNU Emacs, 3rd Edition

7.1.2 Changing Tab Stops

7.1.2 Changing Tab Stops

By default (and if text is not lining up with some previous line of text), tabs are set every eight characters. Emacs allows you to change the positions of the tab stops. To change the tab stops, type M-x edit-tab-stops. A *Tab Stops* buffer appears.

Type: M-x edit-tab-stops


You now see a tab stop ruler; colons show the locations of tab stops.

The colons in the first line of the display show you where tab stops are currently located. The next two lines form a ruler that shows each character position on the line. To insert a tab, use C-f to move to the desired column, and then type a colon (:). To delete a tab, move to the desired tab, and press Space. The *Tab Stops* buffer is in overwrite mode, so these changes won't change the position of other tabs. Make sure that you do all your editing in the first line of the display. Changes made to the other lines won't have any effect.

When you're satisfied with the tab stops, press C-c C-c to install them. If you don't make any changes, press C-c C-c to exit the buffer. If you make some changes and then decide you don't want them after all, kill the buffer by typing C-x k Enter. The default tab stops remain in effect.

If you press C-c C-c to install them, the new tab settings affect all buffers that you create but remain in effect for this Emacs session only.

Again, it may well appear to you that this feature doesn't work as you would expect. Because Emacs's default behavior tries to align with preceding lines, changing tab stops really affects only the first line of any buffer.

In this example, we set the first tab at column 51, pressed C-c C-c to install the tab stops, and started a new buffer. Pressing Tab at the beginning of the buffer moves the cursor immediately to column 51. That works fine.

Press Tab once.


Cursor moves to column 51.

Now we press Tab a few more times, followed by Enter to move to a new line.

When we press Tab on the second line, Emacs views the newline as the only item on the last line. Pressing Tab moves us right to the end of the line.

Press Tab on the next line.


Emacs moves to the end of the line.

As you can see, changing tab stops in this way is of limited efficacy if you're going to add blank lines between rows of your table or whatever you're typing. You'd have to work around this by adding blank lines after typing the whole table, perhaps using a macro as described in Chapter 6.

Оглавление книги


Генерация: 0.156. Запросов К БД/Cache: 0 / 0
поделиться
Вверх Вниз