Sean Whitton [Fri, 24 Jul 2020 20:36:39 +0000 (13:36 -0700)]
Factor out project--read-project-buffer from project-switch-buffer
* lisp/progmodes/project.el (project--read-project-buffer): New
function extracted from project-switch-buffer.
* lisp/progmodes/project.el (project-switch-buffer): Instead of
unconditionally reading a project buffer from the user, add
buffer-or-name argument, and populate it using
project--read-project-buffer when called interactively. Update
docstring.
Philipp Stephani [Sat, 25 Jul 2020 21:04:05 +0000 (23:04 +0200)]
Fix subtle bug when checking liveness of module values.
We can't simply look up the Lisp object in the global reference table
because an invalid local and a valid global reference might refer to
the same object. Instead, we have to test the address of the global
reference against the stored references.
* src/emacs-module.c (module_global_reference_p): New helper function.
(value_to_lisp): Use it.
* test/data/emacs-module/mod-test.c
(Fmod_test_invalid_store_copy): New test module function.
(emacs_module_init): Export it.
* test/src/emacs-module-tests.el
(module--test-assertions--load-non-live-object-with-global-copy):
New unit test.
Turn (+ a b c) into (+ (+ a b) c), and do the same for - and *.
The 2-arg operations have their own bytecode which results in a 1.5×
speed-up. Furthermore, the transform enables other optimisations; for
example, (+ a 1 b) -> (+ (1+ a) b).
* lisp/emacs-lisp/byte-opt.el (byte-optimize-plus, byte-optimize-minus)
(byte-optimize-multiply): Transform (OP a b c) into (OP (OP a b) c).
Eli Zaretskii [Sat, 25 Jul 2020 09:28:05 +0000 (12:28 +0300)]
Update and improve documentation of project.el commands
* doc/emacs/custom.texi (Prefix Keymaps): Document
'project-prefix-map'.
* doc/emacs/maintaining.texi (Project File Commands)
(Switching Projects): Describe key bindings for the commands
described in the sections. Document 'project-list-file'.
(Project Buffer Commands): New section.
* doc/emacs/emacs.texi (Top): Add Project sections to the detailed
menu.
* etc/NEWS: Add entries for project.el, and mark documented entries as
appropriate.
Don't call undefined function elisp-eldoc-documentation-function (bug#42493)
* lisp/ielm.el (inferior-emacs-lisp-mode): Add
`elisp-eldoc-var-docstring' and `elisp-eldoc-funcall' as
`eldoc-documentation-functions' instead of the undefined
elisp-eldoc-documentation-function (bug#42493).
bug-reference auto-setup for IRC, implementation for ERC
* lisp/progmodes/bug-reference.el (bug-reference-setup-from-irc-alist):
Change SERVER-REGEXP to NETWORK-REGEXP in docstring.
* lisp/progmodes/bug-reference.el (bug-reference--maybe-setup-from-irc):
Change semantics from requiring a match of channel OR server to
requiring a match of both (if both are configured).
* lisp/progmodes/bug-reference.el (bug-reference-try-setup-from-erc):
New defun doing the auto-setup for ERC.
(bug-reference--run-auto-setup): Run bug-reference-try-setup-from-erc.
* etc/NEWS: Extend entry describing bug-reference auto-setup.
Philipp Stephani [Thu, 23 Jul 2020 11:48:43 +0000 (13:48 +0200)]
Fix memory leak for global module objects (Bug#42482).
Instead of storing the global values in a global 'emacs_value_storage'
object, store them as hash values alongside the reference counts.
That way the garbage collector takes care of cleaning them up.
* src/emacs-module.c (global_storage): Remove.
(struct module_global_reference): New pseudovector type.
(XMODULE_GLOBAL_REFERENCE): New helper function.
(module_make_global_ref, module_free_global_ref): Use
'module_global_reference' struct for global reference values.
(value_to_lisp, module_handle_nonlocal_exit): Adapt to deletion of
'global_storage'.
João Távora [Sat, 18 Jul 2020 23:48:43 +0000 (00:48 +0100)]
Don't needlessly request docs from ElDoc functions
Fixes: bug#42421
Do this conservatively for now: if the ElDoc helper buffer (as
returned by eldoc--doc-buffer) is visible and showing documentation
for the very same "situation" (as computed by the the new
eldoc--request-state helper), don't request that documentation from
sources again.
Before this change, not only was that request inefficient but if the
user invoked scroll-other-window to see more of the helper buffer,
that would eventually cause it to be reformatted and unexpectedly
recentered.
Later on, when a customizable list of documentation "sinks" is offered
to the user, say, something like eldoc-display-functions, this process
must be consolidated. In those circumstances, as soon as one of those
sinks signals that it doesn't have up-to-date documentation for the
state computed by eldoc--request-state, documentation will have to be
requested anew from eldoc-documentation-functions via
eldoc--invoke-strategy.
* lisp/emacs-lisp/eldoc.el (eldoc--request-docs-p): Rework from
eglot-display-message-p.
(eldoc--last-request-state): New variable.
(eldoc--request-state): New helper.
(eldoc--handle-docs): Memorize state of request in doc buffer.
(eldoc-print-current-symbol-info): Pass a token to
eldoc--request-docs-p.
(Version): Bump to 1.6.0
bc10e467f1 Backport: Rectify allout-widgets region undecoration so it... 82742e295d Backport: Resolve missing button-region keymap bindings. 2035ecca57 Backport: Provide missing let definition to prevent backgr... 3071cecda0 Backport: Don't let item decoration be disrupted by too-sh... 044960ead2 Backport: Fix allout-widgets-mode handling of edits to ite...
Robert Pluim [Tue, 21 Jul 2020 14:37:59 +0000 (16:37 +0200)]
Run custom-magic-reset in the customize buffer
If the user has navigated away from the customize buffer, then
clicking on a widget in the customize buffer applies changes in the
selected buffer rather than in the customize buffer. Pass the
customize buffer to 'custom-magic-reset' to avoid this.
* lisp/cus-edit.el (custom-magic-reset): Add optional buffer argument,
apply changes in that buffer.
(custom-notify): Pass the buffer containing the widget to
'custom-magic-reset'. (Bug#40788)
* lisp/allout-widgets.el (allout-item-icon-keymap,
allout-item-body-keymap, allout-cue-span-keymap, allout-widgets-mode):
Inherit from both (current-local-map) and (current-global-map). This
provides for missing global bindings when inheriting from
just (current-local-map), eg Esc-<.
Ken Manheimer [Mon, 6 Jul 2020 17:19:11 +0000 (13:19 -0400)]
Backport: Provide missing let definition to prevent background void-variable error.
* lisp/allout-widgets.el (allout-widgets-exposure-change-processor)
Let-declare handled-conceal, for reference through `(symbol-value)'
within the let body. (Because the error happens in an
after-change-functions hook, so it is caught and reported as a message
by allout-widgets-hook-error-handler.)
Ken Manheimer [Tue, 7 Jul 2020 14:32:03 +0000 (10:32 -0400)]
Resolve missing button-region keymap bindings.
* lisp/allout-widgets.el (allout-item-icon-keymap,
allout-item-body-keymap, allout-cue-span-keymap, allout-widgets-mode):
Inherit from both (current-local-map) and (current-global-map). This
provides for missing global bindings when inheriting from
just (current-local-map), eg Esc-<.
Ken Manheimer [Mon, 6 Jul 2020 17:19:11 +0000 (13:19 -0400)]
Provide missing let definition to prevent background void-variable error.
* lisp/allout-widgets.el (allout-widgets-exposure-change-processor)
Let-declare handled-conceal, for reference through `(symbol-value)'
within the let body. (Because the error happens in an
after-change-functions hook, so it is caught and reported as a message
by allout-widgets-hook-error-handler.)
* lisp/gnus/gnus-start.el (gnus-active-to-gnus-format):
Add suppressive comment. Prepending "^to\\.\\|" is redundant when
'gnus-ignored-newsgroups' already matches that pattern, but adding
logic here is not worth the trouble.
project.el: Add more docs and two new key bindings
* lisp/progmodes/project.el:
Add a longer description of the package and how to use it.
(project-prefix-map): Add entries for
'project-or-external-find-file' and
'project-or-external-find-regexp'.
* lisp/url/url-http.el (url-http-parse-headers): Parse redirect
URIs more like other web browsers (bug#42382).
RFC 7231 the Location header is defined to carry a URI-reference.
According to RFC 3986 it should be percent-encoded and thus should not
contain spaces. However, there are HTTP server implementation (notably
nginx) that do not do that. This makes Emacs url-http.el behave like
most other HTTP client implementatios. Also remove the stripping of
angle bracket quotes as they are not valid according to the RFCs.
Eric Abrahamsen [Sun, 19 Jul 2020 14:15:33 +0000 (16:15 +0200)]
Complete over the MIME types in gnus-summary-save-parts
* lisp/gnus/gnus-sum.el (gnus-summary-save-parts): Allow
completing over the parts in the first article in the list of the
process-marked articles (bug#39543).
gnus-button-alist: Prefer URL links to Elisp library links
* lisp/gnus/gnus-art.el (gnus-button-alist): Move the URL clauses
higher up the list before library link setup to prevent URLs ending in
".el" from failing to be recognized (and invalid library links being
created instead) (bug#39781).
Do window configuration change before killing Gnus buffers on exit
* lisp/gnus/gnus-sum.el (gnus-summary-exit): Do window
configuration changes before killing off the summary buffer, so
that the window conf machinery can return to a group-only
configuration (bug#40069).
Simplify dummy root subject before comparing it to the current article
* lisp/gnus/gnus-sum.el (gnus-summary-prepare-threads): Simplify both
the dummy root and the following article before comparing them,
otherwise both the former and the latter might display the thread's
subject even when gnus-summary-line-format contains "%s" (bug#40520).
Allow open-network-stream to use different TLS capability commands
* doc/lispref/processes.texi (Network): Document non-string
capability command.
* lisp/gnus/nntp.el (nntp-open-connection): Use HELP for Typhoon
and CAPABILITIES for everything else (bug#41960).
* lisp/net/network-stream.el (open-network-stream): Document
function variety of :capability-command.
(network-stream-open-starttls): Use it.
(network-stream-open-tls): Ditto.
(network-stream-open-shell): Ditto.
(network-stream--capability-command): New helper function.
João Távora [Sat, 18 Jul 2020 22:15:28 +0000 (23:15 +0100)]
Fix ElDoc bugs around eldoc-echo-area-use-multiline-p.
If the value is 'truncate-sym-name-if-fit andthe single docstring
doesn't fit in the echo area even when the symbol name is elided, that
step shouldn't be attempted. Also if the value is nil, really ensure
that only the first line is shown.
* lisp/emacs-lisp/eldoc.el (eldoc--handle-docs): Rework
'truncate-sym-name-if-fit case of eldoc-echo-area-use-multiline-p.
* lisp/net/eww.el (eww-open-file): Allow opening non-local Tramp
files (bug#40425).
(eww): Adjust calling convention to allow passing in data directly
via a buffer.
Eli Zaretskii [Sat, 18 Jul 2020 08:17:31 +0000 (11:17 +0300)]
Revert "Fix filename completion in shell mode buffers"
This reverts commit e4d17d8cb479ffeeb7dfb7320a1432722ac8df75.
Per bug#42383 discussions, the fix for bug#34330 probably
just works around the real issue, which is in pcomplete.el.
Eli Zaretskii [Sat, 18 Jul 2020 07:02:28 +0000 (10:02 +0300)]
Update systems using GnuTLS certificate files
* lisp/net/gnutls.el (gnutls-trustfiles): Update the names of the
systems in the comments. Reported by Richard Stallman <rms@gnu.org>
in
https://lists.gnu.org/archive/html/emacs-devel/2020-07/msg00455.html.
bug-reference auto-setup for IRC, implementation for rcirc
* lisp/progmodes/bug-reference.el (bug-reference-setup-from-irc-alist):
New defvar for configuring bug regexp and URL based on IRC channel and
server names.
(bug-reference--maybe-setup-from-irc): New defun doing the setup given
channel and server.
(bug-reference-try-setup-from-rcirc): New defun calling the above for
rcirc buffers.
(bug-reference--run-auto-setup): Enable the auto-setup for rcirc.
* etc/NEWS: Extend entry describing bug-reference auto-setup.
Fix NOT-CURRENT behaviour in text-property-search-backward
* lisp/emacs-lisp/text-property-search.el
(text-property-search-backward): Fix inconsistent behaviour of
S-TAB in eww (and other callers that use the NOT-CURRENT
behaviour) when there are adjacent elements
(bug#39239).
* src/image.c (gif_load): When unable to parse a GIF specified
via a data attribute, don't message the complete binary, because
that's not useful (bug#40850).
Make old aliases to gnus-child* commands work before Gnus is loaded
* lisp/gnus/gnus.el (gnus-slave-no-server, gnus-slave): Mark as
obsolete in a way that still lets them be used as interactive
commands before Gnus is loaded.
* lisp/gnus/gnus-agent.el (gnus-slave-unplugged): Ditto (bug#42401).
Stefan Kangas [Fri, 17 Jul 2020 01:23:15 +0000 (03:23 +0200)]
Show eww bookmarks buffer only if it's not empty
* lisp/net/eww.el (eww-list-bookmarks): Don't show buffer if there
are no bookmarks. (Bug#41385)
(eww-bookmark-prepare): Move signalling an error if there are no
bookmarks from here...
(eww-read-bookmarks): ...to here. Add new argument `error-out' to
control this.
(eww-next-bookmark, eww-previous-bookmark): Call
`eww-read-bookmarks'.
* lisp/gnus/gnus-agent.el (gnus-child-unplugged): Rename function
from gnus-slave-unplugged (and add the latter as an obsolete alias).
* lisp/gnus/gnus.el (gnus-other-frame-function): Adjust function
names in the defcustom to new naming scheme.
(gnus-other-frame-resume-function): Ditto.
(gnus): Adjust parameter names.
Eli Zaretskii [Thu, 16 Jul 2020 16:51:19 +0000 (19:51 +0300)]
Fix interrupt-process on MS-Windows
* src/w32proc.c (sys_kill): Test the status of the left Ctrl key
for the purpose of restoring it after simulating Ctrl-C. This
avoids leaving the left Ctrl key status in depressed state when
the user actually pressed the right Ctrl key. (Bug#42350)
Jonas Bernoulli [Mon, 20 Apr 2020 21:31:16 +0000 (23:31 +0200)]
* lisp/epa.el (epa-show-key): New command.
Users can move in `epa-key-list-mode' buffers using either
`next-line'/`previous-line' or `widget-forward'/`widget-backward'.
When using the first set of commands, then the cursor stays in the
current column and that normally is the first column. The key
widgets do not begin until the third character of their respective
lines.
All `epa' commands work regardless of whether the cursor is on the
widget or before them. The `epa-show-key' command did not exist until
now because the `widget-button-press' already performs its task. But
because the widgets don't span complete lines we actually need this
command too.
Jonas Bernoulli [Mon, 20 Apr 2020 21:33:44 +0000 (23:33 +0200)]
epa-key-list-mode-map: Use widget-keymap as parent keymap
Normally when one keymap is to be treated as the parent of another,
then that relationship is setup once at the time when the child is
being defined, i.e. at birth. For some reason, this was not done
here; instead `widget-keymap' is set as `epa-key-list-mode-map'
parent every time the former is setup to be used as the local map.
This appears to be a mistake. A few other keymaps use `widget-keymap'
as their parent and in those cases the relationship is established
just once. `epa-key-list-mode-map' is the only exception and because
there is absolutely no indication that that is justified, we remove
this inconsistency.
* lisp/epa.el (epa-key-list-mode-map): Set the parent of this keymap
while defining it.
* lisp/epa.el (epa--list-keys): Do not set the parent of the local
keymap here.
Jonas Bernoulli [Tue, 18 Feb 2020 15:56:16 +0000 (16:56 +0100)]
Cosmetic changes to epa libraries
These changes make the code more readable.
* lisp/epa-dired.el (epa-dired-do-decrypt, epa-dired-do-verify)
(epa-dired-do-sign, epa-dired-do-encrypt): Use dolist instead
of while.
* lisp/epa-file.el (epa-file-passphrase-callback-function):
Set just one variable per setq call.
Jonas Bernoulli [Tue, 18 Feb 2020 15:58:31 +0000 (16:58 +0100)]
Drop unnecessary backward compatibility aliases
We can assume that `encode-coding-string' and `decode-coding-string'
are available; they were added in 1997.
* lisp/epa-file.el (epa-file--encode-coding-string)
(epa-file--decode-coding-string): Remove aliases for
encode-coding-string and decode-coding-string.
* lisp/epa-file.el (epa-file-write-region): Use encode-coding-string
instead of removed epa-file--encode-coding-string.
Jonas Bernoulli [Tue, 18 Feb 2020 15:45:34 +0000 (16:45 +0100)]
* lisp/epa.el (epa-faces): Move definition.
Previously option `epa-mail-aliases' was the only option that was
defined right after the group `epa-faces' and right before all the
faces. Now it is defined with all the other options and thus before
the definition of the `epa-faces' group, which it does not belong to.