* doc/emacs/killing.texi (Clipboard): Refer to it.
* doc/lispref/frames.texi (Yanking Media): Document the mechanism.
* lisp/yank-media.el: New file.
* lisp/gnus/message.el (message-mode): Register a yank handler for
images.
(message-insert-screenshot): Factor out image code from here...
(message--yank-media-image-handler): ... to here.
Stefan Kangas [Fri, 5 Nov 2021 03:22:12 +0000 (04:22 +0100)]
New user option image-auto-resize-max-scale-percent
* lisp/image-mode.el (image-auto-resize-max-scale-percent): New
user option to limit how much 'fit-window' will scale up an image.
(image--scale-within-limits-p): New function.
(image-toggle-display-image): Respect above new user option.
Stefan Kangas [Fri, 5 Nov 2021 02:24:50 +0000 (03:24 +0100)]
New command image-transform-fit-to-window
* lisp/image-mode.el (image-auto-resize, image-transform-resize):
Add new value 'fit-window', meaning to scale the image up or down
to fit the window. (Bug#)
(image-transform-fit-to-window): New command.
(image-transform-fit-to-height, image-transform-fit-to-width):
Make obsolete in favor of above new command.
(image-mode-map): Bind "s w" to 'image-transform-fit-to-window'.
Move binding for obsolete command 'image-transform-fit-to-width'
to "s i".
(image-mode-map): Add menu entry for
'image-transform-fit-to-window'. Remove menu entries for above
obsolete commands.
* doc/emacs/files.texi (Image Mode): Update documentation.
(image-transform-fit-both): Doc fix.
* lisp/outline.el (outline-flag-region): Update buttons on most
outline toggling commands (bug#51629).
(outline--fix-up-all-buttons): Take a region as parameter.
(outline-cycle-buffer): Adjust call.
F. Jason Park [Fri, 11 Jun 2021 10:55:07 +0000 (03:55 -0700)]
Deprecate instead of redefine erc-server-reconnecting
* lisp/erc/erc-backend.el (erc-server-reconnecting,
erc--server-reconnecting): obsolete and replace the former with new
internal variant, which carries a simplified meaning.
(erc-server-reconnect-p, erc--server-reconnect-p): Obsolete and
replace the former with an internal function, and change behavior to
disregard `erc-server-reconnecting' when rendering verdict.
(erc-process-sentinel-2): ensure local var `erc--server-reconnecting'
is t when timers are scheduled or firing, and nil otherwise, including
after retries exhausted. This agrees with the straightforward way
`erc-server-reconnecting' has always been used by `erc-cmd-RECONNECT'.
(erc-server-connect): set `erc--server-reconnecting'.
* lisp/erc/erc.el (erc-cmd-RECONNECT): use `erc--server-reconnecting'
instead of `erc-server-reconnecting'.
Eli Zaretskii [Sat, 6 Nov 2021 17:14:55 +0000 (19:14 +0200)]
Improve latin-2-postfix and latin-2prefix input methods
* lisp/leim/quail/latin-pre.el ("latin-2-prefix"):
* lisp/leim/quail/latin-post.el ("latin-2-postfix"): Add variants
of "`s" and "s," for Romanian. Add key bindings for moving
between variants, when there are more than one. (Bug#51638)
Michael Albinus [Sat, 6 Nov 2021 16:27:16 +0000 (17:27 +0100)]
Merge from origin/emacs-28
5e9b4e70ab Fix dbus-test04-register-method on CentOS (Bug#51369) d96de23510 * lisp/transient.el: Update to package version v0.3.7-11-g... 7343b0d0e4 ; * etc/NEWS: Native compilation is more picky about missi... 0d6b2b0b9d ; * etc/PROBLEMS: Move entry about LLVM plugin to the righ...
Po Lu [Sat, 23 Oct 2021 11:51:31 +0000 (19:51 +0800)]
General improvements to NS port
* src/dispextern.h: Remove some !HAVE_NS conditionals around grab
related code.
* src/frame.c (gui_mouse_grabbed, gui_redo_mouse_highlight): Remove
!HAVE_NS conditionals around code.
* src/nsmenu.m (ns_update_menubar): Prevent recursive calls and enable
shallow updates on GNUstep.
(menuNeedsUpdate): Prevent recursive calls.
(ns_menu_show): Fix mysterious GC-related bug.
(update_frame_tool_bar_1): Work around mysterious toolbar sizing bug
on GNUstep.
* src/nsterm.h (struct ns_output): New field for tracking toolbar
visibility changes.
* src/nsterm.m (frame_set_mouse_pixel_position): Implement for
GNUstep.
(ns_redraw_scroll_bars): Enable for GNUstep.
(ns_clear_frame): Redraw scrollbars on GNUstep.
(ns_update_window_end): New function.
(ns_redisplay_interface): Add ns_update_window_end on GNUstep.
(- keyDown): Remove debug code that doesn't work on GNUstep.
(- mouseDown): Enable grab tracking on NS port.
(- resizeWithOldSuperviewSize): Fix build with NSTRACE.
* src/xdisp.c (note_tab_bar_highlight): Enable some code for NS port.
(struct ns_glyph_layout, enum lgstring_direction).
(enum gs_font_slant, enum gs_font_weight, enum gs_font_width)
(enum gs_specified, struct gs_font_data): New enumerators and
structures.
(ns_font_descs_match_p)
(ns_done_font_data, ns_get_font_data): New functions.
(ns_glyph_metrics): Stop escaping names.
(ns_spec_to_descriptor): Fix font descriptor creation for symbolic
font spec entires.
(ns_descriptor_to_entity): Create entries with the correct symbolic
styles.
(ns_fallback_entity): Fix fallback entity selection.
(ns_findfonts): Use our own font matcher instead of the broken GNUstep
matcher.
(ns_list_family): Remove obsolete comment.
(nsfont_open): Remove obsolete code, comments, and synthItal logic
which doesn't work on GNUstep.
(nsfont_encode_char): Use a type that can fit NSGlyph
(nsfont_draw): Chose correct font, remove obsolete mouse face logic,
obsolete comments, and switch to using glyph-based drawing instead of
character-based drawing.
(ns_font_shape, nsfont_shape): New functions.
(ns_uni_to_glyphs_1): New function.
(ns_uni_to_glyphs): Return glyphs instead of unicode codepoints.
(ns_glyph_metrics): Use NSGlyphs instead of unicode codepoints and fix
left bearing, right bearing, ascent and descent computation.
(struct nsfont_driver): Add shaping capability.
* src/nsterm.h (struct nsfont_info): Use unsigned int for glyph cache.
* src/nsterm.c (ns_focus): Set DPS clipping on GNUstep.
(ns_compute_glyph_string_overhangs): Fix overhang computation by using
xterm code.
(ns_draw_window_cursor): Simplify cursor drawing.
(ns_maybe_dumpglyphs_background): Test for cursor HL and remove
obsolete mouse face logic.
(ns_dumpglyphs_image)
(ns_dumpglyphs_box_or_relief): Rectify for new cursor logic.
(ns_dumpglyphs_stretch): Rectify for new cursor logic and rely on
ns_draw_glyph_string to set focus.
(ns_draw_glyph_string_foreground): Remove mouse face logic.
(ns_draw_glyph_strings): Implement overhangs, remove obsolete
comment, and always focus before dumping glyphs.
(ns_draw_text_decoration): Add condition for DRAW_CURSOR and simplify
color selection.
(ns_define_frame_cursor): Remove nonsensical code (define_frame_cursor
has nothing to do with the text cursor, aka caret).
* src/xdisp.c (draw_glyphs): Enable code for NS port to fix mouse face
cursor display.
* src/macfont.m (get_cgcolor_from_nscolor): New function.
(macfont_draw): Remove obsolete mouse-face code and enable cursor
display.
Eli Zaretskii [Sat, 6 Nov 2021 10:33:26 +0000 (12:33 +0200)]
Improve detection of suspicious reordering in source code
* src/bidi.c (bidi_find_first_overridden): Detect suspiciously
reordered EN types as well.
* test/src/xdisp-tests.el
(xdisp-tests--find-directional-overrides-case-1): Rename from
'xdisp-tests--find-directional-overrides'.
(xdisp-tests--find-directional-overrides-case-2): New test.
Eli Zaretskii [Sat, 6 Nov 2021 09:21:43 +0000 (11:21 +0200)]
Merge from origin/emacs-28
9bdb1d0 ; * etc/PROBLEMS: Describe a crash in xwidgets due to Bubblew... 550887c ; * etc/PROBLEMS: Rearrange and update the section about cras... c2e3cd6 Clarify "text area of a window" in the documentation 4e7e78d Improve docstring of kmacro-set-format
Eli Zaretskii [Sat, 6 Nov 2021 09:21:08 +0000 (11:21 +0200)]
; Merge from origin/emacs-28
The following commits were skipped:
b1885ac ; * etc/NEWS: slightly more careful wording 6ee929c Use current face foreground for SVG icons in customize 82529b9 ; * etc/NEWS: Improve wording of a recently changed entry. e9c7a49 ; * etc/NEWS: Improve NEWS entry for Image-Dired. 2de7be4 ; * etc/NEWS: Various fixes.
Eli Zaretskii [Sat, 6 Nov 2021 06:59:09 +0000 (08:59 +0200)]
Clarify "text area of a window" in the documentation
* src/keyboard.c (Fposn_at_x_y): Clarify that the Y coordinate
includes the header-line and the tab-line. (Bug#51590)
* doc/lispref/windows.texi (Window Sizes, Splitting Windows)
(Textual Scrolling, Coordinates and Windows): Fix/remove improper
or confusing uses of "text area" of a window.
Stefan Kangas [Sat, 6 Nov 2021 04:37:08 +0000 (05:37 +0100)]
Improve docstring of kmacro-set-format
* lisp/kmacro.el (kmacro-set-format): Improve docstring.
(kmacro-insert-counter, kmacro-display-counter)
(kmacro-set-counter, kmacro-add-counter): Add cross-references
to the info manual.
* doc/lispref/display.texi (Showing Images): Mention it.
* lisp/image.el (insert-image): Take an optional parameter to
inhibit isearch of the STRING argument.
* doc/lispref/text.texi (Special Properties): Mention it.
* lisp/image.el (insert-image): Make `C-s' skip over the image data.
* lisp/isearch.el (isearch--search-skip-inhibited): New function.
(isearch-search-string): Use it.
(isearch--invisible-p): New function.
(isearch-range-invisible): Use it.
F. Jason Park [Sat, 6 Nov 2021 02:15:24 +0000 (03:15 +0100)]
Normalize usage of variable erc-server-reconnecting
* lisp/erc/erc-backend.el (erc-server-reconnecting-p):
Don't consider erc-server-reconnecting when rendering verdict.
(erc-process-sentinel-2): ensure local variable
erc-server-reconnecting is t when timers are scheduled or running and
trying to reconnect, and nil otherwise, including after no retries
remain. Previously, its use and meaning in erc-backend were convoluted
and conflicted with its use in erc-cmd-RECONNECT (bug#50007).
F. Jason Park [Sat, 6 Nov 2021 02:09:43 +0000 (03:09 +0100)]
Don't send empty lines for implicit targets in ERC
* erc.el (erc-send-input-line): Previously, any line typed into a
query or channel buffer without an explicit user-command
handler (meaning most lines), would be sent twice because a trailing
newline (linefeed) would be appended. This has been verified by
checking IRCd server logs. IRCds won't return an error upon receiving
an empty message, but they also won't forward them to channel
subscribers and DM pals.
* erc-tests.el: Add test for erc-process-input-line, which also
indirectly tests erc-send-input-line. It also tests the command
lookup and dispatch facility (bug#50008).
Jim Porter [Sat, 6 Nov 2021 00:21:35 +0000 (01:21 +0100)]
Improve behavior of 'electric-pair-mode' in 'cc-mode'
* lisp/progmodes/cc-mode.el (c-electric-pair-inhibit-predicate):
Inhibit insertion of paired quote in fewer cases.
* test/lisp/electric-tests.el (define-electric-pair-test):
Add 'c-mode' to list of modes to test by default (bug#50538).
This ensures that quotes are paired correctly within comments, allows for
insertion of quote pairs immediately before another quote, and allows
inserting quote pairs within a string (thus splitting the string in two).
Stefan Kangas [Fri, 5 Nov 2021 21:31:17 +0000 (22:31 +0100)]
Don't hardcode "Commentary" section in checkdoc
* lisp/emacs-lisp/checkdoc.el
(checkdoc-commentary-header-string): New defvar.
(checkdoc-file-comments-engine): Insert value of above new
variable instead of hardcoding what is inserted for the
"Commentary" section.
Paul Eggert [Fri, 5 Nov 2021 18:51:46 +0000 (11:51 -0700)]
rsvg_handle_get_dimensions is deprecated in 2.52.0
In Bug#44655#32 (2020-11-19) it was reported that
rsvg_handle_get_dimensions was not deprecated. However, it became
deprecated in librsvg 2.52.0 (2021-09-15), and because of this Emacs
builds with --enable-gcc-warnings fail in Fedora 35 (2025-11-02)
with the diagnostic “‘rsvg_handle_get_dimensions’ is deprecated:
Use 'rsvg_handle_get_intrinsic_size_in_pixels' instead
[-Werror=deprecated-declarations]”.
* src/image.c (rsvg_handle_get_dimensions): Define as a DLL
function only if < librsvg 2.46.0, since it’s not used
in 2.46.0 or later.
(svg_load_image): Use rsvg_handle_get_dimensions only if librsvg <
2.46.0, since it isn’t needed if >= 2.46.0.
* lisp/emacs-lisp/pp.el (pp-max-width, pp-use-max-width): New user
options (bug#11934).
(pp-to-string): Use it.
(pp--insert-lisp): Tweak whether to use standard-output or not.
(pp--max-width): New function.
Eli Zaretskii [Fri, 5 Nov 2021 13:47:00 +0000 (15:47 +0200)]
; Fix doc strings of a recent commit
* lisp/image-dired.el (image-dired-gallery-image-root-url)
(image-dired-gallery-thumb-image-root-url)
(image-dired-gallery-dir): Don't use "path" for file names and
URLs.
Eli Zaretskii [Fri, 5 Nov 2021 13:40:37 +0000 (15:40 +0200)]
Enhance 'highlight-confusing-reorderings'
* lisp/international/mule-cmds.el (confusingly-reordered): Make
sure the face looks distinct on displays that don't support the
"wavy" underline attribute.
(highlight-confusing-reorderings): Add a tooltip explaining why
the text was highlighted. Allow to remove the highlighting by
invoking the command with a prefix argument.
Carlos Pita [Thu, 14 Oct 2021 00:09:40 +0000 (21:09 -0300)]
Match dummy output even with non-default rl config
* lisp/progmodes/python.el
(python-shell-completion-native-get-completions): Match dummy output
even when readline is configured in non-default ways. (Bug#51010)
Fix 'diff-font-lock-prettify' breaking display of outline headers
* lisp/vc/diff-mode.el (diff-outline-level): Make hunk headers be
at level 2.
(diff-mode): Use prettified line as outline header.
(diff--outline-level): New function (bug#51016).
* lisp/vc/vc.el (vc-diff-internal): Fix diff mode being set before
content inserted (bug#51016).
Daniel Martín [Sat, 9 Oct 2021 19:10:20 +0000 (21:10 +0200)]
Fix buffer overflow in ns_compute_glyph_string_overhangs
* src/nsterm.m (ns_compute_glyph_string_overhangs): When the first
glyph of a glyph string is a composite glyph, `s->nchars' is 0, so
"s->char2b + s->nchars - 1" dereferenced a position before buffer
`s->char2b'. Instead, rewrite part of the function to distinguish
between character glyphs and composite glyphs. For character glyphs,
calculate the font metrics using the `text_extents' function, passing
it the entire glyph string; for composite glyphs, call
`composition_gstring_width'. (Bug#51105)
Stefan Kangas [Fri, 5 Nov 2021 00:06:38 +0000 (01:06 +0100)]
image-dired: Delete commented out code
* lisp/image-dired.el: Delete broken and commented out speedbar code;
it is not clear what, if anything, it is supposed to do. If anyone
wants to work on this, they are better off starting from scratch.
Stefan Kangas [Thu, 4 Nov 2021 23:47:00 +0000 (00:47 +0100)]
image-dired: New defgroup and section for gallery support
* lisp/image-dired.el: Add new section header "Gallery support" to
improve file organization. Move relevant TODO:s there.
(image-dired-gallery): New defgroup.
(image-dired-gallery-dir, image-dired-gallery-image-root-url)
(image-dired-gallery-thumb-image-root-url)
(image-dired-gallery-hidden-tags): Add options to above new defgroup.
(image-dired-add-to-file-comment-list)
(image-dired-create-gallery-lists)
(image-dired-add-to-tag-file-lists, image-dired-hidden-p): Rename to...
(image-dired--add-to-file-comment-list)
(image-dired--create-gallery-lists)
(image-dired--add-to-tag-file-lists, image-dired--hidden-p):
...this, to make it more clear that these functions are internal.
Make the old names obsolete function aliases.
(image-dired-add-to-tag-file-list): Make unused function obsolete.
New emacsclient option to either create or reuse an existing frame.
* doc/emacs/misc.texi (emacsclient Options): Document the new option.
* doc/man/emacsclient.1: Mention the new option (bug#51374).
* etc/NEWS: Mention the new option.
* lib-src/emacsclient.c (reuse_frame): New variable.
(longopts): New option.
(decode_options): Decode the new option.
(print_help_and_exit): Document the new option.
(main): Use the new option.
Eli Zaretskii [Thu, 4 Nov 2021 18:33:26 +0000 (20:33 +0200)]
Better detection of potentially malicious bidi text
* src/bidi.c (bidi_find_first_overridden): Extend to detect more
subtle effects of directional formatting controls, to include
embeddings and isolates.
* src/xdisp.c (Fbidi_find_overridden_directionality): Accept an
additional argument BASE-DIR to specify the base direction of the
paragraphs.
* lisp/international/mule-cmds.el (confusingly-reordered): New
face.
(reorder-starters, reorder-enders): New variables.
(highlight-confusing-reorderings): New command to detect and
highlight suspiciously reordered text.
* test/src/xdisp-tests.el
(xdisp-tests--find-directional-overrides): New test.
* etc/NEWS: Announce the new and improved features.
* etc/tutorials/TUTORIAL.he: Fix embeddings with incorrect
directions.