Или используйте инструмент, который анализирует Ваши файлы журнала и дает Вам отчет 'о неработающих ссылках' (например, Аналог или Инструменты Веб-мастера Google ) или выполняет инструмент, что пауки Ваш веб-сайт и сообщают о неработающих ссылках (например, Проверка ссылок W3C ).
If you are using Emacs 23 (and maybe 22?), use kmacro-insert-counter
which is bound to C-x C-k TAB
by default. So for your example, you'd do:
C-x ( C-x C-k TAB . RET C-x )
So start macro, insert counter followed by '.', newline, end macro. Then C-x e e e e e e e
etc. Or M-1 0 0 C-x e
to get 100 of them.
EDIT:
Forgot to mention you can set the counter to an initial value also. For example to start at 1 instead of 0 do M-1 C-x C-k C-c
.
And if you don't want the counter to increment at a particular point, prefix it with C-u
. Of course the keystrokes are getting a bit ridiculous at this point, so I usually bind a key to insert-but-don't-increment.
Those who feel there are too many tricks to memorize might find acquiring some elisp more profitable:
M-: (dotimes (i 20) (insert (format "%2d.\n" (1+ i))))
Emacs 23 supports elisp snippets in the replacement text of replace-regexp.
I frequently define keyboard macros that follow this pattern:
\([0-9]+\)
to capture a group of one or more digits\,(1+ \#1)
, where ,
indicates that an elisp form to substitute follows, 1+
is an increment function, and \#1
is the first captured match text, interpreted as a number.After taking a minute to define the keyboard macro, this allows me to have almost the convenience of cutting and pasting to generate lots of blocks of almost-identical code, such as for case
statements.
Note that this technique can be easily adapted to e.g. double numbers (\,(* 2 \#1)
) or whatever. You can even use it to substitute the next element in an arbitrary sequence by using a combination of 'position
and 'nth
, but I won't go into that now :).
Помимо ответа Скоттфрейзера , есть еще один способ создать последовательность чисел в режиме CUA , который может очень помочь вам при редактировании существующего контента. См. скринкаст Марка Мансура о редактировании столбцов Emacs с позиции 2:30.
There's also:
C-u M-! jot -s '.C-q C-j' 10
It's not pure elisp, but has the same effect. You could write a named macro to run it for you.