emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/simple.el


From: Kai Großjohann
Subject: [Emacs-diffs] Changes to emacs/lisp/simple.el
Date: Mon, 19 May 2003 11:47:16 -0400

Index: emacs/lisp/simple.el
diff -c emacs/lisp/simple.el:1.602 emacs/lisp/simple.el:1.603
*** emacs/lisp/simple.el:1.602  Fri May 16 17:17:52 2003
--- emacs/lisp/simple.el        Mon May 19 11:47:14 2003
***************
*** 2205,2210 ****
--- 2205,2229 ----
                       (goto-char end))))
                 (point))))
  
+ (defun kill-whole-line (&optional arg)
+   "Kill current line.
+ With prefix arg, kill that many lines from point.
+ If arg is negative, kill backwards.
+ If arg is zero, kill current line but exclude the trailing newline."
+   (interactive "P")
+   (setq arg (prefix-numeric-value arg))
+   (cond ((zerop arg)
+        (kill-region (point) (progn (forward-visible-line 0) (point)))
+        (kill-region (point) (progn (end-of-visible-line) (point))))
+       ((< arg 0)
+        (kill-line 1)
+        (kill-line (1+ arg))
+        (unless (bobp) (forward-visible-line -1)))
+       (t
+        (kill-line 0)
+        (if (eobp)
+            (signal 'end-of-buffer nil)
+          (kill-line arg)))))
  
  (defun forward-visible-line (arg)
    "Move forward by ARG lines, ignoring currently invisible newlines only.




reply via email to

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