Most newer servers return a vector of 'DocumentSymbol' as a response
to 'textDocument/documentSymbol'. It's not worth trying to dumb this
down to imenu format of 'SymbolInformation' vectors.
This lays groundwork for the forthcoming "breadcrumb" feature of
bug#58431.
* lisp/progmodes/eglot.el
(eglot--imenu-SymbolInformation, eglot--imenu-DocumentSymbol): New
helpers.
(eglot-imenu): Rework.
* lisp/electric.el (electric-indent-local-mode)
(electric-layout-local-mode, electric-quote-local-mode):
* lisp/elec-pair.el (electric-pair-local-mode): Adjust usage.
* lisp/emacs-lisp/gv.el (make-obsolete-generalized-variable): Move
since we're using it earlier in the file.
(buffer-local-value): Make obsolete as a generalized variable
since the semantics are unclear (bug#26624).
This fixes bug#20846 where it transpired that there is no good reason
to shy away from auto-indenting inside comments and strings.
(electric-indent-post-self-insert-function): Don't check syntax-ppss.
Fixes: bug#35254
Do this even when electric-indent-inhibit is t, except when the
newline insertion is being performed by electric-layout-mode.
* lisp/electric.el (electric-indent-post-self-insert-function):
Reindent previous line unless operating under
electric-layout-mode.
(electric-layout-post-self-insert-function-1): Bind
electric-indent-inhibit to 'electric-layout-mode.
* test/lisp/electric-tests.el
(electric-layout-control-reindentation): New test.
Make it possible to control the relative ordering of functions on hooks by
specifying `depth` in the same was as was possible with `add-function`.
* lisp/electric.el (electric--sort-post-self-insertion-hook):
Delete function.
(electric-indent-mode, electric-layout-mode, electric-quote-mode):
* lisp/elec-pair.el (electric-pair-mode): Use new `depth` arg instead of
electric--sort-post-self-insertion-hook.
* lisp/emacs-lisp/syntax.el (syntax-propertize, syntax-ppss):
Use new `depth` arg to make sure noone accidentally gets added
after syntax-ppss-flush-cache.
* doc/lispref/modes.texi (Setting Hooks): Document new `depth` arg.
* test/lisp/subr-tests.el (subr-tests-add-hook-depth): New test.
Restore lines saying "Maintainer: emacs-devel@gnu.org" when there is
no special maintainer for a file. Although this wasn't documented
it was common practice and removing the lines didn't have consensus.
* lisp/electric.el (electric-indent-functions-without-reindent):
* lisp/indent.el (indent-according-to-mode): Check for
indent-relative-first-indent-point in addition to its obsolete alias
indent-relative-maybe.
* lisp/obsolete/vi.el (vi-com-map): Use
indent-relative-first-indent-point in place of its obsolete alias
indent-relative-maybe.
This fixes a serious bug introduced previously
electric-pair-inhibit-if-helps-balance and
electric-pair-skip-if-helps-balance, whereby "innocent" markers were
being pushed by those function's new save-change-and-restore
semantics. The fix can probably still be improved.
It also adds comments to parts of the code, where deemed necessary.
* lisp/elec-pair.el (electric-pair--insert): Add comment.
(electric-pair--save-literal-point-excursion): New helper macro.
(electric-pair-inhibit-if-helps-balance)
(electric-pair-skip-if-helps-balance): Don't use
insert-before-markers since it may hurt other markers that have
nothing to do with the 'save-excursion'.
(electric-pair-post-self-insert-function): Use
electric-pair--save-literal-point-excursion.
* lisp/electric.el (electric-indent-post-self-insert-function):
Remove lexical variable.
This aims to solve problems with indentation. Previously in, say, a
js-mode buffer with electric-layout-rules set to
(?\{ before after)
(?\} before)
would produce an intended:
function ()
{
<indented point>
}
The initial state
function () {
Would go immediately to the following by e-p-m
function () {}
Only then would e-l-m be applied to } first, and then again to {.
This makes lines indent in the wrong order, which can be a problem in
some modes.
The way we fix this is by reversing the order of e-p-m and e-l-m in
the post-self-insert-hook (and also fixing a number of details that
this uncovered). In the end this changes the sequence from
function () {
By way of e-l-m becomes:
function () <newline>
{
<newline>
The e-p-m inserts the pair
function () <newline>
{
<newline>}
And then e-l-m kicks in for the pair again, yielding the desired result
function () <newline>
{
<indented point>
}
* lisp/elec-pair.el (electric-pair--insert): Bind
electric-layout-no-duplicate-newlines.
(electric-pair-inhibit-if-helps-balance)
(electric-pair-skip-if-helps-balance): Use insert-before-markers,
playing nice with save-excurion.
(electric-pair-post-self-insert-function): Go to correct position
before checking electric-pair-inhibit-predicate and
electric-pair-skip-self predicate.
(electric-pair-post-self-insert-function): Increase priority to
50.
* lisp/electric.el (electric-indent-post-self-insert-function):
Delete trailing space in reindented line only if line was
really reindented. Rewrite comment.
(electric-layout-allow-duplicate-newlines): New variable.
(electric-layout-post-self-insert-function-1): Rewrite comments.
Honours electric-layout-allow-duplicate-newlines. Don't reindent
previous line because racecar.
* test/lisp/electric-tests.el: New test.
(plainer-c-mode): Move up.
(electric-modes-int-main-allman-style)
(electric-layout-int-main-kernel-style): Simplify
electric-layout-rules.
(electric-layout-for-c-style-du-jour): New helper.
(electric-layout-plainer-c-mode-use-c-style): New test.
An element of electric-layout-rules is either a function or a pair
(CHAR . WHERE), and WHERE can't be a function anymore.
* lisp/electric.el (electric-layout-post-self-insert-function-1):
Remove leftover line.
Entries in electric-layout-rules can specify multiple
newline-related actions which are executed in order of appearance.
Also, have it play nice with electric-pair-mode when inserting a
newlines, particularly with electric-pair-open-newline-between-pairs.
Entries in electric-layout-rules can also be functions. Among other
things, the logic behind electric-pair-open-newline-between-pairs
could now be moved to electric-layout-mode, but this commit doesn't do
that yet.
This change was motivated by bug#33794 and is an alternative solution
to the problem reported in that bug.
* lisp/electric.el (electric-layout-rules): Adjust docstring.
(electric-layout-post-self-insert-function): Call
electric-layout-post-self-insert-function-1.
(electric-layout-post-self-insert-function-1): Rename from
electric-layout-post-self-insert-function. Redesign.
(electric-layout-local-mode): New minor mode.
* test/lisp/electric-tests.el (electric-layout-int-main-kernel-style)
(electric-layout-int-main-allman-style)
(electric-modes-in-c-mode-with-self-insert-command)
(electric-pair-mode-newline-between-parens)
(electric-layout-mode-newline-between-parens-without-e-p-m)
(electric-layout-mode-newline-between-parens-without-e-p-m-2): New
tests.
(plainer-c-mode): New helper.
Add a paragraph to minor mode's docstring documenting the mode's ARG
usage if the supplied docstring doesn't already contain the word "ARG".
* easy-mmode.el (easy-mmode--arg-docstring): New const.
(easy-mmode--arg-docstring): New function.
(define-minor-mode): Use them.
Remove argument documentation from all minor modes.
* lisp/electric.el (electric-indent-post-self-insert-function):
Suppress errors from indent code, but don't suppress errors from
elsewhere in this function. That way, if trouble is encountered with
electric indent "not working", the error should be reproducible by
calling indent directly (as is the case for Bug#18764), or else it's
from the electric indent code and will be reported normally.
* lisp/electric.el (electric-quote-post-self-insert-function): Skip
over escape characters when determining whether a context-sensitive
quote should be opening or closing.
* test/lisp/electric-tests.el
(electric-quote-replace-double-escaped-open)
(electric-quote-replace-double-escaped-close): New unit tests.
Before this commit, if 'electric-quote-replace-double' is non-nil,
typing " '" turned into " ‘" even if
'electric-quote-context-sensitive' was nil.
* lisp/electric.el (electric-quote-post-self-insert-function): Insert
context-sensitive double quote only if the last character is actually
a double quote character.
* test/lisp/electric-tests.el
(electric-quote-replace-double-no-context-single): New unit test.
63b04c11d5 Fix copyright years by hand
5c7dd8a783 Update copyright year to 2018
220a9ecba1 Merge from Gnulib
312c565566 Don't add empty keyboard macro to macro ring (Bug#24992)
39ca289a7a Allow customization of decoding of "man" command
f8240815ea * etc/NEWS: Add security consideration note on passphrase ...
0c78822c70 Fix subtle problem with scroll-down when scroll-margin is ...
acd289c5a4 Fix problems with indexing in User manual
b240c7846b * lisp/help.el (describe-key): Only (copy-sequence elt) wh...
e879a5444a * src/buffer.c (Frestore_buffer_modified_p): Fix bug#29846
81b1028b63 Improve documentation of 'inhibit-modification-hooks' and ...
7175496d7a Fix doc string of 'enable-recursive-minibuffers'
5b38406491 Fix documentation of delsel and of killing text
# Conflicts:
# etc/NEWS
# etc/refcards/ru-refcard.tex
6e6bf60 Don't let delete_frame select a tooltip frame (Bug#27647)
e9dd580 Filter obtrusive events in help-read-key-sequence.
90075e8 Fix symlink flag in tramp-gvfs-handle-file-attributes
c355529 Fix bug in tramp-handle-file-truename
4c21d04 Fix a typo in doc string of electric-indent-functions-without...
319c2de Avoid assertion violations in echo_area_display
63c7733 ; * lisp/ido.el (ido-find-alternate-file): Doc fix. (Bug#29278)
cbd319a Fix case-folding in Occur
29520b0 Fix quick-calc in C mode with hex values
3e80124 Improve documentation of dired-next/prev-marked-file
90add18 Prevent aborts in line-move-visual
648c128 More fixes in src/.gdbinit
104f3e5 Document how to enter whitespace when using grep-read-files