* lisp/calc/calc-alg.el (math-simplify-only, calc-simplify-mode)
(math-expand-formulas, calc-poly-div-remainder)
(math-living-dangerously, math-simplifying, calc-angle-mode)
(calc-prefer-frac, math-poly-base-variable):
Declare dynamic variables.
* test/lisp/calc/calc-tests.el (calc-poly-div):
Add test for at least one bug caused by missing declarations.
Dmitry Gutov [Thu, 26 Dec 2019 15:39:48 +0000 (17:39 +0200)]
Speed up dired-do-find-regexp
* lisp/dired-aux.el (dired-do-find-regexp): Speed up (bug#36857).
Previously, 'find' was called for every marked file (for plain
files and directories both). Now 'find' is only called for
directories.
Paul Eggert [Wed, 25 Dec 2019 20:01:07 +0000 (12:01 -0800)]
Port x_get_monitor_attributes_fallback to !HAVE_GTK3
* src/xfns.c (x_get_net_workarea) [!HAVE_GTK3]:
Define in this case too, since x_get_monitor_attributes_fallback
contains a call to it regardless whether HAVE_GTK3 is defined.
Wolfgang Scherer [Mon, 26 Aug 2019 22:45:48 +0000 (00:45 +0200)]
Improve vc--add-line, vc--remove-regexp
* lisp/vc/vc.el (vc--add-line): Create file if it does not exist.
Use existing buffer to avoid discrepancies with filesytem. Make sure
that the file ends with a newline.
(vc--remove-line): Do not create file if it does not exist. Use
existing buffer to avoid discrepancies with filesytem. (bug#37185)
Don't default to showing X-Faces externally in Gnus
* lisp/gnus/gnus-art.el (gnus-article-x-face-command): It's seldom
useful to display the face in an external command, so don't ever
default to that. This also fixes the problem of Emacs running as
a server in mixed graphical/non-graphical environments.
Clarify base64 requirements and say what {en,de}code_coding_region does
* src/coding.c (Fencode_coding_region): Clarify what this does.
(Fdecode_coding_region): Ditto.
* src/fns.c (Fbase64_decode_region): Clarify that this function
returns bytes, not text (bug#38587).
(Fbase64_encode_region): Clarify that this function takes bytes,
not text.
* src/image.c (imagemagick_initialize): New function,
with body taken from imagemagick_load_image.
(imagemagick_load_image, Fimagemagick_types): Use it.
Copyright-paperwork-exempt: yes
Philipp Stephani [Mon, 23 Dec 2019 14:37:49 +0000 (15:37 +0100)]
Document and verify that emacs_limb_t doesn’t have padding bits.
This is a useful property when doing further bit-twiddling with the
magnitude array before/after calling extract_big_integer or
make_big_integer. For example, constructing an emacs_limb_t object
using repeated shift-and-add should work as expected, but relies on
the type not having padding bits. Since the C standard already
guarantees that unsigned integers use a pure binary representation,
not having padding bits is enough to guarantee that the type has
unique object representations in the sense of C++’s
std::has_unique_object_representations.
* doc/lispref/internals.texi (Module Values): Document that
emacs_limb_t doesn’t have padding bits.
* src/emacs-module.c: Verify that emacs_limb_t doesn’t have padding
bits.
Fix extension of underline, overline, and strike-through attributes
* src/xdisp.c (extend_face_to_end_of_line): Don't return early
if face attributes beyond background color and box are set,
since that means these attributes need to be extended past the
EOL.
* etc/NEWS:
* lisp/comint.el (comint-password-function): New variable.
(comint-send-invisible): Use it.
* test/lisp/comint-tests.el (comint-test-no-password-function,
comint-test-password-function-with-value,
comint-test-password-function-with-nil): Test new variable.
Juri Linkov [Sun, 22 Dec 2019 23:02:22 +0000 (01:02 +0200)]
* lisp/files.el (save-buffers-kill-emacs): Mark "*Process List*" as dedicated.
Using the 'dedicated' prop for display-buffer--maybe-at-bottom marks the
window of the buffer "*Process List*" as dedicated, so it won't be replaced
by another buffer that might be visited following links to process buffers
from the buffer "*Process List*".
João Távora [Sun, 22 Dec 2019 21:51:08 +0000 (22:51 +0100)]
Fix bug in flex completion style's sorting and simplify
This previous commit targetting this function introduced a bug whereby
the completion table's sorting function wouldn't be called. That is
fixed by this commit, which also simplifies the function further: it
now skips re-sorting the completions completely if there is no
minibuffer input at all (in other words, when flex isn't doing
anything useful).
Stefan Monnier [Sun, 22 Dec 2019 21:09:31 +0000 (16:09 -0500)]
* lisp/gnus/gnus-start.el: Use lexical-binding
(gnus-group-change-level, gnus-make-hashtable-from-newsrc-alist):
Use gnus-info-make.
(gnus-make-hashtable-from-newsrc-alist): Prefer `gnus-info-group`
to `car` when applied to a `gnus-info` object.
(gnus-make-hashtable-from-killed): Remove unused vars `lists` and `list`.
(gnus-gnus-to-quick-newsrc-format): Extract common code from if branches.
* lisp/gnus/gnus.el (gnus-info-make): New constructor.
João Távora [Sun, 22 Dec 2019 11:52:17 +0000 (12:52 +0100)]
Improve sorting of flex completion style with non-nil minibuffer-default
This affects the behaviour of flex completion when there is a default
completion and the user hasn't entered any input pattern to flex-match
against. It is most visible when icomplete-mode or fido-mode are
being used in conjunctio.
When using M-x man, for instance, the default completion is picked
from text around point. Say it is "emacs" (for Emacs's man page). It
will not match the intended completion, "emacs(1)", exactly. If the
user hasn't yet given any input to the completion prompt, that
completion should bubble to top so that
icomplete-force-complete-and-exit will select it, but it didn't.
This new approach uses 'string-prefix-p' instead of 'equal' to find
the default to bubble to the top. This strategy could eventually be
improved, most naturally by flex-matching the default string to all
the candidates and picking the highest scoring one.
Additionally, the new strategy only considers minibuffer-default if
there is no input in the minibuffer, which seems sensible and produces
a small but noticeable speedup.
Fix display of working text on NS (Bug#23412, Bug#1453)
* lisp/term/ns-win.el (ns-insert-working-text):
(ns-delete-working-text): Change how working text is deleted to handle
changed order of operations.
* src/nsterm.m ([EmacsView insertText:]): Move deletion of working
text until after insertion of new text.
Juri Linkov [Sat, 21 Dec 2019 22:02:10 +0000 (00:02 +0200)]
New variable set-message-function to show message at the end of the minibuffer
* doc/lispref/display.texi (Displaying Messages): Document
set-message-function and clear-message-function.
* lisp/minibuffer.el (minibuffer-message-clear-timeout): New defcustom.
(minibuffer-message-timer, minibuffer-message-overlay): New variables.
(set-minibuffer-message, clear-minibuffer-message): New functions.
(set-message-function, clear-message-function): Set variables to
set-minibuffer-message and clear-minibuffer-message respectively.
* src/keyboard.c (read_char): Call clear_message when
Vclear_message_function is a function.
* src/xdisp.c (set_message): Call Vset_message_function when it's a function.
(clear_message): Call Vclear_message_function when it's a function.
(syms_of_xdisp): New variables set-message-function and clear-message-function
(bug#38457).
Stephen Gildea [Fri, 20 Dec 2019 17:15:13 +0000 (09:15 -0800)]
backup-by-copying-when-privileged-mismatch applies to file gid, too.
* lisp/files.el (backup-by-copying-when-privileged-mismatch): In addition
to checking the file uid, a second test is added: if the file gid is not
greater than backup-by-copying-when-privileged-mismatch,
backup-by-copying-when-mismatch will also be forced on.
lin.sun [Fri, 29 Nov 2019 08:10:12 +0000 (03:10 -0500)]
Add new function `python-shell-send-statement'
* lisp/progmodes/python.el (python-shell-send-statement): New function.
(python-mode-map): Bind it to key "C-c C-e", and define a python-menu
item for it. (Bug#38426)
Eli Zaretskii [Sat, 21 Dec 2019 08:47:31 +0000 (10:47 +0200)]
Allow control of data amount read from subprocess in one chunk
* src/process.c (syms_of_process) <read-process-output-max>:
New variable.
(read_process_output): Use it instead of the hard-coded
constant 4096. (Bug#38561)
Use SAFE_ALLOCA to support large buffers for reading process
output.
Stefan Monnier [Fri, 20 Dec 2019 22:34:38 +0000 (17:34 -0500)]
* lisp/international/mule-cmds.el: Fix bug#38642
(universal-coding-system-argument): Adjust the code to the way
`universal-argument` works nowadays. Handle `prefix-arg` a bit more
like `command_loop` does.
* test/lisp/international/mule-tests.el
(mule-cmds--test-universal-coding-system-argument): New test.
Alan Mackenzie [Fri, 20 Dec 2019 19:55:29 +0000 (19:55 +0000)]
Elisp manual: mention parse-partial-sexp as the source of a parser state, etc
* doc/lispref/syntax.texi (Parser State): mention parse-partial-sexp as a
function returning a parser state, and the function to which one supplies a
parser state as an argument for continued parsing.
Refine the documentation of syntax-ppss-context, and correct the text
introducing it and another function.
Eli Zaretskii [Fri, 20 Dec 2019 18:59:07 +0000 (20:59 +0200)]
Support setting OS names of threads on MS-Windows
* src/w32fns.c (setup_w32_kbdhook): Don't initialize
is_debugger_present here...
(globals_of_w32fns): ...initialize it here. Also initialize
the new global variable set_thread_description.
* src/systhread.c: [WINDOWSNT] Include mbctype.h
(w32_set_thread_name): New function.
(MS_VC_EXCEPTION): New macro.
(THREADNAME_INFO, IsDebuggerPresent_Proc)
(SetThreadDescription_Proc): New typedefs.
(w32_beginthread_wrapper): Call w32_set_thread_name to set the
name of the new thread.
* src/thread.h (struct thread_state): New member thread_name.
* src/thread.c (Fmake_thread): Set the thread_name field of
the new thread object.
(run_thread): Free the thread_name member after the thread
exits.
Juri Linkov [Thu, 19 Dec 2019 23:18:28 +0000 (01:18 +0200)]
* lisp/tab-bar.el: Sort tab names by recency for tab switching (bug#38624)
* lisp/tab-bar.el (tab-bar--tabs-recent): New function with code
extracted from tab-bar--tab-index-recent.
(tab-bar-switch-to-tab): Use tab-bar--tabs-recent in interactive spec
to sort names of tabs by recency for default values of completing-read.
(tab-prefix-map): Bind RET to tab-bar-select-tab-by-name, and 'm' to tab-move.
* lisp/emacs-lisp/regexp-opt.el (regexp-opt):
* doc/lispref/searching.texi (Regexp Functions):
Be more specific about how the KEEP-ORDER argument actually works.
If nil, the regexp guarantees a longest match; this is the behaviour
that many callers implicitly rely on.
Wilson Snyder [Tue, 17 Dec 2019 23:04:48 +0000 (18:04 -0500)]
Verilog-Mode collected updates.
* lisp/progmodes/verilog-mode.el (verilog-compiler-directives): Support
indenting `uselib.
(verilog-read-decls): Fix AUTO* to ignore `protected regions.
(verilog-read-auto-template-middle): Fix AUTO_TEMPLATEs with multiple
module templates and at-REGEXPs, msg3183. Reported by Berk Akinci.
Adjust cursor column when auto-scrolling during rectangle selection
* lisp/mouse.el (mouse-drag-region-rectangle):
Move cursor to the correct column during auto-scrolling both when
crutches are used and not (bug#38641). Reported by Konrad Podczeck.
Dmitry Gutov [Mon, 16 Dec 2019 21:55:11 +0000 (23:55 +0200)]
vc-git-after-dir-status-stage: Avoid erroneous up-to-date status
* lisp/vc/vc-git.el (vc-git-after-dir-status-stage):
Don't set `up-to-date' status if the previous stage (`diff-index')
has assigned some other status to the file (bug#38615).
Eli Zaretskii [Mon, 16 Dec 2019 15:43:30 +0000 (17:43 +0200)]
Fix face merging for display strings broken by a recent commit
* src/xfaces.c (face_at_string_position): Revert the last
change, as it cannot possibly solve bug#38563.
* src/xdisp.c (face_at_pos): Fix a typo made during last
change here, which broke face merging for display strings.
(Bug#38633)
Phil Sainty [Sat, 14 Dec 2019 07:49:41 +0000 (20:49 +1300)]
New command 'diff-buffers'
* lisp/vc/diff.el (diff-buffers): New command.
(diff, diff-no-select, diff-file-local-copy): Improve docstrings.
* doc/emacs/files.texi:
* etc/NEWS: Document new command, and the previously-undocumented
ability for 'diff' to compare buffers.
Eli Zaretskii [Sat, 14 Dec 2019 18:02:11 +0000 (20:02 +0200)]
Update documentation of pure-space overflow
* doc/lispref/internals.texi (Garbage Collection)
(Pure Storage):
* src/alloc.c (Fgarbage_collect): Update the documentation of
pure-space overflow for when pdumper is used. (Bug#38492)
Paul Eggert [Sat, 14 Dec 2019 01:06:52 +0000 (17:06 -0800)]
Fix typo that broke GNU/Linux unexec build
* src/emacs.c (Fdump_emacs): Remove stray closing brace that
breaks the build when configured with --with-dumping=unexec on
GNU/Linux. (Apparently everybody is using pdumper now.)
I introduced the bug in 2019-07-09T00:50:39Z!eggert@cs.ucla.edu.
Allow characters and single-char strings in rx charsets
The `not' and `intersection' forms, and `or' inside these forms,
now accept characters and single-character strings as arguments.
Previously, they had to be wrapped in `any' forms.
This does not add expressive power but is a convenience and is easily
understood.
* doc/lispref/searching.texi (Rx Constructs): Amend the documentation.
* etc/NEWS: Announce the change.
* lisp/emacs-lisp/rx.el (rx--charset-p, rx--translate-not)
(rx--charset-intervals, rx): Accept characters and 1-char strings in
more places.
* test/lisp/emacs-lisp/rx-tests.el (rx-not, rx-charset-or)
(rx-def-in-charset-or, rx-intersection): Test the change.
Noam Postavsky [Fri, 13 Dec 2019 11:36:02 +0000 (06:36 -0500)]
Add prefix to help.el uni-confusable* vars
* lisp/help.el (help-uni-confusables, help-uni-confusables-regexp):
Rename from uni-confusable and uni-confusables-regexp, respectively.
(help-uni-confusable-suggestions): Use ngettext. Use new variable
name.
* lisp/emacs-lisp/lisp-mode.el (lisp--match-confusable-symbol-character):
Use new variable name.
Eli Zaretskii [Fri, 13 Dec 2019 10:29:05 +0000 (12:29 +0200)]
A better fix for extension of overlay string's faces
* src/xdisp.c (face_at_pos): Revert previous change that
rejected the underlying face if it failed the filtering
criteria.
* src/xfaces.c (face_at_string_position): Reset the base face's
attribute used for filtering faces if the attribute is t.
(Bug#38563)