help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Optional Arguments


From: pietru
Subject: Optional Arguments
Date: Mon, 7 Dec 2020 04:17:10 +0100

Would like to have two functions

1. skip-chars - skip to beg of word (if no argument) or end of word (if 
argument is 1)

2. word-markers - get beg and end of a word position of word

Have written the following. For the first one, I have not used optional 
arguments before.
And have read documentation about functions.

About the second, there errors when I try to execute.

(defun typh-skip-chars (&optional n)
   (interactive "n Skip direction: ")
   (if (= n 1)
      (skip-chars-forward "[:alpha:]")
      (skip-chars-backward "[:alpha:]")) )

(defun typh-word-markers (ma mb)
   (interactive)
   (skip-chars-backward "[:alpha:]")
   (setq ma (point))
   (skip-chars-forward "[:alpha:]")
   (setq mb (point))
   (message "[ma,mb]: %s,%s" ma mb) )





reply via email to

[Prev in Thread] Current Thread [Next in Thread]