Andrea Corallo [Wed, 3 Jun 2020 21:06:26 +0000 (22:06 +0100)]
* Introduce `comp-loop-insn-in-block'
* lisp/emacs-lisp/comp.el (comp-loop-insn-in-block): New macro.
(comp-call-optim-func, comp-dead-assignments-func)
(comp-remove-type-hints-func): Use `comp-loop-insn-in-block'.
Nicolás Bértolo [Mon, 1 Jun 2020 22:53:00 +0000 (19:53 -0300)]
Fix DLL imports of gccjit version functions.
* src/comp.c (init_gccjit_functions): Use LOAD_DLL_FN_OPT macro to
load gcc_jit_version_major, gcc_jit_version_major and
gcc_jit_version_patchlevel.
* src/w32common.h (LOAD_DLL_FN_OPT): Add macro optionally load a
function from a DLL.
Nicolás Bértolo [Sun, 31 May 2020 21:09:12 +0000 (18:09 -0300)]
* Throw an ICE when asked to emit a cast with sign extension.
* src/comp.c (cast_kind_of_type): Enum that specifies the kind of type
in the cast enum (unsigned, signed, pointer).
(emit_coerce): Throw an ICE when asked to emit a cast with sign
extension.
(define_cast_from_to): Return NULL for casts involving sign extension.
(define_cast_functions): Specify the kind of each type in the cast
union.
Andrea Corallo [Sun, 31 May 2020 19:28:31 +0000 (20:28 +0100)]
* Optimize 'emit_static_object' for load-time
* src/comp.c (emit_static_object): Use a chunck size of 200 bytes
on bugged GCCs and a longer one (1024) in sane ones. Rename
str in buff to disambiguate and prefer xmalloc to a VLA given
the buffer is not that small.
Nicolás Bértolo [Wed, 20 May 2020 03:34:32 +0000 (00:34 -0300)]
* Cut down compile-time emitting static data as string literals
This change drastically reduce compile time. Apparently GCC optimizer
does not scale up well at all for long sequences of assignments into a
single array.
Nicolás Bértolo <nicolasbertolo@gmail.com>
Andrea Corallo <akrl@sdf.org>
* src/comp.c (gcc_jit_context_new_string_literal)
(gcc_jit_block_add_assignment_op): New imports.
(comp_t): New 'size_t_type' 'memcpy' fields.
(emit_static_object): Define static objects using string literals
and memcpy.
(define_memcpy): New function.
(Fcomp__init_ctxt): Define 'size_t_type' and 'memcpy'.
Eli Zaretskii [Sun, 31 May 2020 14:34:09 +0000 (17:34 +0300)]
Protect bidi cache from inadvertent resets
* src/xdisp.c (Fline_pixel_height, Fmove_point_visually): Save and
restore the bidi cache, to avoid inadvertently resetting it by
starting a new iteration through buffer text. This could cause
trouble if these functions are called during a redisplay cycle,
especially while we were processing RTL text.
Tino Calancha [Sun, 31 May 2020 10:31:27 +0000 (12:31 +0200)]
occur: Add bindings for next-error-no-select
Make the navigation in the occur buffer closer
to the navigation in the compilation buffer.
Add bindings to navigate the occur matches (Bug#39121).
Honor `next-error-highlight' and `next-error-highlight-no-select'
when navigating the occurrences.
* lisp/replace.el (occur-highlight-regexp, occur-highlight-overlay):
New variables.
(occur-1): Set `occur-highlight-regexp' to the searched regexp.
(occur-goto-locus-delete-o, occur--highlight-occurrence): New defuns.
(occur-mode-display-occurrence, occur-mode-goto-occurrence):
Use `occur--highlight-occurrence'.
(occur-mode-map): Bind n to `next-error-no-select'
and p to `previous-error-no-select'
* etc/NEWS (Changes in Specialized Modes and Packages in Emacs 28.1):
Announce this change.
Nicolás Bértolo [Sat, 30 May 2020 00:08:37 +0000 (21:08 -0300)]
Fix loading of libgccjit.dll while dumping in Windows.
loadup.el calls `native-comp-available-p', that calls
load_gccjit_if_necessary() in Windows. That function tries to load
libgccjit using the mappings defined in `dynamic-library-alist'. That
mapping is filled by term/w32-win.el, but that file may be loaded too
late.
* src/emacs.c (syms_of_emacs): Add libgccjit to the
`dynamic-library-alist' used when starting to dump so
`native-comp-available-p' always works in Windows.
Nicolás Bértolo [Sat, 30 May 2020 00:03:00 +0000 (21:03 -0300)]
Do not call `gensym' too early when loading a dump file.
This happened when subr.eln was not the first native compilation unit
to be loaded. register_native_comp_unit() is called when loading a
native compilation unit and that in turn used to call `gensym', which
was not loaded yet. This led to a SIGSEGV.
* src/comp.c (register_native_comp_unit): Replace the call to `gensym'
with an ad-hoc counter.
Dmitry Gutov [Sat, 30 May 2020 16:57:06 +0000 (19:57 +0300)]
Don't return transient projects with MAYBE-PROMPT=nil
* lisp/progmodes/project.el (project-current): Only return
transient projects when called with non-nil MAYBE-PROMPT.
Also only update the known projects lists in this case.
(https://lists.gnu.org/archive/html/emacs-devel/2020-05/msg03375.html).
immerrr [Sun, 17 May 2020 11:47:23 +0000 (13:47 +0200)]
Minor fix in 'find-alternate-file'
This fixes the use case when, for example, 'find-file-hooks'
fails.
* lisp/files.el (find-alternate-file): If buffer 'oname' exists,
kill it before renaming the new one. (Bug#41359)
Eli Zaretskii [Sat, 30 May 2020 10:56:20 +0000 (13:56 +0300)]
Remove private prototype for 'execve' and its uses in MinGW build
* src/sysdep.c (emacs_exec_file): Don't compile this function
anymore on WINDOWSNT, since it is not used there. This function
was the only reason for having 'execve' prototype in ms-w32.h.
* nt/inc/ms-w32.h (execve): Remove prototype and the MinGW64 vs
ming.org mess that it causes.
Andrea Corallo [Sat, 30 May 2020 10:13:38 +0000 (11:13 +0100)]
* Avoid calling Ffile_exists_p too early
Being quite early in startup initialization is better not to rely on
Ffile_exists_p, this call Ffile_expand and not all the necessary
initialization already happened.
* src/pdumper.c (dump_do_dump_relocation): Use fopen instead of
Ffile_exists_p.
Eli Zaretskii [Fri, 29 May 2020 20:02:10 +0000 (23:02 +0300)]
Another fix of display of line-prefix with fringe bitmaps
* src/xdisp.c (redisplay_internal): Don't use "optimization 1"
if a glyph row from which to start display begins with a display
property that draws into the fringes. (Bug#41584)
Eli Zaretskii [Fri, 29 May 2020 14:00:52 +0000 (17:00 +0300)]
Fix display of line-prefix with fringe bitmaps
* src/xdisp.c (try_window_id): Don't use this optimization if a
glyph row from which to start display begins with a display
property that draws into the fringes. (Bug#41584)
akater [Fri, 29 May 2020 04:26:09 +0000 (00:26 -0400)]
* lisp/emacs-lisp/lisp-mode.el: Add new indentation convention
(calculate-lisp-indent): To distinguish code and data when indenting,
introduce the convention that a space between an open paren and
a symbol indicate that this should be indented as a simple data list.
James Thomas [Mon, 27 Apr 2020 02:36:48 +0000 (08:06 +0530)]
Improve Malayalam language transliteration
The existing ITRANS scheme did not support some characters and
language quirks like 'chillu's. The Inscript method had errors.
* lisp/language/ind-util.el (indian-mlm-base-table): Add archaic
chars, Mozhi combos; cleanup.
(indian-mlm-mozhi-table): New scheme Mozhi.
* lisp/leim/quail/indian.el (inscript-mlm-keytable): Correct
errors. Add Inscript chillus & zero-width chars, Mozhi scheme.
* etc/NEWS: Mention the changes.
Document that {en,de}code-coding-string preserve match data
* lisp/international/mule.el (define-coding-system):
Require :pre-write-conversion and :post-read-conversion functions
to leave the match data untouched.
* src/coding.c (Fdecode_coding_string, Fencode_coding_string):
Document functions as match-data-preserving.
Glenn Morris [Thu, 28 May 2020 14:50:26 +0000 (07:50 -0700)]
Merge from origin/emacs-27
bd7b681dc4 (origin/emacs-27) Tiny texinfo markup fixes d0dd0e0612 ; Fix more @var/@code mixups in Elisp manual 313dc0439e ; Fix another format-spec typo in the Elisp manual 9d7fd78421 Make next-error behavior a bit more flexible 0691d25295 * etc/NEWS.25: Belatedly announce upcase-dwim and downcase... df91c94ca8 Fix access to single-byte characters in buffer text
Dmitry Gutov [Wed, 27 May 2020 19:15:41 +0000 (22:15 +0300)]
Make next-error behavior a bit more flexible
* lisp/simple.el (next-error-no-navigation-try-current):
Extract from the case #2 in next-error-find-buffer (bug#40919).
(next-error-find-buffer-function): Use it as the default.
Paul Eggert [Wed, 27 May 2020 16:50:07 +0000 (09:50 -0700)]
Fix crash with invalid bytecode vectors
* src/lread.c (read_vector): If the vector is to short to be for
bytecodes don’t do bytecode processing for it, as the processing
might run past the end of the vector.
Paul Eggert [Wed, 27 May 2020 16:45:49 +0000 (09:45 -0700)]
--with-wide-int is a no-op on 64-bit hosts
* configure.ac: Clarify wording for --with-wide-int help.
* src/pdumper.c (dump_vectorlike_generic):
Do the eassert even if --with-wide-int was specified unnecessarily.
Simen Heggestøyl [Wed, 27 May 2020 15:17:15 +0000 (17:17 +0200)]
Simplify the previous commit
* lisp/progmodes/project.el (project--read-project-list): Simplify the
previous commit by utilizing the optional OMIT-NULLS argument to
'split-string'.
Don't clobber match data in utf-8-hfs conversion (bug#41445)
Reported by Ture Pålsson.
* lisp/international/ucs-normalize.el
(ucs-normalize-hfs-nfd-post-read-conversion)
(ucs-normalize-hfs-nfd-pre-write-conversion):
Use save-match-data to avoid match data clobber in normalisation.
* test/lisp/international/ucs-normalize-tests.el
(ucs-normalize-save-match-data): New test.
Paul Eggert [Tue, 26 May 2020 22:47:59 +0000 (15:47 -0700)]
Tweak GC performance if !USE_LSB_TAG
Performance issue reported by Eli Zaretskii (Bug#41321#149).
* src/alloc.c (GC_OBJECT_ALIGNMENT_MINIMUM): New constant.
(maybe_lisp_pointer): Use it instead of GCALIGNMENT.
Simen Heggestøyl [Mon, 25 May 2020 19:10:03 +0000 (21:10 +0200)]
Adapt project functions to the new 'project-root'
* lisp/progmodes/project.el (project-dired, project-eshell)
(project--read-project-list, project--write-project-list)
(project--add-to-project-list-front)
(project--remove-from-project-list): Adapt to the new 'project-root'.
Simen Heggestøyl [Mon, 18 May 2020 16:17:10 +0000 (18:17 +0200)]
Update the Emacs manual with recent project.el changes
* doc/emacs/maintaining.texi (Projects): Add a menu.
(Project File Commands): New subsection describing project file
commands (moved here from 'Working with Projects'). Describe the new
commands 'project-dired' and 'project-eshell'.
(Switching Projects): New subsection.
Simen Heggestøyl [Sun, 17 May 2020 11:54:32 +0000 (13:54 +0200)]
Rename 'project-switch-menu' to 'project-switch-commands'
* lisp/progmodes/project.el (project-switch-commands): Rename from
'project-switch-menu'.
(project--keymap-prompt, project-switch-project): Update after the
renaming.
Simen Heggestøyl [Sat, 16 May 2020 07:53:43 +0000 (09:53 +0200)]
Turn project switch menu var into a public alist
* lisp/progmodes/project.el: Require seq.
(project--switch-alist): Remove in favor of the public
'project-switch-menu'.
(project-add-switch-command): Remove; not needed now that
'project-switch-menu' is a public alist.
(project-switch-menu): New variable mapping keys to project switching
menu entries.
(project--keymap-prompt, project-switch-project): Adjust to the new
'project-switch-menu' format.
Dmitry Gutov [Tue, 12 May 2020 01:20:26 +0000 (04:20 +0300)]
Integrate project-switch-project with project-find-regexp
* lisp/progmodes/project.el:
(project-find-regexp): Add to the list of 'switch' commands.
(project-switch-project): Use call-interactively so that the
former can read its arguments.
Dmitry Gutov [Tue, 12 May 2020 00:22:30 +0000 (03:22 +0300)]
Simplify a little, and avoid duplicate commands
* lisp/progmodes/project.el:
(project--transient-p) Remove, not needed.
(project-current): Move project-find based on the directory here.
(project--remove-from-project-list): Only write if the list changed.
(project-find-project): Rename to project-prompt-project-dir.
Simply return the directory selected by the user.
(project-switch-project-find-file): Remove.
(project-switch-project-dired): Rename to project-dired and make
it follow the convention of existing projec tcommands.
(project-switch-project-eshell): Ditto.
(project-switch-project): Instead of passing the project instance
to the command, just bind default-directory.
Paul Eggert [Tue, 26 May 2020 07:47:24 +0000 (00:47 -0700)]
Port struct Lisp_FLoat to oddball platforms
* src/lisp.h (struct Lisp_Float): Declare via
GCALIGNED_UNION_MEMBER, not via GCALIGNED_STRUCT, since alloc.c
creates these in arrays and GCALIGNED_STRUCT does not necessarily
suffice to align struct Lisp_Float when it’s used in an array.
This avoids undefined behavior on oddball machines where
sizeof (struct Lisp_Float) is not a multiple of 8 and the compiler
does not support __attribute__ ((aligned 8)).
Paul Eggert [Tue, 26 May 2020 06:24:47 +0000 (23:24 -0700)]
Move union emacs_align_type to alloc.c
* src/alloc.c (union emacs_align_type): Move to here ...
* src/lisp.h: ... from here, and uncomment out some of the
types that alloc.c can see but lisp.h cannot.
Paul Eggert [Tue, 26 May 2020 06:06:07 +0000 (23:06 -0700)]
Further fix for aborts due to GC losing pseudovectors
* src/alloc.c (MALLOC_ALIGNMENT_BOUND): Remove.
(LISP_ALIGNMENT): Go back to yesterday’s version, except use
union emacs_align_type instead of max_align_t.
(MALLOC_IS_LISP_ALIGNED): Go back to yesterday’s version.
(maybe_lisp_pointer): Check against GCALIGNMENT, not LISP_ALIGNMENT.
* src/lisp.h (union emacs_align_type): Bring back.
Paul Eggert [Tue, 26 May 2020 05:06:25 +0000 (22:06 -0700)]
Refix aborts due to GC losing pseudovectors
This is simpler, and fixes a bug in the previous fix.
* src/alloc.c (MALLOC_ALIGNMENT_BOUND): Simplify by
using max_align_t, since the buggy implementations won’t
break this simpler implementation.
(LISP_ALIGNMENT): Simplify by just using GCALIGNMENT, since the
fancier implementation wasn’t correct anyway, and fixing it
isn’t worth the trouble on practical platforms.
* src/lisp.h (union emacs_align_type): Remove.
Paul Eggert [Tue, 26 May 2020 03:26:14 +0000 (20:26 -0700)]
Fix aborts due to GC losing pseudovectors
Problem reported by Eli Zaretskii (Bug#41321).
* src/alloc.c (MALLOC_ALIGNMENT_BOUND): New constant.
(LISP_ALIGNMENT): Lower it to avoid crashes on MinGW and similarly
buggy platforms where malloc returns pointers not aligned to
alignof (max_align_t). But keep it higher on platforms where this
is known to work, as it helps GC performance.
(MALLOC_IS_LISP_ALIGNED): Define in terms of the other two.
* src/alloc.c (stacktop_sentry):
* src/thread.c (run_thread):
Don’t overalign or oversize stack sentries; they need to be
aligned only for pointers and Lisp_Object, not for arbitrary
pseudovector contents.
* src/lisp.h (union emacs_align_type): New type, used for
LISP_ALIGNMENT.
Andrea Corallo [Mon, 25 May 2020 19:27:46 +0000 (20:27 +0100)]
* Split type hint pass from dead code removal pass into dedicated one.
Given SSA prop overwrite mvar type slot we clean-up the compiler type
hints as last.
* lisp/emacs-lisp/comp.el (comp-passes): Add comp-remove-type-hints.
(comp-remove-type-hints-func): Code move.
(comp-dead-code): Do not call `comp-remove-type-hints-func'.
(comp-remove-type-hints): Add as new pass.
Allow inhibiting 'auto-save-visited-mode' on a per-buffer basis.
At least for me, 'auto-save-visited-mode' is very slow and blocks user
interaction for files visited over TRAMP. Therefore, I'd like a
mechanism to disable it for some buffers (namely, those visiting
remote files).
* (auto-save-visited-mode): Document that 'auto-save-visited-mode' can
be set to nil buffer-locally.
Eli Zaretskii [Mon, 25 May 2020 14:07:22 +0000 (17:07 +0300)]
Fix access to single-byte characters in buffer text
* src/xdisp.c (get_visually_first_element)
(Fbidi_find_overridden_directionality):
* src/cmds.c (Fend_of_line): Use FETCH_BYTE instead of FETCH_CHAR,
and byte position instead of character position, to access
individual bytes of buffer text. This avoids producing invalid
characters and accessing wrong buffer positions. (Bug#41520)
Noam Postavsky [Mon, 25 May 2020 00:17:40 +0000 (20:17 -0400)]
Make dedicated keymap and mode for eshell-command (Bug#41370)
Otherwise, we end up permanently modifying eshell-mode-map when
running eshell-command.
* lisp/eshell/eshell.el (eshell-command-mode): New mode, with map to
contain the bindings previously set by eshell-return-exits-minibuffer.
(eshell-return-exits-minibuffer): Make into obsolete alias for
eshell-command-mode.
(eshell-command): Use eshell-command-mode instead of
eshell-return-exits-minibuffer.
* doc/lispref/text.texi (Interpolated Strings): Fix typos. Don't
document modifier for default space padding as it's redundant and
inconsistent with the docstring and implementation of format-spec.
Andrea Corallo [Sun, 24 May 2020 20:50:19 +0000 (21:50 +0100)]
Fix non Windows builds
* src/emacs.c (Fkill_emacs): Given
'finish_delayed_disposal_of_comp_units',
'dispose_all_remaining_comp_units' and
'clean_package_user_dir_of_old_comp_units' are defined only with
windows native-comp builds ifdef them.
* src/comp.h (dispose_comp_unit): Fix missing parameter in
declaration.
Nicolás Bértolo [Tue, 19 May 2020 18:57:31 +0000 (15:57 -0300)]
Improve handling of native compilation units still in use in Windows
When closing emacs will inspect all directories from which it loaded
native compilation units. If it finds a ".eln.old" file it will try to
delete it, if it fails that means that another Emacs instance is using it.
When compiling a file we rename the file that was in the output path
in case it has been loaded into another Emacs instance.
When deleting a package we move any ".eln" or ".eln.old" files in the
package folder that we can't delete to `package-user-dir`. Emacs will
check that directory when closing and delete them.
* lisp/emacs-lisp/comp.el (comp--replace-output-file): Function called
from C code to finish the compilation process. It performs renaming of
the old file if necessary.
* lisp/emacs-lisp/package.el (package--delete-directory): Function to
delete a package directory. It moves native compilation units that it
can't delete to `package-user-dir'.
* src/alloc.c (cleanup_vector): Call dispose_comp_unit().
(garbage_collect): Call finish_delayed_disposal_of_comp_units().
* src/comp.c: Restore the signal mask using unwind-protect. Store
loaded native compilation units in a hash table for disposal on
close. Store filenames of native compilation units GC'd in a linked
list to finish their disposal when the GC is over.
(clean_comp_unit_directory): Delete all *.eln.old files in a
directory.
(clean_package_user_dir_of_old_comp_units): Delete all *.eln.old files
in `package-user-dir'.
(dispose_all_remaining_comp_units): Dispose of native compilation
units that are still loaded.
(dispose_comp_unit): Close handle and cleanup directory or arrange for
later cleanup if DELAY is true.
(finish_delayed_disposal_of_comp_units): Dispose of native compilation
units that were GC'd.
(register_native_comp_unit): Register native compilation unit for
disposal when Emacs closes.
* src/comp.h: Introduce cfile member in Lisp_Native_Comp_Unit.
Add declarations of functions that: clean directories of unused native
compilation units, handle disposal of native compilation units.
* src/emacs.c (kill-emacs): Dispose all remaining compilation units
right right before calling exit().
* src/eval.c (internal_condition_case_3, internal_condition_case_4):
Add functions.
* src/lisp.h (internal_condition_case_3, internal_condition_case_4):
Add functions.
* src/pdumper.c (dump_do_dump_relocation): Set cfile to a copy of the
Lisp string specifying the file path.
Stefan Kangas [Sun, 24 May 2020 16:48:16 +0000 (18:48 +0200)]
Mark browse-url-conkeror as obsolete
* lisp/net/browse-url.el:
(browse-url--browser-defcustom-type)
(browse-url-conkeror-new-window-is-buffer)
(browse-url-conkeror-program, browse-url-conkeror-arguments)
(browse-url-default-browser, browse-url-conkeror): Mark the
conkeror browser as obsolete.
Carl Lei [Sun, 24 May 2020 11:52:24 +0000 (11:52 +0000)]
Add three C++20 coroutine keywords, co_await, co_yield, and co_return
* lisp/progmodes/cc-langs.el (c-operators): Add co_await and co_yield to the
C++ value of "Exception" keywords.
(c-return-kwds): Create a C++ value containing co_return.
(c-simple-stmt-kwds): Add co_return to the C++ value.
Paul Eggert [Sat, 23 May 2020 19:55:13 +0000 (12:55 -0700)]
Port etags FALLTHROUGH to C2X
Problem reported by Ashish SHUKLA in:
https://lists.gnu.org/r/emacs-devel/2020-05/msg03013.html
* lib-src/etags.c (C_entries): Move label so that FALLTHROUGH
precedes a case label, as draft C2X specifies.
Paul Eggert [Sat, 23 May 2020 17:38:53 +0000 (10:38 -0700)]
Restore check for Emacs 20.2 bytecodes
* src/eval.c (Ffetch_bytecode): Check for multibyte bytecodes
here too. Problem reported by Stefan Monnier in:
https://lists.gnu.org/r/emacs-devel/2020-05/msg02876.html
Glenn Morris [Sat, 23 May 2020 14:50:30 +0000 (07:50 -0700)]
Merge from origin/emacs-27
d6a0b66a0c (origin/emacs-27) * lisp/subr.el (save-match-data): Clarif... 1a6d59eeba Improve the documentation of setting up fontsets c7737d40f2 ; * etc/TODO (Ligatures): Update the entry based on recent... fb2e34cd21 ; * etc/TODO (Ligatures): Update the entry based on recent... 13b6dfd4f7 * doc/emacs/killing.texi (Rectangles): Improve indexing. a10254dd46 Fix accessing files on networked drives on MS-Windows