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.
* 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.
* lisp/dired-x.el (dired-x-guess-filename-at-point): Rename (bug#43961).
(dired-filename-at-point): Made into an obsolete alias, since the name
can be confused with the unrelated dired-file-name-at-point function.
* lisp/emacs-lisp/package.el (package-install-button-action)
(package-delete-button-action): Run describe-package instead of
revert-buffer in order to use newer package-desc (bug#43983).
Paul Eggert [Tue, 13 Oct 2020 17:21:40 +0000 (10:21 -0700)]
nnimap MODSEQ cleanup
* lisp/gnus/nnimap.el (nnimap-parse-flags):
Remove old hack that deletes MODSEQ entries in the buffer, as
Emacs now has bignums and so won't misparse MODSEQs (Bug#38938).
Paul Eggert [Tue, 13 Oct 2020 17:04:21 +0000 (10:04 -0700)]
eql doc improvements
* doc/lispref/numbers.texi (Comparison of Numbers):
Copy some useful text from eql help string.
* src/fns.c (Feql): In doc string, say that eql also compares
integers by value.
Setting the word size ("b w") to 0 removes the word size clipping for
all bit operations (effectively as if a word size of -∞ had been set).
Rotation is disallowed; logical and arithmetic shifts behave
identically.
After a suggestion by Vincent Belaïche.
* lisp/calc/calc-bin.el (calc-word-size, math-binary-arg)
(math-binary-modulo-args, calcFunc-lsh, calcFunc-ash, calcFunc-rot)
(math-clip, math-format-twos-complement): Allow a word size of 0,
meaning -∞.
* test/lisp/calc/calc-tests.el
(calc-tests--not, calc-tests--and, calc-tests--or, calc-tests--xor)
(calc-tests--diff): New functions.
(calc-tests--clip, calc-tests--rot, calc-shift-binary): Extend to
cover word size 0.
(calc-bit-ops): New test.
* doc/misc/calc.texi (Binary Functions): Update manual.
* etc/NEWS: Announce the change.
* etc/emacs.service (ExecStop): Partially revert previous patch
for bug#37847, since: "This appears to break packages that rely on
`invocation-name' to be executable."
Yuan Fu [Tue, 13 Oct 2020 03:14:21 +0000 (05:14 +0200)]
Add cycling commands to outline
* lisp/outline.el (outline--cycle-state, outline-has-subheading-p)
(outline-cycle, outline-cycle-buffer): New functions.
(outline-mode-map): Add key bindings for the two new commands.
(outline--cycle-buffer-state): New variable.
* doc/emacs/text.text (Outline Visibility): Add 'outline-cycle' and
'outline-cycle-buffer'.
* etc/NEWS (Outline): Record the change (bug#41130).
* lisp/subr.el (read-char-choice): Use `read-char-from-minibuffer'
here (bug#42708) so that we're not as modal (and users can copy
the help buffer, if they should so want).
Make diary fontify headers correctly (if the date has been customized)
* lisp/calendar/diary-lib.el (diary-fancy-display): Insert the
heading with the correct face, so that it doesn't have to be
re-matched later (which is generally impossible) (bug#13072).
(diary-fancy-date-pattern, diary-fancy-date-matcher): Make obsolete.
(diary-fancy-font-lock-keywords): Don't use.
(diary-fancy-font-lock-fontify-region-function): Don't use.
Mauro Aranda [Tue, 13 Oct 2020 01:32:17 +0000 (03:32 +0200)]
Don't bind sort-fold-case when saving the custom-file
* lisp/cus-edit.el (custom-save-variables, custom-save-faces): These
functions sort a list, not buffer text, so they don't need
to use sort-fold-case at all. Remove the let-binding for
sort-fold-case (bug#43919).
Have header-line-highlight inherit from mode-line-highlight
* lisp/faces.el (header-line-highlight): Inherit from
mode-line-highlight instead of highlight (bug#43926). This is
consistent with header-line inheriting from mode-line.
Stefan Kangas [Mon, 12 Oct 2020 18:59:14 +0000 (20:59 +0200)]
Fix man page title lines and timestamps
* doc/man/ebrowse.1:
* doc/man/emacs.1.in:
* doc/man/emacsclient.1:
* doc/man/etags.1: Update date to match last significant change. Set
file local variable time-stamp-pattern. Fix title line to match the
recommendations in "man man-pages".
Ref: https://lists.gnu.org/r/emacs-devel/2020-09/msg01002.html
Stefan Monnier [Sun, 11 Oct 2020 22:21:48 +0000 (18:21 -0400)]
* lisp/proced.el: Fix behavior with variable-pitch `header-line` face
Also, use lexical-scoping. Remove redundant `:group` args.
(proced-process-alist, proced-header-line): Use `defvar-local`
(proced-header-line): Put :align-to on spaces to improve result with
variable-pitch header-line face.
(proced-filter, proced-format): Use a closure instead of `(lambda ...).
Stefan Monnier [Sun, 11 Oct 2020 21:08:25 +0000 (17:08 -0400)]
* lisp/hexl.el: Fix behavior with variable-pitch `header-line` face
(hexl-ascii-region): Don't inherit from the `header-line`.
(hexl-font-lock-keywords): Fix text alignment.
(hexl-mode): Set `font-lock-extra-managed-props` accordingly.
Alan Third [Sun, 11 Oct 2020 19:46:07 +0000 (20:46 +0100)]
Fix GNUstep build
Fix mistakes made when removing Cocoa code from nsfont.m.
* src/nsfont.m (nsfont_draw): Remove spurious #ifdef.
(ns_uni_to_glyphs): The #if/#endif was removed from this code, but the
code itself not removed. Remove it now.