unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Writing Emacs-function: how?
@ 2009-04-21 11:37 Ulrich Scholz
  2009-04-21 12:04 ` Richard Riley
  2009-04-21 14:00 ` harven
  0 siblings, 2 replies; 6+ messages in thread
From: Ulrich Scholz @ 2009-04-21 11:37 UTC (permalink / raw)
  To: help-gnu-emacs

I try to write an Emacs function and bind it to a key.  My first try
is given below.  But I get the error
"Wrong type argument: commandp, my-replace"

I tried several versions but none worked.  Could you give me a correct
version. Thanks.

BTW, the function should replace all occurences of the string "<DF>"
by "ß" in the current buffer.

(defun my-replace nil "doc-string"
  (while (re-search-forward "<DF>" nil t)
    (replace-match "ß" nil nil)))

(global-set-key [f7] 'my-replace)



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-04-21 15:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-21 11:37 Writing Emacs-function: how? Ulrich Scholz
2009-04-21 12:04 ` Richard Riley
2009-04-21 13:35   ` d7
2009-04-21 13:52     ` Anselm Helbig
2009-04-21 14:00 ` harven
2009-04-21 15:17   ` d7

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).