Paul Eggert [Mon, 16 Sep 2019 05:15:04 +0000 (22:15 -0700)]
Fix some file-name-case-insensitive glitches
* src/fileio.c (file_name_directory): New static function,
broken out of Ffile_name_directory.
(file_name_case_insensitive_err, Ffile_writable_p, Fdo_auto_save):
Use it.
(file_name_case_insensitive_err): Rename from
file_name_case_insensitive_p. Accept an unencoded Lisp_Object
rather than an encoded char *, so that platforms other than
Cygwin and macOS need not encode the file name. Return an int
-1, 0, errno rather than a bool (setting errno if false),
so that the caller can distinguish an error from false.
All callers changed.
(Ffile_name_case_insensitive_p): Don’t issue system calls on
platforms other than Cygwin and macOS. Fix bug that broke the
attempt to move up the filesystem tree (it moved up only one
level).
Paul Eggert [Mon, 16 Sep 2019 03:12:07 +0000 (20:12 -0700)]
Improve directory-access diagnostics
* src/callproc.c (init_callproc): Diagnose I/O errors,
access errors, etc. for the game directory.
* src/charset.c (init_charset): Improve quality of diagnostic
when the charsets directory has I/O errors, access errors, etc.
30c4f35 (origin/emacs-26) query-replace-regexp undo: Update next-repl... c596be0 Amend the menu caption for page "Display Property" in the Eli... 13b9510 Add description of chinese-sisheng
Michael Albinus [Sun, 15 Sep 2019 14:52:22 +0000 (16:52 +0200)]
Use also truname of temporary-file-directory in shadowfile-tests.el
* test/lisp/shadowfile-tests.el (top): Use truename of
`temporary-file-directory' and
`shadow-test-remote-temporary-file-directory'. (Bug#37202)
(shadow-test08-shadow-todo, shadow-test09-shadow-copy-files):
Do not bind `shadow-test-remote-temporary-file-directory'.
Wolfgang Scherer [Sun, 15 Sep 2019 13:03:33 +0000 (15:03 +0200)]
Fix vc-default-ignore
* lisp/vc/vc.el: (vc-default-ignore) Treat FILE parameter as relative
to DIRECTORY parameter. Construct a file-path relative to directory
of ignore file. When removing, use properly anchored regexp. Remove
entire line, not just the match (bug#37217).
The alternate editor may be Emacs, which is useful when you want to eval something in an existing Emacs (if it exists), or in a new Emacs if there's no server running.
* lisp/net/shr.el (svg--wrap-svg): Add a default foreground colour
to SVG images (bug#37159). This helps with images like the ones
in https://en.wikipedia.org/wiki/Banach_fixed-point_theorem that
specify no foreground or background colours.
(shr-parse-image-data): Use it.
Make eww more liberal when interpreting some invalid HTML
* lisp/net/eww.el (eww--preprocess-html): New function (bug#37009)
to be more lenient with invalid HTML and translate common invalid
HTML like "a <= b" into "a <= b" to be more liberal in what we
accept before parsing.
(eww-display-html): Use it.
(eww-readable): Ditto.
Paul Eggert [Sat, 14 Sep 2019 07:32:01 +0000 (00:32 -0700)]
Improve gc-cons-percentage calculation
The old calculation relied on a hodgpodge of partly updated GC
stats to find a number to multiply gc-cons-percentage by.
The new one counts data found by the previous GC, plus half of
the data allocated since then; this is more systematic albeit
still ad hoc.
* src/alloc.c (consing_until_gc, gc_threshold, consing_threshold):
Now EMACS_INT, not intmax_t.
(HI_THRESHOLD): New macro.
(tally_consing): New function.
(make_interval, allocate_string, allocate_string_data)
(make_float, free_cons, allocate_vectorlike, Fmake_symbol): Use it.
(allow_garbage_collection, inhibit_garbage_collection)
(consing_threshold, garbage_collect):
Use HI_THRESHOLD rather than INTMAX_MAX.
(consing_threshold): New arg SINCE_GC. All callers changed.
(bump_consing_until_gc): Return new consing_until_gc, instead of
nil. All callers changed. Don’t worry about overflow since we
now saturate at HI_THRESHOLD. Guess that half of
recently-allocated objects are still alive, instead of relying on
the previous (even less-accurate) hodgepodge.
(maybe_garbage_collect): New function.
(garbage_collect): Work even if a finalizer disables or enables
memory profiling. Do not use malloc_probe if GC reclaimed nothing.
* src/lisp.h (maybe_gc): Call maybe_garbage_collect instead
of garbage_collect.
Paul Eggert [Fri, 13 Sep 2019 23:09:48 +0000 (16:09 -0700)]
Simplify GC statistics-gathering
* src/alloc.c (make_interval, allocate_string, make_float)
(free_cons, Fcons, setup_on_free_list)
(allocate_vector_from_block, Fmake_symbol):
Do not update gcstat, since it is for statistics from the most
recent GC, not for a partially-updated hodgepodge.
(sweep_vectors): Update gcstat, since setup_on_free_list
no longer does.
(garbage_collect_1): Rename to garbage_collect and adopt its API.
Remove the old garbage_collect, which is no longer needed.
All callers changed.
Gemini Lasswell [Sun, 4 Aug 2019 04:39:29 +0000 (21:39 -0700)]
Don't build print-number-table unless it will be used
There are only a few users of print-number-table, and none of them use
it when print-circle is nil. A couple of them used to. print_object
was changed in 2012-04-20 "* src/print.c (print_preprocess): Only
check print_depth if print-circle is nil".
byte-compile-output-docform which uses print-number-table binds
print-circle to t before printing unless
byte-compile-disable-print-circle is set, but that variable has been
marked obsolete since 24.1.
* src/print.c (print_preprocess): Assert Vprint_circle is non-nil.
Remove code handling the case when Vprint_circle is nil.
(print, Fprint_preprocess): Don't call print_preprocess unless
Vprint_circle is non-nil.
(print_object): Remove comment referencing removed code in
print_preprocess.
Gemini Lasswell [Sat, 3 Aug 2019 19:33:20 +0000 (12:33 -0700)]
Fix unnecessary hash table creation in cl-prin1 (bug#36566)
cl-prin1 prints all its punctuation by passing strings to prin1. When
print-circle was set, print_preprocess was creating a new hash table
for each string, causing excessive garbage collection when printing
large Lisp objects with cl-prin1.
* src/print.c (print_number_index): Fix typo in comment above.
(PRINT_CIRCLE_CANDIDATE_P): Don't create print_number_table
for top-level strings with no properties, except when
print_continuous_numbering is on.
Improve performance of backtrace printing (bug#36566)
* lisp/emacs-lisp/cl-print.el (cl-print-to-string-with-limit): Reduce
print-level and print-length more quickly when the structure being
printed is very large.
Improve print output options commands in backtrace-mode (bug#36566)
* lisp/emacs-lisp/backtrace.el (backtrace-view): Mention
:print-gensym in docstring.
(backtrace-mode-map): Add keyboard binding for
backtrace-toggle-print-gensym. Add menu entries for
backtrace-toggle-print-circle and backtrace-toggle-print-gensym.
(backtrace--with-output-variables): Bind print-gensym with value
of :print-gensym found in view plist.
(backtrace-toggle-print-circle): Remove description of
implementation details from docstring.
(backtrace-toggle-print-gensym): New command.
(backtrace--toggle-feature): Add echo area message describing result
of command.
* test/lisp/emacs-lisp/backtrace-tests.el
(backtrace-tests--print-circle): New test.
* doc/lispref/debugging.texi (Backtraces): Document keyboard
binding for backtrace-toggle-print-gensym.
Michael Albinus [Fri, 13 Sep 2019 10:08:34 +0000 (12:08 +0200)]
Fix problems in tramp-test33-environment-variables
* test/lisp/net/tramp-tests.el (tramp-test33-environment-variables):
Use ${parameter:-word} construct. Remove PS1 entry from
"printenv" output.
(tramp--test-check-files): Use "printenv".
Eli Zaretskii [Fri, 13 Sep 2019 07:47:28 +0000 (10:47 +0300)]
Fix assertion violations due to non-ASCII text in menus
* src/xdisp.c (tool_bar_height, redisplay_tool_bar)
(display_menu_bar): If the Lisp string to be displayed in the
menu-bar or tool-bar window is multibyte, tell the display
engine to treat it as multibyte, instead of relying on the
initial determination by init_iterator (which is based on the
multibyteness of the current buffer). (Bug#37385)
Jack Coughlin [Thu, 18 Jul 2019 15:16:50 +0000 (08:16 -0700)]
Fix saving user-defined calc commands with compositions (Bug#36720)
* lisp/calc/calc-prog.el (calc-user-define-permanent): Correctly save
the composition when the user specifies their formula by its command
name or key.
Fix fill-paragraph in python docstrings (Bug#36056)
* lisp/progmodes/python.el (python-do-auto-fill): New function.
(python-mode): Set it as normal-auto-fill-function, and don't set
fill-indent-according-to-mode. Having the latter set during
fill-paragraph gives wrongs result, because python-indent-line doesn't
remove indentation added by filling.
* test/lisp/progmodes/python-tests.el (python-fill-docstring): New
test.
(sh-shell-initialize-variables): Use sh--assignment-collect on
post-self-insert-hook instead.
(sh--assignment-collect): New function, extracted from sh-assignment.
(sh-assignment): Use it and mark as obsolete.
Karl Fogel [Thu, 12 Sep 2019 17:42:13 +0000 (12:42 -0500)]
Add `isearch-yank-until-char'
* lisp/isearch.el (isearch-yank-until-char): New function.
(isearch-mode-map, isearch-menu-bar-yank-map): Add it.
(isearch-forward): Document the new binding.
* doc/emacs/search.texi (Isearch Yanking): Document the feature.
Michael Albinus [Thu, 12 Sep 2019 14:38:48 +0000 (16:38 +0200)]
Optimize host name completion in Tramp
* lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
* lisp/net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection):
* lisp/net/tramp-rclone.el (tramp-rclone-maybe-open-connection):
* lisp/net/tramp-sh.el (tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-maybe-open-connection):
Throw `non-essential' at the beginning of the function.
* lisp/net/tramp.el (tramp-handle-file-exists-p):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-exists-p):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-file-exists-p):
Run only when host is connectable. This is due to host name
completion, which shall be optimized.
* lisp/net/tramp-smb.el (tramp-smb-do-file-attributes-with-stat)
(tramp-smb-get-file-entries): Access connection buffer only after
sending the command.
* lisp/net/tramp.el (tramp-get-buffer, tramp-get-connection-buffer):
New argument DONT-CREATE.
(tramp-message): Use it.
(tramp-get-mutex): Check, whether host is connectable.
(tramp-file-name-handler): Set thread only when host is connectable.
(tramp-connectable-p): Allow also VEC as argument.
(tramp-completion-handle-file-name-completion): Do not expand directory.
Stefan Monnier [Thu, 12 Sep 2019 12:25:13 +0000 (08:25 -0400)]
* src/profiler.c: Leave `key` hashslots as Qunbound (bug#37382)
Now that "key == Qunbound" is used to determine if a hash table entry
is available, we can't stash pre-allocated vectors into the `key` slot
anymore, so use the `value` slot instead.
(make_log): Pre-fill the `value` slots i.s.o `key`.
(evict_lower_half): Stash key back into `value`, i.s.o `key`.
(record_backtrace): Get pre-allocated vector for `value` i.s.o `key`.
Paul Eggert [Thu, 12 Sep 2019 06:22:46 +0000 (23:22 -0700)]
Fix directory-files-and-attributes race
* src/dired.c (directory_files_internal): Fix race condition:
when some other process removed a file between the readdir and
the ensuing lstat, directory-files-and-attributes would return
a list containing nil.
Paul Eggert [Wed, 11 Sep 2019 21:24:03 +0000 (14:24 -0700)]
Omit duplicate test of current directory
* src/callproc.c (encode_current_directory): Remove redundant
call to Ffile_accessible_directory_p. The code checks the
encoded name with file_accessible_directory_p anyway.
Paul Eggert [Wed, 11 Sep 2019 18:26:07 +0000 (11:26 -0700)]
Improve checking of pdump load failures
* src/alloc.c (memory_full): Just report "memory exhausted" if
failure occurs during initialization, since fancier recovery
schemes are not likely to work when not initialized.
* src/emacs.c (dump_error_to_string): Accept int, not enum
pdumper_load_result, since the result might not fit in the
enum. Use strerror if it was derived from errno. This is for
better diagnostics of pdump load failures.
(load_pdump_find_executable): Return char *, not enum. 2nd
arg is now pointer to buffer size, rather than pointer to
pointer to buffer. All callers changed. Use Emacs allocator
since they should now be OK even during early startup.
Use check_executable instead access, to use effective rather
than real permissions.
(load_pdump): Return void since callers ignore result.
Use int where enum could be too narrow. Use heap rather
than stack for possibly-long string. Prefer ptrdiff_t to
size_t.
* src/fileio.c (check_executable): Now extern.
* src/pdumper.c (pdumper_load): Return int that may have
errno added to it, for better diagnostics when loads fail.
Paul Eggert [Wed, 11 Sep 2019 17:19:07 +0000 (10:19 -0700)]
Reset dbus registered buses on dump load
Problem reported by Leonard Lausen (Bug#37331).
* src/dbusbind.c: Include pdumper.h.
(syms_of_dbusbind_for_pdumper):
New function, to reset the registered buses.
(syms_of_dbusbind): Use it, fixing a TODO.
Create a new overlay used to mark Attachment header (bug#37370)
* lisp/gnus/gnus-art.el (gnus-mime-inline-part)
(gnus-mm-display-part, gnus-mime-buttonize-attachments-in-header):
Create a new overlay used to mark Attachment header instead of
using existing overlays.
Handle missing start-time when importing ical event (Bug#33277)
* lisp/calendar/icalendar.el (icalendar--convert-ical-to-diary): Set
start time only if it is explicitly given in ical. Do not use
start-time as default for end-time (Bug#33277).
* test/lisp/calendar/icalendar-tests.el (icalendar-import-bug-33277):
New. Test fix for Bug#33277.
Juri Linkov [Sun, 8 Sep 2019 20:27:23 +0000 (23:27 +0300)]
* lisp/tmm.el: Fix broken tmm-prompt (bug#34517)
* lisp/tmm.el (tmm-prompt): Don't duplicate items of tmm--history.
Don't reverse tmm-km-list for completion. Don't set the initial
position of 'tmm--history. Use reverse tmm--history as the list
of default values for M-n.
(tmm-add-prompt): Don't insert initial value to the minibuffer.
Alan Mackenzie [Sun, 8 Sep 2019 10:44:27 +0000 (10:44 +0000)]
Fix untidinesses in compile.el.
* lisp/progmodes/compile.el (compilation--margin-string): Renamed from
compilation-margin-string. Use defconst rather than defvar. Use propertize
rather than a separate put-text-property. Trim the doc string.
Michael Albinus [Sun, 8 Sep 2019 08:13:13 +0000 (10:13 +0200)]
Fix Bug#37202
* test/lisp/shadowfile-tests.el (shadow-test08-shadow-todo)
(shadow-test09-shadow-copy-files): Use truename of
`shadow-test-remote-temporary-file-directory'. (Bug#37202)
Paul Eggert [Sun, 8 Sep 2019 01:08:12 +0000 (18:08 -0700)]
Fix bug when gc-cons-percentage is bumped to 0.8
Problem reported by Michael Heerdegen (Bug#37321).
* src/alloc.c (gc_threshold): New static var.
(bump_consing_until_gc): Change args from DIFF to THRESHOLD and
PERCENTAGE. All uses changed. When accounting for a changed
gc-cons-percentage, do not assume that total_bytes_of_live_objects
returns the same value now that it did the last time we were
called.
Let byte-compiler recognize that local-variable-p implies boundp
* lisp/emacs-lisp/bytecomp.el (byte-compile-maybe-guarded): Add
arguments to local-variable-p to the bound list.
* lisp/image-mode.el (image-toggle-display-image): Remove no longer
needed boundp check.
Joel Rosdahl [Wed, 28 Aug 2019 19:00:00 +0000 (21:00 +0200)]
Fix flymake-proc temporary file deletion bug
* list/progmodes/flymake-proc.el (flymake-proc-create-temp-inplace):
Include a time string part (hour + minute + second + nanosecond) in
the temporary name to make it unique enough.
(flymake-proc-legacy-flymake): Store temporary file names in the
process for usage in the sentinel.
(flymake-proc--process-sentinel): Bind values of temporary file names
dynamically to values stored in the process so that the cleanup
function will delete the correct temporary file(s).
Eli Zaretskii [Sat, 7 Sep 2019 09:33:03 +0000 (12:33 +0300)]
Allow client connections when in recursive-edit
* lisp/server.el (server-goto-toplevel): Check minibuffer
depth, not recursion depth. This avoids exiting
recursive-edit if a client connection is accepted during
recursive-edit. (Bug#37176)
Eli Zaretskii [Sat, 7 Sep 2019 07:14:31 +0000 (10:14 +0300)]
Revert "file-truename now uses realpath for local files"
This reverts commit a59839d7556ef85058e09b005f0ff32e59b20ec3.
This commit broke the MS-Windows build (because there's no
realpath on MS-Windows). Even if I change the implementation
to always signal an error on MS-Windows, the build fails.
Paul Eggert [Fri, 6 Sep 2019 21:30:33 +0000 (14:30 -0700)]
file-truename now uses realpath for local files
This uses fewer syscalls on GNU/Linux and other GNUish platforms.
* lisp/files.el (file-truename): Try fileio--truename
if there are no handlers.
* src/fileio.c: Include stdlib.h, for realpath.
(Ffileio__truename): New function.
Mauro Aranda [Wed, 28 Aug 2019 11:29:57 +0000 (08:29 -0300)]
Improve file name completion in file and directory widgets (Bug#7779)
* lisp/wid-edit.el (widget 'file, widget 'directory): Respect the option
read-file-name-completion-ignore-case.
(widget 'directory): Filter the file names, to only perform directory name
completion.
Amin Bandali [Sat, 17 Aug 2019 18:09:11 +0000 (14:09 -0400)]
Fix erc-lurker-update-status (bug#36843)
Broken since 2013-08-22 "* lisp/erc/erc.el: Use lexical-binding".
* lisp/erc/erc.el (erc-message-parsed): New variable.
(erc-display-message): Dynamically bind it.
(erc-lurker-update-status): Check it instead of using `parsed'
directly. This results in `erc-lurker-state' being properly updated
to keep track of non-lurkers, and thus `erc-lurker-p' returning
correct results rather than return t for everyone.
Paul Eggert [Thu, 5 Sep 2019 20:25:43 +0000 (13:25 -0700)]
Fix bugs when recalculating consing_until_gc
Problem reported by Joseph Mingrone (Bug#37006#72).
* src/alloc.c (watch_gc_cons_threshold)
(watch_gc_cons_percentage):
Don’t try to store an intmax_t into an int.
Redo to make the code clearer.
(watch_gc_cons_percentage):
Use gc_cons_threshold, not consing_until_gc.
Paul Eggert [Thu, 5 Sep 2019 18:42:56 +0000 (11:42 -0700)]
Port :safe-renegotiation test to GnuTLS < 3.6.3
Problem reported by Robert Pluim in
https://lists.gnu.org/r/emacs-devel/2019-09/msg00127.html
* src/gnutls.c (Fgnutls_peer_status): Simplify test for
whether the :safe-renegotiation result is needed, so that it
works all the way back to GnuTLS 2.12.2.
Paul Eggert [Thu, 5 Sep 2019 06:13:54 +0000 (23:13 -0700)]
Use plain ‘static’ for Emacs C inline functions
This improved performance of ‘make compile-always’ by 8.2%
on my platform (AMD Phenom II X4 910e, Fedora 30 x86-64).
* src/conf_post.h (INLINE, EXTERN_INLINE, INLINE_HEADER_BEGIN)
(INLINE_HEADER_END) [!EMACS_EXTERN_INLINE]: Use plain ‘static’.
Robert Pluim [Mon, 2 Sep 2019 12:55:00 +0000 (14:55 +0200)]
Don't check for :safe-renegotiation with TLS1.3
* lisp/net/nsm.el (nsm-protocol-check--renegotiation-info-ext): Don't
check when using TLS1.3, renegotiation has been removed from TLS.
Reported in
<https://lists.gnu.org/archive/html/help-gnu-emacs/2019-09/msg00005.html>
Robert Pluim [Wed, 4 Sep 2019 21:43:56 +0000 (23:43 +0200)]
Fix nsm for unencrypted connections
When connecting using a cleartext connection, nsm was erroring out and
tearing down the connection because it was trying to display
nonexistent certificate information.
* lisp/net/nsm.el (nsm-query-user): Only format certificate status
when it is valid. (Bug#37221)