Paul Eggert [Fri, 3 Dec 2021 17:47:22 +0000 (09:47 -0800)]
Improve overflow checking in svg_load_image
* src/image.c: Include math.h, for lrint.
(scale_image_size, compute_image_size): Use ‘double’, not ‘int’
for image size args, since librsvg uses ‘double’ for pixel counts.
(scale_image_size): Use ceil instead of rounding, to avoid
discarding fractional SVG pixels. Divisor and multiplier are now
double instead of int, for better portability to librsvg
functions with fractional pixel sizes.
(image_get_dimension, compute_image_size, svg_load_image):
Be more careful about ignoring, rejecting or clipping scale
factors or sizes that are out of integer range.
(compute_image_size): Don’t bother to calculate :max-width if
:width is specified, and likewise for :max-height and :height.
Paul Eggert [Fri, 3 Dec 2021 17:47:22 +0000 (09:47 -0800)]
More-robust svg_load_image fallback
Suggested by Alan Third (Bug#44655#56).
* src/image.c (svg_load_image): Fall back on
rsvg_handle_get_geometry_for_layer if the
rsvg_handle_get_intrinsic_dimensions computations yielded unusable
viewbox width and height, instead of falling back only if
rsvg_handle_get_intrinsic_dimensions did not report image width
and height, or did not report a viewbox.
Katsumi Yamaoka [Fri, 3 Dec 2021 16:28:48 +0000 (17:28 +0100)]
Fix regression introduced by the previous date-to-time change
* lisp/calendar/time-date.el (date-to-time): The function needs to
test if `parse-time-string' returns a valid data as the old
version did it with the help of `encode-time' (bug#52209).
Stefan Kangas [Fri, 3 Dec 2021 15:55:27 +0000 (16:55 +0100)]
emacs-lisp-mode: Use error face for "/d" indicator
* lisp/progmodes/elisp-mode.el (emacs-lisp-mode): Use 'error' face for
the dynamic scoping ("/d") indicator in the mode line to make it stand
out more.
Stefan Kangas [Fri, 3 Dec 2021 15:42:24 +0000 (16:42 +0100)]
Don't support obsolete sregex syntax in re-builder
* lisp/emacs-lisp/re-builder.el (reb-lisp-mode)
(reb-lisp-syntax-p, reb-change-syntax, reb-cook-regexp): Remove final
remaining references to the long obsolete sregex syntax.
Stefan Kangas [Fri, 3 Dec 2021 14:13:32 +0000 (15:13 +0100)]
image-mode: Advertize viewing as text less eagerly
* lisp/image-mode.el (image-text-based-formats): New defcustom.
(image-mode--setup-mode): Don't show message to show image as text
unless it is a text based image format. Don't mention key binding
for editing as hex. (Bug#51961)
(image-mode-as-text): Don't mention key binding for editing as hex.
(image-mode-as-hex): Minor cleanup.
Michael Albinus [Fri, 3 Dec 2021 13:24:43 +0000 (14:24 +0100)]
Adapt directory summary line handling in Tramp
* lisp/net/tramp-sh.el (tramp-sh-handle-insert-directory):
* lisp/net/tramp-smb.el (tramp-smb-handle-insert-directory):
Do not add or modify summary line when `dired-free-space' is bound.
Po Lu [Fri, 3 Dec 2021 05:55:39 +0000 (13:55 +0800)]
Improve velocity calculation in momentum scrolling
* lisp/pixel-scroll.el
(pixel-scroll-precision-momentum-factor): Remove option.
(pixel-scroll-precision-initial-velocity-factor)
(pixel-scroll-precision-momentum-min-velocity): New user
options.
(pixel-scroll-accumulate-velocity): Clear velocity ring
if sign is different.
(pixel-scroll-calculate-velocity): Use current time.
(pixel-scroll-start-momentum): Use better algorithm.
Stefan Kangas [Fri, 3 Dec 2021 05:30:26 +0000 (06:30 +0100)]
Merge from origin/emacs-28
9c222b9c1a Port to C compilers that lack size-0 arrays fed35a8951 Port emacsclient to Solaris 10 f35d6a9c73 * CONTRIBUTE: Improve commit message instructions e0ee1d003a Work around IBM XL C compiler bug 6b99b6eb8b * admin/make-tarball.txt: Various clarifications. bbf4140091 * admin/diff-tar-files: Don't assume .tar.gz. 0a50ad11db * lisp/tab-bar.el (tab-bar-close-other-tabs): Fix regression.
Paul Eggert [Fri, 3 Dec 2021 03:01:33 +0000 (19:01 -0800)]
Port to C compilers that lack size-0 arrays
The C standard does not allow size-zero arrays, so redo struct
Lisp_Subr to not use size-zero arrays when native compilation is
not being used. Formerly, the code was using size-zero arrays (a
GNU C extension) to avoid using memory unnecessarily when
HAVE_NATIVE_COMP is not defined. Replace this hack with the
more-traditional hack of putting the relevant members inside
‘#ifdef HAVE_NATIVE_COMP’.
* src/alloc.c (cleanup_vector, mark_object):
* src/comp.c (make_subr):
* src/data.c (Fsubr_native_lambda_list, Fsubr_native_comp_unit):
* src/eval.c (init_eval_once, funcall_lambda):
* src/lisp.h (SUBR_NATIVE_COMPILEDP, SUBR_NATIVE_COMPILED_DYNP)
(SUBR_TYPE):
* src/lread.c (Fload):
Conditionally compile with ‘#ifdef HAVE_NATIVE_COMP’ instead of
with ‘if (NATIVE_COMP_FLAG)’. Redo members like native_comp_u[0]
to be plain native_comp_u. Put all uses of these members inside
‘#ifdef HAVE_NATIVE_COMP’.
* src/lisp.h (struct Lisp_Subr): Members native_comp_u,
native_c_name, lambda_list, type are now all ifdeffed out if
HAVE_NATIVE_COMP is not defined, instead of being size-zero
arrays. All uses changed.
* src/pdumper.c (dump_subr, dump_cold_native_subr)
(dump_do_dump_relocation):
* src/comp.h (NATIVE_COMP_FLAG): Remove; no longer needed.
Paul Eggert [Fri, 3 Dec 2021 02:43:43 +0000 (18:43 -0800)]
Port emacsclient to Solaris 10
Without this patch, the build fails on Solaris 10 with the diagnostic
“Undefined symbol acl_trivial first referenced in file
../lib/libgnu.a(file-has-acl.o)”.
* lib-src/Makefile.in (LIB_HAS_ACL): New macro.
(emacsclient${EXEEXT}): Link with $(LIB_HAS_ACL).
Paul Eggert [Fri, 3 Dec 2021 02:18:39 +0000 (18:18 -0800)]
Work around IBM XL C compiler bug
* src/fileio.c (Fcopy_file): Work around a compiler bug in IBM XL
C for AIX, V12.1 (5765-J02, 5725-C72). Without this patch, the
compiler incorrectly complains “Initialization between types "int"
and "struct timespec" is not allowed” and “Initialization between
types "long" and "struct timespec" is not allowed”.
Po Lu [Fri, 3 Dec 2021 02:12:29 +0000 (10:12 +0800)]
Make momentum scrolling much nicer
* lisp/pixel-scroll.el (pixel-scroll-precision-momentum-tick):
Set default value to 0.01.
(pixel-scroll-precision-momentum-seconds): New user option.
(pixel-scroll-start-momentum): Improvements to momentum
algorithm.
* test/lisp/tab-bar-tests.el: New file.
(tab-bar-tests-close-other-tabs-with-arg): Test for regression
that closed the selected tab after selecting it.
Eli Zaretskii [Thu, 2 Dec 2021 17:44:46 +0000 (19:44 +0200)]
Support display of non-ASCII characters with aligned columns
* src/xdisp.c (get_normal_width): New function.
(gui_produce_glyphs): Use 'get_normal_width' to widen on display
characters whose width is not an integral multiple of the
"standard" width.
(syms_of_xdisp) <align-columns-display>: New boolean variable.
Stefan Kangas [Thu, 2 Dec 2021 17:17:14 +0000 (18:17 +0100)]
update_autogen: Remove unused -H flag
We now update ChangeLog files only when preparing a new release, so
this flag is never used. Keeping it risks confusing more than it
helps.
* admin/update_autogen: Remove the -H flag as it is no longer used.
* doc/lispref/processes.texi (Asynchronous Processes): Document it.
* lisp/cus-start.el (standard): Customize.
* src/process.c (read_process_output_error_handler)
(exec_sentinel_error_handler): Use it.
(syms_of_process): New variable process-error-pause-time (bug#19457).
Eli Zaretskii [Thu, 2 Dec 2021 10:32:17 +0000 (12:32 +0200)]
Fix recent changes related to 'glyphless-display-mode'
* lisp/textmodes/glyphless-mode.el (glyphless-mode-types): Fix
spelling of "bidirectional".
* lisp/international/characters.el (char-acronym-table): Fix
acronyms for LRI and RLI: use their accepted shorthands.
(glyphless-char-display-control): Fix spelling of doc string.
* doc/lispref/display.texi (Glyphless Chars): Fix spelling and add
a cross-reference.
Gemini is a relatively new text-based web protocol, similar to
gopher. There's the "elpher" package to browse gopher and gemini
pages. Adding it to the regexp will make Emacs be aware of gemini links,
e.g. in ERC.
* lisp/net/browse-url.el (browse-url-button-regexp): Add support
for the gemini: URL type.
* lisp/international/characters.el (char-acronym-table): Add the
ISOLATE characters.
(update-glyphless-char-display): Implement bidi-control, and mark
all Cf characters we don't know about as UNK.
(glyphless--bidi-control-characters): New variable.
(glyphless-char-display-control): Add a new type -- bidi-control.
* lisp/textmodes/glyphless-mode.el (glyphless-mode-types): Add a
new type -- bidi-control.
cedet/semantic/bovine/c.el:1462:25: Warning: value returned from
(string= s "static") is unused
* lisp/cedet/semantic/bovine/c.el (semantic-tag-protection): Merge two
`when` into an `if` and set `prot` instead of throwing away a result.
Use `pcase` while we're at it.
Po Lu [Thu, 2 Dec 2021 03:01:59 +0000 (11:01 +0800)]
Add some primitive momentum-based precision scrolling
The algorithm used to scroll the display kinetically is very
simple and needs improvement. Someone should work on that
eventually.
* lisp/pixel-scroll.el (pixel-scroll-precision-use-momentum):
New user option.
(pixel-scroll-precision-mode-map): Add
`pixel-scroll-start-momentum'.
(pixel-scroll-kinetic-state):
(pixel-scroll-accumulate-velocity):
(pixel-scroll-calculate-velocity): New functions.
(pixel-scroll-start-momentum): New command.
* doc/emacs/dired.texi (Misc Dired Features): Document it (bug#23812).
* lisp/dired.el (dired-free-space): New user option.
(dired-insert-directory): Use it from here.
(dired--insert-disk-space): New function that uses the user option.
* lisp/files.el (insert-directory): Don't transform "total" here.
* lisp/ls-lisp.el (ls-lisp--insert-directory): Or here. Instead
just leave the "total <num>" bit alone, and let Dired transform it.
* test/lisp/files-tests.el (files-tests): Move "available" tests
to dired-tests.
* test/lisp/dired-tests.el (data-dir): Moved here.
Juri Linkov [Wed, 1 Dec 2021 17:41:37 +0000 (19:41 +0200)]
* lisp/repeat.el: Use same logic for repeat-check-key and repeat-exit-timeout.
* lisp/repeat.el (repeat-check-key): Use for repeat-check-key the same logic
as is used for repeat-exit-timeout in repeat-post-hook (bug#51390).
(repeat-post-hook): Check for repeat-exit-timeout symbol property.
Juri Linkov [Wed, 1 Dec 2021 17:36:00 +0000 (19:36 +0200)]
* lisp/help.el (help--analyze-key): Prefer posn-set-point over mouse-set-point
* lisp/help.el (help--analyze-key): Use posn-set-point instead of
mouse-set-point that runs the hook mouse-leave-buffer-hook via
mouse-minibuffer-check. Using posn-set-point also unnecessitates
extra conditions added in bug#51421.
* lisp/isearch.el (isearch-describe-key, isearch-describe-mode):
Add precautions to not call isearch-update when the executed
command exited isearch-mode (bug#51173).
Robert Pluim [Wed, 1 Dec 2021 16:11:07 +0000 (17:11 +0100)]
characters.el: remove repetition in glyphless-char-display-control
* lisp/international/characters.el (glyphless-char-display-method):
New custom widget for the different options for displaying glyphless
characters.
(glyphless-char-display-control): Use 'glyphless-char-display-method'.
Fix closure-conversion of shadowed captured lambda-lifted vars
Lambda-lifted variables (ones passed explicitly to lambda-lifted
functions) that are also captured in an outer closure and shadowed
were renamed incorrectly (bug#51982).
Reported by Paul Pogonyshev.
* lisp/emacs-lisp/cconv.el (cconv--lifted-arg): New.
(cconv-convert): Provide correct definiens for the closed-over
variable.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
* test/lisp/emacs-lisp/cconv-tests.el (cconv-tests--intern-all)
(cconv-closure-convert-remap-var): Add tests.
Alan Mackenzie [Wed, 1 Dec 2021 15:41:09 +0000 (15:41 +0000)]
CC Mode: Recognise "struct foo {" as introducing a type declaration
This fixes bug #52157.
* lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): If such a construct
is parsed, set the flag at-type-decl which is part of the function's return
value.
Use proportional fonts in the Gnus headers by default
* lisp/gnus/gnus-art.el (gnus-header): Inherit from `variable-pitch'.
(gnus--variable-pitch-p): New helper function.
(gnus-article-treat-fold-headers): Fill using pixel filling.