summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-01-24 19:33:42 -0500
committerKyle Meyer <kyle@kyleam.com>2015-01-27 01:01:05 -0500
commitbab1cea4888f87ed3e96d6dac935a42e21683679 (patch)
treed6337724a61ffc087c9bd91d4c56d14eb9079b12 /lisp
parent2c6d27441377429529f8d987514b0496a5c3b7fd (diff)
downloademacs.d-bab1cea4888f87ed3e96d6dac935a42e21683679.tar.gz
Rewrite kill-thing-at-point macro
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-editing.el22
1 files changed, 11 insertions, 11 deletions
diff --git a/lisp/init-editing.el b/lisp/init-editing.el
index f0a8277..69ae087 100644
--- a/lisp/init-editing.el
+++ b/lisp/init-editing.el
@@ -218,17 +218,17 @@ and '<<<' mark the bounds of the narrowed region.
(interactive)
(delete-indentation 1))
-(defmacro km/make-kill-thing-at-point (name thing kill-func)
- `(defun ,(intern (concat "km/kill-" name "-at-point")) (arg)
- (interactive "p")
- (goto-char (beginning-of-thing ,thing))
- (funcall ,kill-func arg)))
-
-(km/make-kill-thing-at-point "word" 'word 'kill-word)
-(km/make-kill-thing-at-point "sentence" 'sentence 'kill-sentence)
-(km/make-kill-thing-at-point "paragraph" 'paragraph 'kill-paragraph)
-(km/make-kill-thing-at-point "line" 'line 'kill-line)
-(km/make-kill-thing-at-point "sexp" 'sexp 'kill-sexp)
+(defmacro km/make-kill-thing-at-point (thing)
+ `(defun ,(intern (concat "km/kill-" thing "-at-point")) ()
+ ,(format "Kill %s at point." thing)
+ (interactive)
+ (goto-char (beginning-of-thing (make-symbol ,thing)))
+ (,(intern (concat "kill-" thing)) 1)))
+
+(km/make-kill-thing-at-point "line")
+(km/make-kill-thing-at-point "paragraph")
+(km/make-kill-thing-at-point "sentence")
+(km/make-kill-thing-at-point "word")
(define-prefix-command 'km/kill-map)
(global-set-key (kbd "C-c k") 'km/kill-map)