Make the optimiser aware of lexical arguments. Otherwise we cannot
know for sure whether a variable is lexical or dynamic during
traversal.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-one-form): New optimiser
entry point, replacing the recursive byte-optimize-form.
* lisp/emacs-lisp/bytecomp.el (byte-optimize-one-form): Autoload.
(byte-compile-keep-pending, byte-compile-top-level):
Use byte-optimize-one-form.
Stephen Gildea [Fri, 30 Jul 2021 00:37:39 +0000 (17:37 -0700)]
mh-junk: replace color-based terms with descriptive words
* lisp/mh-e/*.el: "whitelist" -> "allowlist" and "blacklist" -> "blocklist".
* doc/misc/mh-e.texi: update manual to match.
* lisp/mh-e/folder.el: Change the binding of 'mh-junk-allowlist' to 'J a'.
Add a compatibility binding for the old 'J w'.
* lisp/mh-e/mh-scan.el (mh-note-allowlisted): Change char from 'W' to 'A'.
* lisp/mh-e/junk.el: Rename 'mh-blacklist-a-msg' to 'mh-junk-blocklist-a-msg',
adding the missing "junk-" to the function name.
Rename Gnus -unsubscribe-group commands to -toggle-subscription
* doc/emacs/misc.texi (Gnus Group Buffer): Document change.
* doc/misc/gnus.texi (Subscription Commands): Document change.
(Browse Foreign Server): Document change.
* lisp/gnus/gnus-group.el (gnus-group-mode-map):
Unsubscribe is not subscribe.
(gnus-group-sub-map): Unsubscribe is not subscribe.
(gnus-group-make-menu-bar): Unsubscribe is not subscribe.
(gnus-group-tool-bar-gnome): Unsubscribe is not subscribe.
(gnus-group-mode): Unsubscribe is not subscribe.
(gnus-group-unsubscribe): Refactor.
(gnus-group-subscribe): Refactor.
(gnus-group-unsubscribe-current-group): Define obsolete alias.
(gnus-group-unsubscribe-group): Define obsolete alias.
(gnus-group-toggle-subscription-at-point): Refactor.
(gnus-group-set-subscription-at-point): Refactor.
(gnus-group-toggle-subscription): Refactor.
(gnus-group-set-subscription): Refactor.
* lisp/gnus/gnus-srvr.el (gnus-browse-mode-map):
Unsubscribe is not subscribe.
(gnus-browse-make-menu-bar): Unsubscribe is not subscribe.
(gnus-browse-mode): Document the change.
(gnus-browse-unsubscribe-current-group): Define obsolete alias.
(gnus-browse-unsubscribe-group): Define obsolete alias.
(gnus-browse-toggle-subscription-at-point): Unsubscribe is not subscribe.
(gnus-browse-toggle-subscription): Unsubscribe is not subscribe
(bug#49759).
* lisp/bindings.el (mode-line-position-column-format): Improve doc
string.
(mode-line-position-line-format): Point to
`mode-line-position-column-line-format'.
Brian Leung [Tue, 20 Jul 2021 07:32:34 +0000 (00:32 -0700)]
Ensure that gud commands for non-GDB debuggers are handled by repeat-mode
* lisp/progmodes/gud.el (sdb-repeat-map): Define.
(sdb): Set repeat-mode property to the symbol corresponding to the
repeat map.
(dbx-repeat-map): Define.
(dbx): Set repeat-mode property to the symbol corresponding to the
repeat map.
(xdb-repeat-map): Define.
(xdb): Set repeat-mode property to the symbol corresponding to the
repeat map.
(perldb-repeat-map): Define.
(perldb): Set repeat-mode property to the symbol corresponding to the
repeat map.
(pdb-repeat-map): Define.
(pdb): Set repeat-mode property to the symbol corresponding to the
repeat map.
(guiler-repeat-map): Define.
(guiler): Set repeat-mode property to the symbol corresponding to the
repeat map.
(jdb-repeat-map): Define.
(jdb): Set repeat-mode property to the symbol corresponding to the
repeat map. (Bug#49632)
Brian Leung [Tue, 20 Jul 2021 06:41:01 +0000 (23:41 -0700)]
Ensure that gud commands for M-x gdb are handled by repeat-mode
* lisp/progmodes/gud.el (gud-gdb-repeat-map): Rename from
gud-repeat-map, and populate at the top-level.
(gud-set-repeat-map-property): Introduce this helper function for
setting the repeat-map property.
(gud-gdb): Use the gud-set-repeat-map-property function to assign the
repeat-map property.
* lisp/progmodes/gdb-mi.el (gdb): Use the gud-set-repeat-map-property
function to assign the repeat-map property.
Because different debugging tools may not support all of the gud-foo
functions, we reassign the repeat-map property within the respective
commands, as opposed to the top level of the files, to ensure that the
repeat-map property is reassigned each time to a symbol corresponding
to the active debugging tool. (Bug#49632)
Fix mistake in switch-case generation of `null` (bug#49746)
Reported by Gregor Zattler.
* lisp/emacs-lisp/bytecomp.el (byte-compile--cond-switch-prefix):
Be more careful in the selection of equality.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test case.
Alan Third [Sat, 24 Jul 2021 15:08:09 +0000 (16:08 +0100)]
Convert fringe bitmaps to vectors on NS port
Unfortunately *step doesn't support masks for bitmap images so
changing the colors of fringe bitmaps is awkward. We can work around
this by converting the bitmap into an NSBezierPath and drawing it in
the required color.
* src/nsterm.m (ns_define_fringe_bitmap):
(ns_destroy_fringe_bitmap): New functions
(ns_draw_fringe_bitmap): Display the NSBezierPath.
* src/nsimage.m
([EmacsImage initFromXBM:width:height:fg:bg:reverseBytes:]): Remove
variable that's there to allow us to easily modify the XBM colors.
([EmacsImage setXBMColor:]): Remove method.
Alan Third [Sat, 17 Jul 2021 10:23:42 +0000 (11:23 +0100)]
Simplify NS sizing and positioning code
* src/nsterm.m (ns_set_offset): Unify the two branches into one, most
of the code is the same.
(ns_set_window_size): Use the provided tools to calculate the window
size instead of doing it ourselves.
* lisp/progmodes/grep.el (grep-regexp-alist): Adjust the return value
from the END-COL function by one since it is now (after fixing
bug#49624) inclusive. Found by Juri Linkov.
Michael Albinus [Mon, 26 Jul 2021 18:51:57 +0000 (20:51 +0200)]
Some minor improvements for share handling in tramp-gvfs.el
* lisp/net/tramp-gvfs.el (tramp-gvfs-connection-mounted-p):
Set "share" connection property if the mount spec offers it.
(tramp-gvfs-handle-get-remote-uid)
(tramp-gvfs-handle-get-remote-gid): Use it.
* lisp/textmodes/tex-mode.el (tex-validate-buffer):
Set `inhibit-read-only` around all modifications of the
read-protected *Occur* buffer (bug#19326).
Add the `occur-match` property, and adjust the extent of the
`occur-target` property, so that next-error and previous-error work
correctly (bug#39121).
Add back occur-mode-find-occurrence for compatibility (bug#39121)
* lisp/replace.el (occur-mode-find-occurrence):
Put back (an emulation of) the previously removed function.
It is used internally in eshell and in some external code.
When bookmark is overwritten, unfontify its previous position
* lisp/bookmark.el (bookmark-store): When the bookmark-fontify option
is non-nil, setting or jumping to bookmarks will colorize them using
`bookmark-face'. With this change, overwriting a bookmark will remove
the fontification at its former position (bug#49725).
* lisp/replace.el (occur-after-change-function): Instead of replacing
the whole line being edited, use shrink-wrapping to replace the
smallest interval encompassing the change. That way, we avoid
disturbing markers (such as occur highlighting locations) in the line;
they would otherwise all be forced to the beginning.
Keep track of match extents in occur-mode (bug#39121)
Use the `occur-target` text property to keep track of the extents of
all matches on each line instead of just the start of the first match.
Doing so allows us to highlight all matches when jumping to a matching
line instead of just the first one, and it works in a more principled
way. It also removes compatibility problems that were introduced with
occur-highlight-regexp.
For compatibility with code that populate their own occur-mode
buffers, we still accept `occur-target` properties with a single
marker as value.
* lisp/replace.el (occur-highlight-regexp, occur-highlight-overlay):
Remove.
(occur-highlight-overlays): New.
(occur--targets-start): New.
* lisp/replace.el (occur-after-change-function):
(occur-mode-find-occurrence): Replace with...
(occur-mode--find-occurrences): ...this function that returns the
whole `occur-target` property value.
(occur-mode-goto-occurrence, occur-mode-goto-occurrence-other-window)
(occur-goto-locus-delete-o, occur-mode-display-occurrence)
(occur-engine): Adjust to new property format.
(occur--highlight-occurrence): Replace with...
(occur--highlight-occurrences): ...this function that takes
the `occur-target` property value as argument.
(occur-1): Don't use `occur-highlight-regexp`.
* test/lisp/replace-tests.el (occur-highlight-occurrence):
Adapt to new property format.
Arthur Miller [Sat, 24 Jul 2021 14:58:08 +0000 (16:58 +0200)]
Support '--group-directories-first' in ls-lisp.el
* lisp/ls-lisp.el (ls-lisp--sanitize-switches): New function.
(ls-lisp--insert-directory): Support '--group-directories-first'.
Call 'ls-lisp--sanitize-switches' to convert long options to short
forms and remove unsupported long options. Update the doc string.
* test/lisp/replace-tests.el (replace-tests-with-undo):
When testing the "U" (undo all changes) option, the code will delay
and ding which is obnoxious in an automated test.
Disabling that makes the test quiet and about 150 times faster.
Yuan Fu [Sat, 24 Jul 2021 17:11:08 +0000 (19:11 +0200)]
Add filter to GDB's register buffer
* lisp/progmodes/gdb-mi.el (gdb-registers-enable-filter)
(gdb-registers-filter-pattern-list): New custom options.
(gdb-header-click-event-handler, gdb-registers-toggle-filter): New
functions.
(gdb-header-click-event-handler): Only add a register if it passes the
filter.
(gdb-registers-mode-map): New keybinding for toggling the filter.
(gdb-registers-header): New buttons on the header line for the
filter (bug#39179).
* doc/misc/smtpmail.texi (Queued delivery): Document it (bug#49709).
* lisp/gnus/message.el (message-multi-smtp-send-mail): Store
variables.
* lisp/mail/smtpmail.el (smtpmail-queue-mail): Mention it.
(smtpmail-store-queue-variables): New variable.
(smtpmail-send-it): Store SMTP variables if requested.
(smtpmail-send-queued-mail): Restore variables.
Jean Forget [Fri, 23 Jul 2021 13:26:40 +0000 (15:26 +0200)]
Add more support for the French Revolutionary Calendar
* lisp/calendar/cal-french.el (calendar-french-feasts-array): New
variable (bug#19174).
(calendar-french-trim-feast): New function.
(calendar-french-date-string, calendar-french-goto-date):
(calendar-french-goto-date): Use them.
Off-by-one error in compilation rule end-column function (bug#49624)
* lisp/progmodes/compile.el (compilation-error-properties):
When the end-column parameter of a compilation message rule
(in compilation-error-regexp-alist[-alist]) is a function, treat its
return value as if it were matched by the regexp, which is how it is
documented to work, and how all other parameters work.
Warn about arity errors in inlining calls (bug#12299)
Wrong number of arguments in inlining function calls (to `defsubst` or
explicitly using `inline`) did not result in warnings, or in very
cryptic ones.
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): Add calls
to `byte-compile--check-arity-bytecode`.
* lisp/emacs-lisp/bytecomp.el (byte-compile-emit-callargs-warn)
(byte-compile--check-arity-bytecode): New functions.
(byte-compile-callargs-warn): Use factored-out function.
* test/lisp/emacs-lisp/bytecomp-resources/warn-callargs-defsubst.el:
* test/lisp/emacs-lisp/bytecomp-tests.el ("warn-callargs-defsubst.el"):
New test case.
F. Jason Park [Fri, 23 Jul 2021 13:18:05 +0000 (15:18 +0200)]
Remove text props from callback args in erc-button
* lisp/erc/erc-button.el (erc-button-add-buttons-1): Remove text
properties from strings stored in `erc-data' and passed to
`erc-callback'
(both text properties themselves) (bug#49704). This reduces
memory usage in erc buffers (which are long-lived and can become
very large).
Stefan Kangas [Fri, 23 Jul 2021 12:57:44 +0000 (14:57 +0200)]
Make nil value of fill-column obsolete
* lisp/textmodes/fill.el (current-fill-column): Make nil value of
'fill-column' obsolete. (Bug#22847)
(current-fill-column--has-warned): New variable to track warning.
* lisp/simple.el (do-auto-fill): Remove handling of nil return value
from 'current-fill-column'.
* etc/NEWS: Announce obsoletion of this usage.
'global-mode-string' elements should have a space at the end
* lisp/time.el (display-time-string-forms):
* lisp/battery.el (battery-mode-line-format): Add a space to the
end (bug#30056).
* lisp/bindings.el (mode-line-misc-info): Remove space from end.
This will make the default format have one space before the
line-of-dashes (instead of two) on terminals.
Paul Eggert [Fri, 23 Jul 2021 11:33:21 +0000 (13:33 +0200)]
Redo emacsclient socket symlink-attack checking
* admin/merge-gnulib (GNULIB_MODULES): Add file-has-acl.
* lib/file-has-acl.c: New file, copied from Gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib-src/emacsclient.c: Include acl.h, for file_has_acl.
(O_PATH): Default to O_SEARCH, which is good enough here.
(union local_sockaddr): New type.
(socket_status): Remove, replacing with ...
(connect_socket): New function. All callers changed.
This function checks for ownership and permissions issues with the
parent directory of the socket file, instead of checking the
owner of the socket (which does not help security).
(socknamesize): Move to file scope.
(local_sockname): New arg S. No need to pass socknamesize.
UID arg is now uid_t. All callers changed. Get file descriptor
of parent directory of socket, to foil some symlink attacks.
Do not follow symlinks to that directory.
(set_local_socket): Create the socket here instead of on
each attempt to connect it. Fall back from XDG_RUNTIME_DIR
to /tmp only if the former fails due to ENOENT. Adjust
permission-failure diagnostic to match changed behavior.
This addresses Bug#33847, which complained about emacsclient in a
safer XDG environment not connecting to an Emacs server running in
a less-safe enviroment outside XDG. The patch fixes a
longstanding issue with emacsclient permission checking.
It’s ineffective to look at the permission of the socket file
itself; on some platforms, these permissions are ignored anyway.
What matters are the permissions on the parent directory of the
socket file, as these are what make symlink attacks possible.
Change the permissions check accordingly, and also refuse to
follow symlinks to that parent directory. These changes make it
OK for emacsclient to fall back from XDG_RUNTIME_DIR to the
traditionally less-safe /tmp/emacsNNNN directories, since /tmp is
universally sticky nowadays.
Eli Zaretskii [Thu, 22 Jul 2021 18:23:48 +0000 (21:23 +0300)]
Fix display of line/wrap-prefix when there's a display property at BOL
* src/xdisp.c (get_line_prefix_it_property): New function.
(handle_line_prefix): Call 'get_line_prefix_it_property' instead
of 'get_it_property', to examine also the property of the buffer
text underlying the display or overlay string. (Bug#49695)
Avoid failing in desktop-clear due to killed buffers
* lisp/desktop.el (desktop-clear): check that buffer is not already
killed before attempting to kill it. A buffer might become killed as
part of regular operation as a side-effect of killing another buffer,
and then attempt to kill it again causes error (bug#49692).