* How to modify 'write-file' @ 2010-04-10 17:17 richard.christensen 2010-04-10 18:00 ` Pascal J. Bourguignon 2010-04-10 18:19 ` Andreas Politz 0 siblings, 2 replies; 13+ messages in thread From: richard.christensen @ 2010-04-10 17:17 UTC (permalink / raw) To: help-gnu-emacs 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? Richard. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to modify 'write-file' 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-10 18:19 ` Andreas Politz 1 sibling, 2 replies; 13+ messages in thread From: Pascal J. Bourguignon @ 2010-04-10 18:00 UTC (permalink / raw) To: help-gnu-emacs "richard.christensen" <richard.christensen@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__ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to modify 'write-file' 2010-04-10 18:00 ` Pascal J. Bourguignon @ 2010-04-11 18:16 ` richard.christensen 2010-04-11 23:29 ` richard.christensen 1 sibling, 0 replies; 13+ messages in thread From: richard.christensen @ 2010-04-11 18:16 UTC (permalink / raw) To: help-gnu-emacs Thanks. I'll give this a try. 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__ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to modify 'write-file' 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 1 sibling, 1 reply; 13+ messages in thread From: richard.christensen @ 2010-04-11 23:29 UTC (permalink / raw) To: help-gnu-emacs 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. Richard ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to modify 'write-file' 2010-04-11 23:29 ` richard.christensen @ 2010-04-11 23:36 ` Pascal J. Bourguignon 2010-04-13 14:43 ` richard.christensen 0 siblings, 1 reply; 13+ messages in thread From: Pascal J. Bourguignon @ 2010-04-11 23:36 UTC (permalink / raw) To: help-gnu-emacs "richard.christensen" <richard.christensen@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__ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to modify 'write-file' 2010-04-11 23:36 ` Pascal J. Bourguignon @ 2010-04-13 14:43 ` richard.christensen 2010-04-14 0:37 ` Pascal J. Bourguignon 0 siblings, 1 reply; 13+ messages in thread From: richard.christensen @ 2010-04-13 14:43 UTC (permalink / raw) To: help-gnu-emacs 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__ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to modify 'write-file' 2010-04-13 14:43 ` richard.christensen @ 2010-04-14 0:37 ` Pascal J. Bourguignon 2010-04-14 23:35 ` richard.christensen 2010-05-07 0:02 ` Kevin Rodgers 0 siblings, 2 replies; 13+ messages in thread From: Pascal J. Bourguignon @ 2010-04-14 0:37 UTC (permalink / raw) To: help-gnu-emacs "richard.christensen" <richard.christensen@avagotech.com> writes: > 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? Sorry, I assumed you were already a seasoned emacs lisp programmer. Here are detailed instructions: 1- Find the sources of write-file, type: C-h f write-file RET C-x o TAB RET 2- Copy and paste the defun write-file form to the *scratch* buffer: C-SPC C-M-f M-w C-x b *scratch* RET RET C-y C-M-b You get this in the *scratch* buffer: (defun write-file (filename &optional confirm) "Write current buffer into file FILENAME. This makes the buffer visit that file, and marks it as not modified. If you specify just a directory name as FILENAME, that means to use the default file name but in that directory. You can also yank the default file name into the minibuffer to edit it, using \\<minibuffer-local-map>\\[next-history-element]. If the buffer is not already visiting a file, the default file name for the output file is the buffer name. If optional second arg CONFIRM is non-nil, this function asks for confirmation before overwriting an existing file. Interactively, confirmation is required unless you supply a prefix argument." ;; (interactive "FWrite file: ") (interactive (list (if buffer-file-name (read-file-name "Write file: " nil nil nil nil) (read-file-name "Write file: " default-directory (expand-file-name (file-name-nondirectory (buffer-name)) default-directory) nil nil)) (not current-prefix-arg))) (or (null filename) (string-equal filename "") (progn ;; If arg is just a directory, ;; use the default file name, but in that directory. (if (file-directory-p filename) (setq filename (concat (file-name-as-directory filename) (file-name-nondirectory (or buffer-file-name (buffer-name)))))) (and confirm (file-exists-p filename) (or (y-or-n-p (format "File `%s' exists; overwrite? " filename)) (error "Canceled"))) (set-visited-file-name filename (not confirm)))) (set-buffer-modified-p t) ;; Make buffer writable if file is writable. (and buffer-file-name (file-writable-p buffer-file-name) (setq buffer-read-only nil)) (save-buffer) ;; It's likely that the VC status at the new location is different from ;; the one at the old location. (vc-find-file-hook)) 3- Replace the interactive form in this defun by the one I provided: (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))) so that you get: (defun write-file (filename &optional confirm) "Write current buffer into file FILENAME. This makes the buffer visit that file, and marks it as not modified. If you specify just a directory name as FILENAME, that means to use the default file name but in that directory. You can also yank the default file name into the minibuffer to edit it, using \\<minibuffer-local-map>\\[next-history-element]. If the buffer is not already visiting a file, the default file name for the output file is the buffer name. If optional second arg CONFIRM is non-nil, this function asks for confirmation before overwriting an existing file. Interactively, confirmation is required unless you supply a prefix argument." (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))) (or (null filename) (string-equal filename "") (progn ;; If arg is just a directory, ;; use the default file name, but in that directory. (if (file-directory-p filename) (setq filename (concat (file-name-as-directory filename) (file-name-nondirectory (or buffer-file-name (buffer-name)))))) (and confirm (file-exists-p filename) (or (y-or-n-p (format "File `%s' exists; overwrite? " filename)) (error "Canceled"))) (set-visited-file-name filename (not confirm)))) (set-buffer-modified-p t) ;; Make buffer writable if file is writable. (and buffer-file-name (file-writable-p buffer-file-name) (setq buffer-read-only nil)) (save-buffer) ;; It's likely that the VC status at the new location is different from ;; the one at the old location. (vc-find-file-hook)) 4- Evaluate this defun, for example positionning the cursor after it, and typing C-x C-e. 5- Use the new write-file. If you want to keep this version of write-file, you can copy-and-paste it into your ~/.emacs file. -- __Pascal Bourguignon__ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to modify 'write-file' 2010-04-14 0:37 ` Pascal J. Bourguignon @ 2010-04-14 23:35 ` richard.christensen 2010-05-07 0:02 ` Kevin Rodgers 1 sibling, 0 replies; 13+ messages in thread From: richard.christensen @ 2010-04-14 23:35 UTC (permalink / raw) To: help-gnu-emacs Thanks. This works great. Richard. On Apr 13, 6:37 pm, p...@informatimago.com (Pascal J. Bourguignon) wrote: > "richard.christensen" <richard.christen...@avagotech.com> writes: > > 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? > > Sorry, I assumed you were already a seasoned emacs lisp programmer. > Here are detailed instructions: > > 1- Find the sources of write-file, type: > C-h f write-file RET C-x o TAB RET > > 2- Copy and paste the defun write-file form to the *scratch* buffer: > C-SPC C-M-f M-w C-x b *scratch* RET RET C-y C-M-b > > You get this in the *scratch* buffer: > > (defun write-file (filename &optional confirm) > "Write current buffer into file FILENAME. > This makes the buffer visit that file, and marks it as not modified. > > If you specify just a directory name as FILENAME, that means to use > the default file name but in that directory. You can also yank > the default file name into the minibuffer to edit it, using \\<minibuffer-local-map>\\[next-history-element]. > > If the buffer is not already visiting a file, the default file name > for the output file is the buffer name. > > If optional second arg CONFIRM is non-nil, this function > asks for confirmation before overwriting an existing file. > Interactively, confirmation is required unless you supply a prefix argument." > ;; (interactive "FWrite file: ") > (interactive > (list (if buffer-file-name > (read-file-name "Write file: " > nil nil nil nil) > (read-file-name "Write file: " default-directory > (expand-file-name > (file-name-nondirectory (buffer-name)) > default-directory) > nil nil)) > (not current-prefix-arg))) > (or (null filename) (string-equal filename "") > (progn > ;; If arg is just a directory, > ;; use the default file name, but in that directory. > (if (file-directory-p filename) > (setq filename (concat (file-name-as-directory filename) > (file-name-nondirectory > (or buffer-file-name (buffer-name)))))) > (and confirm > (file-exists-p filename) > (or (y-or-n-p (format "File `%s' exists; overwrite? " filename)) > (error "Canceled"))) > (set-visited-file-name filename (not confirm)))) > (set-buffer-modified-p t) > ;; Make buffer writable if file is writable. > (and buffer-file-name > (file-writable-p buffer-file-name) > (setq buffer-read-only nil)) > (save-buffer) > ;; It's likely that the VC status at the new location is different from > ;; the one at the old location. > (vc-find-file-hook)) > > 3- Replace the interactive form in this defun by the one I provided: > > (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))) > > so that you get: > > (defun write-file (filename &optional confirm) > "Write current buffer into file FILENAME. > This makes the buffer visit that file, and marks it as not modified. > > If you specify just a directory name as FILENAME, that means to use > the default file name but in that directory. You can also yank > the default file name into the minibuffer to edit it, using \\<minibuffer-local-map>\\[next-history-element]. > > If the buffer is not already visiting a file, the default file name > for the output file is the buffer name. > > If optional second arg CONFIRM is non-nil, this function > asks for confirmation before overwriting an existing file. > Interactively, confirmation is required unless you supply a prefix argument." > (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))) > (or (null filename) (string-equal filename "") > (progn > ;; If arg is just a directory, > ;; use the default file name, but in that directory. > (if (file-directory-p filename) > (setq filename (concat (file-name-as-directory filename) > (file-name-nondirectory > (or buffer-file-name (buffer-name)))))) > (and confirm > (file-exists-p filename) > (or (y-or-n-p (format "File `%s' exists; overwrite? " filename)) > (error "Canceled"))) > (set-visited-file-name filename (not confirm)))) > (set-buffer-modified-p t) > ;; Make buffer writable if file is writable. > (and buffer-file-name > (file-writable-p buffer-file-name) > (setq buffer-read-only nil)) > (save-buffer) > ;; It's likely that the VC status at the new location is different from > ;; the one at the old location. > (vc-find-file-hook)) > > 4- Evaluate this defun, for example positionning the cursor after it, > and typing C-x C-e. > > 5- Use the new write-file. > > If you want to keep this version of write-file, you can copy-and-paste > it into your ~/.emacs file. > > -- > __Pascal Bourguignon__ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to modify 'write-file' 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 1 sibling, 1 reply; 13+ messages in thread From: Kevin Rodgers @ 2010-05-07 0:02 UTC (permalink / raw) To: help-gnu-emacs Pascal J. Bourguignon wrote: ... > Sorry, I assumed you were already a seasoned emacs lisp programmer. > Here are detailed instructions: > > 1- Find the sources of write-file, type: > C-h f write-file RET C-x o TAB RET > > 2- Copy and paste the defun write-file form to the *scratch* buffer: > C-SPC C-M-f M-w C-x b *scratch* RET RET C-y C-M-b > > You get this in the *scratch* buffer: ... > 3- Replace the interactive form in this defun by the one I provided: > > (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))) > > so that you get: ... > 4- Evaluate this defun, for example positionning the cursor after it, > and typing C-x C-e. > > 5- Use the new write-file. > > > If you want to keep this version of write-file, you can copy-and-paste > it into your ~/.emacs file. (defadvice write-file (before interactive-default activate) "Insert the default in the minibuffer when reading FILENAME." (interactive (let ((default-filename (or buffer-file-name (expand-file-name (file-name-nondirectory (buffer-name)) default-directory)))) (list (read-file-name "Write file: " default-directory default-filename nil (file-name-nondirectory default-filename) nil) (not current-prefix-arg))))) -- Kevin Rodgers Denver, Colorado, USA ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to modify 'write-file' 2010-05-07 0:02 ` Kevin Rodgers @ 2010-05-07 5:30 ` Thierry Volpiatto 0 siblings, 0 replies; 13+ messages in thread From: Thierry Volpiatto @ 2010-05-07 5:30 UTC (permalink / raw) To: help-gnu-emacs Kevin Rodgers <kevin.d.rodgers@gmail.com> writes: > Pascal J. Bourguignon wrote: > ... >> Sorry, I assumed you were already a seasoned emacs lisp programmer. >> Here are detailed instructions: >> >> 1- Find the sources of write-file, type: >> C-h f write-file RET C-x o TAB RET >> >> 2- Copy and paste the defun write-file form to the *scratch* buffer: >> C-SPC C-M-f M-w C-x b *scratch* RET RET C-y C-M-b >> >> You get this in the *scratch* buffer: > ... >> 3- Replace the interactive form in this defun by the one I provided: >> >> (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))) >> >> so that you get: > ... >> 4- Evaluate this defun, for example positionning the cursor after it, >> and typing C-x C-e. >> >> 5- Use the new write-file. >> >> >> If you want to keep this version of write-file, you can copy-and-paste >> it into your ~/.emacs file. > > (defadvice write-file (before interactive-default activate) > "Insert the default in the minibuffer when reading FILENAME." > (interactive > (let ((default-filename (or buffer-file-name > (expand-file-name > (file-name-nondirectory (buffer-name)) > default-directory)))) > (list (read-file-name "Write file: " > default-directory default-filename nil > (file-name-nondirectory default-filename) nil) > (not current-prefix-arg))))) See also `anything-write-file' that is included in anything-config.el. -- Thierry Volpiatto Gpg key: http://pgp.mit.edu/ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to modify 'write-file' 2010-04-10 17:17 How to modify 'write-file' richard.christensen 2010-04-10 18:00 ` Pascal J. Bourguignon @ 2010-04-10 18:19 ` Andreas Politz 2010-04-11 18:17 ` richard.christensen 1 sibling, 1 reply; 13+ messages in thread From: Andreas Politz @ 2010-04-10 18:19 UTC (permalink / raw) To: help-gnu-emacs "richard.christensen" <richard.christensen@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? > > Richard. I would use dired for this. First create a dired buffer with the files, or a superset it, with `dired', `find-dired' or some other incarnation. Then M-x wdired-change-to-dired-mode RET and it let's you edit the file-names, after which you press `C-c C-c' and commit the changes to the filesystem. -ap ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to modify 'write-file' 2010-04-10 18:19 ` Andreas Politz @ 2010-04-11 18:17 ` richard.christensen 2010-04-11 22:43 ` Andreas Politz 0 siblings, 1 reply; 13+ messages in thread From: richard.christensen @ 2010-04-11 18:17 UTC (permalink / raw) To: help-gnu-emacs Thanks. A friend of mine suggested using Dired as well. Your approach is more complete. I really should get more familiar with it and use it more. richard On Apr 10, 12:19 pm, Andreas Politz <poli...@fh-trier.de> 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? > > > Richard. > > I would use dired for this. First create a dired buffer with the files, > or a superset it, with `dired', `find-dired' or some other incarnation. > > Then > M-x wdired-change-to-dired-mode RET > and it let's you edit the file-names, after which you press `C-c C-c' > and commit the changes to the filesystem. > > -ap ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: How to modify 'write-file' 2010-04-11 18:17 ` richard.christensen @ 2010-04-11 22:43 ` Andreas Politz 0 siblings, 0 replies; 13+ messages in thread From: Andreas Politz @ 2010-04-11 22:43 UTC (permalink / raw) To: help-gnu-emacs "richard.christensen" <richard.christensen@avagotech.com> writes: > Thanks. A friend of mine suggested using Dired as well. Your > approach is more complete. I really should get more familiar with it > and use it more. > > richard > >> >> I would use dired for this. First create a dired buffer with the files, >> or a superset it, with `dired', `find-dired' or some other incarnation. >> >> Then >> M-x wdired-change-to-dired-mode RET ^ I missed a `w' in there, the command is called `wdired-change-to-wdired-mode'. >> and it let's you edit the file-names, after which you press `C-c C-c' >> and commit the changes to the filesystem. >> -ap ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2010-05-07 5:30 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).