Po Lu [Wed, 20 Apr 2022 07:37:19 +0000 (07:37 +0000)]
Implement `above' z-group on Haiku
* src/haiku_support.cc (class EmacsWindow): New field `z_group'.
(RecomputeFeel): New function.
(ParentTo, BWindow_set_override_redirect): Use that instead
instead of manually juggling the window feel around.
(BWindow_set_z_group): New function.
* src/haiku_support.h (enum haiku_z_group): New enum.
* src/haikufns.c (haiku_set_parent_frame): Clean up coding
style.
(haiku_set_z_group): New function.
(haiku_create_frame): Always set z group after window creation,
like on X.
(haiku_frame_parm_handlers): Add `haiku_set_z_group'.
Paul Eggert [Wed, 20 Apr 2022 02:02:05 +0000 (19:02 -0700)]
Pacify gcc -std=c99 with printf %p
* src/print.c (print_vectorlike): Assign pointer-to-function
to void * before printing it with %p, as the C standard
doesn’t bless printing function pointers with %p.
Paul Eggert [Wed, 20 Apr 2022 02:00:22 +0000 (19:00 -0700)]
Pacify gcc -std=c99
* src/sysdep.c (system_process_attributes): Use %llu instead of
%Lu for sscanf, as %llu is standard and %Lu is not, and the latter
can provoke warnings if gcc is used pedantically.
Allow several mode: elements in the local variable section
* etc/NEWS (mode): Fall back on outline-mode in older Emacsen.
* lisp/files.el (hack-local-variables--find-variables): Use the
final mode: line (which is the same as having several mode: bits
in the header line.
* lisp/emulation/viper-cmd.el (viper-quote-region)
(viper-read-string-with-history, viper-query-replace): Revert
prompting changes done in 50512e3 -- the way viper prompts in
command mode is special (bug#55007).
Fix handling of intspecs as string by rcirc-define-command
* rcirc.el (rcirc-define-command): Check if an interactive
specification is a string, in which case it was to be wrapped in a
list so that the result of its interpretation is passed as the first
argument of the command resulting from the macro expansion.
Po Lu [Tue, 19 Apr 2022 10:51:28 +0000 (18:51 +0800)]
Fix `x-mouse-click-focus-ignore-position' for odd coincidences across displays
* src/xterm.c (handle_one_xevent): Save the display alongside
the next mouse click timeout.
(x_delete_display): Clear that display here if applicable.
(x_initialize): Likewise.
Eli Zaretskii [Tue, 19 Apr 2022 09:50:01 +0000 (12:50 +0300)]
Fix dimensions of console window of restarted Emacs on MS-Windows
* src/w32.c (get_console_font_size): New function.
(w32_reexec_emacs): Call 'get_console_font_size' to set up the
dimensions of the restarted Emacs's console window to the same
values as that of the original Emacs.
Po Lu [Tue, 19 Apr 2022 07:47:34 +0000 (15:47 +0800)]
Deal with Motif drag window related races
* src/xterm.c (xm_drag_window_error_handler): New function.
(xm_get_drag_window): If a drag window was created and we have
the temp display grabbed, use that instead.
Alan Third [Sun, 17 Apr 2022 20:15:05 +0000 (21:15 +0100)]
Fix glyphless glyph display on NS (bug#54970)
* src/nsterm.m (ns_draw_glyphless_glyph_string_foreground): New
function.
(ns_draw_glyph_string): Use the new function.
* src/nsfont.m (nsfont_draw): Fix the location the glyphs are drawn,
and also which glyphs are drawn.
(ns_glyph_metrics): Reverse ascent and descent.
Eli Zaretskii [Mon, 18 Apr 2022 18:04:57 +0000 (21:04 +0300)]
Minor improvements in 'restart-emacs' on MS-Windows
* src/w32.c (w32_reexec_emacs): Explicitly request a new console
for the restarted Emacs -nw, and specify its dimensions. Specify
NULL instead of security attributes, per examples on the Internet.
* src/w32console.c (initialize_w32_display): Check errors in call
to GetConsoleCursorInfo.
Correct the algorithm for determining the warning position to get the first
symbol-with-position in byte-compile--form-stack.
* lisp/emacs-lisp/bytecomp.el (byte-compile--first-symbol-with-pos): Function
renamed and amended from byte-compile--first-symbol.
(byte-compile--warning-source-offset): Call the new function above rather than
the old one.
Avoid hangs in python-mode with debug-on-error set
* lisp/progmodes/python.el (python-nav-end-of-statement): Avoid
using cl-assert here, because this is called from the font-lock
machinery, and if debug-on-error is set here, we'll hang Emacs
(bug#54996).
Avoid hangs in python-mode with debug-on-error set
* lisp/progmodes/python.el (python-nav-end-of-statement): Avoid
using cl-assert here, because this is called from the font-lock
machinery, and if debug-on-error is set here, we'll hang Emacs
(bug#54996).
Alan Mackenzie [Mon, 18 Apr 2022 10:19:54 +0000 (10:19 +0000)]
Byte compiler: remove symbol positions from byte-switch tables
This fixes bug #54990.
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode): Remove positions from
symbols with positions in byte-switch tables, by temporarily removing the
entries from the table, and reinserting them amended.
* lisp/url/url-http.el (url-http-chunked-last-crlf-missing): Treat
url-http-chunked-last-crlf-missing as any other buffer variable by
declaring and initialising it the same way as the other related
ones (bug#54989).
Make `restart-emacs' work when Emacs is started with --chdir
* src/emacs.c (find_emacs_executable): Rename from
load_pdump_find_executable and always define.
(load_pdump): Return the executable.
(main): Store the executable.
(Fkill_emacs): Use the stored executable so that --chdir works
with relative executable names, and so that we attempt to restart
the same executable and not some other Emacs from PATH.
* src/emacs.c (Fkill_emacs): Use emacs_perror for the "restart"
errors -- we've already shut down Emacs at this point, so the
normal erroring machinery isn't reliable.
Paul Eggert [Mon, 18 Apr 2022 00:54:25 +0000 (17:54 -0700)]
Port sqlite.c to OS X 10.6.8 with Xcode 3.2.6
Problem reported by Keith David Bershatsky in:
https://lists.gnu.org/r/emacs-devel/2022-04/msg00923.html
* src/sqlite.c (Fsqlite_open): Don’t assume SQLITE_OPEN_MEMORY
is defined.
Po Lu [Mon, 18 Apr 2022 00:50:15 +0000 (00:50 +0000)]
Fix Haiku menu bars when redisplay happens immediately after activation
* src/haiku_support.cc (MessageReceived): Make `REPLAY_MENU_BAR'
messages synchronous.
(be_replay_menu_bar_event): Return whether or not the menu bar
really opened.
* src/haiku_support.h: Update prototypes.
* src/haikumenu.c (haiku_activate_menubar): Immediately activate
menu bar after replaying event.
This is a change with far-reaching effects on MS-Windows at the least,
where file-related APIs are shadowed to support transparent support
for UTF-8 encoded file names. Making such changes on a stable branch
for the benefit of a proprietary platform with a 13-year old OS is a
tail wagging the dog. Please don't do that without discussing first.
Paul Eggert [Sun, 17 Apr 2022 17:41:17 +0000 (10:41 -0700)]
Don’t assume openat
Use openat only on platforms with O_PATH.
This ports to OS X 10.9 and earlier.
Problem reported by Keith David Bershatsky in:
https://lists.gnu.org/r/emacs-devel/2022-04/msg00805.html
* lib-src/emacsclient.c (local_sockname): Use open, not openat.
* src/sysdep.c (sys_openat): New static function,
which uses openat only if O_PATH is defined.
(emacs_openat): Use it instead of openat.
(emacs_openat_noquit): Remove.
(emacs_open_noquit): Reimplement as per the old emacs_openat_noquit,
but use plain 'open'.
* lisp/help-fns.el (help-enable-variable-value-editing): New user
option.
(describe-variable): Tag values for editing.
(help-fns--editable-variable, help-fns-edit-variable): New
functions (bug#36826).
(help-fns--edit-value-mode-map, help-fns--edit-value-mode)
(help-fns-edit-mode-done): New mode and commands.
Make :filters run in the correct buffer in describe-buffer-bindings
* lisp/help.el (describe-map-tree): Take an optional buffer parameter.
(describe-map): Ditto, and use it to run `lookup-key' in the
correct buffer. This fixes problems of filters being run in the
wrong buffer (bug#39149).
* src/keymap.c (Fdescribe_buffer_bindings): Pass in BUFFER to
describe-map-tree.
Eli Zaretskii [Sun, 17 Apr 2022 14:20:03 +0000 (17:20 +0300)]
Fix 'restart-emacs' on MS-Windows
* src/w32.c (w32_reexec_emacs): New function, emulation of
'execvp' on Posix systems.
* src/w32.h (w32_reexec_emacs): Add prototype.
* src/emacs.c (main) [WINDOWSNT]: Save the original command line
and working directory.
(Fkill_emacs) [WINDOWSNT]: Call 'w32_reexec_emacs' instead of
'execvp'. (Bug#17036)
* rcirc.el (rcirc-reconnect-delay): Declare variable before it is
defined.
(rcirc-keepalive): Handle rcirc-closed-connection, respecting
rcirc-reconnect-delay.
(rcirc-closed-connection): Add new error type.
(rcirc-send-string): Throw rcirc-closed-connection instead of a
generic error.
Further improve buffer-match-p related documentation
* doc/lispref/buffers.texi (Buffer List): Add entries for
* buffer-match-p and match-buffers
* etc/NEWS: Give examples for buffer-match-p conditions
* lisp/window.el (display-buffer-assq-regexp): Mention what happens
when no entry in the alist satisfies a condition.
chunk-data = 1*OCTET ; a sequence of chunk-size octets
`url-http-chunked-encoding-after-change-function' is able to process
(and remove) that terminator IF AVAILABLE in the buffer when
processing the response, however it won't wait for it if it's not yet
there.
In other words:
| Bottom of the response buffer | Bottom of the full response |
| (visible to url-http) | (to be delivered to Emacs) |
| ------------------------------+-----------------------------|
| 0\r\n | 0\r\n |
| | \r\n |
If the last chunk is processed when the bottom of the response buffer
is as above (note that the whole response has not yet been delivered
to Emacs), url-http will call the user callback without waiting for
the final terminator to be read from the socket.
This is normally not an issue when doing one-shot requests, but it's
problematic when the connection is reused immediately. As there are 2
bytes from the request N that have not been dealt with, they'll be
considered as part of the response of the request N+1. On top, it
turns out that when processing the headers of request N+1,
`url-http-wait-for-headers-change-function' will consider the request
a "headerless malformed response" delivering it broken to the caller.
The proposed fix implements a state in which
`url-http-chunked-encoding-after-change-function` properly waits for
the very last element of the message preventing the problem explained
above from happening.
For additional context, this bug was found when debugging
magit/ghub (see [1] for details).
Po Lu [Sun, 17 Apr 2022 08:10:01 +0000 (08:10 +0000)]
Fix race conditions waiting for menu bar resize events on Haiku
* src/haikufns.c (haiku_create_frame, haiku_create_tip_frame)
(haiku_set_menu_bar_lines): Clear `wait_for_event_type'.
* src/haikumenu.c (set_frame_menubar): Wait for menu bar resize
event.
* src/haikuterm.c (haiku_wait_for_event): New function.
(haiku_read_socket): Handle waiting for MENU_BAR_RESIZE.
* src/haikuterm.h (struct haiku_output): New field
`wait_for_event_type'.