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
Glenn Morris [Sat, 23 May 2020 14:50:29 +0000 (07:50 -0700)]
Merge from origin/emacs-27
4b9fbdb5a7 ; Update TODO item about ligature support 03d44acfdd * doc/lispref/control.texi (Processing of Errors): Improve... b48ab743a8 Minor fixups for mutability doc 6ac2326e5b Don’t use “constant” for values you shouldn’t change
Nicolás Bértolo [Wed, 13 May 2020 19:22:17 +0000 (16:22 -0300)]
* Windows: Use NUMBER_OF_PROCESSORS environment variable.
* lisp/emacs-lisp/comp.el (comp-effective-async-max-jobs): Use
NUMBER_OF_PROCESSORS environment variable if system is Windows NT,
"nproc" if it is in PATH or a default of 1.
Nicolás Bértolo [Fri, 8 May 2020 17:04:06 +0000 (14:04 -0300)]
* Workaround the 32768 chars command line limit in Windows.
* lisp/emacs-lisp/comp.el (comp-run-async-workers): Pass the
compilation commands through a temporary file that is loaded by the
child process. This is also done all other operating systems, even
those that support long command lines. It should not be a problem
since libgccjit uses temporary files too.
Chris McMahan [Tue, 5 May 2020 18:15:01 +0000 (14:15 -0400)]
Let user adjust the column widths of the package menu.
* lisp/emacs-lisp/package.el (package-name-column-width)
(package-version-column-width, package-status-column-width)
(package-archive-column-width): New defcustoms.
(package-menu-mode):
Use the values of defcustoms instead of hardcoded
values. (Bug#41086)
Nicolás Bértolo [Mon, 11 May 2020 23:43:06 +0000 (20:43 -0300)]
Load libgccjit dynamically in Windows.
* configure.ac: don't add linker flags if compiling on
Windows. Compile dynlib.c if modules or native compilation are
enabled. Always compile comp.c
* lisp/term/w32-win.el: Map 'gccjit to "libgccjit.dll" in
`dynamic-library-alist`.
* src/Makefile.in: Update comments. Update to handle changes in
configure.ac.
* src/comp.c: Add declarations of used libgccjit functions using
DEF_DLL_FN. Add calls to load_gccjit_if_necessary() where necessary.
Add `native-comp-available-p`
* src/comp.h: Remove Fnative_elisp_load. Add syms_of_comp().
* src/emacs.c (main): Always call syms_of_comp()
* src/w32.c (globals_of_w32): Clear Vlibrary_cache when starting
because the libraries loaded when dumping will not be loaded when
starting.
* src/w32fns.c: Add Qgccjit symbol.
Dmitry Gutov [Sat, 23 May 2020 01:38:27 +0000 (04:38 +0300)]
project.el: A project has only one main root now
Practice shows that the vast majority of projects only use one main
root. The users of this API very often make this assumption as well.
The rest of the "roots" should be possible to express through
project-external-roots.
* lisp/progmodes/project.el: Update the commentary.
Only 4 non-obsolete generics now.
(project-root): Replacement for `project-roots'.
All callers updated. Implementations too.
(project-roots): Declare obsolete.
(project-external-roots): Simplify the docstring.
(project-ignores): Update the docstring.
(project-find-regexp): Omit the second arg to project-files.
(project--dir-ignores): Simplify.
(project-compile): Simplify, remove outdated comment.
* lisp/net/eww.el (eww): Use function-put in place of put, as
recommended in "(elisp) Symbol Plists".
(eww-follow-link):
* lisp/net/shr.el (shr-browse-url): Rather than call browse-url-mail
directly, call browse-url which respects the user options
browse-url-handlers and browse-url-mailto-function. (Bug#41133)
(shr--current-link-region): Return nil if there is no link at point.
(shr--blink-link): Adapt accordingly.
(shr-fill-line, shr-indent, shr-table-body): Refactor to avoid some
unnecessary allocations.
* etc/NEWS: Announce that eww-follow-link and shr-browse-url support
custom URL handlers.
* etc/NEWS: Announce that json-read-number is now stricter.
* json.el: Bump package version.
(json-encoding-lisp-style-closings, json-pre-element-read-function)
(json-post-element-read-function, json-advance, json-peek)
(json--path): Clarify and improve style of doc strings.
(json-join): Define as an obsolete alias of string-join.
(json-alist-p, json-plist-p): Refactor for speed and declare as
pure, side-effect-free, and error-free.
(json--plist-reverse): Rename function...
(json--plist-nreverse): ...to this, making it destructive for speed.
All callers changed.
(json--plist-to-alist): Remove, replacing single use with map-pairs.
(json--with-indentation): Accept multiple forms as arguments, fix
their indentation, and allow them to be instrumented for debugging.
Add docstring.
(json-pop, json-read-keyword, json-add-to-object)
(json-encode-array): Simplify for speed.
(json-skip-whitespace): Put newline before carriage return for
likely frequency of occurrence, and so that the characters appear in
increasing order.
(json--check-position): Use 1+.
(json-path-to-position): Open code apply-partially.
(json-keywords): Turn into a defconst and mark as obsolete now that
it is no longer used.
(json--post-value, json--number, json--escape): New rx definitions.
(json-encode-keyword): Declare as side-effect-free.
(json-read-number): Reject leading zeros and plus signs, and make
integer part mandatory in accordance with JSON standards and for
consistency with native JSON parsing functions. Eagerly signal
json-number-format when garbage follows a valid number, e.g., when
reading "1.1.1", instead of leaving that up to the caller. Remove
optional internal argument from advertised calling convention now
that the function is no longer recursive.
(json-encode-number): Define as an alias of number-to-string.
(json-special-chars): Turn into a defconst.
(json-read-escaped-char, json-new-object, json-read-file)
(json-pretty-print): Simplify.
(json-read-string): For consistency with other json.el error
reporting, remove check for leading '"', and use the integer value
rather than the printed representation of characters in error data.
At EOB signal json-end-of-file instead of json-string-format.
(json--long-string-threshold, json--string-buffer): New variables.
(json-encode-string): Reimplement in terms of buffer manipulation
for speed (bug#20154).
(json-read-object): Escape ?\} properly.
(json--encode-alist): New function extracted from json-encode-alist.
(json-encode-hash-table, json-encode-alist, json-encode-plist): Use
it to avoid destructively modifying the argument when
json-encoding-object-sort-predicate is non-nil without incurring
unnecessary copying (bug#40693). Encode empty object as "{}" even
when pretty-printing. Simplify for speed.
(json-read-array): Avoid recomputing list length on each iteration
when json-pre-element-read-function is non-nil. Make first element
of json-array-format error data a string for consistency with
json-object-format and to make the displayed error message clearer.
(json-readtable-dispatch): Accept any kind of argument, not just
symbols. Generate the table in a simpler manner so the dispatch
order is clearer. Remove dispatch on ?+ and ?. now that
json-read-number is stricter and for consistency with native JSON
parsing functions. Signal json-end-of-file if argument is nil.
(json-read): Simplify accordingly.
(json-encode): Avoid allocating a list on each invocation.
* lisp/jsonrpc.el (jsonrpc--json-read, jsonrpc--json-encode): Check
whether native JSON functions are fboundp only once, at load time.
* lisp/progmodes/python.el (python--parse-json-array): New function.
(python-shell-prompt-detect): Use it to parse JSON directly as a
list rather than converting from a vector.
(test-json-path-to-position-no-match): Use should-not.
(test-json-read-object): Move error check to new test
test-json-read-object-invalid.
(test-json-pretty-print-object): Adapt test now that empty objects
are pretty-printed as "{}".
Paul Eggert [Mon, 18 May 2020 22:19:49 +0000 (15:19 -0700)]
Redo RCS Id for pdumper
* lisp/version.el: Don’t put an RCS Id style string into the
executable via purecopy, as this does not work with the pdumper.
* src/emacs.c (RCS_Id): New constant, for 'ident'.
Stefan Kangas [Tue, 19 May 2020 22:43:40 +0000 (00:43 +0200)]
Second attempt at improving indexing in control.texi
* doc/lispref/control.texi (Processing of Errors): Improve indexing by
adding the word form "handle" in addition to "handling". With thanks
to Eli Zaretskii.
Ryan C. Thompson [Wed, 20 May 2020 23:21:12 +0000 (02:21 +0300)]
lisp/ido.el: Respect completion-auto-help setting
This commit makes ido completion respect the user's setting for
`completion-auto-help' by default. It does this by defining a wrapper
function `ido-completion-auto-help', which calls `ido-completion-help'
only when `completion-auto-help' is non-nil.
* lisp/ido.el (ido-completion-auto-help): New function.
(ido-cannot-complete-command):
Use it as the new default (bug#41340).
Matthias Meulien [Wed, 20 May 2020 22:37:30 +0000 (01:37 +0300)]
Bookmark locations can refer to VC directory buffers (bug#39722)
* etc/NEWS: Document feature.
* lisp/vc/vc-dir.el (vc-dir-mode): Set local bookmark-make-record-function.
(bookmark-make-record-default, bookmark-prop-get, bookmark-default-handler)
(bookmark-get-bookmark-record): Declarations.
(vc-dir-bookmark-make-record): Make record used to bookmark a `vc-dir' buffer.
(vc-dir-bookmark-jump): Provides bookmark-jump behavior for a `vc-dir' buffer.
Nicolás Bértolo [Fri, 8 May 2020 17:30:14 +0000 (14:30 -0300)]
Handle LISP_WORDS_ARE_POINTERS and CHECK_LISP_OBJECT_TYPE.
* src/comp.c: Introduce the Lisp_X, Lisp_Word, and Lisp_Word_tag
types. These types are used instead of long or long long. Use
emacs_int_type and emacs_uint_types where appropriate.
(emit_coerce): Add special logic that handles the case when
Lisp_Object is a struct. This is necessary for handling the
--enable-check-lisp-object-type configure option.
* src/lisp.h: Since libgccjit does not support opaque unions, change
Lisp_X to be struct. This is done to ensure that the same types are
used in the same binary. It is probably unnecessary since only a
pointer to it is used.
Nicolás Bértolo [Fri, 8 May 2020 19:23:10 +0000 (16:23 -0300)]
* Remove a layer of indirection for access to pure storage.
* src/comp.c: Taking the address of an array is the same as casting it
to a pointer. Therefore, the C expression `(EMACS_INT **) &pure` is in
fact adding a layer of indirection that is not necessary. The fix is
to cast the `pure` array to a pointer and store that in a void pointer
that is part of the compiled shared library.
Nicolás Bértolo [Fri, 8 May 2020 18:56:09 +0000 (15:56 -0300)]
* Handle setjmp() taking two arguments in Windows.
* src/comp.c: Add `define_setjmp_deps()` and `emit_setjmp()` which
abstract over this difference in behavior between operating systems.
WARNING: Not all cases are handled by this patch. The Mingw-64
setjmp.h header deals with many other combinations. I don't think it
is a good idea to replicate the logic of that header inside
emacs. (Maybe a few lines in the configure script could be added to
handle this problem?)
Eric Abrahamsen [Thu, 30 Apr 2020 01:10:35 +0000 (18:10 -0700)]
Prevent gnus-registry-handle-action from creating spurious entries
Thanks to Bob Newell for finding this.
* lisp/gnus/gnus-registry.el (gnus-registry-handle-action): If a
message entry ends up with no groups in its 'group key, that means the
entry should be deleted.
Alan Mackenzie [Wed, 20 May 2020 18:02:13 +0000 (18:02 +0000)]
which-function-mode: put hook function on after-change-major-mode-hook
, rather than find-file-hook. This keeps which-function-mode active should
the major mode be reinitialized. Also accept a null result from
add-log-current-defun as definitive, should that function have run. This
fixes bug #40714.
* lisp/progmodes/which-func.el (which-func-ff-hook): Put on
after-change-major-mode-hook.
(which-function): Enhance the logic to accept a null result from
add-log-current-defun.
Paul Eggert [Wed, 20 May 2020 06:22:40 +0000 (23:22 -0700)]
Hoist some byte-code checking out of eval
Check Lisp_Compiled objects better as they’re created,
so that the byte-code interpreter needn’t do the checks
each time it executes them. This improved performance
of ‘make compile-always’ by 1.5% on my platform. Also,
improve the quality of the (still-incomplete) checks, as
this is more practical now that they’re done less often.
* src/alloc.c (make_byte_code): Remove. All uses removed.
(Fmake_byte_code): Put a better (though still incomplete)
check here instead. Simplify by using Fvector instead
of make_uninit_vector followed by memcpy, and by using
XSETPVECTYPE instead of make_byte_code followed by XSETCOMPILED.
* src/bytecode.c (Fbyte_code): Do sanity check and conditional
translation to unibyte here instead of each time the function is
executed.
(exec_byte_code): Omit no-longer-necessary sanity and
unibyte checking. Use SCHARS instead of SBYTES where
either will do, as SCHARS is faster.
* src/eval.c (fetch_and_exec_byte_code): New function.
(funcall_lambda): Use it.
(funcall_lambda, lambda_arity, Ffetch_bytecode):
Omit no-longer-necessary sanity checks.
(Ffetch_bytecode): Add sanity check if actually fetching.
* src/lisp.h (XSETCOMPILED): Remove. All uses removed.
* src/lread.c (read1): Check byte-code objects more thoroughly,
albeit still incompletely, and do translation to unibyte here
instead of each time the function is executed.
(read1): Use XSETPVECYPE instead of make_byte_code.
(read_vector): Omit no-longer-necessary sanity check.
Tassilo Horn [Sat, 16 May 2020 08:05:12 +0000 (10:05 +0200)]
Allow back-references in syntax-propertize-rules.
* lisp/emacs-lisp/syntax.el (syntax-propertize--shift-groups-and-backrefs):
Renamed from syntax-propertize--shift-groups, and also shift
back-references.
(syntax-propertize-rules): Adapt docstring and use renamed function.
* test/lisp/emacs-lisp/syntax-tests.el: New test.
(syntax-propertize--shift-groups-and-backrefs): New ERT test.
Tassilo Horn [Tue, 19 May 2020 13:17:57 +0000 (15:17 +0200)]
Indicate not downloaded parts in MIME buttons.
Via nnimap-fetch-partial-articles one can tell Gnus to omit fetching
certain parts by default. Now the MIME buttons in the article buffer
indicate how to fetch the complete message in order to act on those
missing parts.
* lisp/gnus/gnus-art.el (gnus-insert-mime-button): Indicate not
downloaded parts in MIME buttons.
Paul Eggert [Tue, 19 May 2020 00:17:46 +0000 (17:17 -0700)]
Reject attempts to clear pure strings
* src/fns.c (Ffillarray, Fclear_string):
Add CHECK_IMPURE here, to be consistent with Faset etc.
(Ffillarray): Prefer memset when the fill is a single byte.
Paul Eggert [Mon, 18 May 2020 22:19:49 +0000 (15:19 -0700)]
Redo RCS Id for pdumper
* lisp/version.el: Don’t put an RCS Id style string into the
executable via purecopy, as this does not work with the pdumper.
* src/emacs.c (RCS_Id): New constant, for 'ident'.
Andrea Corallo [Mon, 18 May 2020 19:51:46 +0000 (20:51 +0100)]
* Pacify with the byte-compiler
* lisp/emacs-lisp/comp.el (comp-num-cpus): New special variable.
(comp-effective-async-max-jobs): Make use of `comp-num-cpus'.
(comp-call-optim-form-call): Remove unnecessary parameter.
(comp-call-optim-func): Reflect `comp-call-optim-form-call'
parameter removal.
Andrea Corallo [Mon, 18 May 2020 18:04:07 +0000 (19:04 +0100)]
* Make the Evil happy (Bug#41374)
* lisp/emacs-lisp/comp.el (comp-never-optimize-functions):
Blacklist all primitives advised by evil-mode from trampoline
optimization.
(comp-call-optim-form-call): Prevent trampoline optimization for
recursive calls at speed 2 to respect elisp original semantic.
Glenn Morris [Mon, 18 May 2020 17:54:14 +0000 (10:54 -0700)]
Restore buffer-undo-list to buffer-local-variables
It has been missing since 2012-07-03 (Emacs 24.3)
"Cleanup basic buffer management", when undo_list was moved to
the end of struct buffer. (Bug#33492)
* src/buffer.c (buffer_local_variables_1): New function.
(Fbuffer_local_variables): Explicitly add buffer-undo-list.
Fix calculator entry of numbers with negative exponents (bug#41347)
* lisp/calculator.el (calculator-string-to-number):
Remove obsolete string transformations preventing entry of 1e-3 etc.
Keep one transformation to allow entry of "1.e3".
Reported by Chris Zheng.
Dmitry Gutov [Mon, 18 May 2020 00:36:43 +0000 (03:36 +0300)]
Add user option project-vc-merge-submodules
* lisp/progmodes/project.el (project-vc): Update the docstring.
(project-vc-merge-submodules): New user option.
(project-try-vc): Use it.
(project--submodule-p): Extract from project-try-vc.
Dmitry Gutov [Sun, 17 May 2020 23:46:06 +0000 (02:46 +0300)]
vc-working-revision: Bind default-directory
* lisp/vc/vc-hooks.el (vc-working-revision):
Bind default-directory to be on the safe side.
Suggested by Ilya Ostapyshyn
(https://lists.gnu.org/archive/html/emacs-devel/2020-05/msg02301.html).
Paul Eggert [Sun, 17 May 2020 23:50:49 +0000 (16:50 -0700)]
Don’t attempt to modify constant strings
These attempts were found by ‘make compile-always’.
* lisp/language/tibet-util.el (tibetan-obsolete-glyphs):
* lisp/org/org-agenda.el (org-agenda-get-restriction-and-command):
Don’t try to modify string constants.
Andrea Corallo [Sun, 17 May 2020 12:23:59 +0000 (13:23 +0100)]
* Fix Garbage Collector for missing calle-saved regs content (Bug#41357)
* src/alloc.c (SET_STACK_TOP_ADDRESS): Do not call
__builtin_unwind_init.
(flush_stack_call_func1): Rename from 'flush_stack_call_func'.
(flush_stack_call_func): New function to spill all registers
before calling 'flush_stack_call_func1'. This to make sure the
top of the stack identified includes those registers.
Stefan Kangas [Sun, 17 May 2020 12:59:10 +0000 (14:59 +0200)]
Fix minor issues with mouse-drag-and-drop-region-show-tooltip
* lisp/mouse.el (mouse-drag-and-drop-region-show-tooltip): Fix
defcustom type to allow all valid values. Suggested by David
Ponce. (Bug#41351)
(mouse-drag-and-drop-region): Fix bug where setting
`drag-and-drop-region-show-tooltip' to 0 would still show a
tooltip.
Andrea Corallo [Sun, 17 May 2020 07:48:26 +0000 (08:48 +0100)]
* Fix bug#41346 assertion triggered while loading dump
* src/comp.c (load_comp_unit): While loading from dump lambda
fixups are still to happen here. Verify relocation coherency only
after 'top_level_run' execution.
Paul Eggert [Sun, 17 May 2020 00:17:00 +0000 (17:17 -0700)]
Don’t use “constant” for values you shouldn’t change
Inspired by patch proposed by Dmitry Gutov (Bug#40671#393)
and by further comments by him and by Michael Heerdegen
in the same bug report.
* doc/lispintro/emacs-lisp-intro.texi (setcar):
Don’t push mutability here.
* doc/lispref/eval.texi (Self-Evaluating Forms, Quoting)
(Backquote):
* doc/lispref/lists.texi (Modifying Lists):
* doc/lispref/objects.texi (Lisp Data Types, Mutability):
* doc/lispref/sequences.texi (Array Functions, Vectors):
* doc/lispref/strings.texi (String Basics, Modifying Strings):
Don’t use the word “constant” to describe all values that
a program should not change.
* doc/lispref/objects.texi (Mutability):
Rename from “Constants and Mutability”. All uses changed.
In a footnote, contrast the Emacs behavior with that of Common
Lisp, Python, etc. for clarity, and say the goal is to be nicer.
Paul Eggert [Sun, 17 May 2020 00:04:15 +0000 (17:04 -0700)]
Don’t attempt to modify constant conses
From a patch privately suggested by Mattias Engdegård on 2020-05-11
in a followup to Bug#40671.
* admin/charsets/cp51932.awk:
* admin/charsets/eucjp-ms.awk:
Generate code that does not modify constant conses.
* doc/misc/emacs-mime.texi (Encoding Customization):
* lisp/emacs-lisp/byte-opt.el (byte-compile-side-effect-free-ops):
* lisp/frameset.el (frameset-persistent-filter-alist):
* lisp/gnus/gnus-sum.el (gnus-article-mode-line-format-alist):
Use append instead of nconc.
* lisp/language/japanese.el (japanese-ucs-cp932-to-jis-map)
(jisx0213-to-unicode):
Use mapcar instead of mapc.
* lisp/language/lao-util.el (lao-transcription-consonant-alist)
(lao-transcription-vowel-alist):
* lisp/language/tibetan.el (tibetan-subjoined-transcription-alist):
Use copy-sequence.
* test/src/fns-tests.el (fns-tests-nreverse):
(fns-tests-sort, fns-tests-collate-sort)
(fns-tests-string-version-lessp, fns-tests-mapcan):
Use copy-sequence, vector, and list.
Glenn Morris [Sat, 16 May 2020 17:29:14 +0000 (10:29 -0700)]
Merge from origin/emacs-27
b4937f64cd (origin/emacs-27) Improve documentation of manually instal... efd4e973a4 Reflect the emacs-devel ELPA/MELPA dispute in FAQ 28541674cd Consider face inheritance when checking region face backgr... e75f6be6cc Fix dired default file operation (bug#41261) 406fb0746c Fix documentation related to 'command-switch-alist'. 747e0a2523 Improve ediff readability in misterioso theme (Bug#41221) 48830c73e7 Fix a crash in handle_display_spec a37290a6f9 In x_hide_tip reset tip_last_frame for GTK+ tooltips only ... 3d81995692 Fix docstring of flymake-make-diagnostic (bug#40351) 632aa9d57a Go back to “Bahá’í” e2406ff60f * lisp/dired.el (dired-toggle-marks): Doc fix. (Bug#41097)
Stefan Kangas [Sat, 16 May 2020 13:34:47 +0000 (15:34 +0200)]
Remove Emacs 22 compat code from ediff-vers.el
* lisp/vc/ediff-vers.el (ediff-vc-revision-other-window)
(ediff-vc-working-revision): Redefine Emacs 22 compatibility
aliases as obsolete function aliases.
(ediff-vc-internal, ediff-vc-merge-internal): Don't use the now
obsolete aliases.
Stefan Kangas [Sat, 16 May 2020 13:22:54 +0000 (15:22 +0200)]
Remove some XEmacs compat code from semantic
* lisp/cedet/semantic/wisent/comp.el (wisent-ISVALID-TOKEN)
(wisent-parse-nonterminals):
* lisp/cedet/semantic/wisent/wisent.el
(wisent-item-to-string): Remove XEmacs compatibility code.
(wisent-char-p): Redefine as obsolete function alias for
'characterp'.
Eli Zaretskii [Sat, 16 May 2020 08:54:37 +0000 (11:54 +0300)]
Improve documentation of manually installing Lisp packages
* doc/emacs/building.texi (Lisp Libraries): Describe how to
manually load packages in the init file. Mention the 'site-lisp'
subdirectory of the default 'load-path'.
* doc/emacs/package.texi (Packages): Describe manual installation
of ELisp packages. Suggested by Jean-Christophe Helary
<jean.christophe.helary@traduction-libre.org>.