From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: require-hard-newlines to use newline Date: Fri, 11 Mar 2005 10:30:12 -0500 Message-ID: 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> <3222 NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1110556233 31446 80.91.229.2 (11 Mar 2005 15:50:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 11 Mar 2005 15:50:33 +0000 (UTC) Cc: Chong Yidong , rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 11 16:50:32 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D9m90-00026t-Ty for ged-emacs-devel@m.gmane.org; Fri, 11 Mar 2005 16:33:44 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D9mO3-0001Fi-Js for ged-emacs-devel@m.gmane.org; Fri, 11 Mar 2005 10:49:15 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D9mMD-0000bP-Eq for emacs-devel@gnu.org; Fri, 11 Mar 2005 10:47:21 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D9mMC-0000b5-Kg for emacs-devel@gnu.org; Fri, 11 Mar 2005 10:47:20 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D9mMC-0000a6-5D for emacs-devel@gnu.org; Fri, 11 Mar 2005 10:47:20 -0500 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.34) id 1D9m5q-0006og-CR; Fri, 11 Mar 2005 10:30:26 -0500 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id EFE0D340018; Fri, 11 Mar 2005 10:30:25 -0500 (EST) Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 2887A4AC285; Fri, 11 Mar 2005 10:30:13 -0500 (EST) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id 1EA0F4D30C; Fri, 11 Mar 2005 10:30:13 -0500 (EST) Original-To: storm@cua.dk (Kim F. Storm) In-Reply-To: (Kim F. Storm's message of "Fri, 11 Mar 2005 15:57:04 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-4.821, requis 5, autolearn=not spam, AWL 0.08, BAYES_00 -4.90) 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:34478 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:34478 >>> + (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.") >> >> I think it's usually important to keep the property that killing doesn't >> modify the buffer's text (when used in copy-as-kill), so rather than having >> before-kill-functions modify the buffer's text just before it's put in the >> kill-ring, it would be more convenient to make it return the string, >> i.e. use it as a replacement for buffer-substring. > I like the idea, but returning a value from a hook is rather > inconvenient -- if there are multiple functions on the hook, which > value should you use eventually? > Perhaps before-kill-functions should get START, END and STRING > as arguments where STRING is the result of buffer-substring. > Each hook could then modify that string as they please. Fair enough. > Or perhaps a different approach: > Run after-kill-hooks (a normal hook!) as the last thing in kill-region > and copy-region-as-kill, i.e. after putting the string into > the kill-ring. If necessary, the hooks can modify the head of > the kill-ring as they please...? I'm not sure if that would be reliable: the head of kill-ring might be the result of concatenating the old head and the new text, where the old head has already been processed by after-kill-hook, but you can't tell which part is the old one and which part is the new one. Stefan