#ifdef REGION_CACHE_NEEDS_WORK
#include "region-cache.h"
#endif
+#include "select.h" /* for select_notify_buffer_kill */
#include "specifier.h"
#include "syntax.h"
#include "sysdep.h" /* for getwd */
*/
(filename))
{
- /* This function can GC. GC checked 1997.04.06. */
+ /* This function can GC. GC checked and fixed 7-11-2000 ben. */
REGISTER Lisp_Object buf;
struct gcpro gcpro1;
dn = Ffile_name_directory (filename);
fn = Ffile_truename (dn, Qnil);
if (! NILP (fn)) dn = fn;
- fn = Fexpand_file_name (Ffile_name_nondirectory (filename),
- dn);
+ /* Formerly the two calls below were combined, but that is
+ not GC-safe because the first call returns unprotected
+ data and the second call can GC. --ben */
+ fn = Ffile_name_nondirectory (filename);
+ fn = Fexpand_file_name (fn, dn);
}
filename = fn;
NUNGCPRO;
}
{
- Lisp_Object elt;
LIST_LOOP_2 (elt, Vbuffer_alist)
{
buf = Fcdr (elt);
Lisp_Object
get_truename_buffer (REGISTER Lisp_Object filename)
{
+ /* This function can GC. GC correct 7-11-00 ben */
/* FSFmacs has its own code here and doesn't call get-file-buffer.
That's because their equivalent of find-file-compare-truenames
(find-file-existing-other-name) isn't looked at in get-file-buffer.
return result;
}
-DEFUN ("buffer-dedicated-frame", Fbuffer_dedicated_frame, 0, 1, 0, /*
-Return the frame dedicated to this BUFFER, or nil if there is none.
-No argument or nil as argument means use current buffer as BUFFER.
-*/
- (buffer))
-{
- struct buffer *buf = decode_buffer (buffer, 0);
-
- /* XEmacs addition: if the frame is dead, silently make it go away. */
- if (!NILP (buf->dedicated_frame) &&
- !FRAME_LIVE_P (XFRAME (buf->dedicated_frame)))
- buf->dedicated_frame = Qnil;
-
- return buf->dedicated_frame;
-}
-
-DEFUN ("set-buffer-dedicated-frame", Fset_buffer_dedicated_frame, 2, 2, 0, /*
-For this BUFFER, set the FRAME dedicated to it.
-FRAME must be a frame or nil.
-*/
- (buffer, frame))
-{
- struct buffer *buf = decode_buffer (buffer, 0);
-
- if (!NILP (frame))
- CHECK_LIVE_FRAME (frame); /* XEmacs change */
-
- return buf->dedicated_frame = frame;
-}
-
-
\f
DEFUN ("buffer-modified-p", Fbuffer_modified_p, 0, 1, 0, /*
Return t if BUFFER was modified since its file was last read or saved.
/* Then run the hooks. */
run_hook (Qkill_buffer_hook);
-#ifdef HAVE_X_WINDOWS
- /* If an X selection was in this buffer, disown it.
- We could have done this by simply adding this function to the
- kill-buffer-hook, but the user might mess that up.
- */
- if (EQ (Vwindow_system, Qx))
- call0 (intern ("xselect-kill-buffer-hook"));
- /* #### generalize me! */
-#endif /* HAVE_X_WINDOWS */
+
+ /* Inform the selection code that a buffer just got killed.
+ We do this in C because (a) it's faster, and (b) it needs
+ to access data internal to select.c that can't be seen from
+ Lisp (so the Lisp code would just call into C anyway. */
+ select_notify_buffer_kill (buf);
+
unbind_to (speccount, Qnil);
UNGCPRO;
b = XBUFFER (buf); /* Hypothetical relocating GC. */
current_buffer = b;
invalidate_current_column (); /* invalidate indentation cache */
-#ifdef HAVE_FEP
- if (!noninteractive && initialized)
- {
- extern Lisp_Object Ffep_force_on (), Ffep_force_off (), Ffep_get_mode ();
-
- old_buf->fep_mode = Ffep_get_mode ();
-
- if (!NILP (current_buffer->fep_mode))
- Ffep_force_on ();
- else
- Ffep_force_off ();
- }
-#endif /* HAVE_FEP */
-
if (old_buf)
{
/* Put the undo list back in the base buffer, so that it appears
DEFSUBR (Fbuffer_base_buffer);
DEFSUBR (Fbuffer_indirect_children);
DEFSUBR (Fbuffer_local_variables);
- DEFSUBR (Fbuffer_dedicated_frame);
- DEFSUBR (Fset_buffer_dedicated_frame);
DEFSUBR (Fbuffer_modified_p);
DEFSUBR (Fset_buffer_modified_p);
DEFSUBR (Fbuffer_modified_tick);
DEFSUBR (Fbuffer_memory_usage);
#endif
- deferror (&Qprotected_field, "protected-field",
- "Attempt to modify a protected field", Qerror);
+ DEFERROR (Qprotected_field, "Attempt to modify a protected field",
+ Qinvalid_change);
}
void
}
}
+#ifndef WIN32_NATIVE
/* Is PWD another name for `.' ? */
static int
directory_is_current_directory (Extbyte *pwd)
Qfile_name);
return (IS_DIRECTORY_SEP (*pwd_internal)
- && stat ((char *) pwd_internal, &pwdstat) == 0
- && stat (".", &dotstat) == 0
+ && xemacs_stat ((char *) pwd_internal, &pwdstat) == 0
+ && xemacs_stat (".", &dotstat) == 0
&& dotstat.st_ino == pwdstat.st_ino
&& dotstat.st_dev == pwdstat.st_dev
&& pwd_internal_len < MAXPATHLEN);
}
+#endif
void
init_initial_directory (void)
{
/* This function can GC */
+#ifndef WIN32_NATIVE
Extbyte *pwd;
+#endif
initial_directory[0] = 0;
/* If PWD is accurate, use it instead of calling getcwd. This is faster
when PWD is right, and may avoid a fatal error. */
+#ifndef WIN32_NATIVE
if ((pwd = (Extbyte *) getenv ("PWD")) != NULL
&& directory_is_current_directory (pwd))
strcpy (initial_directory, (char *) pwd);
- else if (getcwd (initial_directory, MAXPATHLEN) == NULL)
- fatal ("`getcwd' failed: %s\n", strerror (errno));
+ else
+#endif
+ if (getcwd (initial_directory, MAXPATHLEN) == NULL)
+ fatal ("`getcwd' failed: %s\n", strerror (errno));
/* Make sure pwd is DIRECTORY_SEP-terminated.
Maybe this should really use some standard subroutine
}
}
- /* XEmacs change: store buffer's default directory
- using preferred (i.e. as defined at compile-time)
- directory separator. --marcpa */
-#ifdef DOS_NT
-#define CORRECT_DIR_SEPS(s) \
- do { if ('/' == DIRECTORY_SEP) dostounix_filename (s); \
- else unixtodos_filename (s); \
- } while (0)
-
- CORRECT_DIR_SEPS(initial_directory);
+#ifdef CORRECT_DIR_SEPS
+ CORRECT_DIR_SEPS (initial_directory);
#endif
}