all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Optional Arguments
@ 2020-12-07  3:17 pietru
  2020-12-07  8:16 ` Alexis Roda
  0 siblings, 1 reply; 23+ messages in thread
From: pietru @ 2020-12-07  3:17 UTC (permalink / raw)
  To: Help Gnu Emacs

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) )





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

end of thread, other threads:[~2020-12-07 21:21 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-07  3:17 Optional Arguments pietru
2020-12-07  8:16 ` Alexis Roda
2020-12-07 12:37   ` pietru
2020-12-07 13:06     ` tomas
2020-12-07 13:35       ` Anders Dalskov
2020-12-07 14:24       ` pietru
2020-12-07 15:38         ` tomas
2020-12-07 18:13           ` pietru
2020-12-07 19:01             ` Arthur Miller
2020-12-07 19:42               ` pietru
2020-12-07 19:54                 ` Michael Heerdegen
2020-12-07 20:21                   ` pietru
2020-12-07 20:52                   ` Arthur Miller
2020-12-07 21:21                     ` pietru
2020-12-07 19:51             ` Alexis Roda
2020-12-07 15:06       ` pietru
2020-12-07 15:51         ` tomas
2020-12-07 17:51           ` pietru
2020-12-07 18:33             ` Arthur Miller
2020-12-07 18:49               ` pietru
2020-12-07 20:13             ` Stefan Monnier
2020-12-07 20:25               ` pietru
2020-12-07 20:39                 ` Christopher Dimech

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.