aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/simple.el
diff options
context:
space:
mode:
authorKai Großjohann2003-05-19 15:47:14 +0000
committerKai Großjohann2003-05-19 15:47:14 +0000
commit348de80b31f6de0a286d83d2808beb47954d74f5 (patch)
tree73384e9359c5e11bd53146305d526da28fc2532a /lisp/simple.el
parentaf253914f217ccfbc2fcae37d96e8adbd7163bc0 (diff)
downloademacs-348de80b31f6de0a286d83d2808beb47954d74f5.tar.gz
emacs-348de80b31f6de0a286d83d2808beb47954d74f5.zip
* simple.el (kill-whole-line): New function.
* bindings.el (global-map): Bind it.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r--lisp/simple.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index c726bf745bc..64b56d5dfbb 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2205,6 +2205,25 @@ even beep.)"
2205 (goto-char end)))) 2205 (goto-char end))))
2206 (point)))) 2206 (point))))
2207 2207
2208(defun kill-whole-line (&optional arg)
2209 "Kill current line.
2210With prefix arg, kill that many lines from point.
2211If arg is negative, kill backwards.
2212If arg is zero, kill current line but exclude the trailing newline."
2213 (interactive "P")
2214 (setq arg (prefix-numeric-value arg))
2215 (cond ((zerop arg)
2216 (kill-region (point) (progn (forward-visible-line 0) (point)))
2217 (kill-region (point) (progn (end-of-visible-line) (point))))
2218 ((< arg 0)
2219 (kill-line 1)
2220 (kill-line (1+ arg))
2221 (unless (bobp) (forward-visible-line -1)))
2222 (t
2223 (kill-line 0)
2224 (if (eobp)
2225 (signal 'end-of-buffer nil)
2226 (kill-line arg)))))
2208 2227
2209(defun forward-visible-line (arg) 2228(defun forward-visible-line (arg)
2210 "Move forward by ARG lines, ignoring currently invisible newlines only. 2229 "Move forward by ARG lines, ignoring currently invisible newlines only.