[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: How to prompt for string?
From: |
Dirk-Jan.Binnema |
Subject: |
RE: How to prompt for string? |
Date: |
Fri, 17 Feb 2006 18:18:12 +0200 |
You can use 'interactive', which uses to some 'magic' chars to specify
what to prompt for.
(interactive "r\nsSummary:")
The 'r' will get you the region (begin and and), and 's' will get you
a string. The function with the interactive when then be called as
if it were called with these parameters.
My Example:
;; remove parts of old email, and replace with [snip: ... ]
(defun snip-mail (r-begin r-end summary)
(interactive "r\nsSummary:")
(let ((line-num (count-lines r-begin r-end)))
(delete-region r-begin r-end)
(insert (format "[snip%s (%d line%s)]\n"
(if (= 0 (length summary)) "" (concat ": " summary))
line-num
(if (= line-num 1) "" "s")))))
Best wishes,
Dirk.