From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Joe Corneli Newsgroups: gmane.emacs.help Subject: replace-in-string and backward-delete-char [help request!] Date: Mon, 18 Nov 2002 00:06:13 -0600 Sender: help-gnu-emacs-admin@gnu.org Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (Apple Message framework v546) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1037600264 26270 80.91.224.249 (18 Nov 2002 06:17:44 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 18 Nov 2002 06:17:44 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18DfE5-0006pV-00 for ; Mon, 18 Nov 2002 07:17:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 18DfFZ-0007cu-00; Mon, 18 Nov 2002 01:19:13 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 18Df13-0005SB-00 for help-gnu-emacs@gnu.org; Mon, 18 Nov 2002 01:04:13 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 18Df10-0005Rw-00 for help-gnu-emacs@gnu.org; Mon, 18 Nov 2002 01:04:12 -0500 Original-Received: from dell3.ma.utexas.edu ([146.6.139.124]) by monty-python.gnu.org with esmtp (Exim 4.10) id 18Df10-0005Rr-00 for help-gnu-emacs@gnu.org; Mon, 18 Nov 2002 01:04:10 -0500 Original-Received: from math.utexas.edu (dhcp220.ma.utexas.edu [146.6.139.220]) by dell3.ma.utexas.edu (8.11.3/8.10.2) with ESMTP id gAI649r32261 for ; Mon, 18 Nov 2002 00:04:09 -0600 Original-To: help-gnu-emacs@gnu.org X-Mailer: Apple Mail (2.546) Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:3693 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:3693 Hello -- I am running XEmacs version 21.5 (beta4) "bamboo" for darwin 6.0. I expect that won't be hugely relevant but thought I should mention it before proceeding. I wrote the following code (below). It has 2 problems. The first is that replace-in-string does not seem to have any effect. The second is that backward-delete-char copies the deleted stuff to the kill ring even though I ask it not to (at least I think that I'm interpreting the documentation properly by adding an explicit "nil" at the end. -- Behavior is the same for me when I put nothing after the "3"). Suggestions? I'm open to someone rewriting the code entirely if he or she has a better way to do this. I just want it to work.... Thanks, Joe Corneli (defun cite-last-n-words (n) "Copy last ARG words to point and wrap with TeX citation markup." (interactive "p") (backward-kill-word n) (yank) (insert " \\cite{") (kill-new ; stuff I can't get to work properly-------- (replace-in-string (replace-in-string (prin1-to-string (yank)) " " "_") "[\n]" "_") ; --------stuff I can't get to work properly ) (yank) ;; need to rid of trailing nil... but I don't like it being added to ;; kill ring even though I indicate I don't want it there. (backward-delete-char 3 nil) (delete-horizontal-space) (insert "} ") )