[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to increase a number under cursor?
From: |
Oliver Scholz |
Subject: |
Re: How to increase a number under cursor? |
Date: |
Tue, 20 May 2003 15:34:32 +0200 |
User-agent: |
Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.3.50 (windows-nt) |
Wang Yin <wang-y01@mails.tsinghua.edu.cn> writes:
> Hi,
>
> I want to record a macro to type flexible numbered lists.
> for example:
Are you talking about a keyboard macro?
[...]
> The only problem I meet is how to increase the number under
> the cursor?
It is not clear to me what you want here. Do you simply want a
function that deletes the number at point and inserts number + X into
the buffer again? What do you want to achieve?
If you simply want a skeleton for lists, you could use something like
this:
(defun wy-list-skel ()
(interactive)
(let ((num 0))
(skeleton-insert
'(nil
("Type something: "
(number-to-string (setq num (1+ num)))
". " str "\n")))))
Hexadezimal:
(defun wy-hex-list-skel ()
(interactive)
(let ((num 0))
(skeleton-insert
'(nil
("Type something: "
(format "0x%02x" (setq num (1+ num)))
". " str "\n")))))
Oliver
--
1 Prairial an 211 de la Révolution
Liberté, Egalité, Fraternité!