X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/a17b5ed1a9ef01d008c69ed0fb4712afd802badb..09706e1fc4ce4fa2b947d690aae11be8274b0642:/src/buffer.c diff --git a/src/buffer.c b/src/buffer.c index 448ef87413..d52a710573 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -485,7 +485,7 @@ static void clone_per_buffer_values (from, to) struct buffer *from, *to; { - Lisp_Object to_buffer, tem; + Lisp_Object to_buffer; int offset; XSETBUFFER (to_buffer, to); @@ -1359,7 +1359,8 @@ with SIGHUP. */) /* First run the query functions; if any query is answered no, don't kill the buffer. */ arglist[0] = Qkill_buffer_query_functions; - if (NILP (Frun_hook_with_args_until_failure (1, arglist))) + tem = Frun_hook_with_args_until_failure (1, arglist); + if (NILP (tem)) return unbind_to (count, Qnil); /* Then run the hooks. */ @@ -1722,9 +1723,6 @@ do not put this buffer at the front of the list of recently selected ones. */) } } Fset_buffer (buf); - if (NILP (norecord)) - /* Why bother ? Fselect_window will do it for us anyway. -stef */ - record_buffer (buf); Fselect_window (Fdisplay_buffer (buf, other_window, Qnil), norecord); return buf; } @@ -5112,9 +5110,8 @@ void init_buffer () { char *pwd; - struct stat dotstat, pwdstat; Lisp_Object temp; - int rc; + int len; #ifdef USE_MMAP_FOR_BUFFERS { @@ -5135,24 +5132,26 @@ init_buffer () pwd = get_current_dir_name (); - if(!pwd) + if (!pwd) fatal ("`get_current_dir_name' failed: %s\n", strerror (errno)); #ifndef VMS /* Maybe this should really use some standard subroutine whose definition is filename syntax dependent. */ - rc = strlen (pwd); - if (!(IS_DIRECTORY_SEP (pwd[rc - 1]))) + len = strlen (pwd); + if (!(IS_DIRECTORY_SEP (pwd[len - 1]))) { - pwd[rc] = DIRECTORY_SEP; - pwd[rc + 1] = '\0'; + /* Grow buffer to add directory separator and '\0'. */ + pwd = (char *) xrealloc (pwd, len + 2); + pwd[len] = DIRECTORY_SEP; + pwd[len + 1] = '\0'; } #endif /* not VMS */ current_buffer->directory = make_unibyte_string (pwd, strlen (pwd)); if (! NILP (buffer_defaults.enable_multibyte_characters)) - /* At this momemnt, we still don't know how to decode the - direcotry name. So, we keep the bytes in multibyte form so + /* At this moment, we still don't know how to decode the + directory name. So, we keep the bytes in multibyte form so that ENCODE_FILE correctly gets the original bytes. */ current_buffer->directory = string_to_multibyte (current_buffer->directory);