From: "richard.christensen" <richard.christensen@avagotech.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to modify 'write-file'
Date: Tue, 13 Apr 2010 07:43:40 -0700 (PDT) [thread overview]
Message-ID: <9345ad4d-220c-4319-9e2f-d5acfa340d27@35g2000yqm.googlegroups.com> (raw)
In-Reply-To: 87bpdpftpa.fsf@galatea.lan.informatimago.com
Hi Pascal,
I am sorry for being thick. I have tried several things and have
tried to do some
reading about how to implement this code. I can't get anything to
work. I can
see what appears to be the correct words on the minibuffer, but upon
hitting enter,
either nothing happens or I get an error about wrong number of
arguments.
Should I be doing this (defun write-file (arg) or should I be creating
a new function?
I see that a list is created but I am sure the write-file does not
want the "Write file:" text
to be part of the operation. So, some how I need to re-direct the
path and file name from the list
back to the write-function. Am I missing anything else?
Richard.
On Apr 11, 5:36 pm, p...@informatimago.com (Pascal J. Bourguignon)
wrote:
> "richard.christensen" <richard.christen...@avagotech.com> writes:
> > On Apr 10, 12:00 pm, p...@informatimago.com (Pascal J. Bourguignon)
> > wrote:
> >> "richard.christensen" <richard.christen...@avagotech.com> writes:
> >> > Hi, I write and modify many files with long names in which I need to
> >> > save the changed file to a similar name as the original but with a few
> >> > letters or numbers changed. A useful modification to write-file would
> >> > be to have the current file name to be placed in the minibuffer along
> >> > with the path when write-file is called. Then modifying the name would
> >> > be simple. How would I do this? Ideas?
>
> >> Add the (buffer-name) as initial value to the first call to
> >> read-file-name:
>
> >> (interactive
> >> (list (if buffer-file-name
> >> (read-file-name "Write file: " default-directory
> >> (expand-file-name
> >> (file-name-nondirectory (buffer-name))
> >> default-directory)
> >> nil
> >> (buffer-name))
> >> (read-file-name "Write file: " default-directory
> >> (expand-file-name
> >> (file-name-nondirectory (buffer-name))
> >> default-directory)
> >> nil nil))
> >> (not current-prefix-arg)))
> >> --
> >> __Pascal Bourguignon__
>
> > Hi, I am missing something. When I C-x w on a buffer, I see no
> > different behavior. The current path is there but not the buffer
> > name. I did eval-region first.
>
> You have to replace the interactive form in the write-file definition
> and eval-region the write-file defun.
>
> interactive alone doesn't do anything.
>
> --
> __Pascal Bourguignon__
next prev parent reply other threads:[~2010-04-13 14:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-10 17:17 How to modify 'write-file' richard.christensen
2010-04-10 18:00 ` Pascal J. Bourguignon
2010-04-11 18:16 ` richard.christensen
2010-04-11 23:29 ` richard.christensen
2010-04-11 23:36 ` Pascal J. Bourguignon
2010-04-13 14:43 ` richard.christensen [this message]
2010-04-14 0:37 ` Pascal J. Bourguignon
2010-04-14 23:35 ` richard.christensen
2010-05-07 0:02 ` Kevin Rodgers
2010-05-07 5:30 ` Thierry Volpiatto
2010-04-10 18:19 ` Andreas Politz
2010-04-11 18:17 ` richard.christensen
2010-04-11 22:43 ` Andreas Politz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9345ad4d-220c-4319-9e2f-d5acfa340d27@35g2000yqm.googlegroups.com \
--to=richard.christensen@avagotech.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.