aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-02-12 12:00:35 -0800
committerPaul Eggert2011-02-12 12:00:35 -0800
commit583dab51b0c1962c10d5b8baf9da7af7921e8775 (patch)
tree69e6178b399ecfaed2e3b757e2d68e96b7b0334d /src
parent64640ce2d31c153698c501e9385e3d5397181de9 (diff)
parent470d996db4b850a0c4676e03de805e53703b80e0 (diff)
downloademacs-583dab51b0c1962c10d5b8baf9da7af7921e8775.tar.gz
emacs-583dab51b0c1962c10d5b8baf9da7af7921e8775.zip
Merge from mainline.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog14
-rw-r--r--src/callproc.c32
-rw-r--r--src/process.c6
-rw-r--r--src/xdisp.c38
4 files changed, 83 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 43ca62aedfc..031b254739e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,17 @@
12011-02-12 Andreas Schwab <schwab@linux-m68k.org>
2
3 * process.c (create_process): Reset SIGPIPE handler in the child.
4 * callproc.c (Fcall_process): Likewise. (Bug#5238)
5
62011-02-12 Eli Zaretskii <eliz@gnu.org>
7
8 * xdisp.c <this_line_min_pos>: New variable.
9 (move_it_in_display_line_to): Record in this_line_min_pos the
10 smallest position iterated across.
11 (display_line): Use this_line_min_pos to record the smallest
12 position in the line even if it is not displayed due to
13 hscrolling. (Bug#7939)
14
12011-02-12 Paul Eggert <eggert@cs.ucla.edu> 152011-02-12 Paul Eggert <eggert@cs.ucla.edu>
2 16
3 Remove no-longer needed getloadavg symbols. 17 Remove no-longer needed getloadavg symbols.
diff --git a/src/callproc.c b/src/callproc.c
index 925eefb4b02..27e8493bcf1 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -445,6 +445,11 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
445 register char **save_environ = environ; 445 register char **save_environ = environ;
446 register int fd1 = fd[1]; 446 register int fd1 = fd[1];
447 int fd_error = fd1; 447 int fd_error = fd1;
448#ifdef HAVE_WORKING_VFORK
449 sigset_t procmask;
450 sigset_t blocked;
451 struct sigaction sigpipe_action;
452#endif
448 453
449#if 0 /* Some systems don't have sigblock. */ 454#if 0 /* Some systems don't have sigblock. */
450 mask = sigblock (sigmask (SIGCHLD)); 455 mask = sigblock (sigmask (SIGCHLD));
@@ -525,6 +530,18 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
525 pid = child_setup (filefd, fd1, fd_error, (char **) new_argv, 530 pid = child_setup (filefd, fd1, fd_error, (char **) new_argv,
526 0, current_dir); 531 0, current_dir);
527#else /* not WINDOWSNT */ 532#else /* not WINDOWSNT */
533
534#ifdef HAVE_WORKING_VFORK
535 /* On many hosts (e.g. Solaris 2.4), if a vforked child calls `signal',
536 this sets the parent's signal handlers as well as the child's.
537 So delay all interrupts whose handlers the child might munge,
538 and record the current handlers so they can be restored later. */
539 sigemptyset (&blocked);
540 sigaddset (&blocked, SIGPIPE);
541 sigaction (SIGPIPE, 0, &sigpipe_action);
542 sigprocmask (SIG_BLOCK, &blocked, &procmask);
543#endif
544
528 BLOCK_INPUT; 545 BLOCK_INPUT;
529 546
530 pid = vfork (); 547 pid = vfork ();
@@ -541,11 +558,26 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
541#else 558#else
542 setpgrp (pid, pid); 559 setpgrp (pid, pid);
543#endif /* USG */ 560#endif /* USG */
561
562 /* GTK causes us to ignore SIGPIPE, make sure it is restored
563 in the child. */
564 signal (SIGPIPE, SIG_DFL);
565#ifdef HAVE_WORKING_VFORK
566 sigprocmask (SIG_SETMASK, &procmask, 0);
567#endif
568
544 child_setup (filefd, fd1, fd_error, (char **) new_argv, 569 child_setup (filefd, fd1, fd_error, (char **) new_argv,
545 0, current_dir); 570 0, current_dir);
546 } 571 }
547 572
548 UNBLOCK_INPUT; 573 UNBLOCK_INPUT;
574
575#ifdef HAVE_WORKING_VFORK
576 /* Restore the signal state. */
577 sigaction (SIGPIPE, &sigpipe_action, 0);
578 sigprocmask (SIG_SETMASK, &procmask, 0);
579#endif
580
549#endif /* not WINDOWSNT */ 581#endif /* not WINDOWSNT */
550 582
551 /* The MSDOS case did this already. */ 583 /* The MSDOS case did this already. */
diff --git a/src/process.c b/src/process.c
index 80e70e49f8e..d026b9d030b 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1786,6 +1786,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1786 sigset_t blocked; 1786 sigset_t blocked;
1787 struct sigaction sigint_action; 1787 struct sigaction sigint_action;
1788 struct sigaction sigquit_action; 1788 struct sigaction sigquit_action;
1789 struct sigaction sigpipe_action;
1789#ifdef AIX 1790#ifdef AIX
1790 struct sigaction sighup_action; 1791 struct sigaction sighup_action;
1791#endif 1792#endif
@@ -1898,6 +1899,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1898 and record the current handlers so they can be restored later. */ 1899 and record the current handlers so they can be restored later. */
1899 sigaddset (&blocked, SIGINT ); sigaction (SIGINT , 0, &sigint_action ); 1900 sigaddset (&blocked, SIGINT ); sigaction (SIGINT , 0, &sigint_action );
1900 sigaddset (&blocked, SIGQUIT); sigaction (SIGQUIT, 0, &sigquit_action); 1901 sigaddset (&blocked, SIGQUIT); sigaction (SIGQUIT, 0, &sigquit_action);
1902 sigaddset (&blocked, SIGPIPE); sigaction (SIGPIPE, 0, &sigpipe_action);
1901#ifdef AIX 1903#ifdef AIX
1902 sigaddset (&blocked, SIGHUP ); sigaction (SIGHUP , 0, &sighup_action ); 1904 sigaddset (&blocked, SIGHUP ); sigaction (SIGHUP , 0, &sighup_action );
1903#endif 1905#endif
@@ -2054,6 +2056,9 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
2054 2056
2055 signal (SIGINT, SIG_DFL); 2057 signal (SIGINT, SIG_DFL);
2056 signal (SIGQUIT, SIG_DFL); 2058 signal (SIGQUIT, SIG_DFL);
2059 /* GTK causes us to ignore SIGPIPE, make sure it is restored
2060 in the child. */
2061 signal (SIGPIPE, SIG_DFL);
2057 2062
2058 /* Stop blocking signals in the child. */ 2063 /* Stop blocking signals in the child. */
2059 sigprocmask (SIG_SETMASK, &procmask, 0); 2064 sigprocmask (SIG_SETMASK, &procmask, 0);
@@ -2142,6 +2147,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
2142 /* Restore the parent's signal handlers. */ 2147 /* Restore the parent's signal handlers. */
2143 sigaction (SIGINT, &sigint_action, 0); 2148 sigaction (SIGINT, &sigint_action, 0);
2144 sigaction (SIGQUIT, &sigquit_action, 0); 2149 sigaction (SIGQUIT, &sigquit_action, 0);
2150 sigaction (SIGPIPE, &sigpipe_action, 0);
2145#ifdef AIX 2151#ifdef AIX
2146 sigaction (SIGHUP, &sighup_action, 0); 2152 sigaction (SIGHUP, &sighup_action, 0);
2147#endif 2153#endif
diff --git a/src/xdisp.c b/src/xdisp.c
index 630c1dcda85..b9b77e34b9d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -444,6 +444,12 @@ static int this_line_pixel_height;
444 444
445static int this_line_start_x; 445static int this_line_start_x;
446 446
447/* The smallest character position seen by move_it_* functions as they
448 move across display lines. Used to set MATRIX_ROW_START_CHARPOS of
449 hscrolled lines, see display_line. */
450
451static struct text_pos this_line_min_pos;
452
447/* Buffer that this_line_.* variables are referring to. */ 453/* Buffer that this_line_.* variables are referring to. */
448 454
449static struct buffer *this_line_buffer; 455static struct buffer *this_line_buffer;
@@ -6909,6 +6915,9 @@ move_it_in_display_line_to (struct it *it,
6909 && it->current_y < it->last_visible_y) 6915 && it->current_y < it->last_visible_y)
6910 handle_line_prefix (it); 6916 handle_line_prefix (it);
6911 6917
6918 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
6919 SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it));
6920
6912 while (1) 6921 while (1)
6913 { 6922 {
6914 int x, i, ascent = 0, descent = 0; 6923 int x, i, ascent = 0, descent = 0;
@@ -7013,6 +7022,9 @@ move_it_in_display_line_to (struct it *it,
7013 if (it->area != TEXT_AREA) 7022 if (it->area != TEXT_AREA)
7014 { 7023 {
7015 set_iterator_to_next (it, 1); 7024 set_iterator_to_next (it, 1);
7025 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
7026 SET_TEXT_POS (this_line_min_pos,
7027 IT_CHARPOS (*it), IT_BYTEPOS (*it));
7016 continue; 7028 continue;
7017 } 7029 }
7018 7030
@@ -7121,6 +7133,9 @@ move_it_in_display_line_to (struct it *it,
7121 } 7133 }
7122 7134
7123 set_iterator_to_next (it, 1); 7135 set_iterator_to_next (it, 1);
7136 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
7137 SET_TEXT_POS (this_line_min_pos,
7138 IT_CHARPOS (*it), IT_BYTEPOS (*it));
7124 /* On graphical terminals, newlines may 7139 /* On graphical terminals, newlines may
7125 "overflow" into the fringe if 7140 "overflow" into the fringe if
7126 overflow-newline-into-fringe is non-nil. 7141 overflow-newline-into-fringe is non-nil.
@@ -7219,6 +7234,8 @@ move_it_in_display_line_to (struct it *it,
7219 /* The current display element has been consumed. Advance 7234 /* The current display element has been consumed. Advance
7220 to the next. */ 7235 to the next. */
7221 set_iterator_to_next (it, 1); 7236 set_iterator_to_next (it, 1);
7237 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
7238 SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it));
7222 7239
7223 /* Stop if lines are truncated and IT's current x-position is 7240 /* Stop if lines are truncated and IT's current x-position is
7224 past the right edge of the window now. */ 7241 past the right edge of the window now. */
@@ -17139,18 +17156,15 @@ find_row_edges (struct it *it, struct glyph_row *row,
17139 if (min_pos <= ZV) 17156 if (min_pos <= ZV)
17140 SET_TEXT_POS (row->minpos, min_pos, min_bpos); 17157 SET_TEXT_POS (row->minpos, min_pos, min_bpos);
17141 else 17158 else
17142 { 17159 /* We didn't find _any_ valid buffer positions in any of the
17143 /* We didn't find _any_ valid buffer positions in any of the 17160 glyphs, so we must trust the iterator's computed positions. */
17144 glyphs, so we must trust the iterator's computed
17145 positions. */
17146 row->minpos = row->start.pos; 17161 row->minpos = row->start.pos;
17162 if (max_pos <= 0)
17163 {
17147 max_pos = CHARPOS (it->current.pos); 17164 max_pos = CHARPOS (it->current.pos);
17148 max_bpos = BYTEPOS (it->current.pos); 17165 max_bpos = BYTEPOS (it->current.pos);
17149 } 17166 }
17150 17167
17151 if (!max_pos)
17152 abort ();
17153
17154 /* Here are the various use-cases for ending the row, and the 17168 /* Here are the various use-cases for ending the row, and the
17155 corresponding values for ROW->maxpos: 17169 corresponding values for ROW->maxpos:
17156 17170
@@ -17263,8 +17277,18 @@ display_line (struct it *it)
17263 if the first glyph is partially visible or if we hit a line end. */ 17277 if the first glyph is partially visible or if we hit a line end. */
17264 if (it->current_x < it->first_visible_x) 17278 if (it->current_x < it->first_visible_x)
17265 { 17279 {
17280 SET_TEXT_POS (this_line_min_pos, ZV + 1, ZV_BYTE + 1);
17266 move_it_in_display_line_to (it, ZV, it->first_visible_x, 17281 move_it_in_display_line_to (it, ZV, it->first_visible_x,
17267 MOVE_TO_POS | MOVE_TO_X); 17282 MOVE_TO_POS | MOVE_TO_X);
17283 /* Record the smallest positions seen while we moved over
17284 display elements that are not visible. This is needed by
17285 redisplay_internal for optimizing the case where the cursor
17286 stays inside the same line. The rest of this function only
17287 considers positions that are actually displayed, so
17288 RECORD_MAX_MIN_POS will not otherwise record positions that
17289 are hscrolled to the left of the left edge of the window. */
17290 min_pos = CHARPOS (this_line_min_pos);
17291 min_bpos = BYTEPOS (this_line_min_pos);
17268 } 17292 }
17269 else 17293 else
17270 { 17294 {