Stefan Kangas [Sun, 18 Oct 2020 13:32:22 +0000 (15:32 +0200)]
Prefer Lisp version of describe-map-tree
This is a prerequisite to remove the old C functions, and gives a
measured 3 ms slowdown on my machine, from 0.27s to 0.30s per call to
describe-buffer-bindings (average over 50 calls).
* src/keymap.c (Fdescribe_buffer_bindings): Call Lisp function
describe-map-tree instead of C function describe_map_tree.
Stefan Kangas [Sat, 17 Oct 2020 22:02:55 +0000 (00:02 +0200)]
Improve substitute-command-keys performance
The previous conversion of describe_vector from C to Lisp for the
keymap and char table case lead to an unacceptable performance hit.
Moving back to the C version, as we do here, makes this function
around 50 times faster.
The Lisp version of `substitute-command-keys' was benchmarked using
the form `(documentation 'dired-mode)', which now takes less than 8 ms
on my machine. This is around 16 times slower than the previous C
version.
Thanks to Stefan Monnier for helpful pointers on benchmarking.
* src/keymap.c (Fhelp__describe_vector): New defun to expose
describe_vector to Lisp for keymaps and char tables.
(syms_of_keymap): New defsubr for Fhelp__describe_vector.
* lisp/help.el (describe-map): Use above defun instead of Lisp
version.
(help--describe-vector): Remove defun; keep it commented out for now.
Stefan Kangas [Wed, 19 Aug 2020 10:49:39 +0000 (12:49 +0200)]
Translate describe_map to Lisp
Third step in converting substitute-command-keys to Lisp.
* lisp/help.el (describe-map): New Lisp version of describe_map.
(help--describe-map-compare, help--describe-translation)
(help--describe-command, help--shadow-lookup): New helper
functions for describe-map.
(help--keymaps-seen, help--previous-description-column): New
variables.
* src/keymap.c
(Fkeymap__get_keyelt): New defun to expose get_keyelt to Lisp.
(Fdescribe_map_tree_old, Fdescribe_map): Remove defuns.
(Fdescribe_vector_internal): New defun to expose describe_vector to
Lisp in a way usable by describe-map.
(syms_of_keymap): New defsubrs for Fkeymap__get_keyelt and
Fdescribe_vector_internal. Remove defsubrs for Fdescribe_map_tree_old
and Fdescribe_map. Remove 'help--keymaps-seen'.
Stefan Kangas [Sat, 17 Oct 2020 18:55:04 +0000 (20:55 +0200)]
Translate describe_map_tree to Lisp
This is the second step in converting substitute-command-keys to Lisp.
* lisp/help.el (describe-map-tree): New Lisp version of
describe_map_tree.
(substitute-command-keys): Update to use above function.
* src/keymap.c (Fdescribe_map): New defun to expose describe_map to
Lisp.
* src/keymap.c (syms_of_keymap): New variable 'help--keymaps-seen'; a
temporary kludge planned for removal. New defsubr for Fdescribe_map.
Stefan Kangas [Mon, 8 Jul 2019 16:37:50 +0000 (18:37 +0200)]
Add new Lisp implementation of substitute-command-keys
This is only the first step towards a full Lisp implementation, and
does not remove the old C code. On the contrary, it is partly based
on using the old C code, which is to be replaced in steps. This also
makes it easy to test that it produces the same output as the old.
* src/doc.c (Fsubstitute_command_keys_old): Rename from
Fsubstitute_command_keys.
(Fget_quoting_style): New defun to expose text_quoting_style to Lisp.
(syms_of_doc): Expose above symbols.
* lisp/help.el (substitute-command-keys): New Lisp version of
substitute-command-keys. (Bug#8951)
* src/keymap.c
(Fdescribe_map_tree): New defun to expose describe_map_tree to Lisp.
(syms_of_keymap): New defsubr for Fdescribe_map_tree.
* src/keyboard.c (help_echo_substitute_command_keys):
* src/doc.c (Fdocumentation, Fdocumentation_property):
* src/print.c (print_error_message):
* src/syntax.c (Finternal_describe_syntax_value): Fix calls to use new
Lisp implementation of substitute-command-keys.
* test/src/doc-tests.el: Remove file.
* test/lisp/help-tests.el: Add tests for substitute-command-keys
copied from above file.
Glenn Morris [Sat, 17 Oct 2020 16:48:54 +0000 (09:48 -0700)]
Merge from origin/emacs-27
65078e0a76 * lisp/info.el (Info-hide-note-references): Doc fix. (Bug... 30305b543d Make lisp/progmodes/js.el dependent on CC Mode in the Make... c37b2a9b42 Yet another fix for 'set-minibuffer-message' 72dd911981 Fix posn-at-x-y in builds --without-x ace25f2066 Clarify the seq-reduce documentation 7d598e281d Make tramp-completion-reread-directory-timeout obsolete (B... 2c31ce18ea Fix 'message' when there's active minibuffer on another frame
Stefan Kangas [Sat, 17 Oct 2020 15:56:44 +0000 (17:56 +0200)]
Base bookmark-bmenu-mode on tabulated-list-mode (Bug#39293)
Rewriting bookmark-bmenu-mode to be based on 'tabulated-list-mode'
allows us to greatly simplify the code in several cases. In addition,
we get some features for free, such as sorting by column.
The only functional step backwards is that we no longer support the
optional "inline" header line, a bookmark.el-specific feature to have
a header without using 'header-line-format'. This feature is believed
to be not very useful or widely used.
* lisp/bookmark.el (tabulated-list): Require.
(bookmark-bmenu-mode): Inherit from 'tabulated-list-mode' instead of
'special-mode' and make the necessary changes to support that.
(bookmark-bmenu-mode-map): Inherit from 'tabulated-list-mode-map'
instead of 'special-mode-map'. Remove now duplicate key bindings.
(bookmark-bmenu--revert): New function to show the bookmark list using
'tabulated-list-mode'.
(bookmark-bmenu-list): Simplify by using above new function.
(bookmark-bmenu-bookmark): Adapt to 'tabulated-list-mode'.
(bookmark-bmenu--name-predicate)
(bookmark-bmenu--file-predicate): New functions used by
'tabulated-list-mode' to sort.
(bookmark-bmenu-set-header): Redefine as obsolete function alias for
'tabulated-list-init-header'.
(bookmark-bmenu-toggle-filenames, bookmark-bmenu-show-filenames)
(bookmark-bmenu-hide-filenames, bookmark-bmenu-mark)
(bookmark-bmenu-mark-all, bookmark-bmenu-unmark-all)
(bookmark-bmenu-delete-all, bookmark-bmenu-unmark)
(bookmark-bmenu-delete, bookmark-bmenu-delete-backwards): Simplify now
that we can depend on 'tabulated-list-mode' to do more work.
(bookmark-bmenu-use-header-line)
(bookmark-bmenu-inline-header-height): Declare variables relating to
the now unsupported "inline" header obsolete.
(bookmark-bmenu-ensure-position)
(bookmark-bmenu-execute-deletions): Remove code to handle "inline" header.
* test/lisp/bookmark-tests.el
(bookmark-test-bmenu-edit-annotation/show-annotation)
(bookmark-test-bmenu-unmark, bookmark-test-bmenu-mark): Update tests
for minor changes when using 'tabulated-list-mode'.
Add aid for finding missing dynamic variable declarations
Find lexical use of variables that are dynamically declared in other
files by recording 'defvar' declarations in files that can be read
in by the compiler in a second compilation. This is particularly
useful when converting code to use lexical-binding.
The facility is controlled by setting environment variables:
EMACS_GENERATE_DYNVARS -- set to non-empty to generate a .dynvars file
corresponding to each .elc.
EMACS_DYNVARS_FILE -- set to the name of a .dynvars file to use
as defvar information during compilation,
enabling the new warnings.
* lisp/emacs-lisp/bytecomp.el (byte-compile--known-dynamic-vars)
(byte-compile--seen-defvars): New variables.
(byte-compile-warning-types): Add lexical-dynamic warning.
(byte-compile--load-dynvars, byte-compile--warn-lexical-dynamic):
New functions.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file, byte-compile--declare-var)
(byte-compile-lambda, byte-compile-bind): Add dynamic variable loads,
dumps and checks.
* doc/lispref/variables.texi (Converting to Lexical Binding): Document.
Eli Zaretskii [Fri, 16 Oct 2020 14:29:38 +0000 (17:29 +0300)]
Fix documentation of Modus Themes
* doc/misc/modus-themes.texi (Install from the archives)
(No mixed fonts): Remove references to MELPA.
(How do the themes look like)
(Enable and load, Load automatically)
(Configure options prior to loading, Customisation Options)
(No mixed fonts, Command prompts, Mode line, Completion UIs)
(Fringes, Line highlighting, Matching parentheses, Diffs)
(Org mode blocks, Heading styles, Tweak colors (DIY))
(Org user faces (DIY), Supported packages)
(Will NOT be supported, Note for ERC escaped color sequences)
(Note on shr colors, Note for Helm grep)
(Note on vc-annotate-background-mode, Sources of the themes): Fix
spelling, wording, and markup.
We don't support rewriting history!
People who contributed to Emacs development should have their
contributions remain acknowledged forever, even if the files
to which they contributed are deleted at some point.
Eli Zaretskii [Fri, 16 Oct 2020 13:49:47 +0000 (16:49 +0300)]
Fix file-name problems in several tests
* test/lisp/saveplace-tests.el
(saveplace-test-forget-unreadable-files): Use file-truename, to
avoid false negatives when file names are not 'equal' as strings,
but point to the same file.
* test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-with-normal-env)
(edebug-tests-run-macro):
* test/lisp/emacs-lisp/testcover-tests.el
(testcover-tests-markup-region, testcover-tests-run-test-case):
Bind find-file-suppress-same-file-warnings to a non-nil value, to
avoid warnings about "same-file-names", at least on MS-Windows,
due to 8+3 aliases.
Stefan Kangas [Fri, 16 Oct 2020 12:08:31 +0000 (14:08 +0200)]
* doc/emacs/ack.texi (Acknowledgments): Remove now deleted files.
This is in line with an ack.texi comment that says to "Remove things
that are no longer distributed." Most files in this list were removed
many years ago.
Stefan Kangas [Fri, 16 Oct 2020 09:50:30 +0000 (11:50 +0200)]
; Revert some spelling fixes
The preference was to keep the alternative spelling here, to ensure
the documentation matches the name of the macros.
This reverts part of commit 95e8c7d1d9.
Ref: https://lists.gnu.org/r/emacs-devel/2020-10/msg00651.html
Stefan Kangas [Wed, 23 Sep 2020 21:06:02 +0000 (23:06 +0200)]
Add ert macros to get resource file names (Bug#43792)
* lisp/emacs-lisp/ert-x.el (subr-x): Require.
(ert-resource-dir, ert-resource-file): New macros to get the file name
of the resource directory belonging to a test.
(ert-resource-dir-format, ert-resource-dir-trim-left-regexp)
(ert-resource-dir-trim-right-regexp): New variables.
Stephen Berman [Fri, 16 Oct 2020 08:33:19 +0000 (10:33 +0200)]
Adjust some tests so that they work in symlinked environs
* test/lisp/help-fns-tests.el (help-fns-test-lisp-macro)
(help-fns-test-lisp-defsubst):
* test/lisp/emacs-lisp/cl-generic-tests.el
(cl-generic-tests--method-files--finds-methods): Adjust test so
that they work in a symlinked environment (bug#43004).
(cl-generic-tests--method-files--finds-methods): Use file-truename
so that this works in a symlinked environment (bug#43004).
Sanitize ical data in gnus-icalendar-event-from-ical
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical):
Sanitise the data before passing it on to the constructor. This
avoids backtraces on icals with extra, unknown slots (bug#43057).
Substitute command keys in button help-echo values
* lisp/button.el (button--help-echo): Pass resulting string through
substitute-command-keys for consistency with show-help-function.
* test/lisp/button-tests.el (button-tests--map): New test keymap.
(button--help-echo-string, button--help-echo-form)
(button--help-echo-function): Use it to test command key
substitution in help-echo strings (bug#43070).
Make package-install-from-buffer maybe refresh the quickstart file
* lisp/emacs-lisp/package.el (package-install-from-buffer):
Refresh the quickstart file (bug#43237). This makes this command
more consistent with package-install.
Eli Zaretskii [Fri, 16 Oct 2020 07:02:50 +0000 (10:02 +0300)]
Fix posn-at-x-y in builds --without-x
* src/keyboard.c (make_lispy_position): Don't exclude the
window_or_frame = frame case from TTY-only builds. Reported by
Jared Finder <jared@finder.org>.
* doc/lispref/commands.texi (Click Events): Document the format of
POSITION in click events on the frame's internal border.
* lisp/vc/vc.el (vc-revision-other-window): This function used to
change the current buffer, but this was changed in the previous
patch for indirect buffer support. Ensure that it still does
this, because this is what the callers expect (bug#44026).
Add way to prevent asking "increase specpdl size?"
* net/shr.el (shr-offer-extend-specpdl): New option, default t.
(shr-descend): If shr-offer-extend-specpdl is nil, don't even ask
whether to extend the specpdl, just signal error.
* lisp/hi-lock.el (hi-lock-face-buffer): If given a face name a
string, convert it to a symbol first, as later usage of this
expects a symbol and not a string (bug#43339).
Stefan Kangas [Thu, 15 Oct 2020 13:00:05 +0000 (15:00 +0200)]
Remove some references to "in Emacs 21 or later"
* doc/misc/efaq.texi (Colors on a TTY, Disabling backups)
(Errors with init files, Backspace invokes help)
(Backspace invokes help): Remove some references to "in Emacs 21 or
later". Now everyone can be assumed to use at least that version.
Fix problem with next-error-message-highlight in *Occur*
* lisp/simple.el (next-error-message-highlight): This function is
called directly, so clean up the code a bit (bug#32676).
(next-error-found): Pass in the error buffer.
Stefan Monnier [Wed, 14 Oct 2020 22:03:52 +0000 (18:03 -0400)]
* lisp/calc: Fix a few issues introduced by lexical scoping
Fix a few places I missed, where we incorrectly used lexical scoping on a var
that needed dynamic scoping.
These were detected thanks to a bit of footwork by Mattias Engdegård!
* lisp/calc/calc-ext.el (math-read-big-lines): Declare as dynbound.
(math-read-big-bigp): Bind it inside a `let`.
* lisp/calc/calc-graph.el (math-arglist): Declare as dynbound.
* lisp/calc/calc-map.el (math-arglist): Declare as dynbound.
* lisp/calc/calc-misc.el (math-trunc-prec): Declare as dynbound.
(math-trunc): Bind it inside a `let`.
(math-floor-prec): Declare as dynbound.
(math-floor): Bind it inside a `let`.
* lisp/calc/calc-nlfit.el (calc-curve-varnames, calc-curve-coefnames):
Declare as dynbound.
* lisp/calc/calc-sel.el (math-comp-sel-tag): Declare as dynbound.
* lisp/calc/calcsel2.el (calc-sel-reselect): Declare as dynbound.
Juri Linkov [Wed, 14 Oct 2020 08:56:23 +0000 (11:56 +0300)]
Highlight regexp sub-expressions in query-replace
* lisp/replace.el (query-replace-highlight-submatches): New defcustom.
(replace-submatches-overlays): New variable.
(replace-highlight): Use query-replace-highlight-submatches.
(replace-dehighlight): Use query-replace-highlight-submatches.
* doc/emacs/search.texi (Query Replace):
Add documentation for query-replace-highlight-submatches.
Suggested by Drew Adams <drew.adams@oracle.com> in bug#43702.
Juri Linkov [Wed, 14 Oct 2020 08:45:26 +0000 (11:45 +0300)]
* lisp/progmodes/grep.el: More fixes for 'lgrep' (bug#23590)
* lisp/progmodes/grep.el (grep-expand-template): Add new arg 'more-opts'.
(grep-use-directories-skip): New variable.
(lgrep): Set 'grep-use-directories-skip' to the result of 'grep-probe'.
Use "--directories=skip" when 'grep-use-directories-skip' is t.
Ernesto Alfonso [Wed, 14 Oct 2020 05:45:21 +0000 (07:45 +0200)]
Add option to highlight the 'next-error' error message
* lisp/simple.el (next-error-message-highlight):
(next-error-message): New faces (bug#32676).
(next-error--message-highlight-overlay): New internal variable.
(next-error-message-highlight): New function.
(next-error-found): Call the function.