Lennart Borgman [Thu, 27 Jun 2019 17:08:42 +0000 (19:08 +0200)]
Add more fontification to regexp builder mode
* lisp/emacs-lisp/re-builder.el (reb-copy): Work in the presence
of newlines in the regexps.
(reb-change-syntax): Use a dedicated history variable.
(reb-fontify-string-re): Fontify sub-matches.
(reb-regexp-grouping-backslash, reb-regexp-grouping-construct):
New faces.
(reb-string-font-lock-keywords): New variable.
(reb-mark-non-matching-parenthesis): Match parenthesis.
(reb-restart-font-lock): New function.
* lisp/emacs-lisp/re-builder.el (reb-mode-map): Add divider some
dividers (bug#6347).
* lisp/textmodes/refill.el (refill-post-command-function): Make
default-indent-new-line work as indent-new-comment-line.
* lisp/textmodes/refill.el (refill-post-command-function): Bind
`M-C-j' and `M-j' to default-indent-new-line instead of
indent-new-comment-line to allow overriding via
`comment-line-break-function' (bug#12413).
Paul Eggert [Thu, 27 Jun 2019 09:33:36 +0000 (02:33 -0700)]
Tweak ‘error’ and ‘user-error’ doc strings
* lisp/net/tramp.el (tramp-user-error):
* lisp/subr.el (user-error):
Say that user errors are sometimes called pilot errors.
* lisp/subr.el (error, user-error):
Reorder wording to discuss mechanism first, then formatting advice,
rather than going back and forth between the two topics.
Tighten up the wording a bit.
For discussion, see the following thread:
https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg01196.html
https://lists.gnu.org/archive/html/emacs-devel/2019-06/msg00967.html
* etc/TODO: Remove gnus-bug from list of obsolete bug-reporting
commands now that it is implemented in terms of report-emacs-bug.
`replace-regexp-in-string' omits the first START characters of the
input string in its return value. This is a clear bug, but fixing it
probably causes more trouble; document the behaviour instead (bug#36372).
* doc/lispref/searching.texi (Search and Replace)
* lisp/subr.el (replace-regexp-in-string):
Document current behaviour.
Reported by Marco Wahl <marcowahlsoft@gmail.com>.
Update `Commentary:` to use the new command names.
(pages--ctl-x-ctl-p-map): Fix `mark-page` binding.
(pages-directory-mode-map): Update `add-new-page` => `pages-add-new-page`.
Eli Zaretskii [Wed, 26 Jun 2019 16:23:34 +0000 (19:23 +0300)]
Support invoking Emacs via a symlink on MS-Windows
* src/w32.c (w32_my_exename): Resolve symlinks in the
executable name, to support searching for the pdumper file
when the executable is found via a symlink.
* src/emacs.c (load_pdump): Add a comment about symlink
resolution on Windows.
Fdocumentation_property: Return doc string for indirect variables
* src/doc.c (Fdocumentation_property): When dealing with indirect
variables (i.e., aliases), also check the symbol being pointed to
for the doc string (bug #17180).
* lisp/emacs-lisp/rx.el (rx-regexp, rx-literal): Check the cadr of the
form for stringness, not the form itself.
* test/lisp/emacs-lisp/rx-tests.el (rx-to-string-lisp-forms): New test.
Noam Postavsky [Wed, 26 Jun 2019 02:04:13 +0000 (22:04 -0400)]
Merge from emacs-26
e62ad04963 Fix sgml-mode handling of quotes within parens (Bug#36347) 06b35b2f92 ; * lisp/frame.el: Enhance add-variable-watcher commentary. 572e34bb6f Rename 'make-symbolic-link' argument NEWNAME to LINKNAME 04477adedc Check that length of data returned by sysctl is non-zero 81535eeadb * test/lisp/progmodes/python-tests.el (python-virt-bin): D... 9d48979ca8 Fix Python tests depending on system-type fcf6cc3177 Fix problem with wdired test when symlinks cannot be created. 4701e0663e Improve wording of documentation of click events
Noam Postavsky [Fri, 21 Jun 2019 11:09:44 +0000 (07:09 -0400)]
Don't bind search-spaces-regexp around possible autoload (Bug#35802)
* lisp/isearch.el (isearch-search-fun-default): Move possible autoload
trigger outside let-binding of search-spaces-regexp.
* lisp/char-fold.el (char-fold-make-table): Remove no longer needed
workaround.
* lisp/info.el (Info-search-whitespace-regexp):
* lisp/isearch.el (search-whitespace-regexp):
* src/search.c (syms_of_search) <search-spaces-regexp>: Add warning
about adding capturing groups to the value.
* test/lisp/char-fold-tests.el: Remove, binding search-spaces-regexp
to a different should be considered a bug.
Noam Postavsky [Fri, 14 Jun 2019 12:43:17 +0000 (08:43 -0400)]
Support (rx (and (regexp EXPR) (literal EXPR))) (Bug#36237)
* lisp/emacs-lisp/rx.el (rx-regexp): Allow non-string forms.
(rx-constituents): Add literal constituent, which is like a plain
STRING form, but allows arbitrary lisp expressions.
(rx-literal): New function.
(rx-compile-to-lisp): New variable.
(rx--subforms): New helper function for handling subforms, including
non-constant case.
(rx-group-if, rx-and, rx-or, rx-=, rx->=, rx-repeat, rx-submatch)
(rx-submatch-n, rx-kleene, rx-atomic-p): Use it to handle non-constant
subforms.
(rx): Document new form, wrap non-constant forms with concat call.
* test/lisp/emacs-lisp/rx-tests.el (rx-tests--match): New macro.
(rx-nonstring-expr, rx-nonstring-expr-non-greedy): New tests.
* etc/NEWS: Announce changes.
Noam Postavsky [Mon, 24 Jun 2019 01:27:43 +0000 (21:27 -0400)]
Fix sgml-mode handling of quotes within parens (Bug#36347)
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize): Use
syntax-ppss-table if set. This is only needed on the release branch,
on master the caller (syntax-propertize) already does this.
(sgml-mode): Set syntax-ppss-table to sgml-tag-syntax-table. This
correctly classifies parens as punctuation, so they won't confuse the
parser.
* test/lisp/textmodes/sgml-mode-tests.el (sgml-tests--quotes-syntax):
New test copied from master, with two cases added for this bug.
Paul Eggert [Tue, 25 Jun 2019 22:54:37 +0000 (15:54 -0700)]
Prefer PATH_MAX to MAXPATHLEN
PATH_MAX is standardized, MAXPATHLEN is not.
Also, the Gnulib pathmax module fixes some rare bugs with PATH_MAX.
So prefer PATH_MAX to MAXPATHLEN unless we know the latter is
also correct (for some platform-specific code).
* admin/merge-gnulib (GNULIB_MODULES): Add pathmax.
This module was already present, as a dependency of canonicalize-lgpl,
but now Emacs is using it directly. Sort.
* lib-src/emacsclient.c: Include stdint.h, pathmax.h.
(get_current_dir_name): Sync to current src/sysdep.c.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* src/sysdep.c: Include pathmax.h.
(get_current_dir_name_or_unreachable):
Use PATH_MAX instead of MAXPATHLEN.
Dima Kogan [Tue, 25 Jun 2019 22:49:24 +0000 (00:49 +0200)]
View-search-... now hit all the matches, regardless of window position
* lisp/view.el (view-search): Jump to the next/prev occurrence of
the search, even if it's displayed in the buffer (bug#18131).
This seems more logical than the previous (undocumented) behaviour.
Emilio C. Lopes [Tue, 25 Jun 2019 21:40:22 +0000 (23:40 +0200)]
Support opening a new connection when reverting a telnet buffer
* net/telnet.el (telnet-connect-command): New variable.
(telnet-revert-buffer): New function.
(telnet-mode): Use `telnet-revert-buffer' as `revert-buffer-function'.
(telnet, rsh): Set `telnet-connect-command' accordingly (bug#18312).
* lisp/files.el (file-size-human-readable): Open code string-empty-p
call. This was the single occurrence of a subr-x.el function in
files.el, which does not (yet) load subr-x.el.
Highlight zsh glob flags and qualifiers in sh-mode
* lisp/progmode/sh-script.el (sh-syntax-propertize-function):
Add regexps to highlight zsh glob flags and alternate qualifiers
without mistaking them for comments. (bug#19455).
Phil Sainty [Tue, 25 Jun 2019 14:02:12 +0000 (16:02 +0200)]
Fix `goto-address-url-regexp'
* lisp/net/goto-addr.el (goto-address-uri-schemes-ignored): New
variable.
(goto-address-uri-schemes): Ditto.
(goto-address-url-regexp): Use them to compose the final regexp.
* lisp/net/goto-addr.el: The URI schemes to be recognised by
`goto-address-mode' were not regexp-quoted (Bug#23343).
Tino Calancha [Tue, 25 Jun 2019 13:42:17 +0000 (15:42 +0200)]
Make winner restore point in all windows that display a buffer
* lisp/window.el (window--before-delete-windows): New defun.
(delete-window, delete-other-windows): Use it.
* lisp/winner.el (winner-set): Use marker in 'window-prev-buffers'
when available and different than the value returned by
'winner-get-point' (bug#23621).
Robert Weiner [Tue, 25 Jun 2019 12:08:49 +0000 (14:08 +0200)]
Unlispify even more in custom-unlispify-menu-entry
* lisp/cus-edit.el (custom-unlispify-menu-entry): Also allow : and
/ as separators in symbols when making the symbols look more
human-readable (bug#23986).
* lisp/textmodes/tex-mode.el (tex-verbatim-environments): Replace
(delq t ...) with more usual (memq nil ...).
(latex-noindent-environments, latex-noindent-commands): Fix typos
and thinkos in safe-local-variable logic.
* admin/unidata/Makefile.in (extraclean): Don't delete macuvs.h,
because it's a checked-in file, and make targets altering
checked-in files is confusing.
Antoine Beaupré [Tue, 25 Jun 2019 10:58:36 +0000 (12:58 +0200)]
Add imenu support to package-menu-mode
* lisp/vc/vc-git.el (vc-git-grep-template): Include <C> in
template to be more consistent with lgrep/rgrep (bug#35326). This
will introduce the --color and -i flags to the "git grep" command.
Alan Mackenzie [Tue, 25 Jun 2019 08:52:38 +0000 (08:52 +0000)]
Fix documentation of inhibit-modification-hooks in overlays + text properties
This fixes bug #25111.
* doc/lispref/display.text (Overlay Properties): For the hook property
modification-hooks, state that inhibit-modification-hooks is bound to non-nil
when calling its functions. This also applies to insert-in-front-hooks and
insert-behind-hooks, which refer to modification-hooks.
* doc/lispref/text.texi (Special Properties): For the hook property
modification-hooks, state that inhibit-modification-hooks is NOT bound to
non-nil when calling its functions. For the hooks insert-in-fron-hooks and
insert-behind-hooks, state that that variable does get bound to non-nil.
Hong Xu [Mon, 24 Jun 2019 23:22:23 +0000 (01:22 +0200)]
Add imenu support to package-menu-mode
* gnus-cite.el (gnus-message-citation-mode): Fontify if the major
mode is derived from message-mode (not necessarily equal to
message-mode) (bug#25124).
Damien Cassou [Mon, 24 Jun 2019 22:55:45 +0000 (00:55 +0200)]
Add imenu support to package-menu-mode
* lisp/emacs-list/package.el
(package--imenu-prev-index-position-function
package--imenu-extract-index-name-function): Add Imenu functions
to package-menu-mode (bug#27134).
* src/xdisp.c (message_to_stderr): When running as a batch
process, the output from `message' goes to stderr, and has a
newline appended. Rewrite the code so that only one fwrite is
performed to enable messages that are shorter than PIPE_BUF
(usually 4096 on modern operating systems) are written out as one
chunk, as this will ensure that the messages are not interleaved
with messages from other processes that are writing at the same
time. This does not affect other stderr outputs, just the ones
from `message'.
Kaushal Modi [Mon, 24 Jun 2019 22:42:20 +0000 (00:42 +0200)]
Add example for enabling minor modes in .dir-local.el
* doc/emacs/custom.texi (Directory Variables): Add an example that
shows how a minor mode can be enabled in a .dir-local.el (Bug#27639).
Clarify that indent-tabs-mode is not a minor mode.
Stefan Monnier [Mon, 24 Jun 2019 21:15:11 +0000 (17:15 -0400)]
* lisp/svg.el: Prepare for distribution via GNU ELPA
Add a Version: and Package-Requires:.
Don't require subr-x.
Bring Commentary: from the GNU ELPA version of the package.
(svg-remove): Don't use when-let*.
Eric Abrahamsen [Tue, 30 Apr 2019 23:00:46 +0000 (16:00 -0700)]
Tweaks to html mode
* lisp/textmodes/sgml-mode.el (sgml-attributes): Add the "class" and
"id" attributes when needed.
(html-mode-map): Add the `html-div' and `html-span' commands to the
`html-quick-keys' map.
(html-ordered-list, html-unordered-list, html-paragraph): Use the
"\n" element properly.
(html-div, html-span): New HTML skeletons.
Eli Zaretskii [Mon, 24 Jun 2019 17:06:34 +0000 (20:06 +0300)]
Fix MS-Windows build as followup to pdumper executable lookup
* src/w32.c (w32_my_exename): New function.
* src/w32.h (w32_my_exename): Add prototype.
* src/emacs.c (load_pdump_find_executable) [WINDOWSNT]: Find
the actual file name of the program without looking along
PATH, by calling w32_my_exename.
* nt/mingw-cfg.site (ac_cv_func_canonicalize_file_name)
(ac_cv_func_realpath, gl_cv_func_realpath_works): Disable
testing.
* nt/gnulib-cfg.mk (OMIT_GNULIB_MODULE_canonicalize-lgpl): Set
to true.
* lisp/iimage.el (iimage-recenter): Call `recenter-top-bottom'
instead of `recenter', since that's the default function for `C-l'
(bug#27610). Suggested by Arne Frederic Maria Döring.
Michael Albinus [Mon, 24 Jun 2019 15:36:00 +0000 (17:36 +0200)]
Improve error handling in Tramp
* lisp/net/tramp-compat.el (ls-lisp): Require.
* lisp/net/tramp.el (ls-lisp-use-insert-directory-program):
Don't declare.
(tramp-current-connection): Adapt docstring.
(tramp-debug-message): Adapt function names.
(tramp-error, tramp-run-real-handler): Let-bind `signal-hook-function'.
(tramp-signal-hook-function): New defun.
(tramp-debug-on-error, tramp-condition-case-unless-debug): Remove.
(tramp-file-name-handler): Handle `tramp-current-connection'.
Let-bind `signal-hook-function'. Use `unwind-protect' instead of
`tramp-condition-case-unless-debug'.
(tramp-handle-insert-directory): Don't require ls-lisp.
(tramp-process-actions): Check, that
`tramp-password-save-function' is non-nil.
(tramp-equal-remote): Handle the case both files are local.
* test/lisp/net/tramp-tests.el (tramp--test-instrument-test-case):
Do not bind `tramp-debug-on-error'.
(tramp--test-ignore-make-symbolic-link-error): Make error handler
more explicit about the error.
Add new commands to widen/narrow tabulated list columns
* doc/emacs/buffers.texi: Document widen/contracting commands in
tabulated list mode.
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-mode-map): Add
keystrokes.
(tabulated-list-widen-current-column): New command.
(tabulated-list-narrow-current-column): Ditto. The code was
written by Boruch Baum and then tweaked by Drew Adams (bug#32106)
before some white-space changes before the commit.
* lisp/dired-aux.el (dired-compress-file-suffixes): Add suffixes for
zstd compressed tarballs and other files.
(dired-compress-file): Treat options found in
`dired-compress-file-suffixes' as arguments instead of part of the
program name.
Keith Amidon [Mon, 6 May 2019 03:21:43 +0000 (20:21 -0700)]
Minimize entry parsing in auth-source-pass
Prior to this commit, while searching for the most applicable entry
password-store entries were decrypted and parsed to ensure they were
valid. The entries were parsed in the order they were found on the
filesystem and all applicable entries would be decrypted and parsed,
which varied based on the contents of the password-store and the entry
to be found.
This is fine when the GPG key is cached and each entry can be
decrypted without user interaction. However, for security some people
have their GPG on a hardware token like a Yubikey setup so that they
have to touch a sensor on the toke for every cryptographic operation,
in which case it becomes inconvenient as each attempt to find an entry
requires a variable number of touches of the hardware token.
The implementation already assumes that names which contain more of
the information in the search key should be preferred so there is an
ordering of preference of applicable entries. If the decrypt and
parsing is removed from the initial identification of applicable
entries in the store then in most cases a single decrypt and parse of
the most preferred entry will suffice, improving the experience for
hardware token users that require interaction with the token.
This commit implements that strategy. It is in spirit a refactor of
the existing code.
* lisp/auth-source-pass.el (auth-source-pass--matching-entries): New
function, generate an ordered list of regular expression matchers for
all possible names that could be in the password-store for the entry
to be found and then makes a pass over the password-store entry names
accumulating the matching entries in a list after the regexp that
matched. This implementation ensures the password-store entry list
still only has to be scanned once.
(auth-source-pass--find-match-unambiguous): Use it to obtain candidate
entries and then parse them one by one until an entry containing the
desired information is located. When complete, return the parsed data
of the entry instead of the entry name so that the information can be
used directly to construct the auth-source response.
(auth-source-pass--build-result): Update accordingly.
(auth-source-pass--find-match): Update docstring accordingly.
(auth-source-pass--select-one-entry)
(auth-source-pass--entry-valid-p)
(auth-source-pass--find-all-by-entry-name)
(auth-source-pass--find-one-by-entry-name): Remove.
(auth-source-pass--select-from-entries)
(auth-source-pass--accumulate-matches)
(auth-source-pass--entry-reducer)
(auth-source-pass--generate-entry-suffixes)
(auth-source-pass--domains)
(auth-source-pass--name-port-user-suffixes): New functions.
* test/lisp/auth-source-pass-tests.el: One test case was added to the
test suite to verify that only the minimal number of entries are
parsed in common cases. The
auth-source-pass-only-return-entries-that-can-be-open test case had to
be re-implemented because the function it was used eliminated as the
functionality is provided elsewhere. All the other fairly substantial
changes to the test suite are the result of mechanical changes that
were required to adapt to auth-source-pass--find-match returning the
data from a parsed password-store entry instead of the entry name.
Keith Amidon [Tue, 30 Apr 2019 14:52:14 +0000 (07:52 -0700)]
Split out the attribute retrieval form auth-source-pass-get
Eliminate the need to repeatedly retrieve and parse the data for the
entry. This is generally a good thing since it eliminates repetitions
of the same crypto and parsing operations. It is especially valuable
when protecting an entry with a yubikey with touch required for crypto
operations as it eliminates the need to touch the yubikey sensor for
each attribute retrieved.
* lisp/auth-source-pass.el (auth-source-pass-get): Extract some code to
`auth-source-pass--get-attr'.
(auth-source-pass--get-attr): New function to get a field value from a
parsed entry.
(auth-source-pass--build-result): Make use of
`auth-source-pass--get-attr` to avoid repeated parsing.