Stefan Monnier [Sat, 30 Jan 2021 23:44:00 +0000 (18:44 -0500)]
* lisp/gnus: Use lexical-binding in all the files
* lisp/gnus/gnus-group.el (features): Use `dlet`.
(gnus-tmp-level, gnus-tmp-marked, gnus-tmp-group): Declare vars.
(gnus-group-insert-group-line): Bind dynbound vars via `let` rather
than as formal args. Bind `number` as dynbound.
(gnus-visual, gnus-score-find-score-files-function)
(gnus-home-score-file, gnus-apply-kill-hook)
(gnus-summary-expunge-below): Declare vars.
(gnus-group-restart, gnus-group-list-plus): Fix `interactive` spec
since the arg is unused.
* lisp/gnus/mail-source.el (mail-source-bind, mail-source-bind-common):
Use `dlet` and suppress the warnings about the non-prefixed dynbound vars.
(mail-source-set-1): Remove unused var `auth-info`.
(mail-source-call-script): Remove unused var `background`.
(mail-source-fetch-pop, mail-source-check-pop): Bind pop3 vars with `dlet`.
* lisp/gnus/gnus-int.el (mail-source-plugged, gnus-inhibit-demon):
Declare vars.
(gnus-server-opened, gnus-status-message)
(gnus-open-server, gnus-close-server, gnus-request-list)
(gnus-finish-retrieve-group-infos, gnus-retrieve-group-data-early)
(gnus-request-list-newsgroups, gnus-request-newgroups)
(gnus-request-regenerate, gnus-request-compact, gnus-request-group)
(gnus-retrieve-groups, gnus-request-post, gnus-request-expunge-group)
(gnus-request-scan, gnus-request-update-info, gnus-request-marks)
(gnus-request-accept-article, gnus-request-create-group)
(gnus-asynchronous-p, gnus-remove-denial):
Bind `gnus-command-method` via `let` rather than as formal args.
* lisp/gnus/gnus-topic.el (gnus-topic-insert-topic-line):
Pass documented vars to eval for `gnus-topic-line-format-spec`.
* lisp/gnus/message.el (message-yank-original): Use `cl-progv` rather
than `eval` to bind the vars from `message-cite-style`.
* lisp/gnus/mml.el (mml-parse-1): Use `apply` instead of `eval`.
(gnus-newsgroup-name, gnus-displaying-mime, gnus-newsgroup-name)
(gnus-article-prepare-hook, gnus-newsgroup-charset)
(gnus-original-article-buffer, gnus-message-buffer)
(message-this-is-news, message-this-is-mail): Declare vars.
* lisp/gnus/deuglify.el (gnus-outlook-rearrange-article): Remove unused
var `cite-marks`.
* lisp/gnus/gnus-art.el (ansi-color-context-region): Declare var.
(gnus-mime-display-attachment-buttons-in-header): Move declaration
before first use.
(gnus-mime-display-alternative): Remove unused var `from`.
* lisp/gnus/gnus-bookmark.el (gnus-bookmark-bmenu-list): Remove unused
var `start` `end`.
* lisp/gnus/gnus-cache.el (gnus-article-decode-hook)
(nnml-generate-active-function): Declare var.
* lisp/gnus/gnus-cite.el (gnus-message-citation-mode): Remove unused
var `keywords`.
* lisp/gnus/gnus-cloud.el (gnus-cloud-encode-data): Remove unused var
`cipher`.
(gnus-cloud-ensure-cloud-group): Remove unused var `method`.
* lisp/gnus/gnus-delay.el (gnus-delay-article): Remove unused var `days`.
* lisp/gnus/gnus-html.el (gnus-html-wash-images): Remove unused vars
`tag`, `string`, and `images`.
(gnus-html-wash-tags): Remove unused vars `string` and `images`.
* lisp/gnus/gnus-msg.el (gnus-msg-mail): Remove unused var `group-name`.
(gnus-group-mail, gnus-group-news, gnus-summary-mail-other-window)
(gnus-summary-news-other-window):
Remove unused vars `group` and `buffer`.
(gnus-configure-posting-styles): Remove unused vars `style` and `attribute`.
* lisp/gnus/gnus-picon.el (gnus-picon-find-face): Remove unused vars
`database`, `directory`, and `instance`.
(gnus-picon-transform-newsgroups): Remove unused var `point`.
* lisp/gnus/gnus-range.el (gnus-range-difference): Remove unused var `safe`.
* lisp/gnus/gnus-score.el (gnus-score-load-file): Remove unused var
`score-fn`.
* lisp/gnus/gnus-sum.el (message-options-set-recipient): Declare var.
* lisp/gnus/gnus-undo.el (gnus-undo): Fix docstring lie.
* lisp/gnus/gnus-util.el (print-string-length)
(iswitchb-make-buflist-hook): Declare vars.
(gnus-emacs-version): Remove unused var `codename`.
(gnus-rename-file): Remove unused vars `old-name` and `new-name`.
* lisp/gnus/gnus-uu.el (gnus-uu-yenc-article): Remove unused var
`start-char`.
(gnus-asynchronous): Declare var.
* lisp/gnus/mm-partial.el (gnus-displaying-mime): Declare var.
(mm-inline-partial): Remove unused var `buffer`.
* lisp/gnus/mm-view.el (w3m-force-redisplay, w3m-safe-url-regexp)
(gnus-displaying-mime, gnus-original-article-buffer)
(gnus-article-prepare-hook): Declare vars.
* lisp/gnus/mml-smime.el (mml-smime-epg-encrypt): Remove unused var
`boundary`.
(mml-smime-epg-verify): Remove unused vars `plain` and `signature-file`.
* lisp/gnus/mml1991.el (pgg-text-mode): Declare var.
* lisp/gnus/mml2015.el (pgg-text-mode): Declare var.
(mml2015-pgg-decrypt): Remove unused var `result`.
(mml2015-epg-key-image-to-string): Remove unused var `error`.
(mml2015-epg-decrypt): Remove unused var `result`.
(mml2015-epg-verify): Remove unused vars `plain` and `signature-file`.
* lisp/gnus/nnbabyl.el (nnml-current-directory): Declare var.
* lisp/gnus/nndiary.el (nndiary-files): Move declaration before first use.
* lisp/gnus/nnfolder.el (nnfolder-request-accept-article):
Remove unused var `buf`.
* lisp/gnus/nnmail.el (nnmail-parse-active): Remove unused var `err`.
* lisp/gnus/nnmairix.el (nnmairix-request-group): Remove unused var `args`.
(nnmairix-request-create-group): Remove unused var `info`.
(nnmairix-request-list): Remove unused var `folder`.
(nnmairix-request-set-mark): Remove unused var `propto`.
(nnmairix-request-set-mark): Remove unused vars `number` and `method`.
(nnmairix-close-group): Remove unused var `method`.
(nnmairix-create-search-group-from-message): Remove unused var `cq`.
(nnmairix-create-server-and-default-group): Remove unused var `create`.
(nnmairix-purge-old-groups): Remove unused var `folder`.
(nnmairix-remove-tick-mark-original-article, nnmairix-get-valid-servers):
Remove unused var `cur`.
(nnmairix-replace-group-and-numbers): Remove unused var `header`.
(nnmairix-goto-original-article): Remove unused var `rval`.
(nnmairix-widget-create-query): Remove unused var `allwidgets`.
* lisp/gnus/nnmbox.el (nnml-current-directory): Declare var.
* lisp/gnus/nnmh.el (nnmh-toplev): Move declaration before first use.
(nnmh-request-list-1): Remove unused var `rdir`.
* lisp/gnus/nnml.el (nnml-generate-nov-file): Remove unused var `file`.
* lisp/gnus/nnrss.el (nnrss-request-article): Remove unused var `post`.
(nnrss-request-article): Remove unused var `fn`.
(nnrss-check-group): Remove unused var `rdf-ns`.
* lisp/gnus/nnweb.el (nnweb-request-article): Remove unused var `active`.
(nnweb-google-parse-1): Remove unused var `Score`.
* lisp/gnus/spam-stat.el (spam-stat-error-holder): Remove var.
(spam-stat-buffer-words-with-scores): Remove unused var `word`.
(spam-stat-score-buffer): Remove unused var `spam-stat-error-holder`.
(spam-stat-split-fancy): Use `err` instead of `spam-stat-error-holder`.
* lisp/gnus/spam-wash.el (spam-wash): Remove unused var `handle`.
* lisp/gnus/spam.el (spam-copy-or-move-routine): Remove unused vars
`article` and `mark`.
(spam-register-routine): Remove unused var `article`.
(spam-log-undo-registration): Remove unused var `found`.
(spam-ifile-register-with-ifile): Remove unused var `parameters`.
(spam-check-stat): Remove unused vars `category` and `return`.
(spam-parse-list): Remove unused var `found`.
(spam-filelist-register-routine): Remove unused var `from`.
Stefan Monnier [Sat, 30 Jan 2021 21:45:25 +0000 (16:45 -0500)]
* lisp/gnus: Misc simplifications found during conversion to lexical
* lisp/gnus/nnoo.el (noo-import-1, nnoo-define-skeleton-1): Use `dolist`.
(noo-map-functions, nnoo-define-basics): Directly emit the code rather than
going through an intermediate function; this also avoids the use of `eval`.
(noo-map-functions-1, nnoo-define-basics-1): Delete functions,
folded into their corresponding macro.
* lisp/gnus/gmm-utils.el (gmm-tool-bar-from-list): Demote `eval` to
`symbol-value`.
* lisp/gnus/gnus-art.el (gnus-button-handle-describe-key): Avoid `eval`
since `kbd` is a function nowadays.
(gnus-treat-part-number): Rename from `part-number`.
(gnus-treat-total-parts): Rename from `total-parts`.
(gnus-treat-article, gnus-treat-predicate): Adjust accordingly.
* lisp/gnus/gnus-cache.el (gnus-agent-load-alist): Use `declare-function`.
* lisp/gnus/gnus-group.el (gnus-cache-active-hashtb): Use `defvar`.
(gnus-group-iterate): Make it a normal function since lexical scoping
avoids the risk of name capture anyway.
(gnus-group-delete-articles): Actually use the `oldp` arg.
* lisp/gnus/gnus-html.el (gnus-html-wash-images): Fix debug message so
it's emitted after the `url` var it prints is actually initialized.
And avoid `setq` while we're at it.
* lisp/gnus/gnus-msg.el (gnus-group-mail, gnus-group-news)
(gnus-summary-mail-other-window, gnus-summary-news-other-window):
Merge `let`s using `let*`.
* lisp/gnus/gnus-spec.el (gnus-update-format-specifications):
Tighten the scope of `buffer`, and tighten a regexp.
(gnus-parse-simple-format): Reduce code duplication.
* lisp/gnus/gnus-start.el (gnus-child-mode): Don't `defvar` it since we
never use that variable and accordingly don't define it as a minor mode.
* lisp/gnus/gnus-util.el (gnus-byte-compile): Simplify so it obeys
`gnus-use-byte-compile` not just on the first call.
(iswitchb-minibuffer-setup): Declare.
* lisp/gnus/mail-source.el (mail-source-bind-1)
(mail-source-bind-common-1): Use `mapcar`.
(mail-source-set-common-1): Use `dolist`.
(display-time-event-handler): Declare.
* lisp/gnus/spam.el (BBDB): Use the `noerror` arg of `require`, and
define all the functions for BBDB regardless if the require succeeded.
(spam-exists-in-BBDB-p): Don't inline, not worth it.
Stefan Monnier [Sat, 30 Jan 2021 19:15:19 +0000 (14:15 -0500)]
* lisp/gnus: Demote some macros and defsubsts, plus a fix
* lisp/gnus/gnus-sum.el (gnus-summary-thread-level)
(gnus-summary-article-mark): Turn macros into `defsubst`.
* lisp/gnus/mail-source.el (mail-source-bind-common): Actually use its arg.
* lisp/gnus/nntp.el (nntp-copy-to-buffer): Turn macro into a `defsubst`.
(nntp-wait-for, nntp-retrieve-data, nntp-send-command): Don't inline
those, it's not worth it.
* lisp/gnus/gnus-util.el (gnus-define-keys): Use `declare`, and also
don't quote `keymap` if it's a variable name.
(gnus-define-keys-1): Reject the case where `keymap` is a variable name.
(gnus-eval-in-buffer-window, gnus-define-keys-safe)
(gnus-define-keymap, gnus-atomic-progn, gnus-with-output-to-file)
(gnus-parse-without-error): Use `declare`.
(gnus-atomic-progn-assign, gnus-atomic-setq): Delete macros.
* lisp/gnus/gnus-undo.el (gnus-undo-register): Drop indent and edebug spec
since they're not really appropriate for a function.
* lisp/gnus/gnus-art.el (gnus--\,@): New macro.
Use it at top-level to construct the `gnus-article-FOO` => `article-FOO`
wrapper functions.
(gnus-with-article-headers, gnus-with-article-buffer): Use `declare`.
Eli Zaretskii [Sat, 30 Jan 2021 09:26:07 +0000 (11:26 +0200)]
New Rmail option 'rmail-show-message-set-modified'
* lisp/mail/rmail.el (rmail-show-message-set-modified): New
option.
(rmail-show-message-1): If 'rmail-show-message-set-modified' is
non-nil, don't reset the buffer's modified state. (Bug#45941)
Jeff Spencer [Sat, 30 Jan 2021 07:12:57 +0000 (08:12 +0100)]
Fix interaction between two dired cleanup variables
* lisp/dired.el (dired-clean-up-after-deletion): Kill the buffers
if you have `dired-clean-up-buffers-too' set and
`dired-clean-confirm-killing-deleted-buffers' nil (bug#38037).
Dmitry Gutov [Sat, 30 Jan 2021 01:56:27 +0000 (03:56 +0200)]
vc-dir-mode-map: Remove the mouse-2 binding
* lisp/vc/vc-dir.el (vc-dir-mode-map):
Remove the mouse-2 binding (bug#13692).
(vc-dir-mode): Update the docstring accordingly.
(vc-dir-status-mouse-map): New variable.
(vc-default-dir-printer): Use it on the state buttons.
Eli Zaretskii [Fri, 29 Jan 2021 11:52:31 +0000 (13:52 +0200)]
Support 'operating-system-release' on MS-Windows
* src/w32fns.c (w32_version_string) [WINDOWSNT]: New function.
* src/w32common.h (w32_version_string) [WINDOWSNT]: Add prototype.
* src/editfns.c (init_editfns) [WINDOWSNT]: Produce a non-nil
string with the OS version.
* simple.el (shell-command, shell-command-on-region): Set
revert-buffer-function buffer-locally, not globally. Also, avoid an
unnecessary call to (current-buffer) by taking advantage of the
closure (bug#46151).
Stefan Kangas [Thu, 28 Jan 2021 20:55:31 +0000 (21:55 +0100)]
; Fix my previous commit
* lisp/generic-x.el (generic-mode-ini-file-find-file-hook): Fix my
previous commit; for some reason 'function' produces a warning here
while 'quote' does not.
Stefan Monnier [Thu, 28 Jan 2021 19:42:21 +0000 (14:42 -0500)]
Use lexical-binding in all of `lisp/emacs-lisp`
* lisp/emacs-lisp/bindat.el: Use lexical-binding.
(bindat--unpack-group, bindat--length-group, bindat--pack-group):
Declare `last` and `tag` as dyn-scoped.
(bindat-unpack, bindat-pack): Bind `bindat-raw` and `bindat-idx` via
`let` rather than via the formal arglist.
* lisp/emacs-lisp/helper.el: Use lexical-binding.
(Helper-help-map): Move initialization into declaration.
* lisp/emacs-lisp/regi.el: Use lexical-binding.
(regi-interpret): Remove unused var `tstart`.
Declare `curframe`, `curentry` and `curline` as dyn-scoped.
* lisp/emacs-lisp/shadow.el: Use lexical-binding.
(load-path-shadows-find): Remove unused var `file`.
Tighten a regexp, use `push`.
* lisp/emacs-lisp/tcover-ses.el: Use lexical-binding. Require `ses`.
Remove correspondingly redundant declarations.
(ses--curcell-overlay): Declare.
(ses-exercise): Use `dlet` and use a properly-prefixed var name.
Fix name of `curcell-overlay` variable.
* lisp/emacs-lisp/unsafep.el: Use lexical-binding.
(unsafep): Bind `unsafep-vars` via `let` rather than via the formal arglist.
Juri Linkov [Thu, 28 Jan 2021 19:27:26 +0000 (21:27 +0200)]
Use isearch-tmm-menubar when tmm-menubar is called in isearch-mode (bug#43966)
* lisp/isearch.el (isearch-menu-bar-commands): Add tmm-menubar to defaults.
(isearch-mode-map): Remove remapping of tmm-menubar to isearch-tmm-menubar.
* lisp/tmm.el (tmm-menubar): Call isearch-tmm-menubar in isearch-mode.
Stefan Monnier [Thu, 28 Jan 2021 17:13:29 +0000 (12:13 -0500)]
* test/Makefile.in (emacs): Use the C locale
This fixes spurious test failures in my environment for
`diff-mode-test-font-lock-syntax-one-line` (where my `diff` otherwise
returns "No newline at end of file" in French) and for
various tests in `emacs-module-tests` because errors signal
"Abandon" instead of "Abort".
Michael Albinus [Thu, 28 Jan 2021 14:09:18 +0000 (15:09 +0100)]
Simplify auto-revert buffer list by watch descriptor (Bug#44639)
* lisp/autorevert.el (auto-revert--buffer-by-watch-descriptor):
Rename from `auto-revert--buffers-by-watch-descriptor'. Make it
an assoc list.
(auto-revert-notify-rm-watch, auto-revert-notify-add-watch)
(auto-revert-notify-handler): Adapt accordingly. Based on a
patch provided by Spencer Baugh <sbaugh@catern.com>. (Bug#44639)
Mattias M [Thu, 28 Jan 2021 06:34:10 +0000 (07:34 +0100)]
Fix fill-paragraph in asm-mode
* lisp/progmodes/asm-mode.el: The value of fill-prefix ought to be nil
not "\t" so that fill-context-prefix can do its thing. In fact,
fill-prefix does not have to be set at all becuase asm-mode derives
from prog-mode and fill-prefix is set in simple.el.
* test/lisp/progmodes/asm-mode-tests.el: Add relevant test (bug#41064).
Harald Jörg [Thu, 28 Jan 2021 03:22:21 +0000 (04:22 +0100)]
perl-mode.el: Eliminate keywords which are not in Perl.
* lisp/progmodes/perl-mode.el (perl-imenu-generic-expression):
Remove keywords which are not part of Perl.
(perl-font-lock-keywords-2): Remove keywords which are not part of
Perl (bug#46024). (These keywords are part of Raku; aka. Perl 6.)
Juri Linkov [Wed, 27 Jan 2021 18:08:43 +0000 (20:08 +0200)]
Support multi-line prompt and contents in previous-line-or-history-element.
* lisp/simple.el (previous-line-or-history-element): Move to the
beginning of minibuffer contents if there is editable minibuffer contents
on the same line after moving point to the prompt (bug#46033).
Fix minimal old-column from 0 to 1 to put point at the beginning of
minibuffer contents after going to the previous history element.
Stefan Monnier [Wed, 27 Jan 2021 17:25:52 +0000 (12:25 -0500)]
* lisp/international/titdic-cnv.el: Revert to utf-8 encoding
While it's true that using the iso-2022-jp encoding on the file does
allow Emacs to render the two strings differently, this only applies to
the source file. The .elc files all use `utf-8-emacs` encoding anyway,
so that info is lost. And the difference is even lost before we write
the .elc file because when Emacs byte-compiles that code the
byte-compiler considers those two strings as "equal" and emits only one
string in the byte-code (so the two branches return `eq` strings).
So, I think using `iso-2022-jp` is a bad idea here: it gives the
illusion that the the `charset` info exists, even it will be lost.
Eli discussed it with Handa-san a year ago, and they arrived at the
conclusion that the charset information is indeed no longer important.
Stefan Monnier [Wed, 27 Jan 2021 02:11:49 +0000 (21:11 -0500)]
Use lexical-binding in of all lisp/language
* lisp/international/titdic-cnv.el (pinyin-convert):
Enable lexical-binding in the generated file(s).
* lisp/language/ethio-util.el: Use lexical-binding.
(ethio-tex-to-fidel-buffer): Use `inhibit-read-only`. Remove unused
vars `p` and `ch`.
* lisp/language/hanja-util.el: Use lexical-binding.
* lisp/language/ind-util.el: Use lexical-binding.
(indian-translate-region): Actually use the `from` and `to` arguments.
(<toplevel>): Use `dlet`. Remove unused var `current-repertory`.
(indian-2-column-to-ucs-region): Remove unused var `pos`.
* lisp/language/japan-util.el: Use lexical-binding.
(japanese-katakana-region, japanese-hiragana-region)
(japanese-zenkaku-region): Remove unused var `next`.
* lisp/language/korea-util.el: Use lexical-binding.
* lisp/language/lao-util.el: Use lexical-binding.
(lao-composition-function): Remove unused var `glyph`.
* lisp/language/thai-util.el: Use lexical-binding.
(thai-composition-function): Remove unused var `glyph`.
* lisp/language/thai-word.el: Use lexical-binding.
(thai-forward-word): Remove unused var `tail`.
* lisp/language/tibet-util.el: Use lexical-binding.
(tibetan-add-components): Remove unused var `tmp`.
(tibetan-compose-region): Remove unused vars `str`, `result`, `chars`.
* lisp/language/viet-util.el:
* lisp/language/tv-util.el:
* lisp/language/cyril-util.el:
* lisp/language/china-util.el: Use lexical-binding.
Glenn Morris [Wed, 27 Jan 2021 15:55:11 +0000 (07:55 -0800)]
; Merge from origin/emacs-27
The following commits were skipped:
e79e377a4e (origin/emacs-27) Improve documentation of 'read-regexp' a... 0340e9eccb read-regexp-suggestions doc string improvement 932aba674c Try to improve the read-regexp doc string 809503431d ; xref-revert-buffer: Drop the (goto-char) at the end 0399cc2ab5 Erase the buffer only after fetching the new contents
Eli Zaretskii [Wed, 27 Jan 2021 15:52:51 +0000 (17:52 +0200)]
Fix display of stretches of whitespace in the display margins
* src/xdisp.c (produce_stretch_glyph): Truncate the stretch glyph
due to line wrap only when drawing in the text area.
* src/xterm.c (x_draw_stretch_glyph_string):
* src/w32term.c (w32_draw_stretch_glyph_string): Fix the
adjustment of the stretch X and width so that stretch glyphs could
be drawn in the left margin. Reported by Paul W. Rankin
<pwr@bydasein.com>.
Eli Zaretskii [Wed, 27 Jan 2021 15:15:46 +0000 (17:15 +0200)]
Improve documentation of 'read-regexp' and friends
* doc/emacs/glossary.texi (Glossary): Add "Tag" to the Glossary.
* doc/emacs/maintaining.texi (Xref): Mention that identifiers are
also known as "tags".