diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/.gdbinit | 8 | ||||
-rw-r--r-- | src/alloc.c | 2 | ||||
-rw-r--r-- | src/eval.c | 42 | ||||
-rw-r--r-- | src/fns.c | 209 | ||||
-rw-r--r-- | src/keyboard.c | 10 | ||||
-rw-r--r-- | src/search.c | 55 | ||||
-rw-r--r-- | src/xdisp.c | 12 | ||||
-rw-r--r-- | src/xfns.c | 10 | ||||
-rw-r--r-- | src/xterm.c | 15 |
9 files changed, 126 insertions, 237 deletions
diff --git a/src/.gdbinit b/src/.gdbinit index 91a921119e..fd470e3138 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -32,9 +32,12 @@ end define xwindow print (struct window *) ($ & 0x00ffffff) +print ($->left)@4 +print $$ end document xwindow Print $ as a window pointer, assuming it is an Elisp window value. +Print the window's position as { left, top, height, width }. end define xmarker @@ -46,9 +49,12 @@ end define xbuffer print (struct buffer *) ($ & 0x00ffffff) +print &((struct Lisp_String *) (($->name) & 0x00ffffff))->data +print $$ end document xbuffer -Print $ as a buffer pointer, assuming it is an Elisp buffer value. +Set $ as a buffer pointer, assuming it is an Elisp buffer value. +Print the name of the buffer. end define xsymbol diff --git a/src/alloc.c b/src/alloc.c index 9c63f8fe13..c0d92e3380 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -960,7 +960,7 @@ Does not copy symbols.") struct gcpro *gcprolist; -#define NSTATICS 256 +#define NSTATICS 512 Lisp_Object *staticvec[NSTATICS] = {0}; diff --git a/src/eval.c b/src/eval.c index d3d475f4d1..0e012d4500 100644 --- a/src/eval.c +++ b/src/eval.c @@ -41,8 +41,9 @@ struct backtrace struct backtrace *next; Lisp_Object *function; Lisp_Object *args; /* Points to vector of args. */ - int nargs; /* length of vector */ - /* if nargs is UNEVALLED, args points to slot holding list of unevalled args */ + int nargs; /* Length of vector. + If nargs is UNEVALLED, args points to slot holding + list of unevalled args */ char evalargs; /* Nonzero means call value of debugger when done with this operation. */ char debug_on_exit; @@ -451,20 +452,33 @@ and input is currently coming from the keyboard (not in keyboard macro).") if (!INTERACTIVE) return Qnil; - /* Unless the object was compiled, skip the frame of interactive-p itself - (if interpreted) or the frame of byte-code (if called from - compiled function). */ btp = backtrace_list; - if (XTYPE (*btp->function) != Lisp_Compiled) + + /* If this isn't a byte-compiled function, there may be a frame at + the top for Finteractive_p itself. If so, skip it. */ + fun = Findirect_function (*btp->function); + if (XTYPE (fun) == Lisp_Subr + && (struct Lisp_Subr *) XPNTR (fun) == &Sinteractive_p) btp = btp->next; - while (btp - && (btp->nargs == UNEVALLED || EQ (*btp->function, Qbytecode))) + + /* If we're running an Emacs 18-style byte-compiled function, there + may be a frame for Fbytecode. Now, given the strictest + definition, this function isn't really being called + interactively, but because that's the way Emacs 18 always builds + byte-compiled functions, we'll accept it for now. */ + if (EQ (*btp->function, Qbytecode)) + btp = btp->next; + + /* If this isn't a byte-compiled function, then we may now be + looking at several frames for special forms. Skip past them. */ + while (btp && + btp->nargs == UNEVALLED) btp = btp->next; - /* btp now points at the frame of the innermost function - that DOES eval its args. - If it is a built-in function (such as load or eval-region) - return nil. */ + /* btp now points at the frame of the innermost function that isn't + a special form, ignoring frames for Finteractive_p and/or + Fbytecode at the top. If this frame is for a built-in function + (such as load or eval-region) return nil. */ fun = Findirect_function (*btp->function); if (XTYPE (fun) == Lisp_Subr) return Qnil; @@ -2320,8 +2334,8 @@ See also variable `debug-on-quit'."); DEFVAR_BOOL ("debug-on-quit", &debug_on_quit, "*Non-nil means enter debugger if quit is signaled (C-G, for example).\n\ -Does not apply if quit is handled by a `condition-case'. -A non-nil value is equivalent to a `debug-on-error' value containing 'quit."); +Does not apply if quit is handled by a `condition-case'.\n\ +A non-nil value is equivalent to a `debug-on-error' value containing `quit'."); debug_on_quit = 0; DEFVAR_BOOL ("debug-on-next-call", &debug_on_next_call, @@ -20,41 +20,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" -#ifdef LOAD_AVE_TYPE -#ifdef BSD -/* It appears param.h defines BSD and BSD4_3 in 4.3 - and is not considerate enough to avoid bombing out - if they are already defined. */ -#undef BSD -#ifdef BSD4_3 -#undef BSD4_3 -#define XBSD4_3 /* XBSD4_3 says BSD4_3 is supposed to be defined. */ -#endif -#include <sys/param.h> -/* Now if BSD or BSD4_3 was defined and is no longer, - define it again. */ -#ifndef BSD -#define BSD -#endif -#ifdef XBSD4_3 -#ifndef BSD4_3 -#define BSD4_3 -#endif -#endif /* XBSD4_3 */ -#endif /* BSD */ -#ifndef VMS -#ifndef NLIST_STRUCT -#include <a.out.h> -#else /* NLIST_STRUCT */ -#include <nlist.h> -#endif /* NLIST_STRUCT */ -#endif /* not VMS */ -#endif /* LOAD_AVE_TYPE */ - -#ifdef DGUX -#include <sys/dg_sys_info.h> /* for load average info - DJB */ -#endif - /* Note on some machines this defines `vector' as a typedef, so make sure we don't use that name in this file. */ #undef vector @@ -1226,171 +1191,27 @@ and can rub it out if not confirmed.") UNGCPRO; } -/* Avoid static vars inside a function since in HPUX they dump as pure. */ -#ifdef DGUX -static struct dg_sys_info_load_info load_info; /* what-a-mouthful! */ - -#else /* Not DGUX */ - -static int ldav_initialized; -static int ldav_channel; -#ifdef LOAD_AVE_TYPE -#ifndef VMS -static struct nlist ldav_nl[2]; -#endif /* VMS */ -#endif /* LOAD_AVE_TYPE */ - -#define channel ldav_channel -#define initialized ldav_initialized -#define nl ldav_nl -#endif /* Not DGUX */ - DEFUN ("load-average", Fload_average, Sload_average, 0, 0, 0, "Return list of 1 minute, 5 minute and 15 minute load averages.\n\ Each of the three load averages is multiplied by 100,\n\ -then converted to integer.") +then converted to integer.\n\ +If the 5-minute or 15-minute load averages are not available, return a\n\ +shortened list, containing only those averages which are available.") () { -#ifdef DGUX - /* perhaps there should be a "sys_load_avg" call in sysdep.c?! - DJB */ - load_info.one_minute = 0.0; /* just in case there is an error */ - load_info.five_minute = 0.0; - load_info.fifteen_minute = 0.0; - dg_sys_info (&load_info, DG_SYS_INFO_LOAD_INFO_TYPE, - DG_SYS_INFO_LOAD_VERSION_0); - - return Fcons (make_number ((int)(load_info.one_minute * 100.0)), - Fcons (make_number ((int)(load_info.five_minute * 100.0)), - Fcons (make_number ((int)(load_info.fifteen_minute * 100.0)), - Qnil))); -#else /* not DGUX */ -#ifndef LOAD_AVE_TYPE - error ("load-average not implemented for this operating system"); - -#else /* LOAD_AVE_TYPE defined */ - - LOAD_AVE_TYPE load_ave[3]; -#ifdef VMS -#ifndef eunice -#include <iodef.h> -#include <descrip.h> -#else -#include <vms/iodef.h> - struct {int dsc$w_length; char *dsc$a_pointer;} descriptor; -#endif /* eunice */ -#endif /* VMS */ - - /* If this fails for any reason, we can return (0 0 0) */ - load_ave[0] = 0.0; load_ave[1] = 0.0; load_ave[2] = 0.0; - -#ifdef VMS - /* - * VMS specific code -- read from the Load Ave driver - */ - - /* - * Ensure that there is a channel open to the load ave device - */ - if (initialized == 0) - { - /* Attempt to open the channel */ -#ifdef eunice - descriptor.size = 18; - descriptor.ptr = "$$VMS_LOAD_AVERAGE"; -#else - $DESCRIPTOR(descriptor, "LAV0:"); -#endif - if (sys$assign (&descriptor, &channel, 0, 0) & 1) - initialized = 1; - } - /* - * Read the load average vector - */ - if (initialized) - { - if (!(sys$qiow (0, channel, IO$_READVBLK, 0, 0, 0, - load_ave, 12, 0, 0, 0, 0) - & 1)) - { - sys$dassgn (channel); - initialized = 0; - } - } -#else /* not VMS */ - /* - * 4.2BSD UNIX-specific code -- read _avenrun from /dev/kmem - */ - - /* - * Make sure we have the address of _avenrun - */ - if (nl[0].n_value == 0) - { - /* - * Get the address of _avenrun - */ -#ifndef NLIST_STRUCT - strcpy (nl[0].n_name, LDAV_SYMBOL); - nl[1].n_zeroes = 0; -#else /* NLIST_STRUCT */ -#ifdef convex - nl[0].n_un.n_name = LDAV_SYMBOL; - nl[1].n_un.n_name = 0; -#else /* not convex */ - nl[0].n_name = LDAV_SYMBOL; - nl[1].n_name = 0; -#endif /* not convex */ -#endif /* NLIST_STRUCT */ - - nlist (KERNEL_FILE, nl); - -#ifdef FIXUP_KERNEL_SYMBOL_ADDR - FIXUP_KERNEL_SYMBOL_ADDR (nl); -#endif /* FIXUP_KERNEL_SYMBOL_ADDR */ - } - /* - * Make sure we have /dev/kmem open - */ - if (initialized == 0) - { - /* - * Open /dev/kmem - */ - channel = open ("/dev/kmem", 0); - if (channel >= 0) initialized = 1; - } - /* - * If we can, get the load ave values - */ - if ((nl[0].n_value != 0) && (initialized != 0)) - { - /* - * Seek to the correct address - */ - lseek (channel, (long) nl[0].n_value, 0); - if (read (channel, load_ave, sizeof load_ave) - != sizeof(load_ave)) - { - close (channel); - initialized = 0; - } - } -#endif /* not VMS */ - - /* - * Return the list of load average values - */ - return Fcons (make_number (LOAD_AVE_CVT (load_ave[0])), - Fcons (make_number (LOAD_AVE_CVT (load_ave[1])), - Fcons (make_number (LOAD_AVE_CVT (load_ave[2])), - Qnil))); -#endif /* LOAD_AVE_TYPE */ -#endif /* not DGUX */ -} + double load_ave[3]; + int loads = getloadavg (load_ave, 3); + Lisp_Object ret; -#undef channel -#undef initialized -#undef nl + if (loads < 0) + error ("load-average not implemented for this operating system"); + + ret = Qnil; + while (loads > 0) + ret = Fcons (make_number ((int) (load_ave[--loads] * 100.0)), ret); + + return ret; +} Lisp_Object Vfeatures; diff --git a/src/keyboard.c b/src/keyboard.c index 12d936ad0d..97b98c98b9 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1491,7 +1491,7 @@ kbd_buffer_store_event (event) get returned to Emacs as an event, the next event read will set Vlast_event_screen again, so this is safe to do. */ extern SIGTYPE interrupt_signal (); - XSET (Vlast_event_screen, Lisp_Screen, event->screen); + Vlast_event_screen = SCREEN_FOCUS_SCREEN (event->screen); last_event_timestamp = event->timestamp; interrupt_signal (); return; @@ -1610,6 +1610,10 @@ kbd_buffer_get_event () { if (kbd_fetch_ptr == kbd_buffer + KBD_BUFFER_SIZE) kbd_fetch_ptr = kbd_buffer; + /* Do the redirection specified by the focus_screen + member now, before we return this event. */ + kbd_fetch_ptr->screen = + XSCREEN (SCREEN_FOCUS_SCREEN (kbd_fetch_ptr->screen)); XSET (Vlast_event_screen, Lisp_Screen, kbd_fetch_ptr->screen); last_event_timestamp = kbd_fetch_ptr->timestamp; obj = make_lispy_event (kbd_fetch_ptr); @@ -2765,7 +2769,7 @@ typed while in this function is treated like any other character, and\n\ GCPRO1 (keybuf[0]); gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0])); - if (! NILP (continue_echo)) + if (NILP (continue_echo)) this_command_key_count = 0; i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])), @@ -3050,7 +3054,7 @@ Actually, the value is nil only if we can be sure that no input is available.") } DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0, - "Return a vector of last 100 events read from terminal.") + "Return vector of last 100 chars read from terminal.") () { Lisp_Object val; diff --git a/src/search.c b/src/search.c index 88eb72ab1f..5e2a96c87f 100644 --- a/src/search.c +++ b/src/search.c @@ -59,9 +59,10 @@ Lisp_Object last_regexp; able to free or re-allocate it properly. */ static struct re_registers search_regs; -/* Nonzero if search_regs are indices in a string; 0 if in a buffer. */ - -static int search_regs_from_string; +/* The buffer in which the last search was performed, or + Qt if the last search was done in a string; + Qnil if no searching has been done yet. */ +static Lisp_Object last_thing_searched; /* error condition signalled when regexp compile_pattern fails */ @@ -178,7 +179,7 @@ data if you want to preserve them.") search_regs.start[i] += BEGV; search_regs.end[i] += BEGV; } - search_regs_from_string = 0; + XSET (last_thing_searched, Lisp_Buffer, current_buffer); immediate_quit = 0; return val; } @@ -219,7 +220,7 @@ matched by parenthesis constructs in the pattern.") XSTRING (string)->size, s, XSTRING (string)->size - s, &search_regs); immediate_quit = 0; - search_regs_from_string = 1; + last_thing_searched = Qt; if (val == -2) matcher_overflow (); if (val < 0) return Qnil; @@ -587,7 +588,7 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt) search_regs.start[i] += j; search_regs.end[i] += j; } - search_regs_from_string = 0; + XSET (last_thing_searched, Lisp_Buffer, current_buffer); /* Set pos to the new position. */ pos = search_regs.start[0]; } @@ -614,7 +615,7 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt) search_regs.start[i] += j; search_regs.end[i] += j; } - search_regs_from_string = 0; + XSET (last_thing_searched, Lisp_Buffer, current_buffer); pos = search_regs.end[0]; } else @@ -804,7 +805,7 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt) = pos + cursor - p2 + ((direction > 0) ? 1 - len : 0); search_regs.end[0] = len + search_regs.start[0]; - search_regs_from_string = 0; + XSET (last_thing_searched, Lisp_Buffer, current_buffer); if ((n -= direction) != 0) cursor += dirlen; /* to resume search */ else @@ -878,7 +879,7 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt) search_regs.start[0] = pos + ((direction > 0) ? 1 - len : 0); search_regs.end[0] = len + search_regs.start[0]; - search_regs_from_string = 0; + XSET (last_thing_searched, Lisp_Buffer, current_buffer); if ((n -= direction) != 0) pos += dirlen; /* to resume search */ else @@ -1221,6 +1222,9 @@ Use `store-match-data' to reinstate the data in this list.") Lisp_Object *data; int i, len; + if (NILP (last_thing_searched)) + error ("match-data called before any match found"); + data = (Lisp_Object *) alloca ((2 * search_regs.num_regs) * sizeof (Lisp_Object)); @@ -1230,19 +1234,26 @@ Use `store-match-data' to reinstate the data in this list.") int start = search_regs.start[i]; if (start >= 0) { - if (search_regs_from_string) + if (EQ (last_thing_searched, Qt)) { XFASTINT (data[2 * i]) = start; XFASTINT (data[2 * i + 1]) = search_regs.end[i]; } - else + else if (XTYPE (last_thing_searched) == Lisp_Buffer) { data[2 * i] = Fmake_marker (); - Fset_marker (data[2 * i], make_number (start), Qnil); + Fset_marker (data[2 * i], + make_number (start), + last_thing_searched); data[2 * i + 1] = Fmake_marker (); Fset_marker (data[2 * i + 1], - make_number (search_regs.end[i]), Qnil); + make_number (search_regs.end[i]), + last_thing_searched); } + else + /* last_thing_searched must always be Qt, a buffer, or Qnil. */ + abort (); + len = i; } else @@ -1264,6 +1275,10 @@ LIST should have been created by calling `match-data' previously.") if (!CONSP (list) && !NILP (list)) list = wrong_type_argument (Qconsp, list, 0); + /* Unless we find a marker with a buffer in LIST, assume that this + match data came from a string. */ + last_thing_searched = Qt; + /* Allocate registers if they don't already exist. */ { int length = Flength (list) / 2; @@ -1302,9 +1317,14 @@ LIST should have been created by calling `match-data' previously.") } else { - if (XTYPE (marker) == Lisp_Marker - && XMARKER (marker)->buffer == 0) - XFASTINT (marker) = 0; + if (XTYPE (marker) == Lisp_Marker) + { + if (XMARKER (marker)->buffer == 0) + XFASTINT (marker) = 0; + else + XSET (last_thing_searched, Lisp_Buffer, + XMARKER (marker)->buffer); + } CHECK_NUMBER_COERCE_MARKER (marker, 0); search_regs.start[i] = XINT (marker); @@ -1383,6 +1403,9 @@ syms_of_search () last_regexp = Qnil; staticpro (&last_regexp); + last_thing_searched = Qnil; + staticpro (&last_thing_searched); + defsubr (&Sstring_match); defsubr (&Slooking_at); defsubr (&Sskip_chars_forward); diff --git a/src/xdisp.c b/src/xdisp.c index 2045f7f9f2..60bdafea9d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -311,6 +311,18 @@ echo_area_display () /* If desired cursor location is on this line, put it at end of text */ if (SCREEN_CURSOR_Y (s) == vpos) SCREEN_CURSOR_X (s) = s->desired_glyphs->used[vpos]; + + /* Fill the rest of the minibuffer window with blank lines. */ + { + int i; + + for (i = vpos + 1; i < vpos + XWINDOW (minibuf_window)->height; i++) + { + get_display_line (s, i, 0); + display_string (XWINDOW (minibuf_window), vpos, + "", 0, 0, 0, SCREEN_WIDTH (s)); + } + } } else if (!EQ (minibuf_window, selected_window)) windows_or_buffers_changed++; diff --git a/src/xfns.c b/src/xfns.c index 6d32925f95..6eb248c6ba 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -1043,6 +1043,10 @@ x_set_name (s, arg, oldval) { CHECK_STRING (arg, 0); + /* Don't change the name if it's already ARG. */ + if (! NILP (Fstring_equal (arg, s->name))) + return; + if (s->display.x->window_desc) { #ifdef HAVE_X11 @@ -1056,7 +1060,6 @@ x_set_name (s, arg, oldval) XSetWMIconName (XDISPLAY s->display.x->window_desc, &prop); UNBLOCK_INPUT; #else - s->name = arg; BLOCK_INPUT; XStoreName (XDISPLAY s->display.x->window_desc, (char *) XSTRING (arg)->data); @@ -1065,6 +1068,8 @@ x_set_name (s, arg, oldval) UNBLOCK_INPUT; #endif } + + s->name = arg; } void @@ -1868,8 +1873,9 @@ be shared by the new screen.") build_string ("white"), "background", string); x_default_parameter (s, parms, "border-width", make_number (2), "BorderWidth", number); + /* This defaults to 2 in order to match XTerms. */ x_default_parameter (s, parms, "internal-border-width", - make_number (1), "InternalBorderWidth", number); + make_number (2), "InternalBorderWidth", number); /* Also do the stuff which must be set before the window exists. */ x_default_parameter (s, parms, "foreground-color", diff --git a/src/xterm.c b/src/xterm.c index 7bf039a1cf..194f8d6177 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1995,7 +1995,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) { bufp->kind = non_ascii_keystroke; XSET (bufp->code, Lisp_Int, (unsigned) keysym - 0xff50); - bufp->screen = XSCREEN (SCREEN_FOCUS_SCREEN (s)); + bufp->screen = s; bufp->modifiers = x_convert_modifiers (modifiers); bufp->timestamp = event.xkey.time; bufp++; @@ -2012,7 +2012,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) *copy_buffer |= METABIT; bufp->kind = ascii_keystroke; XSET (bufp->code, Lisp_Int, *copy_buffer); - bufp->screen = XSCREEN (SCREEN_FOCUS_SCREEN (s)); + bufp->screen = s; bufp->timestamp = event.xkey.time; bufp++; } @@ -2021,7 +2021,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) { bufp->kind = ascii_keystroke; XSET (bufp->code, Lisp_Int, copy_buffer[i]); - bufp->screen = XSCREEN (SCREEN_FOCUS_SCREEN (s)); + bufp->screen = s; bufp->timestamp = event.xkey.time; bufp++; } @@ -2071,7 +2071,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) bufp->kind = ascii_keystroke; XSET (bufp->code, Lisp_Int, where_mapping[i]); XSET (bufp->time, Lisp_Int, event.xkey.time); - bufp->screen = XSCREEN (SCREEN_FOCUS_SCREEN (s)); + bufp->screen = s; bufp++; } count += nbytes; @@ -2308,13 +2308,13 @@ XTread_socket (sd, bufp, numchars, waitp, expected) { bufp->kind = ascii_keystroke; bufp->code = (char) 'X' & 037; /* C-x */ - bufp->screen = XSCREEN (SCREEN_FOCUS_SCREEN (s)); + bufp->screen = s; XSET (bufp->time, Lisp_Int, event.xkey.time); bufp++; bufp->kind = ascii_keystroke; bufp->code = (char) 0; /* C-@ */ - bufp->screen = XSCREEN (SCREEN_FOCUS_SCREEN (s)); + bufp->screen = s; XSET (bufp->time, Lisp_Int, event.xkey.time); bufp++; @@ -3606,6 +3606,9 @@ x_wm_set_size_hint (s, prompting) Window window = s->display.x->window_desc; size_hints.flags = PResizeInc | PMinSize | PMaxSize; +#ifdef PBaseSize + size_hints.flags |= PBaseSize; +#endif flexlines = s->height; |