Put stdio.h, sys/types.h and sys/stat.h after config.h.
[bpt/emacs.git] / src / callint.c
index 0528fe7..1a79cb0 100644 (file)
@@ -1,5 +1,5 @@
 /* Call a Lisp function interactively.
-   Copyright (C) 1985, 1986, 1993 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1993, 1994 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -18,7 +18,7 @@ along with GNU Emacs; see the file COPYING.  If not, write to
 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 
-#include "config.h"
+#include <config.h>
 #include "lisp.h"
 #include "buffer.h"
 #include "commands.h"
@@ -35,6 +35,10 @@ Lisp_Object Vcommand_history;
 Lisp_Object Vcommand_debug_status, Qcommand_debug_status;
 Lisp_Object Qenable_recursive_minibuffers;
 
+/* Non-nil means treat the mark as active
+   even if mark_active is 0.  */
+Lisp_Object Vmark_even_if_inactive;
+
 Lisp_Object Qlist;
 Lisp_Object preserved_fns;
 
@@ -138,11 +142,13 @@ char *callint_argfuns[]
 static void
 check_mark ()
 {
-  Lisp_Object tem = Fmarker_buffer (current_buffer->mark);
+  Lisp_Object tem;
+  tem = Fmarker_buffer (current_buffer->mark);
   if (NILP (tem) || (XBUFFER (tem) != current_buffer))
     error ("The mark is not set now");
-  if (NILP (current_buffer->mark_active))
-    error ("The mark is not active now");
+  if (!NILP (Vtransient_mark_mode) && NILP (Vmark_even_if_inactive)
+      && NILP (current_buffer->mark_active))
+    Fsignal (Qmark_inactive, Qnil);
 }
 
 
@@ -316,14 +322,20 @@ Otherwise, this is done only if an arg is read using the minibuffer.")
        }
       else if (*string == '@')
        {
-         Lisp_Object event =
-           XVECTOR (this_command_keys)->contents[next_event];
+         Lisp_Object event;
 
+         event = XVECTOR (this_command_keys)->contents[next_event];
          if (EVENT_HAS_PARAMETERS (event)
              && XTYPE (event = XCONS (event)->cdr) == Lisp_Cons
              && XTYPE (event = XCONS (event)->car) == Lisp_Cons
              && XTYPE (event = XCONS (event)->car) == Lisp_Window)
-           Fselect_window (event);
+           {
+             if (MINI_WINDOW_P (XWINDOW (event))
+                 && NILP (call1 (intern ("minibuffer-window-active-p"),
+                                 event)))
+               error ("Attempt to select inactive minibuffer window");
+             Fselect_window (event);
+           }
          string++;
        }
       else break;
@@ -657,6 +669,14 @@ Bound each time `call-interactively' is called;\n\
 may be set by the debugger as a reminder for itself.");
   Vcommand_debug_status = Qnil;
 
+  DEFVAR_LISP ("mark-even-if-inactive", &Vmark_even_if_inactive,
+    "*Non-nil means you can use the mark even when inactive.\n\
+This option makes a difference in Transient Mark mode.\n\
+When the option is non-nil, deactivation of the mark\n\
+turns off region highlighting, but commands that use the mark\n\
+behave as if the mark were still active.");
+  Vmark_even_if_inactive = Qnil;
+
   defsubr (&Sinteractive);
   defsubr (&Scall_interactively);
   defsubr (&Sprefix_numeric_value);