From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: require-hard-newlines to use newline Date: Fri, 11 Mar 2005 15:57:04 +0100 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 1110554250 24959 80.91.229.2 (11 Mar 2005 15:17:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 11 Mar 2005 15:17:30 +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:17:29 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D9lmf-0007SJ-EI for ged-emacs-devel@m.gmane.org; Fri, 11 Mar 2005 16:10:37 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D9lvQ-0004Pz-6f for ged-emacs-devel@m.gmane.org; Fri, 11 Mar 2005 10:19:40 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D9lun-0004Ix-OD for emacs-devel@gnu.org; Fri, 11 Mar 2005 10:19:02 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D9luh-0004FB-AD for emacs-devel@gnu.org; Fri, 11 Mar 2005 10:18:55 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D9luh-0004Ef-0D for emacs-devel@gnu.org; Fri, 11 Mar 2005 10:18:55 -0500 Original-Received: from [212.88.64.25] (helo=mail-relay.sonofon.dk) by monty-python.gnu.org with smtp (Exim 4.34) id 1D9lft-0004Az-Lg for emacs-devel@gnu.org; Fri, 11 Mar 2005 10:03:38 -0500 Original-Received: (qmail 54890 invoked from network); 11 Mar 2005 14:56:55 -0000 Original-Received: from unknown (HELO kfs-l.imdomain.dk.cua.dk) (213.83.150.2) by 0 with SMTP; 11 Mar 2005 14:56:55 -0000 Original-To: Stefan Monnier In-Reply-To: (Stefan Monnier's message of "Fri, 11 Mar 2005 09:32:52 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) 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:34473 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:34473 Stefan Monnier writes: >> + (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. 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...? -- Kim F. Storm http://www.cua.dk