From 62a6934af9c110c28fc1f69f4bb1b79ce9d0c43d Mon Sep 17 00:00:00 2001 From: Alan Third Date: Sat, 5 Dec 2020 19:40:08 +0000 Subject: Fix crash when using XRender and restoring image from X (bug#44930) * src/dispextern.h (struct image): Add original dimension elements. * src/image.c (image_set_transform): Store the original dimensions. (image_get_x_image): If we're using transforms use the original dimensions with XGetImage. --- src/dispextern.h | 4 ++++ src/image.c | 9 +++++++++ 2 files changed, 13 insertions(+) (limited to 'src') diff --git a/src/dispextern.h b/src/dispextern.h index 6b72e68d315..44556276ff5 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -3047,6 +3047,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/image.c b/src/image.c index 956fb1325ed..7beb135f65c 100644 --- a/src/image.c +++ b/src/image.c @@ -2103,6 +2103,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. */ @@ -2930,6 +2934,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); -- cgit v1.3 From 252366866b5691965c8c752aa103ab157a6f3aaa Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 14 Dec 2020 16:44:00 +0100 Subject: Add a new recursively bound `current-minibuffer-command' variable * doc/lispref/commands.texi (Command Loop Info): Document it (bug#45177). * src/callint.c (Fcall_interactively): Bind it. * src/keyboard.c (syms_of_keyboard): Define current-minibuffer-command. --- doc/lispref/commands.texi | 7 +++++++ etc/NEWS | 6 ++++++ src/callint.c | 5 +++++ src/keyboard.c | 7 +++++++ 4 files changed, 25 insertions(+) (limited to 'src') diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index ebfda01671e..15d7e4e3a71 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi @@ -928,6 +928,13 @@ remapping), and @code{this-original-command} gives the command that was specified to run but remapped into another command. @end defvar +@defvar current-minibuffer-command +This has the same value as @code{this-command}, but is bound +recursively when entering a minibuffer. This variable can be used +from minibuffer hooks and the like to determine what command opened +the current minibuffer session. +@end defvar + @defun this-command-keys This function returns a string or vector containing the key sequence that invoked the present command. Any events read by the command diff --git a/etc/NEWS b/etc/NEWS index 635da2d84ab..a5e2c9cf26a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1437,6 +1437,12 @@ that makes it a valid button. ** Miscellaneous ++++ + +*** New variable 'current-minibuffer-command'. +This is like 'this-command', but is bound recursively when entering +the minibuffer. + +++ *** New function 'object-intervals'. This function returns a copy of the list of intervals (i.e., text diff --git a/src/callint.c b/src/callint.c index f80436f3d91..a221705f676 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, Vreal_this_command); + if (NILP (keys)) keys = this_command_keys, key_count = this_command_key_count; else diff --git a/src/keyboard.c b/src/keyboard.c index dbca5be91e4..54232aaea1e 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -11830,6 +11830,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. -- cgit v1.3 From 0dd8d53344a822842660d2ac75108f40ba9ff0f4 Mon Sep 17 00:00:00 2001 From: Daniel Martín Date: Mon, 14 Dec 2020 17:16:00 +0100 Subject: Make goto-char offer the number at point as default * lisp/subr.el (read-natnum-interactive): New function to read natural numbers for interactive functions. * src/editfns.c (Fgoto_char): Call read-natnum-interactive from the interactive definition of goto-char to offer the number at point as default. Also expand the docstring to document this new interactive behavior. * doc/emacs/basic.texi (Moving Point): Expand the Emacs manual to document this new behavior. * etc/NEWS: And announce it (bug#45199). --- doc/emacs/basic.texi | 5 ++++- etc/NEWS | 4 ++++ lisp/subr.el | 9 +++++++++ src/editfns.c | 9 +++++++-- 4 files changed, 24 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/doc/emacs/basic.texi b/doc/emacs/basic.texi index cd1ffbebd7c..77c80547462 100644 --- a/doc/emacs/basic.texi +++ b/doc/emacs/basic.texi @@ -310,7 +310,10 @@ Scroll one screen backward, and move point onscreen if necessary @kindex M-g c @findex goto-char Read a number @var{n} and move point to buffer position @var{n}. -Position 1 is the beginning of the buffer. +Position 1 is the beginning of the buffer. If point is on or just +after a number in the buffer, that is the default for @var{n}. Just +type @key{RET} in the minibuffer to use it. You can also specify +@var{n} by giving @kbd{M-g c} a numeric prefix argument. @item M-g M-g @itemx M-g g diff --git a/etc/NEWS b/etc/NEWS index a5e2c9cf26a..05274a2d6c6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -257,6 +257,10 @@ When 'widen-automatically' is non-nil, 'goto-line' widens the narrowed buffer to be able to move point to the inaccessible portion. 'goto-line-relative' is bound to 'C-x n g'. ++++ +** When called interactively, 'goto-char' now offers the number at +point as default. + +++ ** When 'suggest-key-bindings' is non-nil, the completion list of 'M-x' shows equivalent key bindings for all commands that have them. diff --git a/lisp/subr.el b/lisp/subr.el index ed235ee1f72..77c19c5bbf3 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2820,6 +2820,15 @@ There is no need to explicitly add `help-char' to CHARS; (message "%s%s" prompt (char-to-string char)) char)) +(defun goto-char--read-natnum-interactive (prompt) + "Get a natural number argument, optionally prompting with PROMPT. +If there is a natural number at point, use it as default." + (if (and current-prefix-arg (not (consp current-prefix-arg))) + (list (prefix-numeric-value current-prefix-arg)) + (let* ((number (number-at-point)) + (default (and (natnump number) number))) + (list (read-number prompt default))))) + ;; Behind display-popup-menus-p test. (declare-function x-popup-dialog "menu.c" (position contents &optional header)) 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)) -- cgit v1.3 From 47a854bf24c8a36bf1e8ac32c8b5c9ebcba1d90a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 14 Dec 2020 20:23:24 +0200 Subject: Improve accuracy of scrolling commands * src/xdisp.c (move_it_vertically_backward): Don't rely on line_bottom_y for accurate calculation of the next screen line's Y coordinate: it doesn't work when the current screen line was not yet traversed. Instead, record the previous Y coordinate and reseat there if overshoot is detected. * src/window.c (window_scroll_pixel_based): Calculate the new window-start point more accurately when screen lines have uneven height. (Bug#8355) --- src/window.c | 36 ++++++++++++++++-------------------- src/xdisp.c | 13 ++++++++++++- 2 files changed, 28 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/window.c b/src/window.c index 8e75e460b2b..4eab786958f 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) { diff --git a/src/xdisp.c b/src/xdisp.c index 96dd4fade25..699183f3f59 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10301,11 +10301,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; + } } } } -- cgit v1.3 From c0c6cd2d5d7af82ddfd4d8d080d0aa8d7882d293 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 14 Dec 2020 19:30:01 +0100 Subject: Add 'remote-file-error' for Tramp * doc/lispref/errors.texi (Standard Errors): Add 'remote-file-error'. * etc/NEWS: Mention 'remote-file-error'. * lisp/net/ange-ftp.el (ftp-error): Add error condition `remote-file-error'. * lisp/net/tramp-cmds.el (tramp-cleanup-all-connections): Do not set `tramp-locked'. * lisp/net/tramp-compat.el (remote-file-error): Define if it doesn't exist. * lisp/net/tramp-sh.el (tramp-timeout-session): Check for "locked" property. (tramp-maybe-open-connection): Simplify. * lisp/net/tramp.el (tramp-locked, tramp-locker): Remove them. (tramp-file-name-handler): Do not set them. (with-tramp-locked-connection): New defmacro. (tramp-accept-process-output, tramp-send-string): Use it. * src/fileio.c (Qremote_file_error): New error symbol. * test/lisp/net/tramp-tests.el (tramp-test43-asynchronous-requests): Adapt test. Remove :unstable tag. --- doc/lispref/errors.texi | 11 ++++- etc/NEWS | 61 +++++++++++++---------- lisp/net/ange-ftp.el | 2 +- lisp/net/tramp-cmds.el | 3 -- lisp/net/tramp-compat.el | 5 ++ lisp/net/tramp-sh.el | 13 ++--- lisp/net/tramp.el | 113 ++++++++++++++++++++----------------------- src/fileio.c | 6 +++ test/lisp/net/tramp-tests.el | 27 ++++++----- 9 files changed, 132 insertions(+), 109 deletions(-) (limited to 'src') diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi index cd8694be8a3..ff9b3e57125 100644 --- a/doc/lispref/errors.texi +++ b/doc/lispref/errors.texi @@ -129,9 +129,18 @@ This is a subcategory of @code{file-error}. @xref{Modification Time}. This is a subcategory of @code{file-error}. It happens, when a file could not be watched for changes. @xref{File Notifications}. +@item remote-file-error +This is a subcategory of @code{file-error}, which results from +problems in accessing a remote file. @xref{Remote Files,,, emacs, The +GNU Emacs Manual}. Often, this error appears when timers, process +filters, process sentinels or special events in general try to access +a remote file, and collide with another remote file operation. In +general it is a good idea to write a bug report. @xref{Reporting +Bugs,,, emacs, The GNU Emacs Manual}. + @c net/ange-ftp.el @item ftp-error -This is a subcategory of @code{file-error}, which results from +This is a subcategory of @code{remote-file-error}, which results from problems in accessing a remote file using ftp. @xref{Remote Files,,, emacs, The GNU Emacs Manual}. diff --git a/etc/NEWS b/etc/NEWS index 05274a2d6c6..87463372d57 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -89,7 +89,7 @@ useful on systems such as FreeBSD which ships only with "etc/termcap". This is controlled by the new variable 'scroll-minibuffer-conservatively'. In addition, there is a new variable -`redisplay-adhoc-scroll-in-resize-mini-windows` to disable the +'redisplay-adhoc-scroll-in-resize-mini-windows' to disable the ad-hoc auto-scrolling when resizing minibuffer windows. It has been found that its heuristic can be counter productive in some corner cases, tho the cure may be worse than the disease. This said, the @@ -303,8 +303,8 @@ the buffer cycles the whole buffer between "only top-level headings", * Changes in Specialized Modes and Packages in Emacs 28.1 -** Loading dunnet.el in batch mode doesn't start the game any more -Instead you need to do 'emacs -f dun-batch' to start the game in +** Loading dunnet.el in batch mode doesn't start the game any more. +Instead you need to do "emacs -f dun-batch" to start the game in batch mode. ** Emacs Server @@ -523,21 +523,20 @@ tags to be considered as well. +++ *** New user option 'gnus-registry-register-all'. - If non-nil (the default), create registry entries for all messages. If nil, don't automatically create entries, they must be created manually. +++ -*** New user options to customise the summary line specs %[ and %]. +*** New user options to customise the summary line specs "%[" and "%]". Four new options introduced in customisation group 'gnus-summary-format'. These are 'gnus-sum-opening-bracket', 'gnus-sum-closing-bracket', 'gnus-sum-opening-bracket-adopted', and -'gnus-sum-closing-bracket-adopted'. Their default values are '[', ']', -'<', '>' respectively. These variables control the appearance of '%[' -and '%]' specs in the summary line format. '%[' will normally display +'gnus-sum-closing-bracket-adopted'. Their default values are "[", "]", +"<", ">" respectively. These options control the appearance of "%[" +and "%]" specs in the summary line format. "%[" will normally display the value of 'gnus-sum-opening-bracket', but can also be -'gnus-sum-opening-bracket-adopted' for the adopted articles. '%]' will +'gnus-sum-opening-bracket-adopted' for the adopted articles. "%]" will normally display the value of 'gnus-sum-closing-bracket', but can also be 'gnus-sum-closing-bracket-adopted' for the adopted articles. @@ -1130,13 +1129,13 @@ If 'shr-width' is non-nil, it overrides this variable. ** Images --- -** Can explicitly specify base_uri for svg images. +*** You can explicitly specify base_uri for svg images. ':base-uri' image property can be used to explicitly specify base_uri -for embedded images into svg. ':base-uri' is supported for both file +for embedded images into svg. ':base-uri' is supported for both file and data svg images. +++ -** 'svg-embed-base-uri-image' added to embed images +*** 'svg-embed-base-uri-image' added to embed images. 'svg-embed-base-uri-image' can be used to embed images located relatively to 'file-name-directory' of the ':base-uri' svg image property. This works much faster then 'svg-embed'. @@ -1256,8 +1255,8 @@ project's root directory, respectively. So typing 'C-u RET' in the "*xref*" buffer quits its window before navigating to the selected location. -*** New options xref-search-program and xref-search-program-alist. -So far Grep and ripgrep are supported. ripgrep seems to offer better +*** New user options 'xref-search-program' and 'xref-search-program-alist'. +So far 'grep' and 'ripgrep' are supported. 'ripgrep' seems to offer better performance in certain cases, in particular for case-insensitive searches. @@ -1442,9 +1441,8 @@ that makes it a valid button. ** Miscellaneous +++ - *** New variable 'current-minibuffer-command'. -This is like 'this-command', but is bound recursively when entering +This is like 'this-command', but it is bound recursively when entering the minibuffer. +++ @@ -1763,14 +1761,12 @@ used instead. * New Modes and Packages in Emacs 28.1 ** Lisp Data mode - The new command 'lisp-data-mode' enables a major mode for buffers composed of Lisp symbolic expressions that do not form a computer program. The ".dir-locals.el" file is automatically set to use this mode, as are other data files produced by Emacs. ** hierarchy.el - It's a library to create, query, navigate and display hierarchy structures. ** New themes 'modus-vivendi' and 'modus-operandi'. @@ -1781,13 +1777,12 @@ Consult the Modus Themes Info manual for more information on the user options they provide. ** Dictionary mode - -This is a mode for searching a RFC 2229 dictionary -server. 'dictionary' opens a buffer for starting -operations. 'dictionary-search' performs a lookup for a word. It also -supports a 'dictionary-tooltip-mode' which performs a lookup of the -word under the mouse in 'dictionary-tooltip-dictionary' (which must be -customized first). +This is a mode for searching a RFC 2229 dictionary server. +'dictionary' opens a buffer for starting operations. +'dictionary-search' performs a lookup for a word. It also supports a +'dictionary-tooltip-mode' which performs a lookup of the word under +the mouse in 'dictionary-tooltip-dictionary' (which must be customized +first). * Incompatible Editing Changes in Emacs 28.1 @@ -1939,7 +1934,7 @@ ledit.el, lmenu.el, lucid.el and old-whitespace.el. * Lisp Changes in Emacs 28.1 -** New function `garbage-collect-maybe` to trigger GC early +** New function 'garbage-collect-maybe' to trigger GC early. --- ** 'defvar' detects the error of defining a variable currently lexically bound. @@ -2164,6 +2159,20 @@ and 'play-sound-file'. If this variable is non-nil, character syntax is used for printing numbers when this makes sense, such as '?A' for 65. +** New error 'remote-file-error', a subcategory of 'file-error'. +It is signaled if a remote file operation fails due to internal +reasons, and could block Emacs. It does not replace 'file-error' +signals for the usual cases. Timers, process filters and process +functions, which run remote file operations, shall protect themselves +against this error. + +If such an error occurs, please report this as bug via 'M-x report-emacs-bug'. +Until it is solved you could ignore such errors by performing + + (setq debug-ignored-errors (cons 'remote-file-error debug-ignored-errors)) + +** The error 'ftp-error' belongs also to category 'remote-file-error'. + * Changes in Emacs 28.1 on Non-Free Operating Systems diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index c627e1a088d..1922adb5480 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el @@ -1080,7 +1080,7 @@ All HOST values should be in lower case.") (defvar ange-ftp-trample-marker) ;; New error symbols. -(define-error 'ftp-error nil 'file-error) ;"FTP error" +(define-error 'ftp-error nil '(remote-file-error file-error)) ;"FTP error" ;;; ------------------------------------------------------------ ;;; Enhanced message support. diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 622116d9f90..9b6250430a8 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -159,9 +159,6 @@ When called interactively, a Tramp connection has to be selected." This includes password cache, file cache, connection cache, buffers." (interactive) - ;; Unlock Tramp. - (setq tramp-locked nil) - ;; Flush password cache. (password-reset) diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index b44eabcfa8b..4c8d37d602c 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -348,6 +348,11 @@ A nil value for either argument stands for the current time." (lambda (fromstring tostring instring) (replace-regexp-in-string (regexp-quote fromstring) tostring instring)))) +;; Error symbol `remote-file-error' is defined in Emacs 28.1. We use +;; an adapted error message in order to see that compatible symbol. +(unless (get 'remote-file-error 'error-conditions) + (define-error 'remote-file-error "Remote file error (compat)" 'file-error)) + (add-hook 'tramp-unload-hook (lambda () (unload-feature 'tramp-loaddefs 'force) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 34be4fcba93..e9814cdadb9 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2944,7 +2944,8 @@ implementation will be used." (mapconcat #'tramp-shell-quote-argument uenv " ")) "") - (if heredoc (format "<<'%s'" tramp-end-of-heredoc) "") + (if heredoc + (format "<<'%s'" tramp-end-of-heredoc) "") (if tmpstderr (format "2>'%s'" tmpstderr) "") (mapconcat #'tramp-shell-quote-argument env " ") (if heredoc @@ -4914,7 +4915,8 @@ Goes through the list `tramp-inline-compress-commands'." (defun tramp-timeout-session (vec) "Close the connection VEC after a session timeout. If there is just some editing, retry it after 5 seconds." - (if (and tramp-locked tramp-locker + (if (and (tramp-get-connection-property + (tramp-get-connection-process vec) "locked" nil) (tramp-file-name-equal-p vec (car tramp-current-connection))) (progn (tramp-message @@ -4958,10 +4960,9 @@ connection if a previous connection has died for some reason." (when (and (time-less-p 60 (time-since (tramp-get-connection-property p "last-cmd-time" 0))) - (process-live-p p)) - (tramp-send-command vec "echo are you awake" t t) - (unless (and (process-live-p p) - (tramp-wait-for-output p 10)) + (process-live-p p) + (tramp-get-connection-property p "connected" nil)) + (unless (tramp-send-command-and-check vec "echo are you awake") ;; The error will be caught locally. (tramp-error vec 'file-error "Awake did fail"))) (file-error diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 6750a7ff4c6..70bf1eee26b 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2349,33 +2349,6 @@ Must be handled by the callers." res (cdr elt)))) res))) -;; In Emacs, there is some concurrency due to timers. If a timer -;; interrupts Tramp and wishes to use the same connection buffer as -;; the "main" Emacs, then garbage might occur in the connection -;; buffer. Therefore, we need to make sure that a timer does not use -;; the same connection buffer as the "main" Emacs. We implement a -;; cheap global lock, instead of locking each connection buffer -;; separately. The global lock is based on two variables, -;; `tramp-locked' and `tramp-locker'. `tramp-locked' is set to true -;; (with setq) to indicate a lock. But Tramp also calls itself during -;; processing of a single file operation, so we need to allow -;; recursive calls. That's where the `tramp-locker' variable comes in -;; -- it is let-bound to t during the execution of the current -;; handler. So if `tramp-locked' is t and `tramp-locker' is also t, -;; then we should just proceed because we have been called -;; recursively. But if `tramp-locker' is nil, then we are a timer -;; interrupting the "main" Emacs, and then we signal an error. - -(defvar tramp-locked nil - "If non-nil, then Tramp is currently busy. -Together with `tramp-locker', this implements a locking mechanism -preventing reentrant calls of Tramp.") - -(defvar tramp-locker nil - "If non-nil, then a caller has locked Tramp. -Together with `tramp-locked', this implements a locking mechanism -preventing reentrant calls of Tramp.") - ;; Main function. (defun tramp-file-name-handler (operation &rest args) "Invoke Tramp file name handler for OPERATION and ARGS. @@ -2429,17 +2402,7 @@ Fall back to normal file name handler if no Tramp file name handler exists." (setq result (catch 'non-essential (catch 'suppress - (when (and tramp-locked (not tramp-locker)) - (setq tramp-locked nil) - (tramp-error - v 'file-error - "Forbidden reentrant call of Tramp")) - (let ((tl tramp-locked)) - (setq tramp-locked t) - (unwind-protect - (let ((tramp-locker t)) - (apply foreign operation args)) - (setq tramp-locked tl)))))) + (apply foreign operation args)))) ;; (tramp-message ;; v 4 "Running `%s'...`%s'" (cons operation args) result) (cond @@ -4499,6 +4462,32 @@ performed successfully. Any other value means an error." ;;; Utility functions: +;; In Emacs, there is some concurrency due to timers. If a timer +;; interrupts Tramp and wishes to use the same connection buffer as +;; the "main" Emacs, then garbage might occur in the connection +;; buffer. Therefore, we need to make sure that a timer does not use +;; the same connection buffer as the "main" Emacs. We lock each +;; connection process separately by a connection property. + +(defmacro with-tramp-locked-connection (proc &rest body) + "Lock PROC for other communication, and run BODY. +Mostly useful to protect BODY from being interrupted by timers." + (declare (indent 1) (debug t)) + `(if (tramp-get-connection-property ,proc "locked" nil) + ;; Be kind for older Emacsen. + (if (member 'remote-file-error debug-ignored-errors) + (throw 'non-essential 'non-essential) + (tramp-error + ,proc 'remote-file-error "Forbidden reentrant call of Tramp")) + (unwind-protect + (progn + (tramp-set-connection-property ,proc "locked" t) + ,@body) + (tramp-flush-connection-property ,proc "locked")))) + +(font-lock-add-keywords + 'emacs-lisp-mode '("\\")) + (defun tramp-accept-process-output (proc &optional timeout) "Like `accept-process-output' for Tramp processes. This is needed in order to hide `last-coding-system-used', which is set @@ -4508,15 +4497,17 @@ If the user quits via `C-g', it is propagated up to `tramp-file-name-handler'." (let ((inhibit-read-only t) last-coding-system-used result) - ;; JUST-THIS-ONE is set due to Bug#12145. `with-local-quit' - ;; returns t in order to report success. - (if (with-local-quit - (setq result (accept-process-output proc timeout nil t)) t) - (tramp-message - proc 10 "%s %s %s %s\n%s" - proc timeout (process-status proc) result (buffer-string)) - ;; Propagate quit. - (keyboard-quit)) + ;; This must be protected by the "locked" property. + (with-tramp-locked-connection proc + ;; JUST-THIS-ONE is set due to Bug#12145. `with-local-quit' + ;; returns t in order to report success. + (if (with-local-quit + (setq result (accept-process-output proc timeout nil t)) t) + (tramp-message + proc 10 "%s %s %s %s\n%s" + proc timeout (process-status proc) result (buffer-string)) + ;; Propagate quit. + (keyboard-quit))) result))) (defun tramp-search-regexp (regexp) @@ -4633,19 +4624,21 @@ the remote host use line-endings as defined in the variable (unless (or (string-empty-p string) (string-equal (substring string -1) tramp-rsh-end-of-line)) (setq string (concat string tramp-rsh-end-of-line))) - ;; Send the string. - (with-local-quit - (if (and chunksize (not (zerop chunksize))) - (let ((pos 0) - (end (length string))) - (while (< pos end) - (tramp-message - vec 10 "Sending chunk from %s to %s" - pos (min (+ pos chunksize) end)) - (process-send-string - p (substring string pos (min (+ pos chunksize) end))) - (setq pos (+ pos chunksize)))) - (process-send-string p string)))))) + ;; This must be protected by the "locked" property. + (with-tramp-locked-connection p + ;; Send the string. + (with-local-quit + (if (and chunksize (not (zerop chunksize))) + (let ((pos 0) + (end (length string))) + (while (< pos end) + (tramp-message + vec 10 "Sending chunk from %s to %s" + pos (min (+ pos chunksize) end)) + (process-send-string + p (substring string pos (min (+ pos chunksize) end))) + (setq pos (+ pos chunksize)))) + (process-send-string p string))))))) (defun tramp-process-sentinel (proc event) "Flush file caches and remove shell prompt." 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/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 819a3dfecf5..0a5931d6893 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4817,6 +4817,7 @@ INPUT, if non-nil, is a string sent to the process." ;; this test cannot run properly. :tags '(:expensive-test :unstable) (skip-unless (tramp--test-enabled)) + (skip-unless nil) (skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p))) (skip-unless (not (tramp--test-crypt-p))) ;; Prior Emacs 27, `shell-command-dont-erase-buffer' wasn't working properly. @@ -6236,15 +6237,14 @@ This is needed in timer functions as well as process filters and sentinels." "Check parallel asynchronous requests. Such requests could arrive from timers, process filters and process sentinels. They shall not disturb each other." - ;; The test fails from time to time, w/o a reproducible pattern. So - ;; we mark it as unstable. - :tags '(:expensive-test :unstable) + :tags '(:expensive-test) (skip-unless (tramp--test-enabled)) ;; Prior Emacs 27, `shell-file-name' was hard coded as "/bin/sh" for ;; remote processes in Emacs. That doesn't work for tramp-adb.el. (skip-unless (or (and (tramp--test-adb-p) (tramp--test-emacs27-p)) (tramp--test-sh-p))) (skip-unless (not (tramp--test-crypt-p))) + (skip-unless (not (tramp--test-docker-p))) (with-timeout (tramp--test-asynchronous-requests-timeout (tramp--test-timeout-handler)) @@ -6283,10 +6283,10 @@ process sentinels. They shall not disturb each other." ((getenv "EMACS_HYDRA_CI") 10) (t 1))) ;; We must distinguish due to performance reasons. - ;; (timer-operation - ;; (cond - ;; ((tramp--test-mock-p) #'vc-registered) - ;; (t #'file-attributes))) + (timer-operation + (cond + ((tramp--test-mock-p) #'vc-registered) + (t #'file-attributes))) ;; This is when all timers start. We check inside the ;; timer function, that we don't exceed timeout. (timer-start (current-time)) @@ -6314,10 +6314,15 @@ process sentinels. They shall not disturb each other." (default-directory tmp-name) (file (buffer-name - (nth (random (length buffers)) buffers)))) + (nth (random (length buffers)) buffers))) + ;; A remote operation in a timer could + ;; confuse Tramp heavily. So we ignore this + ;; error here. + (debug-ignored-errors + (cons 'remote-file-error debug-ignored-errors))) (tramp--test-message "Start timer %s %s" file (current-time-string)) - ;; (funcall timer-operation file) + (funcall timer-operation file) (tramp--test-message "Stop timer %s %s" file (current-time-string)) ;; Adjust timer if it takes too much time. @@ -6618,14 +6623,12 @@ If INTERACTIVE is non-nil, the tests are run interactively." ;; * Work on skipped tests. Make a comment, when it is impossible. ;; * Revisit expensive tests, once problems in `tramp-error' are solved. -;; * Fix `tramp-test05-expand-file-name-relative' in `expand-file-name'. ;; * Fix `tramp-test06-directory-file-name' for `ftp'. ;; * Investigate, why `tramp-test11-copy-file' and `tramp-test12-rename-file' ;; do not work properly for `nextcloud'. ;; * Implement `tramp-test31-interrupt-process' for `adb' and for ;; direct async processes. -;; * Fix Bug#16928 in `tramp-test43-asynchronous-requests'. A remote -;; file name operation cannot run in the timer. Remove `:unstable' tag? +;; * Fix `tramp-test44-threads'. (provide 'tramp-tests) -- cgit v1.3 From 3806797583a22ad520e64f7fc35d893840f0d563 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 15 Dec 2020 07:18:03 +0100 Subject: Bind current-minibuffer-command to this-command * src/callint.c (Fcall_interactively): Bind current-minibuffer-command to this-command, as documented (bug#45177). --- src/callint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/callint.c b/src/callint.c index a221705f676..d172af9e30b 100644 --- a/src/callint.c +++ b/src/callint.c @@ -286,7 +286,7 @@ invoke it (via an `interactive' spec that contains, for instance, an /* 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, Vreal_this_command); + specbind (Qcurrent_minibuffer_command, Vthis_command); if (NILP (keys)) keys = this_command_keys, key_count = this_command_key_count; -- cgit v1.3 From 2e7402b760576b54a326fca593c948a73bc3d6d0 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 15 Dec 2020 19:34:16 +0200 Subject: Fix C-n/C-p when a line starts with an image * src/xdisp.c (move_it_to): Handle the case where the second call to move_it_in_display_line_to under MOVE_TO_Y takes us farther from TO_CHARPOS than the first call. This fixes values returned by pos-visible-in-window-p and posn-at-point when the screen line starts with invisible text followed by an image. (Bug#9092) --- src/xdisp.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/xdisp.c b/src/xdisp.c index 699183f3f59..0fd5ec5ec56 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 -- cgit v1.3 From 02c4f65a1ea5d55a569a559bb181c6df5171319b Mon Sep 17 00:00:00 2001 From: Zajcev Evgeny Date: Thu, 17 Dec 2020 11:27:20 +0300 Subject: Make "Invalid modifier in string" ordinary invalid-read-syntax error * src/lread.ec (read1): Raise "Invalid modifier in string" error as `invalid-read-syntax'. This fixes raise of unhandled error in `elisp--local-variables' --- src/lread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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 -- cgit v1.3 From d5941d8396a6bbe67bb06c339af008a5f688c73e Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 17 Dec 2020 11:53:56 -0500 Subject: Fix my two most common causes of all windows/frames redisplay * src/buffer.c (Fkill_all_local_variables): Only redisplay the buffer. * src/window.c (set_window_scroll_bars): Only redisplay the window. --- src/buffer.c | 2 +- src/window.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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/window.c b/src/window.c index 4eab786958f..bcc989b5a79 100644 --- a/src/window.c +++ b/src/window.c @@ -7822,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; } -- cgit v1.3 From 64d97212f42bc0305560a0ae2cc2f16a3a851117 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 19 Dec 2020 13:18:11 +0200 Subject: Fix over-wide doc strings * lisp/vc/ediff-init.el (ediff-before-flag-bol) (ediff-after-flag-eol, ediff-before-flag-mol): * lisp/org/org-ctags.el (org-ctags-open-link-functions): * lisp/mail/feedmail.el (feedmail-sendmail-f-doesnt-sell-me-out): * lisp/language/ethio-util.el (ethio-use-three-dot-question) (ethio-quote-vowel-always, ethio-W-sixth-always): * lisp/gnus/nnvirtual.el (nnvirtual-mapping-table) (nnvirtual-mapping-offsets, nnvirtual-mapping-reads) (nnvirtual-mapping-marks, nnvirtual-info-installed): * lisp/gnus/gnus.el (charset): * lisp/gnus/deuglify.el (gnus-outlook-deuglify-unwrap-stop-chars) (gnus-outlook-deuglify-no-wrap-chars) (gnus-outlook-deuglify-attrib-cut-regexp): Fix doc strings to not exceed 80-column limits. (Bug#44858) --- lisp/gnus/deuglify.el | 10 +++++++--- lisp/gnus/gnus.el | 2 +- lisp/gnus/nnvirtual.el | 15 ++++++++++----- lisp/language/ethio-util.el | 10 +++++++--- lisp/mail/feedmail.el | 2 +- lisp/org/org-ctags.el | 2 +- lisp/vc/ediff-init.el | 6 +++--- src/xterm.c | 9 +++++++-- 8 files changed, 37 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/lisp/gnus/deuglify.el b/lisp/gnus/deuglify.el index 647f643c962..fdc5302a28f 100644 --- a/lisp/gnus/deuglify.el +++ b/lisp/gnus/deuglify.el @@ -250,21 +250,25 @@ :group 'gnus-outlook-deuglify) (defcustom gnus-outlook-deuglify-unwrap-stop-chars nil ;; ".?!" or nil - "Characters that inhibit unwrapping if they are the last one on the cited line above the possible wrapped line." + "Characters that, when at end of cited line, inhibit unwrapping. +When one of these characters is the last one on the cited line +above the possibly wrapped line, it disallows unwrapping." :version "22.1" :type '(radio (const :format "None " nil) (string :value ".?!")) :group 'gnus-outlook-deuglify) (defcustom gnus-outlook-deuglify-no-wrap-chars "`" - "Characters that inhibit unwrapping if they are the first one in the possibly wrapped line." + "Characters that, when at beginning of line, inhibit unwrapping. +When one of these characters is the first one in the possibly +wrapped line, it disallows unwrapping." :version "22.1" :type 'string :group 'gnus-outlook-deuglify) (defcustom gnus-outlook-deuglify-attrib-cut-regexp "\\(On \\|Am \\)?\\(Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\|Sun\\),[^,]+, " - "Regular expression matching the beginning of an attribution line that should be cut off." + "Regexp matching beginning of attribution line that should be cut off." :version "22.1" :type 'regexp :group 'gnus-outlook-deuglify) diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index abe7b1ae76a..8e8af1521fa 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -1545,7 +1545,7 @@ Use with caution.") ("\\(^\\|:\\)soc.culture.vietnamese\\>" vietnamese-viqr) ("\\(^\\|:\\)\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1)) :variable-document - "Alist of regexps (to match group names) and default charsets to be used when reading." + "Alist of regexps (to match group names) and charsets to be used when reading." :variable-group gnus-charset :variable-type '(repeat (list (regexp :tag "Group") (symbol :tag "Charset"))) diff --git a/lisp/gnus/nnvirtual.el b/lisp/gnus/nnvirtual.el index 54c2f7be820..3e9e608a099 100644 --- a/lisp/gnus/nnvirtual.el +++ b/lisp/gnus/nnvirtual.el @@ -61,22 +61,27 @@ component group will show up when you enter the virtual group.") (defvoo nnvirtual-current-group nil) (defvoo nnvirtual-mapping-table nil - "Table of rules on how to map between component group and article number to virtual article number.") + "Table of rules for mapping groups and articles to virtual article numbers. +These rules determine how to map between component group and article number +on the one hand, and virtual article number on the other hand.") (defvoo nnvirtual-mapping-offsets nil - "Table indexed by component group to an offset to be applied to article numbers in that group.") + "Table of mapping offsets to be applied to article numbers in a group. +The table is indexed by component group number of the group.") (defvoo nnvirtual-mapping-len 0 "Number of articles in this virtual group.") (defvoo nnvirtual-mapping-reads nil - "Compressed sequence of read articles on the virtual group as computed from the unread status of individual component groups.") + "Compressed sequence of read articles on the virtual group. +It is computed from the unread status of individual component groups.") (defvoo nnvirtual-mapping-marks nil - "Compressed marks alist for the virtual group as computed from the marks of individual component groups.") + "Compressed marks alist for the virtual group. +It is computed from the marks of individual component groups.") (defvoo nnvirtual-info-installed nil - "T if we have already installed the group info for this group, and shouldn't blast over it again.") + "t if the group info for this group is already installed.") (defvoo nnvirtual-status-string "") diff --git a/lisp/language/ethio-util.el b/lisp/language/ethio-util.el index 55e59ab516f..263ddb235e3 100644 --- a/lisp/language/ethio-util.el +++ b/lisp/language/ethio-util.el @@ -113,17 +113,21 @@ vertically stacked dots. All SERA <--> FIDEL converters refer this variable.") (defvar ethio-use-three-dot-question nil - "Non-nil means associate ASCII question mark with Ethiopic old style question mark (three vertically stacked dots). + "If non-nil, associate ASCII question mark with Ethiopic question mark. +The Ethiopic old style question mark is three vertically stacked dots. If nil, associate ASCII question mark with Ethiopic stylized question mark. All SERA <--> FIDEL converters refer this variable.") (defvar ethio-quote-vowel-always nil - "Non-nil means always put an apostrophe before an isolated vowel (except at word initial) in FIDEL --> SERA conversion. + "Non-nil means always put an apostrophe before an isolated vowel. +This happens in FIDEL --> SERA conversions. Isolated vowels at +word beginning do not get an apostrophe put before them. If nil, put an apostrophe only between a 6th-form consonant and an isolated vowel.") (defvar ethio-W-sixth-always nil - "Non-nil means convert the Wu-form of a 12-form consonant to \"W'\" instead of \"Wu\" in FIDEL --> SERA conversion.") + "Non-nil means convert the Wu-form of a 12-form consonant to \"W'\". +This is instead of \"Wu\" in FIDEL --> SERA conversion.") (defvar ethio-numeric-reduction 0 "Degree of reduction in converting Ethiopic digits into Arabic digits. diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el index 6effe139864..6f8c013ba35 100644 --- a/lisp/mail/feedmail.el +++ b/lisp/mail/feedmail.el @@ -622,7 +622,7 @@ to arrange for the message to get a From: line." (defcustom feedmail-sendmail-f-doesnt-sell-me-out nil - "Says whether the sendmail program issues a warning header if called with \"-f\". + "Whether sendmail should issue a warning header if called with \"-f\". The sendmail program has a useful feature to let you set the envelope FROM address via a command line option, \"-f\". Unfortunately, it also has a widely disliked default behavior of selling you out if you do that by inserting diff --git a/lisp/org/org-ctags.el b/lisp/org/org-ctags.el index 08885d26f66..bb1f2b83647 100644 --- a/lisp/org/org-ctags.el +++ b/lisp/org/org-ctags.el @@ -165,7 +165,7 @@ See the ctags documentation for more information.") '(org-ctags-find-tag org-ctags-ask-rebuild-tags-file-then-find-tag org-ctags-ask-append-topic) - "List of functions to be prepended to ORG-OPEN-LINK-FUNCTIONS when ORG-CTAGS is active." + "List of functions to be prepended to ORG-OPEN-LINK-FUNCTIONS by ORG-CTAGS." :group 'org-ctags :version "24.1" :type 'hook diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el index 04926af16ef..8974692751f 100644 --- a/lisp/vc/ediff-init.el +++ b/lisp/vc/ediff-init.el @@ -554,19 +554,19 @@ See the documentation string of `ediff-focus-on-regexp-matches' for details.") ;; Highlighting (defcustom ediff-before-flag-bol "->>" - "Flag placed before a highlighted block of differences, if block starts at beginning of a line." + "Flag placed before highlighted block of differences at beginning of a line." :type 'string :tag "Region before-flag at beginning of line" :group 'ediff) (defcustom ediff-after-flag-eol "<<-" - "Flag placed after a highlighted block of differences, if block ends at end of a line." + "Flag placed after highlighted block of differences that ends at end of line." :type 'string :tag "Region after-flag at end of line" :group 'ediff) (defcustom ediff-before-flag-mol "->>" - "Flag placed before a highlighted block of differences, if block starts in mid-line." + "Flag placed before highlighted block of differences that starts mid-line." :type 'string :tag "Region before-flag in the middle of line" :group 'ediff) diff --git a/src/xterm.c b/src/xterm.c index 3de0d2e73c0..7f8728e47c4 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -8947,7 +8947,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (!f && (f = any) && configureEvent.xconfigure.window == FRAME_X_WINDOW (f) - && FRAME_VISIBLE_P(f)) + && (FRAME_VISIBLE_P(f) + || !(configureEvent.xconfigure.width <= 1 + && configureEvent.xconfigure.height <= 1))) { block_input (); if (FRAME_X_DOUBLE_BUFFERED_P (f)) @@ -8962,7 +8964,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, f = 0; } #endif - if (f && FRAME_VISIBLE_P(f)) + if (f + && (FRAME_VISIBLE_P(f) + || !(configureEvent.xconfigure.width <= 1 + && configureEvent.xconfigure.height <= 1))) { #ifdef USE_GTK /* For GTK+ don't call x_net_wm_state for the scroll bar -- cgit v1.3 From 2224a64d3110be09ab6e11771e0c835777f61f82 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 19 Dec 2020 15:25:08 +0200 Subject: ; Revert unintended change. --- src/xterm.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/xterm.c b/src/xterm.c index 7f8728e47c4..3de0d2e73c0 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -8947,9 +8947,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, if (!f && (f = any) && configureEvent.xconfigure.window == FRAME_X_WINDOW (f) - && (FRAME_VISIBLE_P(f) - || !(configureEvent.xconfigure.width <= 1 - && configureEvent.xconfigure.height <= 1))) + && FRAME_VISIBLE_P(f)) { block_input (); if (FRAME_X_DOUBLE_BUFFERED_P (f)) @@ -8964,10 +8962,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, f = 0; } #endif - if (f - && (FRAME_VISIBLE_P(f) - || !(configureEvent.xconfigure.width <= 1 - && configureEvent.xconfigure.height <= 1))) + if (f && FRAME_VISIBLE_P(f)) { #ifdef USE_GTK /* For GTK+ don't call x_net_wm_state for the scroll bar -- cgit v1.3 From 7c3d3b83358842857a0af99b89983cfa9a5512a1 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 19 Dec 2020 19:54:46 +0100 Subject: Convert apropos-internal from C to Lisp (Bug#44529) This runs insignificantly faster in C, and is already fast enough on reasonably modern hardware. We might as well lift it to Lisp. This benchmark can be used to verify: (benchmark-run 10 (apropos-command "test")) => (0.12032415399999999 2 0.014772391999999995) ; C => (0.13513192100000002 2 0.017216643000000004) ; Lisp * lisp/subr.el (apropos-internal): New defun, converted from C. * src/keymap.c (Fapropos_internal): Remove defun. (apropos_accum): Remove function. (apropos_predicate, apropos_accumulate): Remove variables. (syms_of_keymap): Remove defsubr for Fapropos_internal, and definitions of the above variables. * test/src/keymap-tests.el (keymap-apropos-internal) (keymap-apropos-internal/predicate): Move tests from here... * test/lisp/subr-tests.el (apropos-apropos-internal) (apropos-apropos-internal/predicate): ...to here. --- lisp/subr.el | 16 ++++++++++++++++ src/keymap.c | 39 --------------------------------------- test/lisp/subr-tests.el | 12 ++++++++++++ test/src/keymap-tests.el | 13 ------------- 4 files changed, 28 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/lisp/subr.el b/lisp/subr.el index 77c19c5bbf3..1b2d778454e 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -5845,6 +5845,22 @@ This is the simplest safe way to acquire and release a mutex." (progn ,@body) (mutex-unlock ,sym))))) + +;;; Apropos. + +(defun apropos-internal (regexp &optional predicate) + "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." + (let (found) + (mapatoms (lambda (symbol) + (when (and (string-match regexp (symbol-name symbol)) + (or (not predicate) + (funcall predicate symbol))) + (push symbol found)))) + (sort found #'string-lessp))) + ;;; Misc. 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/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index e275e4b1c89..25da19574a9 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -597,6 +597,18 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350." (undo-boundary) (undo) (should (equal (buffer-string) "")))) + +;;; Apropos. + +(ert-deftest apropos-apropos-internal () + (should (equal (apropos-internal "^next-line$") '(next-line))) + (should (>= (length (apropos-internal "^help")) 100)) + (should-not (apropos-internal "^test-a-missing-symbol-foo-bar-zot$"))) + +(ert-deftest apropos-apropos-internal/predicate () + (should (equal (apropos-internal "^next-line$" #'commandp) '(next-line))) + (should (>= (length (apropos-internal "^help" #'commandp)) 15)) + (should-not (apropos-internal "^next-line$" #'keymapp))) (provide 'subr-tests) ;;; subr-tests.el ends here diff --git a/test/src/keymap-tests.el b/test/src/keymap-tests.el index 6411cd1f0d4..f58dac87401 100644 --- a/test/src/keymap-tests.el +++ b/test/src/keymap-tests.el @@ -248,19 +248,6 @@ g .. h foo 0 .. 3 foo "))))) - -;;;; apropos-internal - -(ert-deftest keymap-apropos-internal () - (should (equal (apropos-internal "^next-line$") '(next-line))) - (should (>= (length (apropos-internal "^help")) 100)) - (should-not (apropos-internal "^test-a-missing-symbol-foo-bar-zut$"))) - -(ert-deftest keymap-apropos-internal/predicate () - (should (equal (apropos-internal "^next-line$" #'commandp) '(next-line))) - (should (>= (length (apropos-internal "^help" #'commandp)) 15)) - (should-not (apropos-internal "^next-line$" #'keymapp))) - (provide 'keymap-tests) ;;; keymap-tests.el ends here -- cgit v1.3