Alan Mackenzie [Thu, 11 Feb 2021 21:37:45 +0000 (21:37 +0000)]
Make recursive minibuffers and recursive edits work together
* lisp/minibuffer.el (exit-minibuffer): When in a minibuffer, throw an error
should the command loop nesting level be wrong.
* src/lisp.h (minibuffer_quit_level): declare as an extern.
(command_loop_level): Move definition from src/window.h
* src/window.h (command_loop_level): move definition to src/lisp.h.
* src/eval.c (minibuffer_quit_level): Move this variable to file level from
being a static inside internal_catch.
(internal_catch): Simplify the logic.
* src/minibuf.c (Vcommand_loop_level_list): New variable.
(move_minibuffer_onto_frame): Set the major mode of *Minibuf-0*.
(Fminibuffer_innermost_command_loop_p): New primitive.
(Fabort_minibuffers): Check the command loop level before throwing t to 'exit,
and set minibuffer_quit_level too.
(read_minibuf): New variable calling_window.
Before stacking up minibuffers on the current mini-window, check that the
mini-window is not the current one.
Do not call choose_minibuf_frame from read_minibuf's unwinding process.
Bind calling_frame and calling_window over the recursive edit.
Set the new minibuffer's major mode directly.
Remove the switching away from the minibuffer after the recursive edit.
(get_minibuffer): Record the command loop level in new variable
Vcommand_loop_level_list. No longer set the major mode of a returned
minibuffer.
(minibuf_c_loop_level): New function.
(read_minibuf_unwind): New variables calling_frame, calling_window are unbound
from the binding stack. Remove old variable `window', which could not be set
reliably to the expired mini-window.
The expired minibuffer is determined as the nth in the list, rather than the
contents of the current or previous mini-window.
Switch the current window away from the mini-window here (moved from
read_minibuf).
Stefan Kangas [Thu, 11 Feb 2021 18:18:38 +0000 (19:18 +0100)]
Fix two Emacs version references in misc manuals
* doc/misc/forms.texi: Fix reference to Emacs version.
* doc/misc/remember.texi: Fix version reference to indicate Emacs
version instead of version of remember. The corresponding version
variable and header have been marked obsolete.
Fix Octave double-quoted string line continuations
* lisp/progmodes/octave.el (octave-string-continuation-marker): New
defconst after octave-continuation-string.
(octave-continuation-string): Mention it in docstring.
(octave-maybe-insert-continuation-string): Mark unused function as
obsolete.
(octave-help-function): Simplify action.
(octave--indent-new-comment-line): Insert
octave-string-continuation-marker instead of
octave-continuation-string within double-quoted strings (bug#46420).
(octave-indent-new-comment-line):
* etc/NEWS: Describe new behavior.
Stefan Monnier [Wed, 10 Feb 2021 22:47:18 +0000 (17:47 -0500)]
* lisp/play/decipher.el: Use lexical-binding
(decipher-mode-syntax-table): Move initialization into declaration.
(decipher-mode, decipher-stats-mode): Use `define-derived-mode`.
(decipher-stats-buffer): Use `buffer-local-value`.
Juri Linkov [Wed, 10 Feb 2021 19:37:47 +0000 (21:37 +0200)]
Fix ediff even/odd faces to increase their contrast and readability
* lisp/vc/ediff-init.el (ediff-even-diff-A, ediff-even-diff-B)
(ediff-even-diff-C, ediff-even-diff-Ancestor, ediff-odd-diff-A)
(ediff-odd-diff-B, ediff-odd-diff-C): Add :distant-foreground
"Black" for light background. For dark background
add :distant-foreground "White", and use darker shades of grey
for background colors (bug#46396).
Paul Eggert [Wed, 10 Feb 2021 18:55:42 +0000 (10:55 -0800)]
Simplify and speed up after-find-file
Use newer primitives like file-accessible-directory-p to simplify
and speed up longstanding code in after-find-file.
* lisp/files.el (after-find-file):
Prefer file-exists-p + file-symlink-p to file-attributes +
file-symlink-p + file-chase-links + file-exists-p.
Prefer file-accessible-directory-p to directory-file-name +
file-attributes.
Prefer file-directory-p to file-name-directory + file-exists-p.
Stefan Monnier [Wed, 10 Feb 2021 18:12:09 +0000 (13:12 -0500)]
* lisp/emacs-lisp/edebug.el: Tweak last change
Use generic functions i.s.o `edebug--spec-op-function`.
<toplevel>: No need to register the &foo and :foo handler any more.
(edebug--handle-&-spec-op, edebug--handle-:-spec-op): New generic functions.
(edebug-match-specs): Use them.
(edebug--get-spec-op): Remove function.
(edebug-match-&optional, edebug-match-&rest, edebug-match-&or)
(edebug-match-¬, edebug-match-&key, edebug-match-&error)
(edebug-match-&define): Turn functions into methods of
`edebug--handle-&-spec-op`.
(edebug-match-:name, edebug-match-:unique): Turn functions into methods of
`edebug--handle-:-spec-op`.
The `edebug-form-spec` symbol property was used to store two different things:
the handlers for spec elements like `body` and the handlers for
spec operators like `&or`. But these two sets use different calling
conventions, so they're fundamentally incompatible.
So, move the handlers to spec operators to the new property
`edebug--spec-op-function`. This unbreaks Edebugging of:
(cl-flet ((f (&rest x) x)) 3)
* lisp/emacs-lisp/edebug.el <toplevel>: Split the alist of built in
spec elements into normal spec element and spec ops.
(edebug--get-spec-op): New function.
(edebug-match-specs): Use it.
(edebug-match-:name): Rename from `edebug-match-colon-name`.
This bug was introduced by the lexical variable constant propagation
mechanism. It was discovered by Michael Heerdegen.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-let-form)
(byte-optimize-body): Let the effects of a local defvar declaration be
scoped by let and let*, not any arbitrary Lisp expression body (such
as progn).
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--get-vars)
(bytecomp-local-defvar): New test.
Stefan Kangas [Wed, 10 Feb 2021 03:48:43 +0000 (04:48 +0100)]
Make texinfmt-version variable obsolete
* lisp/textmodes/texinfmt.el (texinfmt-version): Make variable and
command obsolete in favour of 'emacs-version'.
(texinfo-format-region, texinfo-format-buffer-1): Use
'emacs-version' instead of above obsolete variable.
Stefan Kangas [Wed, 10 Feb 2021 01:07:55 +0000 (02:07 +0100)]
Convert many manual cedet tests to ert
* test/manual/cedet/cedet-utests.el
(cedet-files-utest): Move test from here...
* test/lisp/cedet/cedet-files-tests.el: ...to this new file.
* test/manual/cedet/srecode-tests.el
(srecode-document-function-comment-extract-test): Move test from
here...
* test/lisp/cedet/srecode/document-tests.el: ...to this new file.
* test/manual/cedet/cedet-utests.el
(inversion-unit-test): Move test from here...
* test/lisp/cedet/inversion-tests.el: ...to this new file.
* test/manual/cedet/semantic-tests.el
(semantic-gcc-test-output-parser): Move test from here...
* test/lisp/cedet/semantic/bovine/gcc-tests.el: ...to this new file.
* test/manual/cedet/semantic-tests.el
(semantic-test-data-cache): Move test from here...
* test/lisp/cedet/semantic/fw-tests.el: ...to this new file.
* lisp/vc/vc-dir.el (vc-default-dir-printer): Add check for the
"ignored" status and make 'vc-dir-status-edited' the default face.
Also extend condition for more states that qualify as "warnings".
(vc-dir-ignored, vc-dir-status-ignored): Rename face for consistency.
* lisp/vc/vc-git.el (vc-git-dir-printer): Use the
'vc-dir-status-edited' as the default for the Git backend. And
reference the renamed face. Also stop treating the empty stash
differently from other header values.
* lisp/international/mule-cmds.el (mule--ucs-names-sort-by-code):
Sort with car-less-than-car instead of slower lambda.
(mule--ucs-names-affixation): Just stick character into a list to
avoid trip through format and char-to-string.
(read-char-by-name): Quote function symbols as such.
* lisp/net/dictionary.el (dictionary-link-dictionary): New defcustom.
(dictionary-mark-reference): Use dictionary-link-dictionary.
(dictionary-post-buffer-hook): New defcustom.
(dictionary-post-buffer): Run dictionary-post-buffer-hook.
(dictionary-mode-map): Bind 'S-SPC' to scroll-down-command.
(dictionary-search-default): Use possibly multi-word data at point.
Stefan Monnier [Tue, 9 Feb 2021 18:27:08 +0000 (13:27 -0500)]
Use lexical-binding in a few more scattered files
* lisp/registry.el: Use lexical-binding.
(registry-reindex): Remove unused var `values`.
* lisp/cedet/pulse.el: Use lexical-binding.
* lisp/cedet/semantic/idle.el: Use lexical-binding.
(semantic-idle-core-handler): Remove unused var `safe`.
(ede-auto-add-method): Declare var.
(define-semantic-idle-service): Use `declare`. Remove unused var `setup`.
(pulse-flag): Declare var.
* lisp/net/ldap.el: Use lexical-binding.
(ldap-search-internal): Remove unused var `proc`.
* lisp/net/mairix.el: Use lexical-binding.
Remove redundant `:group` args.
(mairix-widget-create-query): Remove unnused var `allwidgets`.
Juri Linkov [Tue, 9 Feb 2021 18:12:36 +0000 (20:12 +0200)]
New options read-char-by-name-sort and read-char-by-name-group (bug#46240)
* lisp/international/mule-cmds.el (mule--ucs-names-sort-by-code)
(mule--ucs-names-group): New functions.
(read-char-by-name-sort, read-char-by-name-group): New defcustoms.
(read-char-by-name): Use them.
Stefan Monnier [Tue, 9 Feb 2021 17:52:04 +0000 (12:52 -0500)]
* lisp/cedet/{semantic/scope.el,ede/project-am.el}: Use lexical-scoping
* lisp/cedet/ede/project-am.el: Remove redundant `:group` args.
(recentf-exclude): Declare variable.
(project-am--with-makefile-current): New function extracted from
`project-am-with-makefile-current`. Use `with-current-buffer` and
`unwind-protect`.
(project-am-with-makefile-current): Use `declare` and
`project-am--with-makefile-current`.
(project-am-with-config-current): Use `declare` and `with-temp-buffer`.
(project-am-extract-shell-variable): Turn it into a `defun`; the use of
`defmacro` appears to have been a plain mistake.
Stefan Monnier [Tue, 9 Feb 2021 17:02:25 +0000 (12:02 -0500)]
* lisp/emacs-lisp/macroexp.el: Break cycle with bytecomp/byte-opt
The recent change in macroexp triggered a cyclic dependency error
during eager macroexpansion when neither `bytecomp` nor `byte-opt` had
been byte-compiled yet. This fixes it by moving the offending
function to macroexp.el.
* lisp/emacs-lisp/macroexp.el (macroexp--unfold-lambda): Move from
byte-opt.el and rename.
(macroexp--expand-all): Use it.
* lisp/emacs-lisp/byte-opt.el (byte-compile-unfold-lambda): Move to
macroexp.el.
(byte-compile-inline-expand, byte-optimize-form-code-walker):
* lisp/emacs-lisp/bytecomp.el (byte-compile-form):
Use `macroexp--unfold-lambda` instead.
* src/lread.c (syms_of_lread): Note that it's obsolete in the doc
string (because we can't mark it as obsolete "properly" yet,
because that leads to compilation warnings when somebody
(let (values) ... values).
Alan Mackenzie [Tue, 9 Feb 2021 09:41:13 +0000 (09:41 +0000)]
Allow exit-minibuffer to be called from Lisp code. Fixes bug #46373
* lisp/minibuffer.el (exit-minibuffer): Throw the error "Not in most nested
minibuffer" only when the current buffer is a minibuffer (thus the command
came directly from a key binding).
* doc/lispref/minibuf.texi (Minibuffer Commands): Change the documentation
accordingly.
Stefan Monnier [Tue, 9 Feb 2021 00:08:14 +0000 (19:08 -0500)]
* lisp/gnus/gnus-topic.el: Fix a backward incompatibility
(gnus-topic-insert-topic-line): Make the vars used in
`gnus-topic-line-format-spec` dynamically scoped since it seems
that they're sometimes accessed from functions called by
`gnus-topic-line-format-spec` :-(
* lisp/gnus/gnus-util.el (gnus--\,@): Move macro to here...
* lisp/gnus/gnus-art.el (gnus--\,@): .. from here.
Eli Zaretskii [Mon, 8 Feb 2021 16:04:00 +0000 (18:04 +0200)]
Fix scrolling past tall images
* src/xdisp.c (try_window): Don't try checking the margins if the
window is vscrolled, as that could cause unnecessary recentering
when tall images are displayed. (Bug#46320)
Anticrisis [Mon, 8 Feb 2021 06:33:49 +0000 (07:33 +0100)]
Fix tcl-mode indentation of namespaced code
* lisp/progmodes/tcl.el (tcl-calculate-indent): Fix indentation
when using namespaces (bug#44834).
(tcl-beginning-of-defun-function): Remove. This partially reverts cd5bb4bf3dbad8941d25823f398b595b8f0edbb9.
Make `C-a' in enriched-mode behave more line in other modes
* lisp/textmodes/enriched.el (enriched-mode-map): Don't rebind
beginning-or-line, because it makes `C-S-a' not mark the region,
and it doesn't allow actually moving to the beginning of the line
if the line starts with characters in `adaptive-fill-regexp'
(bug#22554).
Eric Abrahamsen [Sun, 7 Feb 2021 21:46:50 +0000 (13:46 -0800)]
Fix namazu search result parsing in gnus-search
* lisp/gnus/gnus-search.el (gnus-search-indexed-extract): This method
is documented to leave point at the end of the extracted search
result. The namazu implementation wasn't doing that.
Tino Calancha [Sun, 7 Feb 2021 15:51:07 +0000 (16:51 +0100)]
Add command to recenter errors from Occur/Grep buffers
To scroll up/down the current displayed occurrence/error
without abandon the Occur/Grep buffer.
Add also a command 'recenter-other-window' to recenter
the other window from any kind of buffer.
* lisp/window.el (recenter-other-window): New command.
Bind recenter-other-window to S-M-C-l (Bug#46119).
* lisp/simple.el (recenter-current-error): New command.
* lisp/progmodes/grep.el (grep-mode-map):
Delete bidings for n and p.
* lisp/progmodes/compile.el (compilation-minor-mode-map):
Move here the n and p bindings.
Bind `recenter-current-error' to l.
* lisp/replace.el (occur-mode-map):
Same.
* lisp/simple.el (count-lines): Revert back to using
`forward-line', because there seems to be a disagreement on how
lines should be counted in a region...
* src/fns.c (Fline_number_at_pos): Rename from
Fline_number_at_position and adjust parameter list.
Reverse customize-changed and customize-changed-options aliasing
* lisp/cus-edit.el (customize-changed): Rename from
customize-changed-options (bug#23085), since the old name doesn't
reflect what it does: It's not just about user options, but also
faces and the like.
(customize-changed-options): Make into an obsolete alias.
Sean Whitton [Sun, 7 Feb 2021 12:30:33 +0000 (13:30 +0100)]
Move 'revert-buffer' global binding to 'C-x g g'
* lisp/bindings.el: Define ctl-x-g-map and bind 'revert-buffer' to
'C-x x g' globally.
* doc/emacs/files.texi: Replace 'C-x g' with 'C-x x g'.
* etc/NEWS: Document the change (bug#46300).