* doc/lispref/display.texi (Image Descriptors): Document it.
* lisp/image.el (image-transform-smoothing): New user option.
(create-image): Use it.
(image--default-smoothing): New function.
Yuan Fu [Wed, 3 Mar 2021 14:50:15 +0000 (09:50 -0500)]
Map redo records for undo in region to 'undo-in-region
* lisp/simple.el (undo-equiv-table): Add explaination for
undo-in-region, undo to the beginning of undo list and null undo.
(undo): If equiv is 'undo-in-region, empty or t, set pending-undo-list
to t. If the redo is undo-in-region, map buffer-undo-list to
'undo-in-region instead of t, if it is an identity mapping, map to
'empty.
(undo-make-selective-list): Only continue when ulist is a proper list.
* test/lisp/simple-tests.el (simple-tests--undo): Add test for
undo-only in region.
(simple-tests--sans-leading-nil): New helper function.
(simple-tests--undo-equiv-table): New test for 'undo-equiv-table'.
Stefan Monnier [Thu, 11 Mar 2021 19:32:42 +0000 (14:32 -0500)]
* lisp/mail/: Use lexical-binding
Remove some redundant `:group` args as well.
* lisp/mail/supercite.el: Use lexical-binding.
(completer-disable): Declare var.
(sc-set-variable): Don't rely on dynbind to access `help` variable.
* lisp/mail/mail-extr.el: Use lexical-binding.
(mail-extract-address-components): Avoid use of dynamic scoping to
refer to local vars.
* lisp/mail/mailabbrev.el: Use lexical-binding.
(mail-abbrev-make-syntax-table): Rename `_` variable to `syntax-_`.
* lisp/mail/mailheader.el: Use lexical-binding.
(headers): Don't declare as dynbound globally.
(mail-header-set, mail-header-merge): Declare `headers` as dynbound
locally, instead. Mark those functions as obsolete.
(mail-header-format): Use `alist-get` instead of `mail-header`.
* lisp/mail/binhex.el (binhex-decode-region-external): Remove always-nil
var `firstline`.
* lisp/mail/emacsbug.el: Use lexical-binding.
(report-emacs-bug): Remove always-nil var `message-end-point`.
* lisp/mail/rmail-spam-filter.el: Use lexical-binding.
(bbdb/mail_auto_create_p): Declare variable.
* lisp/mail/rmail.el (rmail-get-new-mail): Remove always-nil var
`delete-files`.
* lisp/mail/rmailout.el: Use lexical-binding.
(rmail-output-read-file-name): Remove unused var `err`.
(rmail-convert-to-babyl-format): Remove unused var `count`.
(rmail-output-as-mbox): Remove unused vars `from` and `date`.
* lisp/mail/rmailsort.el: Use lexical-binding.
(rmail-sort-messages): Remove unused var `msginfo`.
* lisp/mail/rfc822.el: Use lexical-binding.
* lisp/mail/rmailedit.el: Use lexical-binding.
* lisp/mail/mailclient.el: Use lexical-binding.
* lisp/mail/blessmail.el: Use lexical-binding.
* lisp/mail/mail-hist.el: Use lexical-binding.
* lisp/mail/rmailkwd.el: Use lexical-binding.
* lisp/mail/rmailmsc.el: Use lexical-binding.
* lisp/mail/uce.el: Use lexical-binding.
* lisp/mail/unrmail.el: Use lexical-binding.
Juri Linkov [Thu, 11 Mar 2021 19:05:12 +0000 (21:05 +0200)]
* lisp/tab-bar.el (tab-bar--current-tab-find): New function.
(tab-bar-close-other-tabs, tab-bar-close-group-tabs): Use it.
(tab-bar--history-pre-change): Rename from
'tab-bar-history--pre-change' to follow naming convention.
(tab-bar-history-mode): Use renamed 'tab-bar--history-pre-change'.
Stefan Monnier [Thu, 11 Mar 2021 06:14:30 +0000 (01:14 -0500)]
* lisp/gnus/nnmh.el (nnmh-newsgroup-articles): Declare var
Reported by Barry Fishman <barry@ecubist.org>.
Along the way, I checked other variables which are similarly let-bound
to nil and then read with any intervening assignment, which found
another similar case of missing `defvar`s plus a bit of dead code.
* lisp/gnus/gnus-kill.el (gnus-apply-kill-file-internal):
Remove constant nil var `beg`.
* lisp/gnus/gnus-search.el (gnus-search-query-parse-kv):
Remove constant nil var `return`.
* lisp/gnus/gnus-start.el (gnus-ask-server-for-new-groups):
Remove constant nil var `group`.
(gnus-killed-assoc, gnus-marked-assoc, gnus-newsrc-assoc): Declare vars.
* lisp/gnus/gnus-sum.el (gnus-compute-read-articles):
Remove constant nil var `first`.
* lisp/gnus/nnbabyl.el (nnbabyl-request-accept-article):
Remove constant nil var `beg`.
* lisp/gnus/nnfolder.el (nnfolder-possibly-change-group):
Remove constant nil var `inf`.
* lisp/gnus/nnrss.el (nnrss-request-article):
Remove constant nil var `err`.
Juri Linkov [Wed, 10 Mar 2021 18:09:23 +0000 (20:09 +0200)]
* lisp/tab-bar.el (tab-bar-close-group-tabs): New command.
(tab-close-group): New alias.
(tab-bar-close-other-tabs): Rewrite to fix old bug where regardless of
the returned value from tab-bar-tab-prevent-close-functions,
only one tab was retained.
Juri Linkov [Wed, 10 Mar 2021 17:57:48 +0000 (19:57 +0200)]
* lisp/tab-bar.el: 'C-x t G' (tab-group) assigns a group name to the tab.
* lisp/tab-bar.el (tab-bar--tab, tab-bar--current-tab): Add tab group if any.
(tab-bar-change-tab-group): New command.
(display-buffer-in-new-tab): Handle tab-group alist entry.
(tab-group): New alias.
(tab-prefix-map): Bind "G" to 'tab-group'.
Stefan Kangas [Wed, 10 Mar 2021 02:29:50 +0000 (03:29 +0100)]
Use 'help-key-binding' face in userlock.el
* lisp/userlock.el (userlock--fontify-key): New function.
(ask-user-about-lock, ask-user-about-lock-help,
(ask-user-about-supersession-threat)
(ask-user-about-supersession-help): Add face 'help-key-binding' to
displayed keys.
Dmitry Gutov [Wed, 10 Mar 2021 01:08:29 +0000 (03:08 +0200)]
(project-switch-commands): Remove the ###autoload instruction
* lisp/progmodes/project.el (project-switch-commands):
Remove the ###autoload instruction. It's unnecessary and can
cause surprises in some circumstances (bug#46986).
Paul Eggert [Tue, 9 Mar 2021 19:22:59 +0000 (11:22 -0800)]
Port alternate signal stack to upcoming glibc 2.34
* src/sysdep.c (sigsegv_stack): Increase size to 64 KiB and align
it to max_align_t. This copies from Gnulib’s c-stack.c, and works
around a portability bug in draft glibc 2.34, which no longer
defines SIGSTKSZ when _GNU_SOURCE is defined.
Juri Linkov [Tue, 9 Mar 2021 17:27:31 +0000 (19:27 +0200)]
* lisp/tab-bar.el (tab-bar-select-tab): Set window-state-put WINDOW arg to nil
WINDOW arg nil will always create a new window regardless of the value
returned by 'frame-root-window' that is nondeterministic - it returns
an internal window when there are more than 1 window on the frame/tab,
otherwise it returns a live window that was reused between different tabs
(bug#46904)
(tab-prefix-map): Bind "u" to 'tab-undo'.
smerge-vc-next-conflict: Move to conflict markers more reliably
* lisp/vc/smerge-mode.el (smerge-vc-next-conflict): Search for a
conflict marker if call to (vc-find-conflicted-file) haven't resulted in
a jump to one. And remove `buffer` variable that becomes unused.
Stefan Monnier [Mon, 8 Mar 2021 15:11:22 +0000 (10:11 -0500)]
* lisp/net/*.el: Use lexical-binding
Also remove some redundant `:group` arguments.
* lisp/net/eudc-export.el: Use lexical-binding.
(eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`.
* lisp/net/eudc-hotlist.el: Use lexical-binding.
* lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid
`eval`.
* lisp/net/eudcb-bbdb.el: Use lexical-binding.
(eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`.
Move `bbdb-val` binding to avoid `setq`.
Use `seq-some` instead of `eval+or`.
(eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`.
Use `funcall` to avoid `eval`.
(eudc-bbdb-query-internal): Simplify a bit.
* lisp/net/eudcb-ldap.el: Use lexical-binding.
(eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`.
* lisp/net/telnet.el: Use lexical-binding.
* lisp/net/quickurl.el: Use lexical-binding.
* lisp/net/newst-ticker.el: Use lexical-binding.
* lisp/net/newst-reader.el: Use lexical-binding.
* lisp/net/goto-addr.el: Use lexical-binding.
* lisp/net/gnutls.el: Use lexical-binding.
* lisp/net/eudcb-macos-contacts.el: Use lexical-binding.
* lisp/net/eudcb-mab.el: Use lexical-binding.
* lisp/net/net-utils.el: Use lexical-binding.
(finger): Remove unused var `found`.
Fix structure of condition object in nested 'ert-fail'.
See the test 'ert-test-fail' for the expected structure.
* lisp/emacs-lisp/ert.el (ert--should-signal-hook): Condition list
should be (SYMBOL . DATA), not (SYMBOL DATA).
* test/lisp/emacs-lisp/ert-tests.el (ert-test-fail-inside-should): Fix
unit test.
Mauro Aranda [Mon, 8 Mar 2021 11:11:38 +0000 (08:11 -0300)]
Make checkdoc--next-docstring use the doc-string-elt property
This follows from a fix for Bug#46918 and a discussion to use
doc-string-elt:
https://lists.gnu.org/archive/html/emacs-devel/2021-03/msg00232.html
* lisp/emacs-lisp/checkdoc.el (checkdoc--next-docstring): Check for a
non-nil doc-string-elt property, instead of hard-coding the
supported symbols. Use that property to position point at the
doc-string.
Stefan Kangas [Mon, 8 Mar 2021 02:29:42 +0000 (03:29 +0100)]
Add new face 'help-key-binding' for keybindings in help
* lisp/faces.el (help-key-binding): New face.
* lisp/help.el
(help-for-help): Rename from 'help-for-help-internal'. Use
'substitute-command-keys' syntax.
(help): Make into alias for 'help-for-help'.
(help-for-help-internal): Make into obsolete alias for
'help-for-help'.
(help--key-description-fontified): New function to add the
'help-key-binding' face.
(help-key-description, substitute-command-keys)
(describe-map-tree, help--describe-command)
(help--describe-translation, describe-map):
* lisp/help-fns.el (help-fns--key-bindings, describe-mode):
Use above new function.
* lisp/isearch.el (isearch-help-for-help-internal): Use
`substitute-command-keys' syntax.
* lisp/help-macro.el (make-help-screen): Use
'substitute-command-keys' and 'help--key-description-fontified'.
Simplify.
* src/keymap.c (describe_key_maybe_fontify): New function to add
the 'help-key-binding' face to keybindings.
(describe_vector): Use above new keybinding.
(syms_of_keymap) <Qfont_lock_face, Qhelp_key_binding>: New
DEFSYMs.
(fontify_key_properties): New static variable.
* lisp/tooltip.el (tooltip-show): Avoid overriding faces in
specified tooltip text.
* test/lisp/help-tests.el (with-substitute-command-keys-test):
Don't test for text properties.
(help-tests-substitute-command-keys/add-key-face)
(help-tests-substitute-command-keys/add-key-face-listing):
New tests.
Dmitry Gutov [Mon, 8 Mar 2021 02:25:15 +0000 (04:25 +0200)]
Speed up xref rendering for matches on very long lines
* lisp/progmodes/xref.el (xref--insert-xrefs): Cut up the current
line into pieces here for multiple matches's summaries, so that
xref--insert-xrefs can do less work (bug#46859).
(xref--insert-xrefs): Do less work.
(xref--outdated-p):
Update accordingly to how the summary creation logic changed.
(xref--buf-pairs-iterator): Update to the new calling convention.
(xref-location-column): Effectively rename back to
xref-file-location-column since the generic version is now unused.
* test/lisp/progmodes/xref-tests.el
(xref-matches-in-directory-finds-two-matches-on-the-same-line)
(xref-matches-in-directory-finds-an-empty-line-regexp-match):
Adjust to the xref-location-column change.
(xref-matches-in-files-trims-summary-for-matches-on-same-line):
New test.
* test/lisp/progmodes/xref-resources/file1.txt:
Change contents slightly to test the new xref--outdated-p code.
Dmitry Gutov [Mon, 8 Mar 2021 00:44:24 +0000 (02:44 +0200)]
Xref test improvements
* test/lisp/progmodes/xref-tests.el
(xref--xref-file-name-display-is-abs):
Fix not to rely on the default value.
(xref-matches-in-files-includes-matches-from-all-the-files):
New test.
The conversion to `lexical-binding` introduced a regression because
`bovine/c.el` relied on inspecting the local variable `lse` in one of
its callers.
(semantic-bovinate-stream): Bind `lse` dynamically, because of
`semantic-parse-region-c-mode`.
(semantic-bovinate-nonterminal-check-map): Rename from
`semantic-bovinate-nonterminal-check-obarray` to hold some other kind
of table.
(semantic-bovinate-nonterminal-check): Use a hash-table instead of an obarray.
* lisp/cedet/semantic/bovine/c.el (semantic-parse-region-c-mode):
Declare use of `lse` via dynamic scoping.
Stefan Monnier [Mon, 8 Mar 2021 00:00:47 +0000 (19:00 -0500)]
* lisp/emacs-lisp/bytecomp.el: Warn about unprefixed vars in `boundp`
(byte-compile--check-prefixed-var): New fun,
extracted from `byte-compile--declare-var`.
(byte-compile--declare-var): Use it.
(byte-compile-maybe-guarded): Use it as well.
Juri Linkov [Sun, 7 Mar 2021 18:52:39 +0000 (20:52 +0200)]
Remove outline-cycle-minor-mode and outline-cycle-highlight-minor-mode
* lisp/outline.el (outline-font-lock-keywords): Use OVERRIDE or
LAXMATCH depending on outline-minor-mode-highlight in outline-minor-mode.
(outline-minor-mode-cycle, outline-minor-mode-highlight): Promote
defvar to defcustom.
(outline-minor-mode-highlight-buffer): Don't override existing faces.
(outline-cycle-minor-mode, outline-cycle-highlight-minor-mode):
Remove minor modes.
* etc/compilation.txt:
* etc/grep.txt: Enable outline-minor-mode-cycle and
outline-minor-mode-highlight with outline-minor-mode.
https://lists.gnu.org/archive/html/emacs-devel/2021-03/msg00144.html
* lisp/subr.el (string-replace): Signal an error with data that is a
list, and whose contents are consistent with other uses of
wrong-length-argument.
* test/lisp/subr-tests.el (string-replace): Test for this.
(subr-test-define-prefix-command): Pacify byte-compiler warnings.
Stefan Monnier [Sun, 7 Mar 2021 06:58:16 +0000 (01:58 -0500)]
* lisp/cedet/semantic/wisent: Use lexical-binding
* lisp/cedet/semantic/wisent/comp.el: lexical-binding.
(wisent-defcontext): Make sure the vars are also dynbound in the files
that `require` us.
(wisent-state-actions, wisent-automaton-lisp-form): Use `obarray-make`.
(wisent--compile-grammar): Rename from `wisent-compile-grammar`.
(wisent-compile-grammar): Redefine as an obsolete function.
(wisent-automaton-lisp-form): Avoid variable `state`.
* lisp/cedet/semantic/grammar.el: Use lexical-binding.
(semantic-grammar-require-form): New var.
(semantic-grammar-header): Use it to provide new element `require-form`.
(semantic-grammar-header-template): Use it.
* lisp/cedet/semantic/wisent.el (wisent-compiled-grammar): New macro.
* lisp/cedet/semantic/wisent/grammar.el (wisent-grammar-parsetable-builder):
Use it in the generated code instead of the `wisent-compile-grammar` function.
(wisent-grammar-mode): Set `semantic-grammar-require-form` so
the generated ELisp files require `semantic/wisent` rather than
`semantic/bovine`.
* lisp/cedet/semantic/wisent/wisent.el: Use lexical-binding.
* lisp/cedet/semantic/wisent/java-tags.el: Use lexical-binding.
* lisp/cedet/semantic/wisent/python.el: Use lexical-binding.
* lisp/cedet/semantic/wisent/javascript.el: Use lexical-binding.
(semantic-ctxt-current-symbol): Remove unused var `symlist`.
* admin/grammars/python.wy (wisent-python-EXPANDING-block):
Declare dynbound var.
Stefan Monnier [Sun, 7 Mar 2021 03:33:19 +0000 (22:33 -0500)]
* lisp/cedet/semantic/bovine/*.el: Use lexical-binding
* lisp/cedet/semantic/bovine/c.el: Use lexical-binding.
(semantic-lex-cpp-define): Remove unused var `name`.
(semantic-c-do-lex-if): Remove unused var `pt`.
(semantic-analyze-tag-references): Remove unused var `refs`.
(semantic-c-dereference-namespace): Remove unused vars `tmp` and
`usingname`.
(semantic-c-dereference-namespace-alias): Remove unused var `newtype`.
(semantic-c-check-type-namespace-using): Remove unused vars `tmp` and
`shortname`.
(semanticdb-find-table-for-include): Remove unused var `prefix`.
(semantic-default-c-setup, semantic-c-describe-environment):
Use `derived-mode-p`.
* lisp/cedet/semantic/bovine/debug.el: Use lexical-binding.
* lisp/cedet/semantic/bovine/make.el: Use lexical-binding.
* lisp/cedet/semantic/bovine/scm.el: Use lexical-binding.
* lisp/cedet/semantic/lex.el (define-lex-analyzer): Define the var (and
the function) in a single step.
Glenn Morris [Sat, 6 Mar 2021 19:09:19 +0000 (11:09 -0800)]
Don't pass implicit flags to sub-makes
* Makefile.in (info_misc, uninstall, texi_misc):
Don't pass any implicit make flags to sub-makes.
Ref https://lists.gnu.org/r/help-make/2021-03/msg00007.html
This replaces most json-encode-* functions with similar
json--print-* counterparts that insert into the current buffer
instead of returning a string (bug#46761).
Some unused but useful json-encode-* functions are kept for backward
compatibility and as a public API, and the rest are deprecated.
* etc/NEWS: Announce obsoletions.
* lisp/json.el: Document organization of library. Make subsection
headings more consistent.
(json--encoding-current-indentation): Rename...
(json--print-indentation-prefix): ...to this, to reflect new use.
(json--encode-stringlike, json--encode-alist): Rename...
(json--print-stringlike, json--print-alist): ...to these,
respectively, and encode argument into current buffer instead. All
callers changed.
(json--print-string, json--print-unordered-map, json--print-array)
(json--print): New functions.
(json-encode-string, json-encode-plist, json-encode-array)
(json-encode): Use them, respectively.
(json-encode-number, json-encode-hash-table): Mark as obsolete
aliases of json-encode.
(json-encode-key, json-encode-list): Mark as obsolete in preference
for json-encode.
(json--print-indentation-depth, json--print-keyval-separator): New
variables.
(json--with-output-to-string): New macro.
(json--print-indentation, json--print-keyword, json--print-key)
(json--print-pair, json--print-map, json--print-list): New
functions.
(json--with-indentation): Use json--print-indentation-depth to avoid
unnecessary string allocation.
(json-encoding-default-indentation, json-pretty-print-max-secs):
Clarify docstrings.
(json--escape, json--long-string-threshold, json--string-buffer):
Remove; no longer used.
* lisp/progmodes/js.el (js--js-encode-value): Replace
json-encode-string and json-encode-number with json-encode.
(js-eval-defun): Use json--print-list to avoid
json-encode-list->insert roundtrip.
* test/lisp/json-tests.el (test-json-encode-number)
(test-json-encode-hash-table, test-json-encode-hash-table-pretty)
(test-json-encode-hash-table-lisp-style)
(test-json-encode-hash-table-sort, test-json-encode-list): Replace
uses of obsolete functions with the equivalent use of json-encode.
(test-json-encode-key): Suppress obsoletion warnings.
(test-json-encode-string): Check that text properties are stripped.
Stefan Monnier [Sat, 6 Mar 2021 18:03:12 +0000 (13:03 -0500)]
* lisp/emulation/: Use lexical-binding
* lisp/emulation/cua-base.el: Use lexical-binding.
Remove redundant `:group` arguments.
(cua-mode): Don't use `:require` since the autoload on `define-minor-mode`
takes care of loading the mode when custom-setting it.
* lisp/emulation/cua-gmrk.el: Use lexical-binding.
(cua--copy-rectangle-to-global-mark): Remove unused var `src-buf`.
* lisp/emulation/edt-mapper.el: Use lexical-binding.
* lisp/emulation/edt.el: Use lexical-binding.
Remove redundant `:group` arguments.
(edt-with-position): Allow `top`, `left`, and `far` to be left unused
in `body`.
* lisp/emulation/keypad.el: Use lexical-binding.
* lisp/emulation/viper-cmd.el: Move `provide` to the end.
(viper-read-string-with-history): Strength reduce `eval` to `symbol-value`.
* lisp/emulation/viper-ex.el: Use lexical-binding.
Remove redundant `:group` arguments.
Move `provide` to the end.
* lisp/emulation/viper-init.el: Use lexical-binding.
* lisp/emulation/viper-keym.el (viper-toggle-key): Use `dolist`.
(viper-insert-diehard-map): Use `string`.
(viper-modify-major-mode): Use `alist-get` and `setf`.
* lisp/emulation/viper-macs.el (viper-ex-work-buf):
Move `provide` to the end.
(viper-record-kbd-macro): Strength reduce `eval` to `symbol-value`.
(viper-describe-kbd-macros): Return value is not significant.
(viper-keyseq-is-a-possible-macro): Use `seq-some`.
(viper-common-seq-prefix): Use `seq-every-p`.
* lisp/emulation/viper-mous.el: Use lexical-binding.
Remove redundant `:group` arguments.
Move `provide` to the end.
(viper-remember-current-frame): Accept arbitrary ignored args.
(viper-parse-mouse-key): Strength reduce `eval` to `symbol-value`.
Remove unused var `key-spec`.
(viper-bind-mouse-search-key, viper-bind-mouse-insert-key):
Apply de Morgan.
* lisp/emulation/viper-util.el: Move `provide` to the end.
(viper-move-marker-locally, viper-push-onto-ring, viper-save-setting):
Strength reduce `eval` to `symbol-value`.
(viper-event-vector-p, viper-char-symbol-sequence-p, viper-char-array-p):
Use `seq-every-p`.
* lisp/emulation/viper.el (viper-non-hook-settings): Eta-reduce use of
`viper-remember-current-frame`.