1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-31 04:41:23 -08:00
Commit graph

44419 commits

Author SHA1 Message Date
Alan Third
058c012f73 Only set LANG if the ID is valid
* src/nsterm.m (ns_init_locale): Check the provided locale identifier
is available before trying to use it.
2021-11-16 20:52:10 +00:00
Lars Ingebrigtsen
ee2a578456 Fix compilation error in previous keymap.c change
* src/keymap.c (initial_define_lispy_key, define_as_prefix): Fix
--enable-checking error.
2021-11-16 14:10:56 +01:00
Po Lu
8d0c19fb0c Lower xwidget views owned by parent when lowering frame
* src/xterm.c (x_lower_frame): Lower parent frame's xwidget
views as well.

* src/xwidget.h (lower_frame_xwidget_views):
* src/xwidget.c (lower_frame_xwidget_views): New function.
2021-11-16 17:51:07 +08:00
Lars Ingebrigtsen
de477ec683 Add new 'keymap-*' functions
* lisp/keymap.el: New file with all the new keymap-* functions.

* lisp/loadup.el ("keymap"): Load.

* lisp/subr.el (kbd): Refactor out all the code to key-parse.
(define-key-after, keyboard-translate, global-set-key)
(local-set-key, global-unset-key, local-unset-key)
(local-key-binding, global-key-binding)
(substitute-key-definition): Note in doc strings that these are
legacy functions.
(define-keymap--define): Use keymap-set.

* lisp/emacs-lisp/byte-opt.el: Remove the optimizations for
defvar-keymap and define-keymap since the macros now only
understand the kbd syntax.
* lisp/emacs-lisp/bytecomp.el (byte-compile-define-keymap)
(byte-compile-define-keymap--define): Warn about invalid key
definitions in all keymap-* functions.

* lisp/emacs-lisp/shortdoc.el (keymaps): Add shortdocs form
keymap* functions.

* src/keymap.c (possibly_translate_key_sequence): Adjust callers
to key-valid-p and key-parse.
(syms_of_keymap): Adjust defs.
2021-11-16 08:26:24 +01:00
Lars Ingebrigtsen
560c921ed8 Allow removing keymap definitions
* src/keymap.c (initial_define_lispy_key): Adjust caller.
(store_in_keymap): Allow removing definitions in addition to
setting them to nil.
(Fdefine_key): Ditto.
(define_as_prefix): Adjust caller.

* src/term.c (term_get_fkeys_1): Adjust caller.
2021-11-16 08:26:24 +01:00
Stefan Kangas
e0abd83b49 Merge from origin/emacs-28
e852822f3d Fix removal of fringe marks of deleted bookmarks
b418aad85a * lisp/repeat.el (repeat-echo-message): Bind message-log-m...
fe2ac7cb7c * lisp/repeat.el (describe-repeat-maps): Use help-fns--ana...
c840bfe7e1 * lisp/repeat.el: Detect changes in the minibuffer state (...
5044151486 Avoid segfaults due to freed face cache
199e2468d3 Doc fix; change recommended file name of custom-file
2021-11-16 07:18:19 +01:00
Po Lu
7cfc3f34bb Prevent xwidget windows from obscuring child frames
* src/xwidget.c (x_draw_xwidget_glyph_string): Lower view window
when creating it.
2021-11-16 09:32:37 +08:00
Po Lu
367cf464a1 Fix documentation string
* src/xwidget.c (Vxwidget_list, Vxwidget_views_list): Fix
horrid doc string.
2021-11-16 09:32:37 +08:00
Eli Zaretskii
5044151486 Avoid segfaults due to freed face cache
* src/xfaces.c (face_at_buffer_position): Make sure DEFAULT_FACE
is usable.  (Bug#51864)
2021-11-15 15:35:31 +02:00
Po Lu
d5a4772712 Fix xwidget-webkit-back-forward-list
* src/xwidget.c (Fxwidget_webkit_back_forward_list): Use correct
list variable in loop.
2021-11-15 13:43:55 +08:00
Po Lu
d9e91da769 Stop assuming xwidget views will only be displayed in TEXT_AREA
* src/xterm.c (x_scroll_run): Use view->area when calculating
xwidget view clipping.

* src/xwidget.c (x_draw_xwidget_glyph_string): Set view->area
to s->area and use that instead.

* src/xwidget.h (struct xwidget_view): Add glyph row area field.
2021-11-15 09:27:31 +08:00
Ken Brown
364cf2494c Prefer POSIX timers to timerfd timers
* src/atimer.c (set_alarm): Try to start a POSIX timer before
starting a timerfd timer.  On Cygwin, return if the POSIX timer is
started successfully. (Bug#51734)
2021-11-14 14:06:55 -05:00
Stefan Monnier
572eed83fc * src/lread.c (read_escape): Fix handling of ?\C-<char> for chars 128-255 2021-11-14 12:56:11 -05:00
Eli Zaretskii
96806a22fb Merge from origin/emacs-28
a56dd60 Improve style and comments in font-related sources
2021-11-14 15:02:40 +02:00
Eli Zaretskii
289f3a9e5f Add more files to be natively-compiled AOT
* src/Makefile.in (elnlisp): Add emacs-lisp/gv.eln and other
missing dependencies of comp.el.
2021-11-14 14:46:27 +02:00
Po Lu
c3f53d2604 Expose xwidget navigation history to Lisp code
* doc/lispref/display.texi (Xwidgets): Document changes.
* etc/NEWS: Announce new function.
* src/xwidget.c (Fxwidget_webkit_back_forward_list): New
function.
(syms_of_xwidget): Define new subr.
2021-11-14 17:45:23 +08:00
Po Lu
609bc1d33a Add `kill-xwidget'
* doc/lispref/display.texi (Xwidgets): Document 'kill-xwidget'.
* src/xwidget.c (kill_xwidget, Fkill_xwidget): New function.
(syms_of_xwidget): Define new subr.
(kill_buffer_xwidgets): Use `kill_xwidget' instead.
2021-11-14 17:42:16 +08:00
Po Lu
9627b731c0 Fix crash in xwidget_end_redisplay
* src/xwidget.c (xwidget_end_redisplay): Always test if xv is
NULL.
2021-11-14 10:00:40 +08:00
Eli Zaretskii
480241983e Fix compilation on MS-Windows
* src/callproc.c (emacs_spawn) <fork_done>: Define the label only
if USABLE_POSIX_SPAWN is defined, to avoid a compiler warning.

(cherry picked from commit a8fc080851)
2021-11-13 16:46:31 +01:00
Philipp Stephani
cc4edea872 Use posix_spawn if possible.
posix_spawn is less error-prone than vfork + execve, and can make
better use of system-specific enhancements like 'clone' on Linux.  Use
it if we don't need to configure a pseudoterminal.

Backported from commit a60053f836.
Unlike that commit, only define USABLE_POSIX_SPAWN on macOS, because
there posix_spawn is much faster than vfork.

Don't merge to master.

* configure.ac (HAVE_SPAWN_H, HAVE_POSIX_SPAWN)
(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR)
(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP)
(HAVE_POSIX_SPAWNATTR_SETFLAGS, HAVE_DECL_POSIX_SPAWN_SETSID): New
configuration variables.
* src/callproc.c (USABLE_POSIX_SPAWN): New configuration macro.
(emacs_posix_spawn_init_actions)
(emacs_posix_spawn_init_attributes, emacs_posix_spawn_init): New
helper functions.
(emacs_spawn): Use posix_spawn if possible.

(cherry picked from commit a60053f836)
2021-11-13 16:45:19 +01:00
Eli Zaretskii
a56dd60d2f Improve style and comments in font-related sources
* src/w32font.c (fill_in_logfont): Stylistic changes.
* src/font.h (font_property_index, font_select_entity):
Add/improve comments.
2021-11-13 16:37:39 +02:00
Po Lu
f7abc04c40 Fix scroll event test in handle_one_xevent
* src/xterm.c (handle_one_xevent): Test for scroll wheel button
correctly in xwidget code.
2021-11-13 21:38:06 +08:00
Eli Zaretskii
89d7a71ce6 Fix font selection via :family on MS-Windows
* src/font.c (font_delete_unmatched) [HAVE_NTGUI]: Allow non-exact
matches of :weight when looking for a suitable font.  (Bug#51768)
2021-11-13 15:22:12 +02:00
Alan Mackenzie
f740becf8a Correct patch from 2021-11-12 on src/fileio.c
* src/fileio.c (restore_window_points): Reverse commit
974192413f and instead replace a < by a <=.
This ensures that if w->mpoint is at the top of the middle region being
replaced, it gets adjusted and stays at the top after the reinsertion.
2021-11-13 12:58:23 +00:00
Po Lu
102406edb1 Don't emit SELECT_WINDOW_EVENT when an xwidget is scrolled
* src/xterm.c (handle_one_event): Don't select xwidget window
on button event if the button pressed actually represents the
scroll wheel.
2021-11-13 20:04:47 +08:00
Po Lu
dafebe37eb Use GTK native file choosers in xwidget callback
* src/xwidget.c (run_file_chooser_cb): Use GtkFileChooserNative
instead.
2021-11-13 15:38:12 +08:00
Stefan Kangas
b4c6ab8cb6 Merge from origin/emacs-28
42d4e24ff3 ; Fix typos
0d0125daae Improve documentation of 'decode-coding-region'
2021-11-13 07:00:30 +01:00
Po Lu
a5008352c4 Prevent NULL-pointer dereference on xwidget callback error
* src/xwidget.c (webkit_javascript_finished_cb): Check if
`error' is NULL before freeing it.
2021-11-13 13:02:09 +08:00
Po Lu
eb4567e5be Fix file chooser hangs inside xwidget-webkit
* src/xwidget.c (run_file_chooser_cb): New function that runs
a nested event loop instead of acting asynchronously.
(Fmake_xwidget): Attach file chooser signal.
2021-11-13 11:24:13 +08:00
Po Lu
59a58328bc Remove unused xwidget code in EmacsFixed GTK widget class
This is no longer required, as we rely on X to position
xwidgets now.  It also makes resizing Emacs frames slightly
slower.

* src/emacsgtkfixed.c (EMACS_FIXED_GET_CLASS)
(struct GtkFixedPrivateL)
(emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init) [HAVE_XWIDGETS]: Remove unused code.
2021-11-13 08:51:32 +08:00
Ken Brown
e4f8ce7818 Don't start both timerfd and alarms on Cygwin
* src/atimer.c (set_alarm) [CYGWIN]: Don't start both timerfd and
alarms; this causes a slowdown.  (Bug#51734)
2021-11-12 15:04:49 -05:00
Alan Mackenzie
974192413f In insert_file_contents, always set windows' point markers.
This fixes bug #51776.

* src/fileio.c (restore_window_points): Restore a w->mpoint even when that
marker originally pointed into the unchanged area near BOB or EOB.  This
prevents that window's point being moved a long way from its starting place
due to the removal of the central part of the buffer by insert_file_contents.
2021-11-12 18:43:22 +00:00
Stefan Kangas
42d4e24ff3 ; Fix typos 2021-11-12 13:59:58 +01:00
Eli Zaretskii
0d0125daae Improve documentation of 'decode-coding-region'
* src/coding.c (Fdecode_coding_region): Doc fix.

* doc/lispref/nonascii.texi (Coding System Basics)
(Explicit Encoding): Explain the significance of using 'undecided'
in 'decode-coding-*' functions.
2021-11-12 10:53:52 +02:00
Eli Zaretskii
766f636a72 ; * src/lread.c (safe_to_load_version, Fload): Fix coding style. 2021-11-12 09:47:44 +02:00
Lars Ingebrigtsen
0c3bf6ce11 Remove unused xlfd_ enums
* src/xfaces.c: Remove xlfd_weight, xlfd_swidth and xlfd_slant
enums.  These seem to be unused in the Emacs sources.
2021-11-12 08:23:45 +01:00
Po Lu
e9a68b1de5 Remove obsolete comment
The comment probably dated back to when xwidgets supported
many other GTK+ widgets with other data.  In the current
implementation of xwidgets, everything that should be freed
is already freed in `kill_buffer_xwidgets'.

* src/xwidget.c (kill_buffer_xwidgets): Remove outdated TODO.
2021-11-12 14:31:36 +08:00
Lars Ingebrigtsen
dae3c4e89b Allow choosing regular-weighted fonts when medium-weighted exist
* src/ftfont.c (ftfont_pattern_entity): Allow using both regular
and medium-weighted fonts.
2021-11-12 07:19:25 +01:00
Stefan Kangas
fc00fe53e1 Merge from origin/emacs-28
a6905e90cc Fix problem with temp buffer killing in package-install-file
144ad77fda Fix Lisp Intro markup error
24b86cb4f7 Fix ACL errors with WebDAV volumes on MS-Windows
2021-11-12 07:17:11 +01:00
Po Lu
070d6297ca Fix doc string for xwidget-webkit-load-html
* src/xwidget.c (Fxwidget_webkit_load_html): Fix doc string.
2021-11-12 14:16:31 +08:00
Bryan C. Mills
31279f92ae Make "emacs --script /dev/stdin work again when that's a pipe
* src/lread.c (Fload): Adjust callers.

* src/lread.c (safe_to_load_version): Check lseek errors
(Bug#48940).

Copyright-paperwork-exempt: yes
2021-11-12 04:27:16 +01:00
Po Lu
df2438d369 Fix potential NULL dereference in xwidget-webkit-uri
* src/xwidget.c (Fxwidget_webkit_uri): Don't assume
webkit_web_view_get_uri will always return a valid string.
2021-11-12 11:19:30 +08:00
Po Lu
372824a8bf Check for WebKit xwidgets inside all xwidget-webkit functions
This is done in preparation for the introduction of other
xwidgets, such as media xwidgets, even though there are
only WebKit widgets at present.

* src/xwidget.c (CHECK_WEBKIT_XWIDGET): New macro.
(WEBKIT_FN_INIT): Use CHECK_WEBKIT_XWIDGET.

(Fxwidget_webkit_search, Fxwidget_webkit_next_result)
(Fxwidget_webkit_previous_result)
(Fxwidget_webkit_finish_search)
(Fxwidget_webkit_load_html): Check that xwidget is a WebKit
widget.
2021-11-12 10:40:03 +08:00
Po Lu
fe0f7bddb6 Prevent crashes from Lisp code modifying xwidget-list
* src/xwidget.c (internal_xwidget_view_list)
(internal_xwidget_list): New variable.

(find_xwidget_for_offscreen_window)
(define_cursors, offscreen_damage_event)
(webkit_ready_to_show, xwidget_init_view)
(Fxwidget_resize, Fdelete_xwidget_view)
(Fxwidget_view_lookup, xwidget_spec_value)
(lookup_xwidget, xwidget_end_redisplay)
(kill_frame_xwidget_views, kill_buffer_xwidgets)
(Fmake_xwidget, Fget_buffer_xwidgets): Use internal list.

(syms_of_xwidget): Initialize internal xwidget lists.
2021-11-12 09:53:30 +08:00
Po Lu
554a875493 Prevent crashes in xwidgets whose buffers have been killed
* doc/lispref/display.texi (Xwidgets): Explain meaning of killed
xwidgets.
* src/xwidget.c (Fxwidget_live_p): New function.
(Fxwidget_perform_lispy_event, WEBKIT_FN_INIT)
(Fxwidget_resize, Fxwidget_size_request)
(Fxwidget_info, Fxwidget_plist)
(Fset_xwidget_buffer, Fset_xwidget_plist)
(Fset_xwidget_query_on_exit_flag)
(Fxwidget_query_on_exit_flag)
(Fxwidget_webkit_search)
(Fxwidget_webkit_next_result)
(Fxwidget_webkit_previous_result)
(Fxwidget_webkit_finish_search)
(Fxwidget_webkit_load_html): Check for live xwidgets instead of
just xwidgets.

(xwidget_button, xwidget_motion_or_crossing)
(xv_do_draw, x_draw_xwidget_glyph_string)
(Fdelete_xwidget_view): Ignore killed xwidgets.

(syms_of_xwidget): Define new symbols and subrs and define
appropriate weakness of id_to_xwidget map.
(kill_buffer_xwidgets): Check live xwidgets instead of
killed xwidgets, set xwidget buffer to nil, and rely on GC to
free the hash table for us instead.

* src/xwidget.h (XWIDGET_LIVE_P, CHECK_LIVE_XWIDGET): New
macros.
2021-11-12 08:17:41 +08:00
Eli Zaretskii
a8fc080851 Fix compilation on MS-Windows
* src/callproc.c (emacs_spawn) <fork_done>: Define the label only
if USABLE_POSIX_SPAWN is defined, to avoid a compiler warning.
2021-11-11 22:00:03 +01:00
Philipp Stephani
a60053f836 Use posix_spawn if possible.
posix_spawn is less error-prone than vfork + execve, and can make
better use of system-specific enhancements like 'clone' on Linux.  Use
it if we don't need to configure a pseudoterminal.

* configure.ac (HAVE_SPAWN_H, HAVE_POSIX_SPAWN)
(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR)
(HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR_NP)
(HAVE_POSIX_SPAWNATTR_SETFLAGS, HAVE_DECL_POSIX_SPAWN_SETSID): New
configuration variables.
* src/callproc.c (USABLE_POSIX_SPAWN): New configuration macro.
(emacs_posix_spawn_init_actions)
(emacs_posix_spawn_init_attributes, emacs_posix_spawn_init): New
helper functions.
(emacs_spawn): Use posix_spawn if possible.
2021-11-11 22:00:03 +01:00
Eli Zaretskii
24b86cb4f7 Fix ACL errors with WebDAV volumes on MS-Windows
* src/w32.c (acl_get_file): Handle ERROR_INVALID_FUNCTION from
WebDAV.  Patch from Ioannis Kappas <ioannis.kappas@gmail.com>.
(Bug#51773)
2021-11-11 21:41:10 +02:00
Eli Zaretskii
2c082ce800 ; * src/term.c (init_tty): Fix last change. 2021-11-11 16:58:47 +02:00
Eli Zaretskii
4a261ce91d ; * src/term.c (init_tty): Fix style of parentheses. 2021-11-11 16:56:46 +02:00