diff options
| author | Yuuki Harano <masm+github@masm11.me> | 2020-12-21 01:53:07 +0900 |
|---|---|---|
| committer | Yuuki Harano <masm+github@masm11.me> | 2020-12-21 01:53:07 +0900 |
| commit | 565d8f57d349c19d9bbb5d5d5fdacf3c70b85d42 (patch) | |
| tree | 5a25406b9f4ff091cb6856e857d2857bb3e631e4 /src | |
| parent | a44cd7c88121bb0e04bdf13d73e15f085cf3b085 (diff) | |
| parent | 87b82a1969edf80d3bd4781454ec9fc968773a6d (diff) | |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'src')
| -rw-r--r-- | src/buffer.c | 2 | ||||
| -rw-r--r-- | src/callint.c | 5 | ||||
| -rw-r--r-- | src/dispextern.h | 4 | ||||
| -rw-r--r-- | src/editfns.c | 9 | ||||
| -rw-r--r-- | src/fileio.c | 6 | ||||
| -rw-r--r-- | src/image.c | 9 | ||||
| -rw-r--r-- | src/keyboard.c | 7 | ||||
| -rw-r--r-- | src/keymap.c | 39 | ||||
| -rw-r--r-- | src/lread.c | 2 | ||||
| -rw-r--r-- | src/window.c | 38 | ||||
| -rw-r--r-- | src/xdisp.c | 35 |
11 files changed, 90 insertions, 66 deletions
diff --git a/src/buffer.c b/src/buffer.c index 4215acbf1df..dfc34faf6e6 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -2814,7 +2814,7 @@ the normal hook `change-major-mode-hook'. */) /* Force mode-line redisplay. Useful here because all major mode commands call this function. */ - update_mode_lines = 12; + bset_update_mode_line (current_buffer); return Qnil; } diff --git a/src/callint.c b/src/callint.c index f80436f3d91..d172af9e30b 100644 --- a/src/callint.c +++ b/src/callint.c @@ -283,6 +283,11 @@ invoke it (via an `interactive' spec that contains, for instance, an Lisp_Object save_real_this_command = Vreal_this_command; Lisp_Object save_last_command = KVAR (current_kboard, Vlast_command); + /* Bound recursively so that code can check the current command from + code running from minibuffer hooks (and the like), without being + overwritten by subsequent minibuffer calls. */ + specbind (Qcurrent_minibuffer_command, Vthis_command); + if (NILP (keys)) keys = this_command_keys, key_count = this_command_key_count; else diff --git a/src/dispextern.h b/src/dispextern.h index 126f2cb11e5..df04db45955 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3051,6 +3051,10 @@ struct image # if !defined USE_CAIRO && defined HAVE_XRENDER /* Picture versions of pixmap and mask for compositing. */ Picture picture, mask_picture; + + /* We need to store the original image dimensions in case we have to + call XGetImage. */ + int original_width, original_height; # endif #endif /* HAVE_X_WINDOWS */ #ifdef HAVE_NTGUI diff --git a/src/editfns.c b/src/editfns.c index 4104edd77fd..e4c4141ef5e 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -188,11 +188,16 @@ DEFUN ("point-marker", Fpoint_marker, Spoint_marker, 0, 0, 0, return build_marker (current_buffer, PT, PT_BYTE); } -DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ", +DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, + "(goto-char--read-natnum-interactive \"Go to char: \")", doc: /* Set point to POSITION, a number or marker. Beginning of buffer is position (point-min), end is (point-max). -The return value is POSITION. */) +The return value is POSITION. + +If called interactively, a numeric prefix argument specifies +POSITION; without a numeric prefix argument, read POSITION from the +minibuffer. The default value is the number at point (if any). */) (register Lisp_Object position) { if (MARKERP (position)) diff --git a/src/fileio.c b/src/fileio.c index 702c1438283..c97f4daf20c 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -6259,6 +6259,7 @@ syms_of_fileio (void) DEFSYM (Qfile_date_error, "file-date-error"); DEFSYM (Qfile_missing, "file-missing"); DEFSYM (Qfile_notify_error, "file-notify-error"); + DEFSYM (Qremote_file_error, "remote-file-error"); DEFSYM (Qexcl, "excl"); DEFVAR_LISP ("file-name-coding-system", Vfile_name_coding_system, @@ -6320,6 +6321,11 @@ behaves as if file names were encoded in `utf-8'. */); Fput (Qfile_notify_error, Qerror_message, build_pure_c_string ("File notification error")); + Fput (Qremote_file_error, Qerror_conditions, + Fpurecopy (list3 (Qremote_file_error, Qfile_error, Qerror))); + Fput (Qremote_file_error, Qerror_message, + build_pure_c_string ("Remote file error")); + DEFVAR_LISP ("file-name-handler-alist", Vfile_name_handler_alist, doc: /* Alist of elements (REGEXP . HANDLER) for file names handled specially. If a file name matches REGEXP, all I/O on that file is done by calling diff --git a/src/image.c b/src/image.c index e2a3902b26c..b62e7bcd2ef 100644 --- a/src/image.c +++ b/src/image.c @@ -2281,6 +2281,10 @@ image_set_transform (struct frame *f, struct image *img) # if !defined USE_CAIRO && defined HAVE_XRENDER if (!img->picture) return; + + /* Store the original dimensions as we'll overwrite them later. */ + img->original_width = img->width; + img->original_height = img->height; # endif /* Determine size. */ @@ -3140,6 +3144,11 @@ image_get_x_image (struct frame *f, struct image *img, bool mask_p) if (ximg_in_img) return ximg_in_img; +#ifdef HAVE_XRENDER + else if (img->picture) + return XGetImage (FRAME_X_DISPLAY (f), !mask_p ? img->pixmap : img->mask, + 0, 0, img->original_width, img->original_height, ~0, ZPixmap); +#endif else return XGetImage (FRAME_X_DISPLAY (f), !mask_p ? img->pixmap : img->mask, 0, 0, img->width, img->height, ~0, ZPixmap); diff --git a/src/keyboard.c b/src/keyboard.c index e8d0747210a..7f12449a39c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -11838,6 +11838,13 @@ will be in `last-command' during the following command. */); doc: /* This is like `this-command', except that commands should never modify it. */); Vreal_this_command = Qnil; + DEFSYM (Qcurrent_minibuffer_command, "current-minibuffer-command"); + DEFVAR_LISP ("current-minibuffer-command", Vcurrent_minibuffer_command, + doc: /* This is like `this-command', but bound recursively. +Code running from (for instance) a minibuffer hook can check this variable +to see what command invoked the current minibuffer. */); + Vcurrent_minibuffer_command = Qnil; + DEFVAR_LISP ("this-command-keys-shift-translated", Vthis_command_keys_shift_translated, doc: /* Non-nil if the key sequence activating this command was shift-translated. diff --git a/src/keymap.c b/src/keymap.c index e22eb411f63..ca2d33dba47 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -3243,49 +3243,11 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args, } } -/* Apropos - finding all symbols whose names match a regexp. */ -static Lisp_Object apropos_predicate; -static Lisp_Object apropos_accumulate; - -static void -apropos_accum (Lisp_Object symbol, Lisp_Object string) -{ - register Lisp_Object tem; - - tem = Fstring_match (string, Fsymbol_name (symbol), Qnil); - if (!NILP (tem) && !NILP (apropos_predicate)) - tem = call1 (apropos_predicate, symbol); - if (!NILP (tem)) - apropos_accumulate = Fcons (symbol, apropos_accumulate); -} - -DEFUN ("apropos-internal", Fapropos_internal, Sapropos_internal, 1, 2, 0, - doc: /* Show all symbols whose names contain match for REGEXP. -If optional 2nd arg PREDICATE is non-nil, (funcall PREDICATE SYMBOL) is done -for each symbol and a symbol is mentioned only if that returns non-nil. -Return list of symbols found. */) - (Lisp_Object regexp, Lisp_Object predicate) -{ - Lisp_Object tem; - CHECK_STRING (regexp); - apropos_predicate = predicate; - apropos_accumulate = Qnil; - map_obarray (Vobarray, apropos_accum, regexp); - tem = Fsort (apropos_accumulate, Qstring_lessp); - apropos_accumulate = Qnil; - apropos_predicate = Qnil; - return tem; -} - void syms_of_keymap (void) { DEFSYM (Qkeymap, "keymap"); DEFSYM (Qdescribe_map_tree, "describe-map-tree"); - staticpro (&apropos_predicate); - staticpro (&apropos_accumulate); - apropos_predicate = Qnil; - apropos_accumulate = Qnil; DEFSYM (Qkeymap_canonicalize, "keymap-canonicalize"); @@ -3429,7 +3391,6 @@ be preferred. */); defsubr (&Stext_char_description); defsubr (&Swhere_is_internal); defsubr (&Sdescribe_buffer_bindings); - defsubr (&Sapropos_internal); } void diff --git a/src/lread.c b/src/lread.c index a3d5fd7bb81..3ef874039a6 100644 --- a/src/lread.c +++ b/src/lread.c @@ -3438,7 +3438,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) /* Any modifiers remaining are invalid. */ if (modifiers) - error ("Invalid modifier in string"); + invalid_syntax ("Invalid modifier in string"); p += CHAR_STRING (ch, (unsigned char *) p); } else diff --git a/src/window.c b/src/window.c index 8e75e460b2b..bcc989b5a79 100644 --- a/src/window.c +++ b/src/window.c @@ -5686,27 +5686,20 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror) we would end up at the start of the line ending at ZV. */ if (dy <= 0) { - goal_y = it.current_y - dy; + goal_y = it.current_y + dy; move_it_vertically_backward (&it, -dy); - /* Extra precision for people who want us to preserve the - screen position of the cursor: effectively round DY to the - nearest screen line, instead of rounding to zero; the latter - causes point to move by one line after C-v followed by M-v, - if the buffer has lines of different height. */ - if (!NILP (Vscroll_preserve_screen_position) - && it.current_y - goal_y > 0.5 * flh) + /* move_it_vertically_backward above always overshoots if DY + cannot be reached exactly, i.e. if it falls in the middle + of a screen line. But if that screen line is large + (e.g., a tall image), it might make more sense to + undershoot instead. */ + if (goal_y - it.current_y > 0.5 * flh) { it_data = bidi_shelve_cache (); - struct it it2 = it; - - move_it_by_lines (&it, -1); - if (it.current_y < goal_y - 0.5 * flh) - { - it = it2; - bidi_unshelve_cache (it_data, false); - } - else - bidi_unshelve_cache (it_data, true); + struct it it1 = it; + if (line_bottom_y (&it1) - goal_y < goal_y - it.current_y) + move_it_by_lines (&it, 1); + bidi_unshelve_cache (it_data, true); } /* Ensure we actually do move, e.g. in case we are currently looking at an image that is taller that the window height. */ @@ -5718,8 +5711,11 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror) { goal_y = it.current_y + dy; move_it_to (&it, ZV, -1, goal_y, -1, MOVE_TO_POS | MOVE_TO_Y); - /* See the comment above, for the reasons of this - extra-precision. */ + /* Extra precision for people who want us to preserve the + screen position of the cursor: effectively round DY to the + nearest screen line, instead of rounding to zero; the latter + causes point to move by one line after C-v followed by M-v, + if the buffer has lines of different height. */ if (!NILP (Vscroll_preserve_screen_position) && goal_y - it.current_y > 0.5 * flh) { @@ -7826,7 +7822,7 @@ set_window_scroll_bars (struct window *w, Lisp_Object width, if more than a single window needs to be considered, see redisplay_internal. */ if (changed) - windows_or_buffers_changed = 31; + wset_redisplay (w); return changed ? w : NULL; } diff --git a/src/xdisp.c b/src/xdisp.c index a8c66f017fc..5533c82d143 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -9957,7 +9957,27 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos { skip = skip2; if (skip == MOVE_POS_MATCH_OR_ZV) - reached = 7; + { + reached = 7; + /* If the last move_it_in_display_line_to call + took us away from TO_CHARPOS, back up to the + previous position, as it is a better + approximation of TO_CHARPOS. (Note that we + could have both positions after TO_CHARPOS or + both positions before it, due to bidi + reordering.) */ + if (IT_CHARPOS (*it) != to_charpos + && ((IT_CHARPOS (it_backup) > to_charpos) + == (IT_CHARPOS (*it) > to_charpos))) + { + int max_ascent = it->max_ascent; + int max_descent = it->max_descent; + + RESTORE_IT (it, &it_backup, backup_data); + it->max_ascent = max_ascent; + it->max_descent = max_descent; + } + } } } else @@ -10301,11 +10321,22 @@ move_it_vertically_backward (struct it *it, int dy) move_it_vertically (it, target_y - it->current_y); else { + struct text_pos last_pos; + int last_y, last_vpos; do { + last_pos = it->current.pos; + last_y = it->current_y; + last_vpos = it->vpos; move_it_by_lines (it, 1); } - while (target_y >= line_bottom_y (it) && IT_CHARPOS (*it) < ZV); + while (target_y > it->current_y && IT_CHARPOS (*it) < ZV); + if (it->current_y > target_y) + { + reseat (it, last_pos, true); + it->current_y = last_y; + it->vpos = last_vpos; + } } } } |
