Stefan Kangas [Sat, 12 Aug 2023 14:30:08 +0000 (16:30 +0200)]
Convert dictionary-mode to define-derived-mode
* lisp/net/dictionary.el (dictionary-instances): Delete.
(dictionary-mode): Use define-derived-mode.
(dictionary--count-mode-buffers): New function.
(dictionary-close): Use above new function.
Stefan Kangas [Sat, 12 Aug 2023 10:43:19 +0000 (12:43 +0200)]
Stop `use-package-report` from displaying an empty buffer
* lisp/use-package/use-package-core.el (use-package-report): Signal
user-error if there are no statistics to display, instead of showing
an empty buffer.
Paul Eggert [Sat, 12 Aug 2023 06:09:39 +0000 (23:09 -0700)]
Update lists of non-UTF files
* .gitattributes: Don't diff text files with encodings
incompatible with UTF-8. Add some new binary file extensions,
like '.webp'. etc/e/eterm-direct and java/emacs.keystore
are also binary.
* admin/notes/unicode: Update similarly.
This fixes what I consider to be the core of the bug, by handling
`cl--labels-convert-cache` more carefully (i.e. being more careful how
we look up its value and by flushing it ASAP).
Po Lu [Sat, 12 Aug 2023 02:21:34 +0000 (10:21 +0800)]
Improve precision pixel scrolling
* lisp/pixel-scroll.el (pixel-scroll-precision-scroll-down-page)
(pixel-scroll-precision-scroll-up-page): Use
pos-visible-in-window-p to opt between the next line or to the
window start rather than computing the next position by hand.
(pixel-scroll-precision-mode): Disable
make-cursor-line-fully-visible. (bug#65214)
* src/image.c (jpeg_load_body): Fix crash if libjpeg detects an
error before ximg is initialized.
* src/xdisp.c (display_and_set_cursor): Don't display cursor in
vscrolled-away row.
Dmitry Gutov [Sat, 12 Aug 2023 00:58:53 +0000 (03:58 +0300)]
Unbreak project-find-file's future history when cpd is not root
* lisp/progmodes/project.el (project-find-file): Pass in
buffer-file-name as absolute name (bug#63829).
(project--read-file-cpd-relative): Make it relative to the
appropriate common parent dir.
Po Lu [Fri, 11 Aug 2023 08:08:16 +0000 (16:08 +0800)]
Improve kill-ring-deindent-mode
* etc/NEWS:
* lisp/simple.el (kill-ring-deindent-buffer-substring-function):
(kill-ring-deindent-mode): Deindent by the column number at BEG
in lieu of the indentation at BEG.
Po Lu [Fri, 11 Aug 2023 07:58:31 +0000 (15:58 +0800)]
New global minor mode `kill-ring-deindent-mode'
* etc/NEWS: Announce the new minor mode.
* lisp/simple.el (kill-ring-deindent-buffer-substring-function):
New function.
(kill-ring-deindent-mode): New minor mode, for trimming excess
indentation from saved text.
Po Lu [Fri, 11 Aug 2023 06:55:21 +0000 (14:55 +0800)]
Minor adjustments to Android port
* java/org/gnu/emacs/EmacsService.java (readDirectoryEntry):
Also refrain from returning NULL or file names containing
non-representable NULL bytes.
* src/callproc.c (get_current_directory): Clean up by employing
android_is_special_directory.
Po Lu [Fri, 11 Aug 2023 00:57:04 +0000 (08:57 +0800)]
Repair mailutils configury
* configure.ac (with_mailutils): When processing defaults,
set to yes-unless-android if with_features.
(HAVE_MAILUTILS): Later, disable Mailutils if yes-on-android
and with_android is set. This is the minimal Emacs build
for the build machine. (bug#65190)
Jim Porter [Tue, 8 Aug 2023 05:28:24 +0000 (22:28 -0700)]
Return separators from 'eshell-split-commands' directly when requested
This eliminates the need for using a dynamically-bound variable to
hold the list of separators.
* lisp/eshell/esh-cmd.el (eshell--sep-terms): Remove.
(eshell-split-commands): New function, adapted from
'eshell-separate-commands'.
(eshell-separate-commands): Make obsolete, and call
'eshell-split-commands'.
(eshell-parse-command, eshell-parse-pipeline): Use
'eshell-split-commands'.
Jim Porter [Tue, 8 Aug 2023 05:15:18 +0000 (22:15 -0700)]
Simplify command parsing in Eshell
* lisp/eshell/esh-cmd.el (eshell-parse-command): Do all modifications
to each command in a single pass.
(eshell-parse-pipeline): Remove unncessary reversing of parsed
results.
Manuel Giraud [Thu, 9 Mar 2023 13:35:31 +0000 (14:35 +0100)]
Scroll up and down in image-dired
* lisp/image/image-dired.el (image-dired-scroll):
Function to manage scroll in image-dired.
(image-dired-scroll-up, image-dired-scroll-down): Scroll up and down
command in image-dired.
(image-dired-thumbnail-mode-map): Use them. (Bug#65052)
Po Lu [Thu, 10 Aug 2023 06:15:03 +0000 (14:15 +0800)]
; Improve sectioning and documentation in xterm.c
* src/xterm.c (x_dnd_compute_toplevels, x_dnd_get_target_window_1)
(x_dnd_get_wm_state_and_proto, xi_frame_selected_for)
(xi_convert_event_state, x_free_xi_devices)
(xi_populate_device_from_info): Improve sectioning, fill some
lines to 80 columns. Not all lines could be filled as a result
of XCB's heretically long identifier names.
* lisp/calendar/lunar.el (calendar-lunar-phases): Use that
function to derive event windows, in case these commands are
being called from the menu bar.
* lisp/doc-view.el (doc-view-tool-bar-map): Fix typo in help
text.
Po Lu [Thu, 10 Aug 2023 01:53:26 +0000 (01:53 +0000)]
Fix the MS-DOS, Haiku, USG, etc builds
* configure.ac (emacs_cv_boot_time_file): Only compute this on
GNU/Linux, the sole system with systemd.
* nt/inc/ms-w32.h (BOOT_TIME_FILE): Remove now redundant #undef.
* src/filelock.c (get_boot_time): Eschew BOOT_TIME_FILE if not
defined.
Paul Eggert [Wed, 9 Aug 2023 19:06:25 +0000 (12:06 -0700)]
Adjust to random-seed move
For some time, GNU/Linux systems have put their random-seed file
somewhere other than where src/filelock.c looks for it.
Catch up to this by having 'configure' scout for it.
* configure.ac (BOOT_TIME_FILE):
Define this at configure-time.
* nt/inc/ms-w32.h (BOOT_TIME_FILE): Override 'configure'.
* src/filelock.c (BOOT_TIME_FILE): Remove default definition,
since 'configure' defaults it now.
Alan Mackenzie [Wed, 9 Aug 2023 11:27:28 +0000 (11:27 +0000)]
Remove harmful and redundant bindings from the byte compiler.
This fixes bug#65017. Binding symbols-with-pos-enabled in two
macro handling functions was harmful; one of these caused
cl--labels-convert to fail. Binding print-symbols-bare in many
places in the byte compiler was redundant.
Since we know that the value from [NSString UTF8String] is valid
UTF-8, using make_string is wastefully slow.
* src/nsfns.m (count_utf8_chars): New function, at least twice as fast
as parse_str_as_multibyte used by make_string for this purpose.
([NSString lispString]): Use count_utf8_chars. We now always make a
multibyte string because there is no reason not to.
Alan Third [Sat, 5 Aug 2023 09:39:31 +0000 (10:39 +0100)]
Fix percentage sizes in SVG display (bug#64908)
* src/image.c (svg_css_length_to_pixels): Make percent units always
return zero and handle font size based units better.
(svg_load_image): Don't rely on the width and height values from the
SVG actually having any useful data, even if they're explicitly set.
Stefan Kangas [Tue, 8 Aug 2023 17:04:48 +0000 (19:04 +0200)]
Make lm-verify footer checking more strict
* lisp/emacs-lisp/lisp-mnt.el (lm-verify): Make file footer regexp
more strict to match requirement in old versions of package.el (now
only a warning).
Better error for missing or bad :name arg in make-process etc
Improve on the famously bad error message given when the :name keyword
parameter is missing or of the wrong type in calls to make-process,
make-pipe-process and make-network-process (bug#65030).
* src/process.c (get_required_string_keyword_param): New function.
(Fmake_process, Fmake_pipe_process, Fmake_network_process): Use it.
Helmut Eller [Thu, 3 Aug 2023 06:33:40 +0000 (08:33 +0200)]
Check keyword args of make-process
The functions make-process and make-network-process have many
keyword args and it's easy to misspell some of them.
Use a compiler macro to warn about some possible mistakes.
* lisp/emacs-lisp/bytecomp.el (bytecomp--check-keyword-args): New
helper.
(make-process, make-network-process): Define a compiler macro that
performs some checks but doesn't anything else.
* test/lisp/emacs-lisp/bytecomp-tests.el: Add some tests.
* test/lisp/emacs-lisp/bytecomp-resources/:
(warn-make-process-missing-keyword-arg.el,
warn-make-process-missing-keyword-value.el,
warn-make-process-repeated-keyword-arg.el,
warn-make-process-unknown-keyword-arg.el): New test files
Po Lu [Tue, 8 Aug 2023 12:20:02 +0000 (20:20 +0800)]
Repair test failures stemming from Android merge
* lisp/kmacro.el (kmacro-step-edit-query)
(kmacro-step-edit-pre-command): Use `dummy-event' instead of
[nil] to continue a kbd macro; this is because nil now has a
function key map.
* src/androidfns.c (Fx_hide_tip): Allow calling this as a stub.
* src/fileio.c (Finsert_file_contents): In adherence to the
documentation, forbid supplying a BEG offset even for seekable
files, i.e. /dev/urandom on Linux kernel based systems.
* lisp/dired-aux.el (dired-do-create-files): Preserve the return value
that isn't documented but used by dired-test-bug30624 in
dired-aux-tests. Change suggested by Po Lu.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-equal, byte-optimize-eq):
Optimise (eq X X) -> t where X is a variable; idem for eql and equal.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test case.
Po Lu [Tue, 8 Aug 2023 08:17:10 +0000 (16:17 +0800)]
Avoid caching file status when they are about to change
* java/org/gnu/emacs/EmacsSafThread.java (EmacsSafThread)
(cacheFileStatus): New argument NO_CACHE.
(cacheDirectoryFromCursor, statDocument1):
* java/org/gnu/emacs/EmacsService.java (EmacsService)
(statDocument): Plumb that argument through each of these wrapper
functions.
* src/android.c (android_init_emacs_service): Adjust JNI
function signatures to agree with statDocument1.
* src/androidvfs.c (android_saf_stat): Plumb that argument
through here.
(android_saf_tree_stat, android_saf_file_open): And don't cache
file status if a write is imminent.
Po Lu [Tue, 8 Aug 2023 08:02:49 +0000 (16:02 +0800)]
Minor improvements to write-region heuristic
* src/androidvfs.c (android_saf_stat): Set STATB->st_dev.
(android_fstat): Likewise.
(NATIVE_NAME): Seek to start of file after truncation.
* src/fileio.c (write_region): Use stat instead of open+fstat
to obtain updated mtime.
Po Lu [Tue, 8 Aug 2023 05:39:16 +0000 (13:39 +0800)]
Utilize more frequently supported file access modes
* java/org/gnu/emacs/EmacsSafThread.java (openDocument1): Use
plain r or w where possible, as the fileio stuff is now better
prepared for FIFOs.
(openDocument): New argument READ.
* java/org/gnu/emacs/EmacsService.java (openDocument): New
argument READ.
* src/android.c (android_init_emacs_service): Adjust
correspondingly.
* src/androidvfs.c (android_saf_file_open): Don't support
O_APPEND. Pass read as well as trunc and write.
Po Lu [Tue, 8 Aug 2023 05:37:00 +0000 (13:37 +0800)]
Enable visiting FIFOs as files
* doc/lispref/files.texi (Reading from Files): Document new
`if-regular' value of REPLACE.
* etc/NEWS: Announce the new value.
* lisp/files.el (basic-save-buffer-2): Demote errors saving
backup files, since FIFOs cannot be copied.
(revert-buffer-insert-file-contents--default-function): Supply
`if-regular' instead of t as REPLACE.
* src/fileio.c (selinux_enabled_p): New function.
(Fcopy_file, Ffile_selinux_context, Fset_file_selinux_context):
Call that function to ascertain if SELinux applies to a file.
(read_non_regular): Don't assume `emacs_fd_read' always returns
int.
(Finsert_file_contents): If REPLACE is if-regular and FILENAME
is a special non-seekable file, fall back to erasing the buffer
before inserting the contents of that file.
(syms_of_fileio) <Qif_regular>: New symbol.
Paul Eggert [Tue, 8 Aug 2023 04:23:28 +0000 (21:23 -0700)]
Fix some emacs_fopen confusion
Problem reported by Po Lu in:
https://lists.gnu.org/r/emacs-devel/2023-08/msg00195.html
* src/comp.c (comp_hash_source_file, Fcomp__release_ctxt):
* src/sysdep.c (get_up_time, procfs_ttyname, procfs_get_total_memory):
Be more systematic about using emacs_fclose on streams that were
opened with emacs_fopen or emacs_fdopen. Do this even if not
Android, as this simplifies checking that it's done consistently.
* src/lisp.h (emacs_fclose): If it’s just fclose,
make it a macro rather than a function, to avoid confusing gcc
-Wmismatched-dealloc.
(emacs_fopen): Move decl here from sysstdio.h, because sysstdio.h
is included from non-Emacs executables and emacs_fopen is good
only inside Emacs.
* src/sysdep.c (emacs_fclose): Define as a function only if Android.
Jim Porter [Sun, 6 Aug 2023 20:34:18 +0000 (13:34 -0700)]
Fix listing of directory contents after "cd" in Eshell
* lisp/eshell/em-dirs.el (eshell/cd): Ensure we don't close the I/O
handles prematurely. Additionally, don't clobber the "cd" command's
last-command info.
* test/lisp/eshell/em-dirs-tests.el (em-dirs-test/cd):
(em-dirs-test/cd/list-files-after-cd): New tests (bug#65110).
Paul Eggert [Mon, 7 Aug 2023 16:17:56 +0000 (09:17 -0700)]
Pacify --enable-gcc-warnings with emacs_fdopen
* src/lisp.h (emacs_fdopen): Now ATTRIBUTE_MALLOC
ATTRIBUTE_DEALLOC (emacs_fclose, 1), to pacify gcc
-Wsuggest-attribute=malloc on non-Android platforms.