Alan Mackenzie [Fri, 22 Apr 2022 19:11:31 +0000 (19:11 +0000)]
Byte compiler: Prevent special forms' symbols being replaced by bare symbols
These are symbols with position from source code, which should not be replaced
by bare symbols in, e.g., optimization functions.
* lisp/Makefile.in: (BYTE_COMPILE_FLAGS, compile-first case): Set
max-specpdl-size to 5000 for the benefit of lisp/emacs-lisp/comp.el.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker)
(byte-optimize--rename-var, byte-optimize-if, byte-optimize-letX)
* lisp/emacs-lisp/bytecomp.el (byte-compile-recurse-toplevel)
(byte-compile-lambda)
* lisp/emacs-lisp/cconv.el (cconv-convert)
* lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Preserve, e.g., (car
form) in the byte compiler, when this form's car is a symbol with position of
a special form, rather than replacing the symbol with a bare symbol, e.g.
'cond.
Eli Zaretskii [Fri, 22 Apr 2022 12:18:56 +0000 (15:18 +0300)]
; Improve comments for a recently installed bugfix
* lisp/startup.el (command-line): Remove references to a wrong bug
number and improve comments for delaying the 'user-emacs-directory'
warning. (Bug#25163)
Po Lu [Fri, 22 Apr 2022 05:42:09 +0000 (05:42 +0000)]
Fix default frame name on Haiku
* src/haikufns.c (haiku_set_background_color)
(haiku_set_cursor_color, haiku_get_pixel, haiku_put_pixel)
(haiku_set_internal_border_width)
(haiku_set_inhibit_double_buffering)
(Fhaiku_mouse_absolute_pixel_position, Fxw_color_defined_p)
(Fxw_color_values, Fx_double_buffered_p)
(Fx_display_backing_store): Clean up coding style.
(haiku_set_name): Use correct default name and don't cons extra
string all the time.
* src/haikuterm.c (haiku_read_socket): Remove unused variable.
(haiku_term_init): Set default name.
(mark_haiku_display): Mark new field.
* src/haikuterm.h (struct haiku_display_info): New field
`default_name'.
Sean Whitton [Thu, 14 Apr 2022 14:12:41 +0000 (07:12 -0700)]
Bind 'imenu' to 'M-g i' globally
Another candidate was 'M-s i'. Discussion on emacs-devel has led me
to conclude that most people will find 'M-g i' more intuitive and thus
easier to memorize.
* lisp/bindings.el (goto-map): Bind 'imenu' to 'M-g i' globally.
* etc/NEWS: Document the change.
* doc/emacs/programs.texi (Imenu):
* lisp/progmodes/cperl-mode.el: Replace 'M-x imenu' with 'M-g i'.
* lisp/startup.el (command-line): If user-emacs-directory is not
accessible, delay to show a warning until all command line args
are processed (bug#25163).
* lisp/info.el (Info-find-node): Allow not signalling errors.
(Info-apropos-matches): Allow taking a regexp.
(info-apropos): Prefix now means looking for a regexp.
Po Lu [Thu, 21 Apr 2022 03:09:22 +0000 (03:09 +0000)]
Use a cache on Haiku to avoid constantly reading fonts during font lookup
* src/haiku_font_support.cc (struct font_object_cache_bucket):
New struct.
(language_code_points): Make `int'.
(hash_string): New function.
(cache_font_object_data, lookup_font_object_data)
(font_object_has_chars): New functions.
(font_check_wanted_chars, font_check_one_of)
(font_check_language): Lookup in cached font object instead.
(be_init_font_data, be_evict_font_cache): New functions.
* src/haiku_support.h (struct haiku_font_pattern): Make
`uint32_t's ints instead.
* src/haikufont.c (haikufont_apply_registry, syms_of_haikufont):
Adjust for those changes.
* src/haikuterm.c (haiku_frame_up_to_date): Clear font lookup
cache every 50 updates.
This is a partial backport from master: it only includes the changes below.
* lib/mini-gmp.c (gmp_assert_nocarry): Avoid many Clang
unused-variable warnings when building with optimisation.
* lib/verify.h (_GL_HAVE__STATIC_ASSERT): Modify condition for using
_Static_assert to cope with older Apple builds of Clang exposing
misleading compiler version numbers. See discussion starting at
https://lists.gnu.org/archive/html/emacs-devel/2022-04/msg00779.html
* 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).
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.