From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: Various simple.el patches Date: Sun, 18 May 2003 21:11:18 -0500 (CDT) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200305190211.h4J2BI505694@eel.dms.auburn.edu> References: <200305132031.h4DKVp58013718@rum.cs.yale.edu> <84llx9hhwp.fsf@lucy.is.informatik.uni-duisburg.de> <20030514124245.GA24487@gnu.org> <843cjhtytp.fsf@lucy.is.informatik.uni-duisburg.de> <20030514144839.GA6241@gnu.org> <844r3xr0ar.fsf@lucy.is.informatik.uni-duisburg.de> <84fznfzb9t.fsf@lucy.is.informatik.uni-duisburg.de> <84k7co464e.fsf@lucy.is.informatik.uni-duisburg.de> NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1053310385 14020 80.91.224.249 (19 May 2003 02:13:05 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 19 May 2003 02:13:05 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon May 19 04:13:03 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19Ha99-0003ds-00 for ; Mon, 19 May 2003 04:13:03 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19HaIk-0007GN-00 for ; Mon, 19 May 2003 04:22:58 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19Ha98-0005Fe-05 for emacs-devel@quimby.gnus.org; Sun, 18 May 2003 22:13:02 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 19Ha8E-0003qW-00 for emacs-devel@gnu.org; Sun, 18 May 2003 22:12:06 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 19Ha86-0003h8-00 for emacs-devel@gnu.org; Sun, 18 May 2003 22:11:59 -0400 Original-Received: from manatee.dms.auburn.edu ([131.204.53.104]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19Ha7a-0002pD-00 for emacs-devel@gnu.org; Sun, 18 May 2003 22:11:26 -0400 Original-Received: from eel.dms.auburn.edu (eel.dms.auburn.edu [131.204.53.108]) h4J2BGoc024432; Sun, 18 May 2003 21:11:17 -0500 (CDT) Original-Received: (from teirllm@localhost) by eel.dms.auburn.edu (8.11.6+Sun/8.11.6) id h4J2BI505694; Sun, 18 May 2003 21:11:18 -0500 (CDT) X-Authentication-Warning: eel.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: kai.grossjohann@gmx.net In-reply-to: <84k7co464e.fsf@lucy.is.informatik.uni-duisburg.de> (kai.grossjohann@gmx.net) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:13984 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:13984 Kai Grossjohann wrote: Good :-) Here is a proposed patch. I'm not sure if I did it right. Somehow I get the feeling that using kill-line was not the right thing to do. The use of kill-line does not bother me personally, but in terms of the functionality there are two lines I would like to add to the code. More precisely: ((< arg 0) (forward-visible-line 1) (kill-line arg) (unless (bobp) (forward-visible-line -1))) The reasons for adding the last line are that it looks more intuitive for point to move backward while killing backward, that this way there is a differentiation between numeric arguments of 1 and -1, and most importantly that one can do M--1 S- C-x z z z z... (t (forward-visible-line 0) (if (eobp) (signal 'end-of-buffer nil) (kill-line arg))))) Because you call kill-line with an argument, there is, unlike for C-k, no warning at the end of the buffer. I have personally default-indicate-empty-lines set to t, but with the default value of nil, the warning at the end of the buffer is really essential while killing invisible empty lines at the end of the buffer. Otherwise, one does not know when to stop. With the two added lines the function becomes: (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 (progn (forward-visible-line 0) (point)) (progn (end-of-visible-line) (point)))) ((< arg 0) (forward-visible-line 1) (kill-line arg) (unless (bobp) (forward-visible-line -1))) (t (forward-visible-line 0) (if (eobp) (signal 'end-of-buffer nil) (kill-line arg))))) Sincerely, Luc.