From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: DEFUN in Emacs's C-code. Can I give "prompt" an arbitrary lisp expression? Date: Thu, 14 Oct 2004 20:17:30 +0000 Organization: muc.de e.V. -- private internet access Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1097785990 24002 80.91.229.6 (14 Oct 2004 20:33:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 14 Oct 2004 20:33:10 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Oct 14 22:32:57 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CICHR-0004TW-00 for ; Thu, 14 Oct 2004 22:32:57 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CICOX-00010E-Hp for geh-help-gnu-emacs@m.gmane.org; Thu, 14 Oct 2004 16:40:17 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!syros.belnet.be!news.belnet.be!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!informatik.tu-muenchen.de!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 38 Original-NNTP-Posting-Host: acm.muc.de Original-X-Trace: marvin.muc.de 1097785260 53633 193.149.49.134 (14 Oct 2004 20:21:00 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: 14 Oct 2004 20:21:00 GMT User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686)) Original-Xref: shelby.stanford.edu gnu.emacs.help:125880 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:21250 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:21250 [N.B. "prompt" in an Emacs C-code DEFUN is what would be created by `(interactive ...)' in a command written in lisp.] Right now, I'm unhappy with the command `rename-buffer', because M-x rename-buffer prompts with an empty string. I'd far rather it prompted with the current name of the buffer, allowing me to edit the name, rather than requiring me to enter the entire name from scratch. Why do I want this? Because I often want to change names like "longbuffername.el<2>" to "longbuffername.el", and that much typing is tedious ;-). Besides, the analogous `find-alternate-file' prompts with the name of the current file. rename-buffer's interactive form is "sRename buffer (to new name): \nP". I'd like to change it to this lisp form: (let ((n (buffer-name (current-buffer)))) (read-string "New buffer name: " n nil n t)) [OK, I'd need to think about the P on the end, but that's inessential for now]. Can I do this directly in emacs/src/buffer.c, somehow? I tried this by just inserting the lisp form (not within string quotes), but got only compiler errors. Also, there appears to be no command/function `set-interactive-form' to match `interactive-form'. Pity. ;-) Now presumably I could do what I want by advising the function, somehow. But it would be nice to hack the interactive form directly in the C source. Thanks in advance for any help. -- Alan Mackenzie (Munich, Germany) Email: aacm@muuc.dee; to decode, wherever there is a repeated letter (like "aa"), remove half of them (leaving, say, "a").