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.
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)