F. Jason Park [Sat, 27 Feb 2021 04:35:40 +0000 (05:35 +0100)]
Accept string argument in erc-add-to-input-ring
* lisp/erc/erc-ring.el: (erc-add-to-input-ring)
(erc-previous-command): Use existing API to grab input.
* test/lisp/erc/erc-tests.el: (erc-ring-previous-command)
See (bug#46339).
Glenn Morris [Sat, 27 Feb 2021 03:28:43 +0000 (19:28 -0800)]
Distribute the real source for some doc/misc manuals (bug#45143)
* doc/misc/modus-themes.texi, doc/misc/org.texi:
Remove generated files from repository.
* doc/misc/Makefile.in: Add rules for building .texi from .org.
(ORG_SRC, abs_top_builddir, EMACS, emacs):
New variables.
(org_template): New template.
(orgclean): New phony target.
* Makefile.in (info): Depend on lisp.
* lisp/org/ox-texinfo.el (org-texinfo-export-to-texinfo-batch):
New function.
* doc/misc/org.org, doc/misc/org-setup.org: New files.
Import from https://code.orgmode.org d8e8a97a14.
Stefan Monnier [Sat, 27 Feb 2021 01:24:52 +0000 (20:24 -0500)]
* lisp/emacs-lisp/cconv.el: Improve line-nb info of unused var warnings
Instead of warning about unused vars during the analysis phase of
closure conversion, do it in the actual closure conversion by
annotating the code with "unused" warnings, so that the warnings
get emitted later by the bytecomp phase, like all other warnings,
at which point the line-number info is a bit less imprecise.
Take advantage of this change to wrap the expressions of unused
let-bound vars inside (ignore ...) so the byte-compiler can better
optimize them away.
Finally, promote `macroexp--warn-and-return` to "official" status
by removing its "--" marker.
(cconv-captured+mutated, cconv-lambda-candidates): Remove vars.
(cconv-var-classification): New var to replace them.
(cconv-warnings-only): Delete function.
(cconv--warn-unused-msg, cconv--var-classification): New functions.
(cconv--convert-funcbody): Add warnings for unused args.
(cconv-convert): Add warnings for unused vars in `let` and `condition-case`.
(cconv--analyze-use): Don't emit an "unused var" warning any more,
but instead remember the fact in `cconv-var-classification`.
* lisp/emacs-lisp/pcase.el (pcase--if): Don't throw away `test` effects.
(\`):
* lisp/emacs-lisp/cl-macs.el (cl--do-arglist): Use `car-safe` instead
of `car`, so it can more easily be removed by the optimizer if the
result is not used.
* lisp/emacs-lisp/macroexp.el (macroexp--warn-wrap): New function.
(macroexp-warn-and-return): Rename from `macroexp--warn-and-return`.
(eldoc-last-message): Remove var declaration.
(eldoc-message): Remove function declaration.
(semantic--eldoc-info): Rename from semantic-idle-summary-idle-function.
Make it usable on `eldoc-documentation-functions`.
(semantic-idle-summary-mode): Use `eldoc-mode`.
(semantic-idle-summary-refresh-echo-area): Delete function.
Stefan Monnier [Fri, 26 Feb 2021 20:19:31 +0000 (15:19 -0500)]
* lisp/cedet/semantic/analyze*.el: Use lexical-binding
* lisp/cedet/semantic/analyze.el: Use lexical-binding.
Rename the dynbound var `prefixtypes` to `semantic--prefixtypes`.
(semantic--prefixtypes): Declare var.
* lisp/cedet/semantic/analyze/complete.el: Use lexical-binding.
(semantic--prefixtypes): Declare var.
(semantic-analyze-possible-completions-default): Remove unused var `any`.
Rename `prefixtypes` to `semantic--prefixtypes`.
* lisp/cedet/semantic/analyze/debug.el: Use lexical-binding.
(semantic-analyzer-debug-global-symbol): Remove no-op use of `prefixtypes`.
* lisp/cedet/semantic/analyze/refs.el:
* lisp/cedet/semantic/analyze/fcn.el: Use lexical-binding.
Stefan Kangas [Fri, 26 Feb 2021 15:09:14 +0000 (16:09 +0100)]
Convert simula-mode menu to easy-menu-define
* lisp/progmodes/simula.el (simula-mode-map): Move menu definition
from here...
(simula-mode-menu): ...to here, and use easy-menu-define.
(simula-popup-menu): Declare unused function obsolete.
Function-quote completion property of declare form
For discussion, see the following thread:
https://lists.gnu.org/r/emacs-devel/2021-02/msg01666.html
* lisp/emacs-lisp/byte-run.el (byte-run--set-completion): Quote with
'function' for syntactical consistency with other declare form
properties. This allows writing (declare (completion foo)) instead
of (declare (completion 'foo)).
* lisp/emacs-lisp/easymenu.el (easy-menu-do-define):
* lisp/gnus/gnus-sum.el (gnus-summary-make-menu-bar): Prefer
function-put over put for function symbols.
* lisp/subr.el (ignore, undefined): Remove #'-quoting from declare
form; it is no longer needed.
Two unrelated bugs: A missing type check caused an error in rx
patterns for non-string match targets, and rx patterns did not work at
all in pcase-let or pcase-let*.
Second bug reported by Basil Contovounesios and Ag Ibragimov; fixes
proposed by Stefan Monnier. Discussion and explanation in thread at
https://lists.gnu.org/archive/html/emacs-devel/2021-02/msg01924.html
* lisp/emacs-lisp/rx.el (rx): Add (pred stringp) to avoid type errors,
and replace the `pred` clause for the actual match with something that
works with pcase-let(*) without being optimised away.
* test/lisp/emacs-lisp/rx-tests.el (rx-pcase): Add test cases.
Eli Zaretskii [Thu, 25 Feb 2021 18:58:44 +0000 (20:58 +0200)]
Fix documentation of a recent change
* src/fns.c (Fyes_or_no_p): Don't use braces around one-line
block.
(syms_of_fns) <use-short-answers>: Improve the wording of the doc
string.
* etc/NEWS: Improve wording of the entry about 'use-short-answers'.
Alan Third [Wed, 24 Feb 2021 09:52:42 +0000 (09:52 +0000)]
Fix freeze on older macOS's (bug#46687)
* src/nsterm.m ([EmacsView windowDidChangeBackingProperties:]):
([EmacsView viewWillDraw]): Only run this code when actually drawing
to an offscreen bitmap.
Robert Pluim [Thu, 25 Feb 2021 15:36:56 +0000 (16:36 +0100)]
Don't crash if gnutls_handshake fails
In some situations involving Internet access not being fully
functional, gnutls_handshake returns a fatal error, which we were
ignoring, causing us to call gnutls_handshake again. Now we check for
the error and return it to the caller.
* src/gnutls.c (gnutls_try_handshake): Return immediately if
gnutls_handshake returns a fatal error (Bug#46709).
Stefan Monnier [Wed, 24 Feb 2021 23:39:06 +0000 (18:39 -0500)]
* test/lisp/emacs-lisp/macroexp-tests.el (macroexp--tests-file-name): Add case
Add use of `macroexp-file-name` from a macro called from within
a function, which works thanks to eager-macroexpansion (so the macro
is expanded which the file is being loaded rather than only later
when the function is called).
* test/lisp/emacs-lisp/macroexp-resources/m1.el
(macroexp--m1-tests-file-name): New function.
Stefan Monnier [Wed, 24 Feb 2021 18:52:45 +0000 (13:52 -0500)]
* lisp/emacs-lisp/macroexp.el (macroexp-file-name): New function.
Yes, finally: a function that tells you the name of the file where
the code is located. Finding this name is non-trivial in practice,
as evidenced by the "4 shift/reduce conflicts" warning when compiling
CEDET's python.el, because its `wisent-source` got it wrong in that
case, thinking the grammar came from `python.el` instead of
`python-wy.el`.
While at it, also made `macroexp-compiling-p` public, since it's
useful at various places.
(macroexp-compiling-p): Rename from `macroexp--compiling-p`.
* lisp/emacs-lisp/bytecomp.el (byte-compile-close-variables):
Bind `load-file-name` to nil so we can distinguish a load that calls
the byte compiler from a byte compilation which causes a load.
* lisp/cedet/semantic/wisent/python.el (wisent-python--expected-conflicts):
Remove; it was just a workaround.
* lisp/subr.el (do-after-load-evaluation): Avoid `byte-compile--` vars.
* lisp/cedet/semantic/fw.el (semantic-alias-obsolete):
Use `macroexp-compiling-p` and `macroexp-file-name`.
* lisp/cedet/semantic/wisent/comp.el (wisent-source): Use `macroexp-file-name`
(wisent-total-conflicts): Tighten regexp.
* lisp/emacs-lisp/cl-lib.el (cl--compiling-file): Delete function
and variable. Use `macroexp-compiling-p` instead.
* lisp/progmodes/flymake.el (flymake-log):
* lisp/emacs-lisp/package.el (package-get-version):
* lisp/emacs-lisp/ert-x.el (ert-resource-directory):
Use `macroexp-file-name`.
Ulf Jasper [Wed, 24 Feb 2021 18:26:37 +0000 (19:26 +0100)]
Add options to use feed names from newticker-url-list
* lisp/net/newst-treeview.el
(newsticker-treeview-use-feed-name-from-url-list-in-treeview): New.
(newsticker-treeview-use-feed-name-from-url-list-in-itemview): New.
(newsticker--treeview-item-show): Show feed name from
newsticker-url-list if wanted.
(newsticker--treeview-propertize-tag): Add argument 'tooltip'.
(newsticker--treeview-tree-get-tag): Usefeed name from
newsticker-url-list if wanted. (Fixes third issue in
Bug#41376.)
Remove the "Documentation:" line from the variable help
* lisp/help-fns.el (describe-variable): Remove the
"Documentation:" line (bug#46702). This makes the help text more
compact and seems easier to read, too.
* shortdoc.el (shortdoc-heading): Define new face for headings.
(shortdoc-display-group): Apply new heading face.
(shortdoc--display-function): Use existing face for section text.
* etc/NEWS: Document new face (bug#46748).
Eli Zaretskii [Wed, 24 Feb 2021 15:43:08 +0000 (17:43 +0200)]
Better support for 'truncate-line' non-nil in the mini-window
* src/xdisp.c (resize_mini_window): Resize the mini-window
when multi-line text is displayed under truncate-lines
non-nil in the minibuffer. (Bug#46718)
Juri Linkov [Tue, 23 Feb 2021 19:01:31 +0000 (21:01 +0200)]
* lisp/tab-line.el (tab-line-tab-name-format-function): New defcustom.
(tab-line-tab-name-format-default): New function as the default value.
(tab-line-format-template): Funcall tab-line-tab-name-format-function.
This is like recently added tab-bar-tab-name-format-function.
Stefan Monnier [Tue, 23 Feb 2021 17:14:59 +0000 (12:14 -0500)]
* test/: Use lexical-binding the few remaining files
* test/manual/biditest.el: Use lexical-binding.
(biditest-generate-testfile): Remove unused var `levels`.
* test/manual/image-circular-tests.el: Use lexical-binding.
* test/manual/image-size-tests.el: Use lexical-binding.
(image-size-tests): Check `fboundp` before calling `imagemagick-types`.
* test/manual/redisplay-testsuite.el: Use lexical-binding.
* test/manual/cedet/cedet-utests.el: Use lexical-binding.
Use `with-current-buffer`.
(cedet-utest): Test `fboundp` i.s.o `featurep` to silence warning.
(srecode-map-save-file): Declare var.
(pulse-test): Test `fboundp` before calling `pulse-available-p`.
Declare `pulse-momentary-highlight-overlay` since it's not autoloaded.
* test/manual/cedet/semantic-tests.el: Use lexical-binding.
Use `with-current-buffer`.
(semanticdb-ebrowse-dump): Remove unused var `ab`.
(semanticdb-test-gnu-global): Don't use obsolete "name" arg to constructor.
(cedet-utest-directory): Declare var.
* lisp/net/dictionary-connection.el: Grammar fix
(dictionary-connection-open): Use active voice.
(dictionary-connection-status): Reword and improve formatting.
Alan Mackenzie [Tue, 23 Feb 2021 11:16:24 +0000 (11:16 +0000)]
CC Mode: Fix bug in "state cache" invalidation function.
* lisp/progmodes/cc-engine.el (c-invalidate-state-cache-1): Rewrite part of
it, following the code in c-parse-state-1, to get a proper setting of
c-state-cache-good-pos.
(antlr-mode): Remove compatibility code with older CC-mode.
This somehow appears to fix the error:
In antlr-mode:
progmodes/antlr-mode.el:2426:20: Error: `c-init-language-vars' defined
after use in (c-init-language-vars) (missing `require' of a library
file?)
progmodes/antlr-mode.el:2427:26: Warning: c-init-language-vars called
with 0 arguments, but requires 1
No idea what caused the error to appear after the previous patch either.
Stefan Monnier [Mon, 22 Feb 2021 21:54:59 +0000 (16:54 -0500)]
* lisp/obsolete: Use lexical-binding
Use lexical-binding in all the lisp/obsolete/*.el files.
While at it, removed redundant :group arguments and used #' to quote
functions. Commented out the key bindings which the #' revealed
to lead to non-existing commands, and replaced those revealed to be obsolete.
* lisp/obsolete/cl-compat.el: Use cl-lib.
* lisp/obsolete/cust-print.el: Assume `defalias` exists.
(with-custom-print): Use `declare`.
* lisp/obsolete/landmark.el (landmark, landmark-nslify-wts):
Prefer `apply` to `eval`.
* lisp/obsolete/longlines.el (longlines-mode): Don't use `add-to-list`
on a hook.
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region): Use `clear-string`.
* lisp/obsolete/pgg-pgp.el (pgg-pgp-encrypt-region): Remove oddly
unused var `passphrase`.
(pgg-pgp-verify-region): Declare var `jam-zcat-filename-list`.
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-encrypt-region): Remove oddly
unused var `passphrase`.
(pgg-pgp5-verify-region): Declare var `jam-zcat-filename-list`.
* lisp/obsolete/pgg.el: Remove some XEmacs compatibility code.
(pgg-run-at-time, pgg-cancel-timer, pgg-clear-string): Remove functions.
Use their core equivalent instead.
* lisp/obsolete/rcompile.el (remote-compile): Remove unused vars `l`,
`l-host`, `l-user`, and `localname`.
* lisp/obsolete/starttls.el (starttls-any-program-available):
Use `define-obsolete-function-alias`.
* lisp/obsolete/tls.el (tls-format-message): Delete function, use
`format-message` instead.
* lisp/obsolete/url-ns.el (url-ns-prefs): Use `with-current-buffer`
and `dlet`.
* lisp/obsolete/vip.el (vip-escape-to-emacs): Remove unused var `key`.
(vip-command-argument, vip-read-string, ex-delete, ex-line): Remove
unused var `conditions`.
(ex-map): Use a closure instead of `eval`.
(ex-set): Make it an alias of `set-variable`.
(ex-substitute): Remove unused var `cont`.
Buttonize function values in help (and add a blank line)
* lisp/help-fns.el (describe-variable): Add a newline for better
readability (bug#46702). This also has the side effect of
buttonizing `function-references-like-this' in the "Its value is"
part.
(cond-emacs-xemacs, cond-emacs-xemacs-macfn, defunx, ignore-errors-x):
Remove those functions and macros. Replace every use with the result
of their use.
(antlr-default-directory): Remove function, use the `default-directory`
variable instead.
(antlr-read-shell-command): Remove function, use
`read-shell-command` instead.
(antlr-with-displaying-help-buffer): Remove function, by inlining it at
its only call site.
(antlr-end-of-rule, antlr-beginning-of-rule, antlr-end-of-body)
(antlr-beginning-of-body): Mark them as movement commands.
Juri Linkov [Mon, 22 Feb 2021 17:12:43 +0000 (19:12 +0200)]
* lisp/tab-bar.el: 'C-x t N' bound to tab-new-to supports a negative argument
* lisp/tab-bar.el (tab-bar-new-tab-to): Negative TO-INDEX counts
tabs from the end of the tab bar.
(tab-bar-new-tab): Fix docstring to add reference to
'tab-bar-new-tab-to'.
(tab-prefix-map): Bind "N" to tab-new-to.
Juri Linkov [Mon, 22 Feb 2021 17:08:16 +0000 (19:08 +0200)]
* lisp/tab-bar.el: 'C-x t M' bound to tab-move-to supports a negative argument
* lisp/tab-bar.el (tab-bar-move-tab-to): Negative TO-INDEX counts
tabs from the end of the tab bar.
(tab-bar-move-tab): Fix docstring to add reference to tab-bar-move-tab-to.
(tab-prefix-map): Bind "M" to tab-move-to.
Juri Linkov [Mon, 22 Feb 2021 17:03:42 +0000 (19:03 +0200)]
'Mod-9' bound to 'tab-last' now switches to the last tab like in web browsers
* lisp/tab-bar.el (tab-bar--define-keys): Rebind 0 from
tab-bar-switch-to-recent-tab to its alias tab-recent.
Bind 9 to tab-last.
(tab-bar-switch-to-last-tab): New command.
(tab-last): New alias to tab-bar-switch-to-last-tab.
(tab-bar-switch-to-tab, tab-bar-undo-close-tab): Fix docstrings to
avoid mentioning the term "last" for "most recently used" meaning.
* lisp/obsolete/pgg.el: Enable lexical-binding. Remove XEmacs compat code.
(pgg-save-coding-system, pgg-as-lbt, pgg-process-when-success):
Use `declare`.
(pgg-add-passphrase-to-cache): Remove unused var `new-timer`.
(pgg-decrypt-region): Remove unused var `buf`.
* lisp/org/org-agenda.el (org-let, org-let2): Move from org-macs and
use `declare`.
* lisp/org/org-macs.el (org-let, org-let2): Move these functions that
are inherently harmful to your karma to the only package that uses them.
(org-scroll): Use `pcase` to avoid `eval` and use more readable syntax
for those integers standing for events.
* lisp/progmodes/antlr-mode.el: Enable lexical-binding.
(save-buffer-state-x): Use `declare` and `with-silent-modifications`.
Robert Pluim [Mon, 22 Feb 2021 14:05:48 +0000 (15:05 +0100)]
Skip tests that require Internet when there's no Internet
Bug#46641
The network-stream-tests actually work fine when the local machine has
no IP at all, but cause a crash in the GnuTLS library when there is an
IP configured but the interface is down.
* test/lisp/net/network-stream-tests.el (internet-is-working): New
defvar, checks if we can resolve "google.com".
(connect-to-tls-ipv4-nowait, connect-to-tls-ipv6-nowait)
(open-network-stream-tls-nowait, open-gnutls-stream-new-api-nowait)
(open-gnutls-stream-old-api-nowait): Use it to check for working
Internet access.
* test/src/process-tests.el (internet-is-working): New defvar, checks
if we can resolve "google.com".
(lookup-family-specification, lookup-unicode-domains)
(unibyte-domain-name, lookup-google, non-existent-lookup-failure): Use
it to check for working Internet access.
Robert Pluim [Mon, 22 Feb 2021 13:47:41 +0000 (14:47 +0100)]
Fix hang when running dns-query with no working internet
* lisp/net/dns.el (dns-set-servers): reduce the timeout and retry
count when using 'nslookup' for "localhost".
(dns-query): Check to see if we actually managed to initiate a dns
request before starting a busy-wait for the result.
Stefan Kangas [Mon, 22 Feb 2021 11:17:41 +0000 (12:17 +0100)]
Prefer mailing lists to newsgroups in FAQ
* doc/misc/efaq.texi (Real meaning of copyleft)
(Guidelines for mailing list postings, Mailing list archives)
(Packages that do not come with Emacs): Prefer mailing lists to
newsgroups. (Bug#46633)
Fix compilation of closures with nontrivial doc strings
* lisp/emacs-lisp/bytecomp.el (byte-compile-make-closure):
Use the supplied doc string if it's a literal; fall back to the old
slow way of building a closure otherwise.
Stefan Kangas [Mon, 22 Feb 2021 01:24:25 +0000 (02:24 +0100)]
Convert some textmodes menus to easy-menu-define
* lisp/textmodes/artist.el (artist-menu-map): Convert menu definition
to easy-menu-define.
* lisp/textmodes/conf-mode.el (conf-mode-map):
* lisp/textmodes/nroff-mode.el (nroff-mode-map): Move menu
definition from here...
* lisp/textmodes/conf-mode.el (conf-mode-menu):
* lisp/textmodes/nroff-mode.el (nroff-mode-menu): ...to here, and
convert to use easy-menu-define.
Faster, more compact, and readable closure creation
Simplify closure creation by calling a single function at run time
instead of putting it together from small pieces. This is faster
(by about a factor 2), takes less space on disk and in memory, and
makes internal functions somewhat readable in disassembly listings again.
This is done by creating a prototype function at compile-time whose
closure variables are placeholder values V0, V1... which can be seen
in the disassembly. The prototype is then cloned at run time using
the new make-closure function that replaces the placeholders with
the actual closure variables.
* lisp/emacs-lisp/bytecomp.el (byte-compile-make-closure):
Generate call to make-closure from a prototype function.
* src/alloc.c (Fmake_closure): New function.
(syms_of_alloc): Defsubr it.
* src/data.c (syms_of_data): Defsym byte-code-function-p.
Stefan Kangas [Fri, 19 Feb 2021 11:31:56 +0000 (12:31 +0100)]
Run admin/cus-tests.el tests from test suite
* test/Makefile.in (SUBDIRS): Run tests in new directory "misc",
intended for tests not belonging to any one file.
* test/misc/test-custom-deps.el:
* test/misc/test-custom-libs.el:
* test/misc/test-custom-noloads.el:
* test/misc/test-custom-opts.el: New files.
* test/lisp/custom-tests.el (custom--test-local-option): Move test to
above new file test-custom-opts.el.
* admin/cus-test.el: Document running tests from regular test suite.
* test/file-organization.org (Test Files): Document new test directory
"misc" for tests not belonging to any one file.
* lisp/json.el (json-encode-string): Clarify commentary.
(json--encode-stringlike): New function that covers a subset of
json-encode.
(json-encode-key): Use it for more efficient encoding and
validation, and to avoid mishandling confusable keys like boolean
symbols (bug#42545).
(json-encode-array): Make it clearer that argument can be a list.
(json-encode): Reuse json-encode-keyword and json--encode-stringlike
for a subset of the dispatch logic.
(json-pretty-print): Ensure confusable keys like ":a" survive a
decoding/encoding roundtrip (bug#24252, bug#45032).
* test/lisp/json-tests.el (test-json-encode-string)
(test-json-encode-hash-table, test-json-encode-alist)
(test-json-encode-plist, test-json-pretty-print-object): Test
encoding of confusable keys.