Alan Third [Wed, 10 Feb 2021 22:12:16 +0000 (22:12 +0000)]
Remove aliasing on SVG images under scaled NS frames
* src/image.c (FRAME_SCALE_FACTOR): New #define for getting frame
scale factor.
(image_set_transform):
(svg_load_image): Use FRAME_SCALE_FACTOR.
* src/nsterm.m (ns_frame_scale_factor): Get the scale factor for an NS
frame.
Stefan Monnier [Sat, 13 Feb 2021 21:21:53 +0000 (16:21 -0500)]
* lisp/emacs-lisp/edebug.el (edebug--handle-&-spec-op <&name>): New method
(edebug--concat-name): New function.
(edebug-match-name, edebug-match-cl-generic-method-qualifier)
(edebug-match-cl-generic-method-args): Delete functions.
* doc/lispref/edebug.texi (Specification List): Document it.
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric): Use `&name`.
(cl-generic--method-qualifier-p): New predicate.
(cl-defmethod): Use it and `&name`.
* lisp/emacs-lisp/cl-macs.el (cl-defun, cl-iter-defun, cl-flet):
* lisp/emacs-lisp/eieio-compat.el (defmethod):
* lisp/emacs-lisp/gv.el (gv-define-setter):
* lisp/emacs-lisp/ert.el (ert-deftest): Use `&name`.
* lisp/erc/erc-backend.el (define-erc-response-handler): Use `declare`
and `&name`.
Augusto Stoffel [Fri, 12 Feb 2021 18:29:54 +0000 (19:29 +0100)]
Small correction to `isearch-lazy-highlight-buffer-update'
The value of point is now read after a potential change of buffer.
* lisp/isearch.el (isearch-lazy-highlight-buffer-update): Move call
to `point' after `select-window'.
Stefan Monnier [Sat, 13 Feb 2021 15:41:45 +0000 (10:41 -0500)]
(backtrace-goto-source-functions): Make it a normal abnormal hook
* lisp/emacs-lisp/backtrace.el (backtrace-goto-source-functions):
Don't mark it as buffer-local any more.
(backtrace-goto-source): Use `run-hook-with-args-until-success`.
* lisp/emacs-lisp/edebug.el (edebug-pop-to-backtrace): Clarify that the
hook is only intended to be modified buffer-locally.
* lisp/gnus/gnus-msg.el (gnus-group-mail, gnus-group-news)
(gnus-summary-mail-other-window, gnus-summary-news-other-window):
Remove stale comments about let-binding gnus-newsgroup-name, as they
should have been addressed (bug#37871#38).
Eli Zaretskii [Sat, 13 Feb 2021 12:57:25 +0000 (14:57 +0200)]
Fix vertical cursor motion among many images
* src/xdisp.c (move_it_in_display_line_to): Consider it
MOVE_POS_MATCH_OR_ZV if we are just after an image, stretch, or
display string, and the position matches exactly. This is needed
when one image follows another at TO_CHARPOS. (Bug#46464)
Stefan Kangas [Fri, 12 Feb 2021 23:21:36 +0000 (00:21 +0100)]
Comment out mysterious code from cperl-mode.el
* lisp/progmodes/cperl-mode.el: Comment out mysterious code referring
to some unknown variable 'edit-var-mode-alist'. No one seems to know
what it is used for, so comment it out and see if anyone complains
before Emacs 28.1 or 28.2.
Stefan Kangas [Fri, 12 Feb 2021 23:10:38 +0000 (00:10 +0100)]
Remove outdated documentation from cperl-mode.el
* lisp/progmodes/cperl-mode.el (cperl-tips, cperl-problems)
(cperl-praise, cperl-speed, cperl-mode): Doc fixes; remove references
to very old versions of Emacs and other "Emaxen".
(cperl-problems-old-emaxen): Make obsolete and remove information on
Emacs 20.3 and older.
Stefan Monnier [Sat, 13 Feb 2021 00:28:25 +0000 (19:28 -0500)]
Edebug: Overload `edebug-form-spec` even less
The `edebug-form-spec` symbol property was used both to map forms's
head symbol to the corresponding spec, and to map spec element names
to their expansion.
This lead to name conflicts which break instrumentation of examples such as
(cl-flet ((gate (x) x)) (gate 4))
because of the Edebug spec element `gate`.
So introduce a new symbol property `edebug-elem-spec`.
* lisp/subr.el (def-edebug-elem-spec): New function.
* lisp/emacs-lisp/edebug.el (edebug--get-elem-spec): New function.
(edebug-match-symbol): Use it.
(Core Edebug elems): Put them on `edebug-elem-spec` instead of
`edebug-form-spec`.
(ELisp special forms): Set their `edebug-form-spec` via dolist.
(Other non-core Edebug elems): Use `def-edebug-elem-spec`.
(edebug-\`): Use `declare`.
* test/lisp/emacs-lisp/edebug-tests.el
(edebug-tests--conflicting-internal-names): New test.
* test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
(edebug-test-code-cl-flet1): New test case.
* doc/lispref/edebug.texi (Specification List): Add `def-edebug-elem-spec`.
(Specification Examples): Use it.
* doc/lispref/loading.texi (Hooks for Loading): Avoid the use of
`def-edebug-spec` in example (better use `debug` declaration).
Stefan Monnier [Fri, 12 Feb 2021 21:08:01 +0000 (16:08 -0500)]
Use `declare` instead of `def-edebug-spec` in most places
* lisp/speedbar.el: Use lexical-binding.
(speedbar-with-writable): Use `declare`.
* lisp/subr.el (def-edebug-spec): Use `declare`.
* lisp/cedet/ede/base.el: Use lexical-binding.
(ede-with-projectfile): Use `declare`.
(recentf-exclude): Declare var.
* lisp/cedet/ede/pmake.el: Use lexical-binding.
(ede-pmake-insert-variable-shared, ede-pmake-insert-variable-once):
Use `declare`.
* lisp/cedet/ede/proj-comp.el: Use lexical-binding.
(ede-compiler-begin-unique, ede-compiler-only-once)
(ede-linker-begin-unique, ede-linker-only-once): Use `declare`.
* lisp/cedet/semantic/ctxt.el: Use lexical-binding.
(semantic-with-buffer-narrowed-to-context)
(semantic-with-buffer-narrowed-to-command): Use `declare`.
(semantic--progress-reporter): Declare var.
(semantic-ctxt-end-of-symbol-default): Remove unused var `fieldsep`.
* lisp/cedet/semantic/lex-spp.el: Use lexical-binding.
(define-lex-spp-macro-declaration-analyzer)
(define-lex-spp-include-analyzer, semantic-lex-with-macro-used)
(define-lex-spp-macro-undeclaration-analyzer): Use `declare`.
(semantic-lex-spp-symbol-remove): Rename arg to avoid colliding with
dynamic variable `obarray`.
(semantic-lex-spp-symbol-pop): Remove unused var `oldvalue`.
(semantic-lex-spp-lex-text-string): Remove unused var `analyzer`.
* lisp/cedet/semantic/lex.el (define-lex)
(semantic-lex-unterminated-syntax-protection, define-lex-analyzer)
(define-lex-regex-analyzer, define-lex-block-analyzer)
(semantic-lex-catch-errors): Use `declare`.
* lisp/cedet/semantic/tag.el: Use lexical-binding.
(semantic-with-buffer-narrowed-to-current-tag)
(semantic-with-buffer-narrowed-to-tag): Use `declare`.
* lisp/cedet/semantic/wisent.el: Use lexical-binding.
(define-wisent-lexer): Use `declare`.
* lisp/emacs-lisp/cl-lib.el (cl-pushnew): The arg to :test can be any
form not just function form.
* lisp/org/ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Use `declare`.
* lisp/org/ob-core.el (org-babel-map-src-blocks): Use `declare`.
(org-babel-result-cond): Simplify edebug spec.
Avoid traversing dead `if` branches in bytecode optimiser
There is no point in traversing conditional branches that are
statically known never to be executed. This saves some optimisation
effort, but more importantly prevents variable assignments and
references in those branches from blocking effective constant
propagation.
Also attempt to traverse as much as possible in an unconditional
context, which enables constant-propagation through (linear)
assignments.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form):
Rewrite the (tail) recursion into an explicit loop. Normalise a
return value of (quote nil) to nil, for easier subsequent
optimisations.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Don't
traverse dead `if` branches. Use unconditional traversion context
when possible.
* lisp/net/tramp.el (tramp-debug-message): Change defsubst into defun.
Until now the byte-compiler hasn't been clever enough to inline this
function but this is about to change; the code expansion is
unnecessary and makes compiler improvements more difficult to gauge.
Stefan Kangas [Fri, 12 Feb 2021 17:38:58 +0000 (18:38 +0100)]
; Fix recent regexp-opt conversion in cperl-mode
* lisp/progmodes/cperl-mode.el (cperl-init-faces): Add missing
identifiers found by static analysis of recent change.
Thanks to Mattias Engdegård <mattiase@acm.org>.
Stefan Kangas [Fri, 12 Feb 2021 04:15:01 +0000 (05:15 +0100)]
Add font locking for many missing macros in m4-mode
* lisp/progmodes/m4-mode.el (m4--macro-list): New variable.
(m4-font-lock-keywords): Use regexp-opt and add many missing macros
sourced from the M4 manual.
Stefan Monnier [Fri, 12 Feb 2021 17:17:40 +0000 (12:17 -0500)]
* lisp/emacs-lisp/edebug.el (edebug--handle-&-spec-op) <&lookup>: New method
* doc/lispref/edebug.texi (Specification List): Document it.
* lisp/emacs-lisp/pcase.el (pcase-PAT): Use it.
(pcase-MACRO): Remove Edebug element.
(pcase--get-edebug-spec): New function.
(pcase--edebug-match-macro): Remove function.
Stefan Monnier [Fri, 12 Feb 2021 16:12:49 +0000 (11:12 -0500)]
* lisp/emacs-lisp/edebug.el: Misc cleanups.
Move all definitions under the `edebug-` prefix.
(edebug-get-spec): Rename from `get-edebug-spec`.
(edebug-move-cursor): Use `cl-callf`.
(edebug-spec-p): Remove unused function.
(def-edebug-spec, edebug-spec-list, edebug-spec): Remove unused specs
(nothing in there gets instrumented anyway).
(edebug-tracing): Use `declare`.
(edebug-cancel-on-entry): Rename from `cancel-edebug-on-entry`.
(edebug-global-prefix): Rename from `global-edebug-prefix`.
(edebug-global-map): Rename from `global-edebug-map`.
* lisp/emacs-lisp/pcase.el (pcase-PAT): Remove `let`.
(let): Use `declare` instead.
(pcase--edebug-match-macro): Use new name `edebug-get-spec`.
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.