Eli Zaretskii [Sat, 18 Sep 2021 10:23:48 +0000 (13:23 +0300)]
Fix performance degradation in commands that describe key bindings
* src/keymap.c (syms_of_keymap)
<describe-bindings-check-shadowing-in-ranges>: New variable.
(describe_vector): Check shadowing of consecutive keys only if
'describe-bindings-check-shadowing-in-ranges' is non-nil. Remove
redundant second loop when VECTOR is a char-table. Improve
comments. Patch by Stefan Kangas <stefan@marxist.se>. (Bug#45379)
* test/src/keymap-tests.el
(help--describe-vector/bug-9293-one-shadowed-in-range): Adapt the
test case for the new variable.
Stefan Kangas [Sat, 18 Sep 2021 08:39:35 +0000 (10:39 +0200)]
checkdoc: Only look for commonly used modifier keys
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
Search for the modifier key "s-", but not the modifier key "A-".
The latter is very uncommon and leads to false positives.
Check for null bytes in filenames in 'expand-file-name' (bug#49723)
* src/fileio.c (expand-file-name): Check for null bytes for both
NAME and DEFAULT-DIRECTORY arguments. Also check for null bytes
in buffer-local default-directory, assuming it is used.
* src/coding.c (encode_file_name): Use CHECK_STRING_NULL_BYTES.
* src/lisp.h (CHECK_STRING_NULL_BYTES): Add function for checking
for null bytes in Lisp strings.
* test/src/fileio-tests.el (fileio-test--expand-file-name-null-bytes):
Add test for new changes to expand-file-name.
* etc/NEWS: Announce changes.
Stefan Kangas [Thu, 16 Sep 2021 17:13:56 +0000 (19:13 +0200)]
checkdoc: 'y-or-n-p' no longer needs space
* lisp/emacs-lisp/checkdoc.el (checkdoc-message-text-engine):
Change 'y-or-n-p' check to accept prompt ending with both "? " or "?",
that is, it no longer needs the space. (Bug#50621)
(checkdoc--fix-y-or-n-p): New helper function.
* test/lisp/emacs-lisp/checkdoc-tests.el (checkdoc-tests-fix-y-or-n-p)
(checkdoc-tests-fix-y-or-n-p/no-change)
(checkdoc-tests-fix-y-or-n-p/with-space): New tests.
Robert Pluim [Fri, 17 Sep 2021 17:40:48 +0000 (19:40 +0200)]
Move emoji fontset addition later
* lisp/international/fontset.el (setup-default-fontset): Move the
fontset addition for emoji script after that for various graphic-like
characters, since they overlap, and we want the emoji setting to win.
* lisp/term.el (term-emulate-terminal): Don't record the selection
of the window here, because we're not doing a user-level window
selection, but just selecting the window for internal purposes
(bug#41984).
Stop imenu indexing after a certain number of seconds
* doc/emacs/programs.texi (Imenu): Document it.
* lisp/imenu.el (imenu-max-index-time): New user option.
(imenu-default-create-index-function, imenu--generic-function):
Use it (bug#18696).
Stephen Gildea [Fri, 17 Sep 2021 14:01:40 +0000 (07:01 -0700)]
MH-E: fix check for nmh or Mailutils installation
* lisp/mh-e/mh-e.el (mh-variant-gnu-mh-info, mh-variant-nmh-info):
Run install-mh, not mhparam, to check whether an MH variant is
installed on the system. mhparam fails if no user profile is found,
so it is not a reliable check of the state of the system as a whole.
Tested with:
nmh 1.4, nmh 1.7.1, GNU Mailutils 2.2, GNU Mailutils 3.7, GNU Mailutils 3.13
Eli Zaretskii [Fri, 17 Sep 2021 14:07:32 +0000 (17:07 +0300)]
Fix display of stretch glyphs
* src/xterm.c (x_draw_stretch_glyph_string):
* src/w32term.c (w32_draw_stretch_glyph_string): Fix drawing
stretch glyphs when the window is hscrolled. (The original
pre-Jan-2021 code was almost correct, except that it used
'window_box_left_offset' instead of 'window_box_left', and didn't
restrict the background_width fixup to text-area.) (Bug#50564)
Robert Pluim [Tue, 14 Sep 2021 17:07:03 +0000 (19:07 +0200)]
Split Unicode emoji into their own script
* admin/notes/unicode: Describe how to update emoji for new Unicode release.
* admin/unidata/Makefile.in: Pass emoji-data.txt to
blocks.awk script.
* admin/unidata/README: Add pointer to emoji-data.txt file.
* admin/unidata/blocks.awk: Parse emoji-data.txt, add emoji codepoints
to the 'emoji' script (except for the ASCII ones).
* admin/unidata/emoji-data.txt: New file.
* etc/NEWS: Describe new 'emoji' script.
* etc/TODO: Update item about 'emoji' script.
* lisp/international/fontset.el (script-representative-chars): Add
'emoji' script.
(setup-default-fontset): Add 'emoji' script. Use "Noto Color Emoji"
as default font for it.
For better compatibility with different systems.
Performance is unaffected, except in very pathological cases
(~100000 matches), and even then the overhead of 'sort' is comparable.
* lisp/progmodes/xref.el (xref-search-program-alist):
Drop the piping through 'sort'.
(xref-matches-in-files): Sort here instead.
Do that to both searchers' output as well now.
Stefan Kangas [Fri, 17 Sep 2021 09:02:38 +0000 (11:02 +0200)]
Make ediff-set-difference into obsolete alias for seq-difference
* lisp/vc/ediff-util.el (ediff-set-difference): Make into obsolete
function alias for 'seq-difference'.
* lisp/vc/ediff-mult.el (ediff-intersect-directories): Update single caller.
Stefan Kangas [Fri, 17 Sep 2021 09:00:06 +0000 (11:00 +0200)]
Make ediff-intersection into obsolete alias for seq-intersection
* lisp/vc/ediff-util.el (ediff-intersection): Make into obsolete
function alias for 'seq-intersection'.
* lisp/vc/ediff-mult.el (ediff-intersect-directories): Update
single caller.
Stefan Kangas [Fri, 17 Sep 2021 08:41:15 +0000 (10:41 +0200)]
Make ediff-union into obsolete alias for seq-union
* lisp/emacs-lisp/seq.el (seq-union): Autoload.
* lisp/vc/ediff-util.el (ediff-union): Make into obsolete function
alias for 'seq-union'.
* lisp/vc/ediff-mult.el (ediff-intersect-directories): Update single
caller.
John Cummings [Thu, 16 Sep 2021 23:00:50 +0000 (23:00 +0000)]
Fix disk-free info in 'insert-directory'
* lisp/files.el (insert-directory): Call 'get-free-disk-space'
with the argument FILE, to make sure the reported info is for the
correct volume. (Bug#50630)
Olivier Certner [Fri, 5 Feb 2021 14:34:50 +0000 (15:34 +0100)]
ERC: NickServ: Prompt for password last, overall simplifications (bug#46777)
When 'erc-prompt-for-nickserv-password' is non-nil, don't ignore the
other forms of identification. Instead, process them first, and
prompt for the password last. Separate concerns (determination of the
nick to use, of the password to use, and actual message sending).
Note that the user can be interactively prompted for a password on
reception of a NickServ request, as before (on
'erc-prompt-for-nickserv-password').
* lisp/erc/erc-services.el (erc-nickserv-identify): Make the password
argument optional (and don't prompt for it interactively). Further,
now take the nick to use for identification (interactively, ask for
it, defaulting to the current one). Move the actual message sending
into the new 'erc-nickserv-send-identify' function, and the password
prompting into 'erc-nickserv-get-password'.
(erc-nickserv-send-identify): New function containing the code for
sending the identify message to NickServ, given the nick and password.
(erc-nickserv-get-password): Try each password source in turn, in the
following order: 'erc-nickserv-passwords', auth-source (if
'erc-use-auth-source-for-nickserv-password' is non-nil), and in the
end prompt the user interactively (if
'erc-prompt-for-nickserv-password' is non-nil). If one source returns
a string, the function returns it, or nil if the string is empty.
(erc-nickserv-call-identify-function): Declare obsolete, but retain
for backward compatibility. Prefer invoking 'erc-nickserv-identify'
directly instead.
(erc-nickserv-identify-autodetect, erc-nickserv-identify-on-connect)
(erc-nickserv-identify-on-nick-change): Call 'erc-nickserv-identify'
directly ('erc-nickserv-call-identify-function' has been obsoleted).
For the last two functions, remove the redundant checks on the
NickServ identification flags (additionally, it is doubtful they have
any measurable impact on performance).
Allow irc network symbols in erc-autojoin-channels-alist
* lisp/erc/erc-join.el (erc-autojoin-channels-alist): Explain the
extension.
(erc-autojoin-server-match): New function.
(erc-autojoin-channels): Use it.
(erc-autojoin-current-server): New function.
(erc-autojoin-add): Use it.
(erc-autojoin-remove): Ditto.
This can be useful when connecting to an IRC proxy like Weechat that
relays several networks under the same server. If we just keyed on the
server name, we would end up joining a channel on all networks
whenever we join one network on that server.
Networks are simply stored as symbols instead of regexes, since that's
how `erc-network' works.
The `erc-autojoin-add' function will still auto-add servers as strings
if the network doesn't have at least one entry in
`erc-autojoin-channels-alist'.
Stefan Kangas [Thu, 16 Sep 2021 13:33:35 +0000 (15:33 +0200)]
Prefer "website" to "homepage"
These days, a "home page" is understood to be only "the main web page
of a website" or "landing page", whereas a "website" is "a collection
of web pages and related content" (Wikipedia).
F. Jason Park [Thu, 16 Sep 2021 13:35:55 +0000 (15:35 +0200)]
Change the erc debug logging format to be more repeatable
* erc.el (erc-debug-irc-protocol): Fix line-ending mismatch between
incoming and outgoing logger lines without changing interface. Do this
by adding carriage returns to the latter to improve machine
readability. Change printed peer labels to most accurately reflect
logical endpoints.
(erc-debug-irc-protocol-time-format): Add new variable to support
timestamps in protocol logger output.
(erc-debug-irc-protocol-version): Add new variable to help tooling
track logging format independent of ERC and Emacs versions.
(erc-toggle-debug-irc-protocol): Add headers to protocol-log buffer
to aid future bug-reproduction tools. Clean up overlong lines (bug#50009).
F. Jason Park [Thu, 16 Sep 2021 13:25:18 +0000 (15:25 +0200)]
Fix erc nick trimming
* lisp/erc/erc.el (erc-lurker-maybe-trim): Prevent warning from
showing up in third-party code using this function by autoloading
rx.el when needed. Remove trailing chars appended for uniquifying
purposes when a nick is already taken. Special thanks to Mattias
Engdegård for making this more respectable (Bug#50005).
* test/lisp/erc/erc-tests.el: Add tests for the above and require
erc-networks.
F. Jason Park [Thu, 16 Sep 2021 13:20:59 +0000 (15:20 +0200)]
Fix mistake in test for erc-ring-previous-command
* test/lisp/erc/erc-tests.el (erc-ring-previous-command):
The variable erc-send-completed-hook was previously set to nil
permanently, which would affect other tests (bug#50005).
Eli Zaretskii [Thu, 16 Sep 2021 12:34:36 +0000 (15:34 +0300)]
Clarify use of early-init file
* doc/emacs/custom.texi (Early Init File): Clarify that using the
early-init file should be reserved to cases where it is absolutely
necessary. (Bug#50491)
Stefan Kangas [Thu, 16 Sep 2021 09:31:42 +0000 (11:31 +0200)]
Various minor checkdoc tweaks
* lisp/emacs-lisp/checkdoc.el (checkdoc-symbol-words): Add more
"good" words that are used a lot in practice, and where using them
doesn't really hurt the quality of the documentation.
(checkdoc-proper-noun-list): Add "dired", remove "ispell"; the
latter should not always be capitalized.
(checkdoc-common-verbs-wrong-voice): Add some more common words.
Don't check for "matches" as it leads to too many false positives and
almost no fixes in practice.
(checkdoc-this-string-valid-engine): Clarify comment.
(checkdoc-in-abbreviation-p): Ignore some less common or non-standard
abbreviations.
Stefan Kangas [Thu, 16 Sep 2021 07:23:51 +0000 (09:23 +0200)]
Doc fix for y-or-n-p; trailing space is no longer needed
* doc/lispref/minibuf.texi (Yes-or-No Queries):
* doc/lispref/os.texi (Suspending Emacs):
* doc/lispref/tips.texi (Programming Tips):
* doc/misc/gnus-faq.texi (FAQ 5-9):
* lisp/subr.el (y-or-n-p):
* src/fns.c (Fyes_or_no_p): Doc fix to reflect that a trailing space
is no longer needed; one is added or removed automatically.
* lisp/isearch.el (beginning-of-buffer, end-of-buffer)
(scroll-up-command, scroll-down-command): Evaluate the lambdas
inside the isearch-motion properties of these commands.
Stefan Kangas [Wed, 15 Sep 2021 06:18:20 +0000 (08:18 +0200)]
checkdoc: Don't warn about command substitutions by default
* lisp/emacs-lisp/checkdoc.el (checkdoc-max-keyref-before-warn):
Add new valid value nil meaning to never warn about too many command
substitutions, and use this value as the default. This is no longer a
performance problem on modern machines. (Bug#50599)
(checkdoc-this-string-valid-engine): Respect above new valid value
nil.
Juri Linkov [Wed, 15 Sep 2021 16:00:56 +0000 (19:00 +0300)]
Add docstrings to context menu functions, and add middle-separator
* lisp/mouse.el (context-menu-functions): Add context-menu-middle-separator
to default values.
(context-menu-middle-separator): New function.
* lisp/replace.el (occur-context-menu): Use middle-separator.
* lisp/progmodes/elisp-mode.el (elisp-context-menu):
* lisp/progmodes/prog-mode.el (prog-context-menu):
Use middle-separator and reorder menu items correspondingly.
* lisp/progmodes/python.el
(python-hideshow-forward-sexp-function): Avoid compilation warning
in a more standard way. Problem reported in
https://thedailywtf.com/articles/the-programmer-s-motto-and-other-comments
Eli Zaretskii [Wed, 15 Sep 2021 13:14:30 +0000 (16:14 +0300)]
Avoid crashes due to clearing of a frame's face cache
* src/xfaces.c (clear_face_cache): Don't clear fonts and faces of
a frame that is being redisplayed, just because it's time for some
routine maintenance. (Bug#50571)
* src/xdisp.c (redisplay_internal):
* src/frame.h (struct frame) <inhibit_clear_image_cache>: Update
commentary of using this struct member.
Eli Zaretskii [Wed, 15 Sep 2021 13:09:45 +0000 (16:09 +0300)]
Avoid compiler warnings in comp.c on MS-Windows
* src/comp.c (DEF_DLL_FN, init_gccjit_functions): Don't load and
don't define functions/macros if libgccjit doesn't have them, to
avoid compiler warnings.
* lisp/cedet/semantic/symref/grep.el (semantic-symref-perform-search):
Use the `-w` flag instead of wrapping the pattern in regexps that make
matching much slower. This speeds up `xref-find-references` by about
3× on macOS.
* lisp/international/fontset.el (script-representative-chars): Add
new scripts.
(otf-script-alist): Update from latest version.
(setup-default-fontset): Add new scripts.
* lisp/international/characters.el: Update syntax and category
tables for new characters and scripts.
(char-width-table): Update for changes in Unicode 14.0.
* lisp/international/mule-cmds.el (ucs-names): Update used and
unused ranges per Unicode 14.0.
* test/lisp/international/ucs-normalize-tests.el
(ucs-normalize-tests--failing-lines-part1)
(ucs-normalize-tests--failing-lines-part2): Update per the test
results.
* doc/lispref/nonascii.texi (Character Properties): Update Unicode
version number.
Augusto Stoffel [Wed, 15 Sep 2021 08:02:34 +0000 (10:02 +0200)]
Python shell: rearrange printing of newline before output
* progmodes/python.el (python-shell-output-filter-in-progress)
(python-shell-output-filter-buffer): Move defvars to avoid compiler
warnings.
(python-shell-eval-setup-code): Don't print a newline in
__PYTHON_EL_eval.
(python-shell-send-string): Insert newline before output when
applicable (bug#50514).
* lisp/bookmark.el (bookmark--set-fringe-mark): Make the bookmark
evaporate when a buffer is erased (like, for instance, when doing
`revert-buffer' in a vc buffer).
Juri Linkov [Wed, 15 Sep 2021 06:27:57 +0000 (09:27 +0300)]
* lisp/tab-bar.el: Rename args to consistent naming convention.
Use the same naming scheme for function arguments. Use the term "index" when
arguments count from 0, and the term "number" when arguments count from 1.
* lisp/tab-bar.el (tab-bar-select-tab): Rename ‘arg’ to ‘tab-number’.
(tab-bar-move-tab-to): Rename ‘from-index’ to ‘from-number’
and ‘to-index’ to ‘to-number’.
(tab-bar-move-tab-to-frame): Rename ‘from-index’ to ‘from-number’
and ‘to-index’ to ‘to-number’.
(tab-bar-new-tab-to): Rename ‘to-index’ to ‘tab-number’.
(tab-bar-close-tab): Rename ‘arg’ to ‘tab-number’
and ‘to-index’ to ‘to-number’.
(tab-bar-rename-tab): Rename ‘arg’ to ‘tab-number’.
(tab-bar-change-tab-group): Rename ‘arg’ to ‘tab-number’.