From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Chong Yidong" Newsgroups: gmane.emacs.devel Subject: Re: require-hard-newlines to use newline Date: Fri, 11 Mar 2005 08:03:54 -0500 (EST) Message-ID: <3222.220.255.169.59.1110546234.squirrel@www.stupidchicken.com> References: <1483.220.255.172.231.1109730379.squirrel@www.stupidchicken.com> <200503020302.j2232fR21722@raven.dms.auburn.edu> <2750.220.255.172.231.1109734015.squirrel@www.stupidchicken.com> <1415.220.255.169.59.1109818150.squirrel@www.stupidchicken.com> <1404.220.255.169.59.1109889146.squirrel@www.stupidchicken.com> <200503040033.j240XD022473@raven.dms.auburn.edu> <50554.203.116.59.23.1109897782.squirrel@www.stupidchicken.com> <200503080005.j2805Kg28696@raven.dms.auburn.edu> <2451.220.255.169.59.1110299961.squirrel@www.stupidchicken.com> <2518.220.255.169.59.1110532203.squirrel@www.stupidchicken.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1110547245 32755 80.91.229.2 (11 Mar 2005 13:20:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 11 Mar 2005 13:20:45 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 11 14:20:45 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D9k3H-0008DJ-A0 for ged-emacs-devel@m.gmane.org; Fri, 11 Mar 2005 14:19:39 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D9kIM-0000lA-33 for ged-emacs-devel@m.gmane.org; Fri, 11 Mar 2005 08:35:14 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D9k9Q-0004SU-T1 for emacs-devel@gnu.org; Fri, 11 Mar 2005 08:26:01 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D9k3e-0001pO-EL for emacs-devel@gnu.org; Fri, 11 Mar 2005 08:20:03 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D9k3d-0001oS-FP for emacs-devel@gnu.org; Fri, 11 Mar 2005 08:20:01 -0500 Original-Received: from [64.21.80.18] (helo=shark.dnsvelocity.com) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1D9jo8-0002Fn-Tk; Fri, 11 Mar 2005 08:04:01 -0500 Original-Received: from stupidch by shark.dnsvelocity.com with local (Exim 4.44) id 1D9jo2-0007bp-HY; Fri, 11 Mar 2005 08:03:54 -0500 Original-Received: from 220.255.169.59 ([220.255.169.59]) (SquirrelMail authenticated user cyd@stupidchicken.com) by www.stupidchicken.com with HTTP; Fri, 11 Mar 2005 08:03:54 -0500 (EST) In-Reply-To: Original-To: "Kim F. Storm" User-Agent: SquirrelMail/1.4.4 X-Priority: 3 (Normal) Importance: Normal X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - shark.dnsvelocity.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [32675 33085] / [47 12] X-AntiAbuse: Sender Address Domain - stupidchicken.com X-Source: /usr/local/cpanel/3rdparty/bin/php X-Source-Args: /usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/base/3rdparty/squirrelmail/src/compose.php X-Source-Dir: :/base/3rdparty/squirrelmail/src X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: news.gmane.org gmane.emacs.devel:34468 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:34468 > If we agree that those hooks are the proper approach, and you can > write the proper doc for them, this is a trivial change, so I don't > see why we have to wait. > > Especially if that means that longlines.el can go into 22.1. Okay then. How about this patch? While writing it, I figured out that I only need to introduce one hook (`before-kill-functions'), not two. The hook for yanking is not needed for longlines.el -- I can handle that with post-command-hook (which longlines already makes use of anyway.) `before-kill-functions' seems like a convenient thing to have in any event, since Emacs Lisp packages can use it to apply the yank-handler text property on the fly. *** simple.el~ Fri Mar 11 19:27:00 2005 --- simple.el Fri Mar 11 21:00:45 2005 *************** *** 2275,2280 **** --- 2275,2286 ---- (defvar kill-ring-yank-pointer nil "The tail of the kill ring whose car is the last thing yanked.") + (defvar before-kill-functions nil + "List of functions called on the region before killing. + This abnormal hook is run before `kill-region' and + `copy-region-as-kill', with the beginning and end positions of + the killed region as the arguments.") + (defun kill-new (string &optional replace yank-handler) "Make STRING the latest kill in the kill ring. Set `kill-ring-yank-pointer' to point to it. *************** *** 2371,2376 **** --- 2377,2385 ---- The command \\[yank] can retrieve it from there. \(If you want to kill and then yank immediately, use \\[kill-ring-save].) + This runs the abnormal hook `before-kill-functions' with the + arguments BEG and END before actually killing. + If you want to append the killed region to the last killed text, use \\[append-next-kill] before \\[kill-region]. *************** *** 2390,2395 **** --- 2399,2405 ---- specifies the yank-handler text property to be set on the killed text. See `insert-for-yank'." (interactive "r") + (run-hook-with-args 'before-kill-functions beg end) (condition-case nil (let ((string (delete-and-extract-region beg end))) (when string ;STRING is nil if BEG = END *************** *** 2424,2431 **** "Save the region as if killed, but don't kill it. In Transient Mark mode, deactivate the mark. If `interprogram-cut-function' is non-nil, also save the text for a window ! system cut and paste." (interactive "r") (if (eq last-command 'kill-region) (kill-append (buffer-substring beg end) (< end beg)) (kill-new (buffer-substring beg end))) --- 2434,2445 ---- "Save the region as if killed, but don't kill it. In Transient Mark mode, deactivate the mark. If `interprogram-cut-function' is non-nil, also save the text for a window ! system cut and paste. ! ! The abnormal hook `before-kill-functions' is run with the ! arguments BEG and END before the region is saved." (interactive "r") + (run-hook-with-args 'before-kill-functions beg end) (if (eq last-command 'kill-region) (kill-append (buffer-substring beg end) (< end beg)) (kill-new (buffer-substring beg end)))