aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-07-02 06:23:21 +0000
committerRichard M. Stallman1997-07-02 06:23:21 +0000
commitbdd8d692f3b31e5c53397d4484e71bb70462c500 (patch)
treec0ad5addddf8dccaf6566081b17a550b88750ad4
parent9fbc011645bf22b2d8907f8d824778af326fc11f (diff)
downloademacs-bdd8d692f3b31e5c53397d4484e71bb70462c500.tar.gz
emacs-bdd8d692f3b31e5c53397d4484e71bb70462c500.zip
(Fy_or_n_p, Fyes_or_no_p): Obey use_dialog_box.
(use_dialog_box): New variable, controls whether to use dialog boxes. (syms_of_fns): Set up Lisp variable. (concat): Use XCONS rather than Fcar, Fcdr--for known cons. (Fassq, assq_no_quit, Fassoc, Frassq, Frassoc, Fdelq): Likewise. (Fdelete, Fplist_get, mapcar1, Fmember, Fmemq): Likewise.
-rw-r--r--src/fns.c56
1 files changed, 34 insertions, 22 deletions
diff --git a/src/fns.c b/src/fns.c
index 9e8a15d5578..473f9ed17d6 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -40,6 +40,10 @@ Boston, MA 02111-1307, USA. */
40#define NULL (void *)0 40#define NULL (void *)0
41#endif 41#endif
42 42
43/* Nonzero enables use of dialog boxes for questions
44 asked by mouse commands. */
45int use_dialog_box;
46
43extern Lisp_Object Flookup_key (); 47extern Lisp_Object Flookup_key ();
44 48
45extern int minibuffer_auto_raise; 49extern int minibuffer_auto_raise;
@@ -470,7 +474,7 @@ concat (nargs, args, target_type, last_special)
470 `this' is exhausted. */ 474 `this' is exhausted. */
471 if (NILP (this)) break; 475 if (NILP (this)) break;
472 if (CONSP (this)) 476 if (CONSP (this))
473 elt = Fcar (this), this = Fcdr (this); 477 elt = XCONS (this)->car, this = XCONS (this)->cdr;
474 else 478 else
475 { 479 {
476 if (thisindex >= thisleni) break; 480 if (thisindex >= thisleni) break;
@@ -657,7 +661,7 @@ The value is actually the tail of LIST whose car is ELT.")
657 Lisp_Object list; 661 Lisp_Object list;
658{ 662{
659 register Lisp_Object tail; 663 register Lisp_Object tail;
660 for (tail = list; !NILP (tail); tail = Fcdr (tail)) 664 for (tail = list; !NILP (tail); tail = XCONS (tail)->cdr)
661 { 665 {
662 register Lisp_Object tem; 666 register Lisp_Object tem;
663 tem = Fcar (tail); 667 tem = Fcar (tail);
@@ -676,7 +680,7 @@ The value is actually the tail of LIST whose car is ELT.")
676 Lisp_Object list; 680 Lisp_Object list;
677{ 681{
678 register Lisp_Object tail; 682 register Lisp_Object tail;
679 for (tail = list; !NILP (tail); tail = Fcdr (tail)) 683 for (tail = list; !NILP (tail); tail = XCONS (tail)->cdr)
680 { 684 {
681 register Lisp_Object tem; 685 register Lisp_Object tem;
682 tem = Fcar (tail); 686 tem = Fcar (tail);
@@ -695,12 +699,12 @@ Elements of LIST that are not conses are ignored.")
695 Lisp_Object list; 699 Lisp_Object list;
696{ 700{
697 register Lisp_Object tail; 701 register Lisp_Object tail;
698 for (tail = list; !NILP (tail); tail = Fcdr (tail)) 702 for (tail = list; !NILP (tail); tail = XCONS (tail)->cdr)
699 { 703 {
700 register Lisp_Object elt, tem; 704 register Lisp_Object elt, tem;
701 elt = Fcar (tail); 705 elt = Fcar (tail);
702 if (!CONSP (elt)) continue; 706 if (!CONSP (elt)) continue;
703 tem = Fcar (elt); 707 tem = XCONS (elt)->car;
704 if (EQ (key, tem)) return elt; 708 if (EQ (key, tem)) return elt;
705 QUIT; 709 QUIT;
706 } 710 }
@@ -716,12 +720,12 @@ assq_no_quit (key, list)
716 Lisp_Object list; 720 Lisp_Object list;
717{ 721{
718 register Lisp_Object tail; 722 register Lisp_Object tail;
719 for (tail = list; CONSP (tail); tail = Fcdr (tail)) 723 for (tail = list; CONSP (tail); tail = XCONS (tail)->cdr)
720 { 724 {
721 register Lisp_Object elt, tem; 725 register Lisp_Object elt, tem;
722 elt = Fcar (tail); 726 elt = Fcar (tail);
723 if (!CONSP (elt)) continue; 727 if (!CONSP (elt)) continue;
724 tem = Fcar (elt); 728 tem = XCONS (elt)->car;
725 if (EQ (key, tem)) return elt; 729 if (EQ (key, tem)) return elt;
726 } 730 }
727 return Qnil; 731 return Qnil;
@@ -735,12 +739,12 @@ The value is actually the element of LIST whose car equals KEY.")
735 Lisp_Object list; 739 Lisp_Object list;
736{ 740{
737 register Lisp_Object tail; 741 register Lisp_Object tail;
738 for (tail = list; !NILP (tail); tail = Fcdr (tail)) 742 for (tail = list; !NILP (tail); tail = XCONS (tail)->cdr)
739 { 743 {
740 register Lisp_Object elt, tem; 744 register Lisp_Object elt, tem;
741 elt = Fcar (tail); 745 elt = Fcar (tail);
742 if (!CONSP (elt)) continue; 746 if (!CONSP (elt)) continue;
743 tem = Fequal (Fcar (elt), key); 747 tem = Fequal (XCONS (elt)->car, key);
744 if (!NILP (tem)) return elt; 748 if (!NILP (tem)) return elt;
745 QUIT; 749 QUIT;
746 } 750 }
@@ -755,12 +759,12 @@ The value is actually the element of LIST whose cdr is ELT.")
755 Lisp_Object list; 759 Lisp_Object list;
756{ 760{
757 register Lisp_Object tail; 761 register Lisp_Object tail;
758 for (tail = list; !NILP (tail); tail = Fcdr (tail)) 762 for (tail = list; !NILP (tail); tail = XCONS (tail)->cdr)
759 { 763 {
760 register Lisp_Object elt, tem; 764 register Lisp_Object elt, tem;
761 elt = Fcar (tail); 765 elt = Fcar (tail);
762 if (!CONSP (elt)) continue; 766 if (!CONSP (elt)) continue;
763 tem = Fcdr (elt); 767 tem = XCONS (elt)->cdr;
764 if (EQ (key, tem)) return elt; 768 if (EQ (key, tem)) return elt;
765 QUIT; 769 QUIT;
766 } 770 }
@@ -775,12 +779,12 @@ The value is actually the element of LIST whose cdr equals KEY.")
775 Lisp_Object list; 779 Lisp_Object list;
776{ 780{
777 register Lisp_Object tail; 781 register Lisp_Object tail;
778 for (tail = list; !NILP (tail); tail = Fcdr (tail)) 782 for (tail = list; !NILP (tail); tail = XCONS (tail)->cdr)
779 { 783 {
780 register Lisp_Object elt, tem; 784 register Lisp_Object elt, tem;
781 elt = Fcar (tail); 785 elt = Fcar (tail);
782 if (!CONSP (elt)) continue; 786 if (!CONSP (elt)) continue;
783 tem = Fequal (Fcdr (elt), key); 787 tem = Fequal (XCONS (elt)->cdr, key);
784 if (!NILP (tem)) return elt; 788 if (!NILP (tem)) return elt;
785 QUIT; 789 QUIT;
786 } 790 }
@@ -808,13 +812,13 @@ to be sure of changing the value of `foo'.")
808 if (EQ (elt, tem)) 812 if (EQ (elt, tem))
809 { 813 {
810 if (NILP (prev)) 814 if (NILP (prev))
811 list = Fcdr (tail); 815 list = XCONS (tail)->cdr;
812 else 816 else
813 Fsetcdr (prev, Fcdr (tail)); 817 Fsetcdr (prev, XCONS (tail)->cdr);
814 } 818 }
815 else 819 else
816 prev = tail; 820 prev = tail;
817 tail = Fcdr (tail); 821 tail = XCONS (tail)->cdr;
818 QUIT; 822 QUIT;
819 } 823 }
820 return list; 824 return list;
@@ -842,13 +846,13 @@ to be sure of changing the value of `foo'.")
842 if (! NILP (Fequal (elt, tem))) 846 if (! NILP (Fequal (elt, tem)))
843 { 847 {
844 if (NILP (prev)) 848 if (NILP (prev))
845 list = Fcdr (tail); 849 list = XCONS (tail)->cdr;
846 else 850 else
847 Fsetcdr (prev, Fcdr (tail)); 851 Fsetcdr (prev, XCONS (tail)->cdr);
848 } 852 }
849 else 853 else
850 prev = tail; 854 prev = tail;
851 tail = Fcdr (tail); 855 tail = XCONS (tail)->cdr;
852 QUIT; 856 QUIT;
853 } 857 }
854 return list; 858 return list;
@@ -996,12 +1000,12 @@ one of the properties on the list.")
996 register Lisp_Object prop; 1000 register Lisp_Object prop;
997{ 1001{
998 register Lisp_Object tail; 1002 register Lisp_Object tail;
999 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail))) 1003 for (tail = plist; !NILP (tail); tail = Fcdr (XCONS (tail)->cdr))
1000 { 1004 {
1001 register Lisp_Object tem; 1005 register Lisp_Object tem;
1002 tem = Fcar (tail); 1006 tem = Fcar (tail);
1003 if (EQ (prop, tem)) 1007 if (EQ (prop, tem))
1004 return Fcar (Fcdr (tail)); 1008 return Fcar (XCONS (tail)->cdr);
1005 } 1009 }
1006 return Qnil; 1010 return Qnil;
1007} 1011}
@@ -1621,7 +1625,7 @@ mapcar1 (leni, vals, fn, seq)
1621 for (i = 0; i < leni; i++) 1625 for (i = 0; i < leni; i++)
1622 { 1626 {
1623 vals[i] = call1 (fn, Fcar (tail)); 1627 vals[i] = call1 (fn, Fcar (tail));
1624 tail = Fcdr (tail); 1628 tail = XCONS (tail)->cdr;
1625 } 1629 }
1626 } 1630 }
1627 1631
@@ -1714,6 +1718,7 @@ Also accepts Space to mean yes, or Delete to mean no.")
1714 1718
1715#ifdef HAVE_MENUS 1719#ifdef HAVE_MENUS
1716 if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) 1720 if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
1721 && use_dialog_box
1717 && have_menus_p ()) 1722 && have_menus_p ())
1718 { 1723 {
1719 Lisp_Object pane, menu; 1724 Lisp_Object pane, menu;
@@ -1832,6 +1837,7 @@ and can edit it until it has been confirmed.")
1832 1837
1833#ifdef HAVE_MENUS 1838#ifdef HAVE_MENUS
1834 if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) 1839 if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
1840 && use_dialog_box
1835 && have_menus_p ()) 1841 && have_menus_p ())
1836 { 1842 {
1837 Lisp_Object pane, menu, obj; 1843 Lisp_Object pane, menu, obj;
@@ -1985,6 +1991,12 @@ syms_of_fns ()
1985Used by `featurep' and `require', and altered by `provide'."); 1991Used by `featurep' and `require', and altered by `provide'.");
1986 Vfeatures = Qnil; 1992 Vfeatures = Qnil;
1987 1993
1994 DEFVAR_BOOL ("use-dialog-box", &use_dialog_box,
1995 "*Non-nil means mouse commands use dialog boxes to ask questions.\n\
1996This applies to y-or-n and yes-or-no questions asked by commands
1997invoked by mouse clicks and mouse menu items.");
1998 use_dialog_box = 1;
1999
1988 defsubr (&Sidentity); 2000 defsubr (&Sidentity);
1989 defsubr (&Srandom); 2001 defsubr (&Srandom);
1990 defsubr (&Slength); 2002 defsubr (&Slength);