Previous: , Up: Buffer Names and File Names   [Index]


7.4.5.11 set-visited-file-name

Function: set-visited-file-name filename &optional no-query along-with-file

If FILENAME is a non-empty string, this function changes (or sets) the name of the file visited in the current buffer to FILENAME. The next time the buffer is saved it will go in the newly-specified file.

This command marks the buffer as modified. It also renames the buffer to correspond to the new file name, unless the new name is already in use.

If FILENAME is ‘nil’ or the empty string, that stands for “no visited file”. In this case, ‘set-visited-file-name’ marks the buffer as having no visited file, without changing the buffer’s modified flag.

Normally, this function asks the user for confirmation if there already is a buffer visiting FILENAME. If NO-QUERY is non-‘nil’, that prevents asking this question.

If ALONG-WITH-FILE is non-‘nil’, that means to assume that the former visited file has been renamed to FILENAME. In this case, the command does not change the buffer’s modified flag, nor the buffer’s recorded last file modification time as reported by ‘visited-file-modtime’. If ALONG-WITH-FILE is ‘nil’, this function clears the recorded last file modification time, after which ‘visited-file