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

7.6.1 Drawing in Picture Mode

7.6.1 Drawing in Picture Mode

In picture mode, you can "draw" with any character in any of eight directions. Although you can draw in eight directions, only one direction is available at a time; this direction is referred to as the default direction. When you first enter picture mode, the default direction is right, meaning that if you press the hyphen key four times, you would draw a line to the right, as follows: ——. The default direction is displayed on the mode line, like this:

(Picture: right)

By typing special commands that change the default direction, you can draw in seven other directions as well. For example, C-c makes the default direction "southeast;" the mode line would then read (Picture: se). If you typed four hyphens in this direction, they would look like stair steps:

-
 -
  -
   -

Figure 7-4 illustrates the commands for setting various directions as the default in picture mode.

Figure 7-4. Moving around in picture mode


Picture mode tries to make these commands easy to remember, and it doesn't do too badly: for example, C-c ^ points upward, C-c-` arguably points to the northwest, and so on. If you can come up with a good mnemonic device for C-c . let us know! Maybe you can think of it as "dot for down."

After you set a default direction, pressing any character repeatedly draws a line of characters in that direction. Give it a try in a scratch buffer, using the commands in the figure to change the default direction. Try drawing a box.[41]

Type: M-x picture-mode


Putting the buffer into picture mode, default direction "right."

Type: Tab M-20 -


Emacs draws a line to the right. Next, we'll change the default direction to down, and use | for the right side of the square.

Type: C-c . M-5 |


Emacs draws a line down. Now we'll set the default direction to "left," then draw the bottom of the square.

Type: C-c < M-20 -


Emacs draws a line to the left. Next, use C-c ^ to set the default direction to "up," and then draw vertical bars back to the starting point.

Type: C-c ^ M-5 |


Emacs draws a line up that completes the box.

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


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