From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: Enhance word-based commands? Date: 19 Jan 2003 03:18:16 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <5xn0lxzxuf.fsf@kfs2.cua.dk> References: <84el7edy18.fsf@lucy.is.informatik.uni-duisburg.de> <84y95km257.fsf@lucy.is.informatik.uni-duisburg.de> <5xr8bbyja1.fsf@kfs2.cua.dk> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1042939106 31670 80.91.224.249 (19 Jan 2003 01:18:26 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 19 Jan 2003 01:18:26 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18a46S-0008EZ-00 for ; Sun, 19 Jan 2003 02:18:24 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18a4Gb-0000HW-00 for ; Sun, 19 Jan 2003 02:28:54 +0100 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 18a47X-0006CN-04 for emacs-devel@quimby.gnus.org; Sat, 18 Jan 2003 20:19:31 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18a47C-0005vE-00 for emacs-devel@gnu.org; Sat, 18 Jan 2003 20:19:10 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18a470-0005Tx-00 for emacs-devel@gnu.org; Sat, 18 Jan 2003 20:18:59 -0500 Original-Received: from mail.filanet.dk ([195.215.206.179]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18a46y-0005OQ-00; Sat, 18 Jan 2003 20:18:56 -0500 Original-Received: from kfs2.cua.dk.cua.dk (unknown [10.1.82.3]) by mail.filanet.dk (Postfix) with SMTP id 827ED7C017; Sun, 19 Jan 2003 02:18:54 +0100 (CET) Original-To: kai.grossjohann@uni-duisburg.de (=?iso-8859-1?q?Kai_Gro=DFjohann?=) In-Reply-To: <5xr8bbyja1.fsf@kfs2.cua.dk> Original-Lines: 37 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-cc: rms@gnu.org 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:10855 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:10855 storm@cua.dk (Kim F. Storm) writes: > The fun thing about my "yank-function" functionality is that using > dynaword-kill-word can (silently) arrange for C-y to insert the killed > word(s) in a certain "non-trivial" way. I renamed it to "yank-handler" (see NEWS), but here is a replacement to kill-rectangle which allows you to insert the rectangle using C-y (from the kill-ring), and even use M-y to cycle the kill-ring with rectangles on the ring: (defun kill-rectangle (start end &optional fill) (interactive "*r\nP") (when buffer-read-only (setq killed-rectangle (extract-rectangle start end)) (barf-if-buffer-read-only)) (setq killed-rectangle (delete-extract-rectangle start end fill)) (kill-new "=" nil (list 'insert-rectangle killed-rectangle t (lambda (s e) (delete-rectangle s e) (goto-char s))))) It is not perfect though. If inserting the rectangle changes tabs to spaces, M-y may not completely restore the buffer to the state before the rectangle was inserted, before inserting the next element from the kill-ring. But it's close, so I hope you can see the potential in the new functionality. Now, this should allow a new intelligent i-kill-word function to install a yank-handler which will correctly insert the killed words with appropriate spaces according to context [i.e. don't insert a space before punctuation or at beginning/end of line]. -- Kim F. Storm http://www.cua.dk