if current at point is [ \t\r\n] (re-search-forward "[ \t\r\n]+" nil t)
otherwise (kill-word)
(defun delete-to-word ()
(interactive)
(setq myChar (thing-at-point 'char))
(if (string-match "[ \t\r\n]" myChar)
(progn
(re-search-forward "[ \t\r\n]+" nil t)
(replace-match "" nil nil))
(kill-word))
)
if: Wrong number of arguments: #[(arg) "Ã`^Hv\210`\"\207" [arg kill-region] 3 2119065 "p"], 0
help delete-to-word
Re: help delete-to-word
(defun le-kill-word (arg)
(interactive "p")
(setq myChar (thing-at-point 'char))
(if (string-match "[ \t\r\n]" myChar)
(progn
(re-search-forward "[ \t\r\n]+" nil t)
(replace-match "" nil nil))
(kill-region (point) (progn (forward-word arg) (point)))
)
)
why can not call kill-word directly
(interactive "p")
(setq myChar (thing-at-point 'char))
(if (string-match "[ \t\r\n]" myChar)
(progn
(re-search-forward "[ \t\r\n]+" nil t)
(replace-match "" nil nil))
(kill-region (point) (progn (forward-word arg) (point)))
)
)
why can not call kill-word directly
Re: help delete-to-word
KILL-WORD takes an argument. Emacs is self-documenting, if you are unsure how to use a function use 'C-h f', which by default is bound to describe-function command.
Re: help delete-to-word
Or, better, enable the `eldoc-mode' that will show description of function under cursor in the minibuffer.Ramarren wrote:KILL-WORD takes an argument. Emacs is self-documenting, if you are unsure how to use a function use 'C-h f', which by default is bound to describe-function command.
Re: help delete-to-word
freshman using emacs thanks guy 
