Andrea Corallo [Tue, 13 Oct 2020 20:48:22 +0000 (22:48 +0200)]
Use form native compilation in `comp-trampoline-compile'
* lisp/emacs-lisp/comp.el (comp-trampoline-sym): Remove function.
(comp-trampoline-filename): As we are introducing an ABI change in
the eln trampoline format change the trampoline filename to
disambiguate.
(comp-trampoline-search): Rename from `comp-search-trampoline'
and return directly the trampoline.
(comp-trampoline-compile): Rework to use native form compilation
in place of un-evaluating a function and return directly the
trampoline.
(comp-subr-trampoline-install): Update for
`comp-trampoline-search' and `comp-trampoline-compile' new
interfaces.
* src/comp.c (Fcomp__install_trampoline): Store the trampoline
itself as value in `comp-installed-trampolines-h'.
(syms_of_comp): Doc update `comp-installed-trampolines-h'.
Andrea Corallo [Mon, 12 Oct 2020 20:34:57 +0000 (22:34 +0200)]
Rework `native-compile' interface so it can return compiled functions
* lisp/emacs-lisp/comp.el (native-compile): Return the compiled
function when the input is a symbol or a form.
* test/src/comp-tests.el (free-fun, tco, fw-prop): Update tests
for new `native-compile' interface.
Andrea Corallo [Mon, 12 Oct 2020 20:11:06 +0000 (22:11 +0200)]
Have `native-elisp-load' return the last registerd function
* lisp/emacs-lisp/comp.el (comp-emit-for-top-level): Synthesize
'top_level_run' so it returns the last value returned by
`comp--register-subr'.
* src/comp.c (load_comp_unit): Return what 'top_level_run'
returns.
(Fnative_elisp_load): Return what 'load_comp_unit' returns.
* src/comp.h (load_comp_unit): Update signature.
Andrea Corallo [Sun, 27 Sep 2020 21:24:24 +0000 (23:24 +0200)]
* Add into phi l-value args basic block names
* lisp/emacs-lisp/comp.el (comp-ssa-rename-insn): Clean-up a
leftover space.
(comp-finalize-phis): Cons the blasic block name providing the
mvar together with the mvar itself while forming the phi.
(comp-fwprop-insn): Destructure correctly the phi.
Andrea Corallo [Sat, 10 Oct 2020 16:18:09 +0000 (18:18 +0200)]
Provide feature nativecomp and make use of it
* lisp/emacs-lisp/comp.el (comp-ensure-native-compiler): Use
`featurep' to identify if the native compiler is available.
* lisp/emacs-lisp/nadvice.el (advice--add-function): Likewise.
* lisp/emacs-lisp/package.el (package--delete-directory): Likewise.
* lisp/loadup.el: Likewise.
* src/comp.c (syms_of_comp): Provide feature nativecomp.
Andrea Corallo [Sat, 10 Oct 2020 08:15:21 +0000 (10:15 +0200)]
* Fix failure when compiling a trampoline with no eln-cache dir (bug#43875)
* lisp/emacs-lisp/comp.el (comp-trampoline-compile): Try to create
the eln-cache dir if this is not existing, if fails to do that
move on to the next one.
Calc: fix arithmetic right shift sign bit detection
Arithmetic right shift didn't compute the bit to shift in correctly.
For example, #x600000000 right-shifted 8 steps (with 32 bit word size)
resulted in #xff000000 rather than 0. (Bug#43764)
Only skip directories in lgrep, not the other grep commands
* lisp/progmodes/grep.el (lgrep): Do the directory ignores here
(bug#23590).
(grep-compute-defaults): ... instead of here, because this would
affect all grep commands, not just lgrep.
Alan Mackenzie [Thu, 8 Oct 2020 16:49:49 +0000 (16:49 +0000)]
CC Mode: Move the handling of keyword auto into type handling for C++.
This should allow auto, const, static, ... to be in any order.
* lisp/progmodes/cc-engine.el (c-forward-type): New return value 'no-id for
when auto precludes the parsing of a type identifier. Adapt processing for
this.
(c-forward-decl-or-cast-1): Use the new facility from c-forward-type.
* lisp/progmodes/cc-langs.el (c-type-modifier-prefix-kwds): Insert the value
of c-no-type-kwds into the value.
(c-no-type-kwds, c-no-type-key): New lang consts/vars, basically "auto".
(c-typeless-decl-kwds, c-modifier-kwds): Remove "auto" from the C++ value.
Stefan Monnier [Thu, 8 Oct 2020 13:49:20 +0000 (09:49 -0400)]
* src/ftcrfont.c (ftcrfont_open): Initialize the `max_width` field
On a 32bit build, Emacs can otherwise crash with a !FIXNUM_OVERFLOW_P
assertion in `Ffont_info` by simply doing `emacs -Q` and then `C-s`.
* src/font.c: Try and detect uninitialized `max_width` fields.
(font_make_object): Set max_width to a silly value.
(Ffont_info): Check the value is not silly any more.
Andrea Corallo [Wed, 7 Oct 2020 21:38:00 +0000 (23:38 +0200)]
* Fix failure when eln-cache is removed (introduced by 4a1bb46260)
* src/comp.c (make_directory_wrapper, make_directory_wrapper_1):
New functions.
(Fcomp_el_to_eln_filename): If base_dir is not
specified and we are searching across `comp-load-path' try to
create a directory if does not exists.
Andrea Corallo [Wed, 7 Oct 2020 18:43:00 +0000 (20:43 +0200)]
* Fix some nits in comp.el
* lisp/emacs-lisp/comp.el (comp-spill-lap-function): Use
`cl-defmethod' where correct in place of `cl-defgeneric'.
(comp-tampoline-compile): Add missing #.
Eli Zaretskii [Wed, 7 Oct 2020 08:35:59 +0000 (11:35 +0300)]
Fix last change in frame.el.
* lisp/frame.el (frame-set-background-mode): Fix last change: yet
another place where FRAME was not taken into account, using the
selected frame instead. (Bug#43837)
Update documentation on this-command-keys to reflect new behavior
* doc/lispref/commands.texi (Command Loop Info):
`this-command-keys' does not include the C-u any more, so remove
that from the description and the example
(bug#22107).
* src/keyboard.c (Fthis_single_command_keys): Don't say that
`this-command-keys' returns the C-u prefix (bug#22111).
Make artist-mode work when display-line-numbers-mode is on
* lisp/textmodes/artist.el (artist--adjust-x): New function.
(artist-mouse-draw-continously, artist-mouse-draw-poly)
(artist-mouse-draw-1point, artist-mouse-draw-2points): Use it to
take `display-line-numbers-mode' widths into account.
Mauro Aranda [Wed, 7 Oct 2020 02:35:52 +0000 (04:35 +0200)]
Make the State button in Custom use extended menus
* lisp/cus-edit.el (custom-actioned-widget): New variable.
Dynamically hold the widget for which to show the menu.
(custom-variable-extended-menu, custom-face-extended-menu)
(custom-group-extended-menu): Keymap menus for the State menu. Use
custom-actioned-widget for the :enable and :selected forms. Make
related items radio buttons. (Bug#4787)
(custom-variable-menu, custom-face-menu, custom-group-menu): Keep for
backward compatibility, but default to nil, so we prefer the keymap
menus instead.
(custom-variable-action, custom-face-action, custom-group-action):
Pass the keymap menu to widget-choose when the simplified menus
are nil.
Juri Linkov [Tue, 6 Oct 2020 20:14:26 +0000 (23:14 +0300)]
Add match-data to isearch state and repeat faces to highlight group matches
* lisp/isearch.el (isearch-match-data): New variable.
(isearch-mode): Set isearch-match-data to nil.
(isearch-update): Call isearch-highlight with isearch-match-data.
(isearch--state): Add isearch-match-data.
(isearch--set-state): Restore isearch-match-data.
(with-isearch-suspended): Preserve isearch-match-data.
(isearch-search): Set isearch-match-data to integers.
(isearch-group-1): Rename from isearch-group-odd and adjust colors.
(isearch-group-2): Rename from isearch-group-even and adjust colors.
(isearch-highlight): Add optional arg 'match-data'.
Rewrite search-highlight-submatches part to recycle faces.
* doc/emacs/search.texi (Search Customizations): Amend the
documentation for isearch-group faces.
* lisp/international/mule-util.el (truncate-string-ellipsis):
Use Unicode hex escapes instead of named escapes here, because \N{...}
is not available during bootstrapping. (Bug#41250)
Harald Jörg [Tue, 6 Oct 2020 01:39:55 +0000 (03:39 +0200)]
cperl-mode: Fix a test to ensure cperl-mode is active
* test/lisp/progmodes/cperl-mode-tests.el
(cperl-mode-test-indent-exp): Make sure that cperl-mode is active
for testing 'cperl-indent-exp', also skip this test under
perl-mode.
* test/lisp/progmodes/cperl-mode-resources/cperl-indent-exp.pl:
Eliminate dependency on unrelated customizable variables (bug#10483).
* doc/lispref/display.texi (Size of Displayed Text): Improve
wording and accuracy of the documentation of
'truncate-string-to-width'. Document the function
'truncate-string-ellipsis'.
* etc/NEWS: Improve the wording of the entry for
'truncate-string-to-width'.
Stefan Monnier [Mon, 5 Oct 2020 02:50:38 +0000 (22:50 -0400)]
* src/xdisp.c (syms_of_xdisp): New var `redisplay_skip_initial_frame`.
This makes it possible to run most of the redisplay code (tho not the
actual drawing since there's nowhere to draw) even when there's no
real frame at hand, as is the case in batch mode.
This makes `xdisp-tests--minibuffer-resizing` work even in batch.
(redisplay_internal): Obey it.
(init_xdisp): Set `echo_area_window` even in noninteractive mode.
* src/dispnew.c (update_frame): Skip the initial frame.
* src/frame.c (make_frame): Use 80x25 as the default initial size.
* test/src/xdisp-tests.el (xdisp-tests--minibuffer-resizing):
Use the new var and fix use of `executing-kbd-macro`.
Juri Linkov [Sun, 4 Oct 2020 19:41:36 +0000 (22:41 +0300)]
Use '…' for ellipsis in truncate-string-to-width by default (bug#41250)
* lisp/international/mule-util.el (truncate-string-ellipsis):
Change the default value to nil.
(truncate-string-ellipsis): New function.
(truncate-string-to-width): Use the value returned from the
function 'truncate-string-ellipsis'.
* lisp/tab-bar.el (tab-bar-tab-name-truncated):
* lisp/tab-line.el (tab-line-tab-name-ellipsis):
Take advantage of the improvement of the ellipsis default value
in truncate-string-to-width and truncate-string-ellipsis.
* doc/lispref/display.texi (Size of Displayed Text):
Improve description of truncate-string-ellipsis.
Andrea Corallo [Sun, 4 Oct 2020 07:16:24 +0000 (09:16 +0200)]
Make filename hashing compatible with self contained builds (bug#43532)
* Makefile.in (lispdirrel): Add replace template.
(epaths-force): Form correctly 'PATH_REL_LOADSEARCH' into epath.h
* configure.ac (lispdirrel): Define variable (relative path of the
lisp files from the installation directory).
* src/comp.c (Fcomp_el_to_eln_filename): Update algorithm not to
rely on 'PATH_DUMPLOADSEARCH' but on 'PATH_REL_LOADSEARCH'.
* src/epaths.in (PATH_REL_LOADSEARCH): Add macro template.
Eli Zaretskii [Sat, 3 Oct 2020 17:49:18 +0000 (20:49 +0300)]
Avoid segfaults in lookup_image when faces were freed
* src/image.c (lookup_image): Make sure the frame's face cache
exists and has at least the basic faces. If FACE_ID is not a
basic face, and is no longer cached, fall back on the 'default'
face. (Bug#43700)
* etc/NEWS: Document the feature (bug#4787).
* lisp/wid-edit.el (widget--simplify-menu): New function, to convert
extended menus into simplified menus when using the menu to prompt
through the minibuffer.
(widget-choose): Accept a keymap menu. When not using x-popup-menu,
simplify the menu with widget--simplify-menu. Document the changes in
the docstring.
Alan Mackenzie [Fri, 2 Oct 2020 21:21:06 +0000 (21:21 +0000)]
Enhance syntax-tests.el to test comments in parse-partial-sexp
This now tests the interface between parse-partial-sexp and the low level
comment function in syntax.c
* test/src/syntax-tests.el (syntax-comments-midpoint): New function.
(syntax-pps-comments): New macro.
(top level): Two new syntax-br-comments tests and five new syntax-pps-comments
tests.
* test/data/syntax-comments.txt (top level): Amend some test fragments and add
some more.
Calc: fix formatting and parsing Unix time (bug#43759)
The number of days from epoch to Jan 1, 1970 that was used in parsing
and formatting Unix time was incorrect. The previous fix
(in e368697ce36) was incomplete.
Reported by Vincent Belaïche.
* lisp/calc/calc-forms.el (math-unix-epoch): New constant.
(math-format-date-part, math-parse-standard-date, calcFunc-unixtime):
Use math-unix-epoch instead of a constant that is sometimes wrong.
* test/lisp/calc/calc-tests.el (calc-unix-date): New test.
Alan Mackenzie [Fri, 2 Oct 2020 17:25:02 +0000 (17:25 +0000)]
Enhance syntax-tests.el to test comments in scan-lists
This now tests the interface between scan_lists and the comment functions.
* test/src/syntax-tests.el (syntax-br-comments): New macro.
({-in, ;-in, /*-in): Set parse-sexp-ignore-comments to t.
(top level): Add 15 tests for comments inside brace lists.
* test/data/syntax-comments.txt (top level): Amend some test fragments.