Paul Eggert [Fri, 22 Jan 2016 19:15:05 +0000 (11:15 -0800)]
xwidgets style cleanup
Adjust the newly-added Xwidgets code so that it uses a more-typical
Emacs style. This should not affect behavior, except that in
a few places it adds runtime checks that Lisp arguments are of
the proper type, and in one place it uses more-precise arithmetic.
* src/buffer.c, src/dispnew.c, src/emacs.c, src/emacsgtkfixed.c:
* src/emacs.c, src/print.c, src/window.c, src/xdisp.c, src/xterm.c:
Include xwidget.h unconditionally.
* src/buffer.c (Fkill_buffer):
* src/dispnew.c (update_window):
* src/emacs.c (main):
* src/print.c (print_object):
* src/window.c (Fdelete_window_internal):
* src/xdisp.c (handle_single_display_spec, push_it, pop_it)
(get_next_element, set_iterator_to_next, next_element_from_xwidget)
(dump_glyph, calc_pixel_width_or_height, BUILD_GLYPH_STRINGS_XW)
(BUILD_GLYPH_STRINGS, x_produce_glyphs, get_window_cursor_type):
* src/xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
Call xwidget functions and macros without worrying about
HAVE_XWIDGETS when the code is a no-op on non-xwidget
platforms.
* src/dispextern.h (XWIDGET_GLYPH, struct glyph_string.xwidget)
(IT_XWIDGET, GET_FROM_XWIDGET, struct it.u.xwidget)
(struct it.xwidget):
* src/lisp.h (PVEC_XWIDGET, PVEC_XWIDGET_VIEW):
Always define.
* src/emacsgtkfixed.h: Omit unnecessary comment.
* src/keyboard.c: Fix spacing.
* src/xdisp.c (BUILD_XWIDGET_GLYPH_STRING, produce_xwidget_glyph):
Define to be a no-op if not HAVE_XWIDGETS.
* src/xwidget.c: Include xwidget.h first (after config.h)
to make sure that it can stand by itself.
(Fmake_xwidget, Fxwidget_webkit_execute_script):
Fix typo in doc string.
(Fmake_xwidget): Check type of args.
(Fmake_xwidget, offscreen_damage_event)
(webkit_document_load_finished_cb, webkit_download_cb)
(webkit_new_window_policy_decision_requested_cb)
(webkit_navigation_policy_decision_requested_cb)
(xwidget_osr_draw_cb, xwidget_osr_event_forward)
(xwidget_osr_event_set_embedder, xwidget_init_view):
Omit unnecessary casts.
* src/xwidget.c (Fmake_xwidget, xwidget_hidden)
(xwidget_show_view, xwidget_hide_view)
(x_draw_xwidget_glyph_string, xwidget_start_redisplay, xwidget_touch)
(xwidget_touched):
* src/xwidget.h (struct xwidget.kill_without_query)
(struct xwidget_view.redisplayed, struct xwidget_view.hidden):
Use bool for boolean.
* src/xwidget.c (store_xwidget_event_string, Fxwidget_size_request):
Simplify by using list functions.
(WEBKIT_FN_INIT): Omit unnecessary test for nil.
(Fxwidget_resize): Check type of integer args
before doing any work. Check that they are nonnegative.
(Fxwidget_set_adjustment): Check type of integer arg.
Avoid redundant call to gtk_scrolled_window_get_vadjustment.
Simplify. Use double, not float.
(Fxwidget_info, Fxwidget_view_info): Simplify by using CALLN.
(valid_xwidget_spec_p): Simplify.
(xwidget_spec_value): Omit unused arg FOUND. All callers changed.
* src/xwidget.h: Include lisp.h first, so that includers do
not need to worry about doing that before including this file.
Make this .h file safe to include even on non-HAVE_XWIDGETS
configurations, to simplify the includers.
(x_draw_xwidget_glyph_string, syms_of_xwidget, valid_xwidget_spec_p)
(xwidget_end_redisplay, lookup_xwidget)
(xwidget_view_delete_all_in_window, kill_buffer_xwidgets):
Now a no-op if !HAVE_XWIDGETS, to simplify callers.
(struct glyph_matrix, struct glyph_string, struct xwidget)
(struct xwidget_view, struct window):
New forward or incomplete decls, so that includers need not
assume the corresponding .h files are already included, or that
HAVE_XWIDGETS is defined.
(struct xwidget_type, xwidget_from_id): Remove; unused.
Michael Albinus [Fri, 22 Jan 2016 18:56:09 +0000 (19:56 +0100)]
Backport kqueue integration from master
* configure.ac (--with-file-notification): Add kqueue.
(top): Remove special test for "${HAVE_NS}" and
${with_file_notification}, this is handled inside gfilenotify
tests. Add kqueue tests. Use NOTIFY_CFLAGS and NOTIFY_LIBS
instead of library specific variables. Add error message for
gfile on Nextstep.
* doc/lispref/os.texi (File Notifications): Add kqueue as backend.
Fix some glitches in the example.
* src/Makefile.in: Use NOTIFY_CFLAGS and NOTIFY_LIBS.
* src/emacs.c (main): Call globals_of_kqueue and syms_of_kqueue.
* src/inotify.c (inotifyevent_to_event): Extract file name from
watch_object if the event doesn't provide it.
(Finotify_add_watch): Add file name to watch_object.
* src/keyboard.c (make_lispy_event): Check also for HAVE_KQUEUE.
* src/kqueue.c: New file.
* src/lisp.h: Declare extern globals_of_kqueue and syms_of_kqueue.
* test/automated/file-notify-tests.el
(file-notify--test-expected-events): Remove.
(file-notify--test-cleanup): Do not set that variable.
(file-notify--test-timeout) Use different timeouts for
different libraries.
(file-notify--test-library): New defun.
(file-notify--test-event-test): Make stronger checks.
(file-notify--test-with-events): EVENTS can also be a list of
lists. Flush outstanding events before running the body.
Make timeout heuristically depend on the number of events.
(file-notify-test01-add-watch, file-notify-test02-events)
(file-notify-test04-file-validity, file-notify-test05-dir-validity):
Rewrite in order to call file monitors but directory monitors.
(file-notify-test02-events, file-notify-test04-file-validity): Do
not skip cygwin tests. Add additional test for file creation.
Adapt expected result for different backends.
(file-notify-test03-autorevert): Some of the tests don't work for
w32notify.
(file-notify-test06-many-events): New test.
Paul Eggert [Wed, 20 Jan 2016 22:55:09 +0000 (14:55 -0800)]
Don’t export C symbols not used elsewhere
These were recently added, mostly as part of xwidget code.
* src/emacsgtkfixed.c (emacs_fixed_get_type): Now static.
(EMACS_FIXED, EMACS_FIXED_GET_CLASS):
Now static functions here, not macros in emacsgtkfixed.h.
* src/emacsgtkfixed.h (EMACS_TYPE_FIXED):
Remove. All uses replaced by definiens.
(EMACS_FIXED, EMACS_FIXED_GET_CLASS):
Remove; these are now static functions in emacsgtkfixed.c.
(EMACS_FIXED_CLASS, EMACS_IS_FIXED, EMACS_IS_FIXED_CLASS):
Remove; unused.
(emacs_fixed_get_type): Remove decl; no longer extern.
* src/xwidget.c (offscreen_damage_event)
(webkit_mime_type_policy_typedecision_requested_cb)
(webkit_new_window_policy_decision_requested_cb)
(webkit_navigation_policy_decision_requested_cb)
(xwidget_spec_value, xwidget_view_lookup)
(xwidget_start_redisplay, xwidget_touch):
Now static.
* src/xwidget.h (xwidget_start_redisplay, xwidget_touch):
Remove decls.
Paul Eggert [Wed, 20 Jan 2016 19:06:01 +0000 (11:06 -0800)]
Port to platforms with gtk3 but not webkitgtk3
I ran into this problem on my Fedora 23 installation;
Emacs configured but did not build when --with-xwidgets was specified.
* configure.ac (HAVE_WEBKIT, HAVE_GIR): Omit unnecessary initializations.
(DOES_XWIDGETS_USE_GIR): New var.
If --with-xwidgets is specified, report an error if not
doable, to be consistent with the other --with options.
Require webkitgtk3 to use Xwidgets, as the Xwidgets code does
not work at all without webkitgtk3. Simplify use of
EMACS_CHECK_MODULES. Output message about gobject
introspection only if xwidgets are used.
* etc/NEWS: Users need webkitgtk3, not merely webkit.
* src/xwidget.c (syms_of_xwidget): Don’t worry about HAVE_WEBKIT_OSR,
since this file is no longer compiled if webkitgtk3 is not available.
Katsumi Yamaoka [Tue, 19 Jan 2016 22:10:09 +0000 (22:10 +0000)]
* lisp/gnus/nnir.el (nnir-request-update-mark):
Default to the original mark.
cf. <http://thread.gmane.org/gmane.emacs.gnus.general/86583>
and <http://thread.gmane.org/gmane.emacs.gnus.general/86640>
Eli Zaretskii [Tue, 19 Jan 2016 17:31:05 +0000 (19:31 +0200)]
Minor copyedits of doc/emacs/maintaining.texi
* doc/emacs/maintaining.texi (List Identifiers): More accurate
description of "C-M-i" wrt tags tables.
(Tags Tables): Move the definition of "tag" to a footnote.
Phillip Lord [Sun, 17 Jan 2016 22:03:10 +0000 (22:03 +0000)]
Cope with multiple overlapping faces.
* lisp/htmlfontify.el (hfy-face-to-style-i): Treat inheritance right to
left.
(hfy-face-resolve-face): Handle font specification as well as font
name. Documentation update. (Bug#21990)
Paul Eggert [Tue, 19 Jan 2016 07:09:15 +0000 (23:09 -0800)]
Fix spurious escapes in describe-input-method
Problem reported by Vincent Belaïche (Bug#22309).
* lisp/international/mule-cmds.el (describe-language-environment):
* lisp/international/quail.el (quail-help):
Apply substitute-command-keys to doc strings before displaying them.
Dmitry Gutov [Tue, 19 Jan 2016 05:03:41 +0000 (08:03 +0300)]
Rename methods in Ruby etags example file
* test/etags/ruby-src/test.rb: Rename the example methods to
correspond to the common terminology used in Ruby.
* test/etags/CTAGS.good:
* test/etags/ETAGS.good_1:
* test/etags/ETAGS.good_2:
* test/etags/ETAGS.good_3:
* test/etags/ETAGS.good_4:
* test/etags/ETAGS.good_5:
* test/etags/ETAGS.good_6: Adjust accordingly.
Dmitry Gutov [Tue, 19 Jan 2016 04:58:46 +0000 (07:58 +0300)]
Propertize backtick in 'def `(abc)' as symbol constituent
* lisp/progmodes/ruby-mode.el (ruby-syntax-propertize):
Propertize backtick in 'def `(abc)' as symbol constituent.
(ruby-syntax-propertize-function):
Rename to ruby-syntax-propertize.
Eli Zaretskii [Mon, 18 Jan 2016 19:53:34 +0000 (21:53 +0200)]
Fix scrolling under scroll-preserve-screen-position on TTY
* src/window.c (window_scroll_line_based): When setting point to
preserve screen coordinates, don't let cursor enter either of the
two scroll margins. (Bug#22395)
Dmitry Gutov [Mon, 18 Jan 2016 19:11:46 +0000 (22:11 +0300)]
Add xref-based replacements for Dired search commands
* lisp/dired-aux.el (dired-do-find-regexp)
(dired-do-find-regexp-and-replace): New commands.
http://lists.gnu.org/archive/html/emacs-devel/2016-01/msg00864.html
* lisp/dired.el (dired-mode-map): Change bindings for `A' and
`Q' to the new commands.
* lisp/progmodes/xref.el (xref-query-replace)
(xref-collect-matches): Add progress reporters.
(xref--find-ignores-arguments): Return nil for zero ignores.
(xref--show-xrefs): Add an optional argument.
(xref-collect-matches): Drop the assert. 'find' accepts a
regular file in place of directory argument, too.
Eli Zaretskii [Mon, 18 Jan 2016 17:28:49 +0000 (19:28 +0200)]
Improve user documentation of Xref
* doc/emacs/maintaining.texi (Xref, Find Identifiers)
(Looking Up Identifiers, Identifier Search, List Identifiers):
Adjudicate comments by Dmitry Gutov <dgutov@yandex.ru>. See
http://lists.gnu.org/archive/html/emacs-devel/2016-01/msg00650.html
for the details.
Eli Zaretskii [Mon, 18 Jan 2016 16:19:50 +0000 (18:19 +0200)]
Fix scrolling under scroll-preserve-screen-position and margins
* src/window.c (window_scroll_pixel_based): When setting point to
preserve screen coordinates, don't let cursor enter either of the
two scroll margins. Fix incorrect usage of
WINDOW_WANTS_HEADER_LINE_P and use WINDOW_HEADER_LINE_HEIGHT
instead of CURRENT_HEADER_LINE_HEIGHT. (Bug#22395)
Alan Mackenzie [Mon, 18 Jan 2016 13:32:22 +0000 (13:32 +0000)]
Desktop: protect users against inadvertant upgrading of desktop file.
An upgraded (version 208) desktop file cannot be read in Emacs < 25.
* etc/NEWS: Add an entry about upgrading a desktop file.
* lisp/desktop.el (desktop-file-version): Amend doc string.
(desktop-native-file-version, desktop-io-file-version): new variables.
(desktop-clear): Set desktop-io-file-version to nil.
(desktop-buffer-info): make the presence of the last item on the list
conditional on (>= desktop-io-file-version 208).
(desktop-save): Add extra parameter VERSION to take user's C-u or C-u C-u.
Amend the doc string. Add code to determine the output file version.
(desktop-create-buffer): Set desktop-io-file-version to the input file's
version.
Paul Eggert [Mon, 18 Jan 2016 01:16:12 +0000 (17:16 -0800)]
Initialize GnuTLS before calling gnutls_rnd
* src/gnutls.c (emacs_gnutls_global_init): Now extern.
Don’t set gnutls_global_initialized if gnutls_global_init fails.
* src/sysdep.c: Include "gnutls.h", and <gnutls/crypto.h>
if 2.12 or later, which has gnutls_rnd.
(emacs_gnutls_global_init, gnutls_rnd): New fallback
placeholder macros if before 2.12.
(init_random): Initialize gnutls globals before trying to
use gnutls_rnd.
Paul Eggert [Sun, 17 Jan 2016 22:10:26 +0000 (14:10 -0800)]
Port cleanup attribute to OpenBSD
The OpenBSD C compiler issues false alarms about strcpy, strcat, and
sprintf, and this messes up 'configure' when it tests for the cleanup
attribute. Work around the problem by using __has_attribute directly.
Problem reported by Joakim Jalap (Bug#22385).
* configure.ac: Don’t use AX_GCC_VAR_ATTRIBUTE.
* m4/ax_gcc_var_attribute.m4: Remove.
* src/conf_post.h (__has_attribute): Provide a substitute, for
non-GCC or older GCC compilers. All uses changed to assume
the substitute. Check for the cleanup attribute.
* src/emacs-module.c (module_has_cleanup): Just use __has_attribute.
Paul Eggert [Sun, 17 Jan 2016 20:12:08 +0000 (12:12 -0800)]
Prefer GnuTLS when acquiring random seed
This attempts to improve on the fix for Bug#22202.
* configure.ac (HAVE_DEV_URANDOM): Remove.
Check /dev/urandom existence at run time, not at build time,
since the device could exist in the former but not the latter.
* src/sysdep.c [HAVE_GNUTLS]: Include gnutls/gnutls.h.
(gnutls_rnd) [GNUTLS_VERSION_NUMBER < 0x020c00]: New fallback macro.
(random_seed): New typedef.
(set_random_seed): New static function.
(seed_random): Use them.
(init_random): Use random_seed instead of uintmax_t, so as to
not consume more entropy than needed. Prefer gnutls_rnd if it
works; this avoids a redundant open of /dev/urandom on
GNU/Linux with modern GnuTLS.
Eli Zaretskii [Sat, 16 Jan 2016 15:30:11 +0000 (17:30 +0200)]
Improve documentation of dynamic modules
* doc/lispref/loading.texi (How Programs Do Loading): Update the
description of searching for files in 'load' when Emacs was built
with support for dynamic modules.
Eli Zaretskii [Sat, 16 Jan 2016 13:56:50 +0000 (15:56 +0200)]
Document renaming of selection-related functions
* doc/lispref/frames.texi (Window System Selections): Rename "x-*"
functions into the corresponding "gui-*" functions. Make the
description slightly less X-centric.
Fix incompatbilities with MS-Windows 2000 and older
* src/w32.c <multiByteToWideCharFlags>: New global variable.
(filename_to_utf16, filename_from_ansi, check_windows_init_file):
Use it instead of the literal MB_ERR_INVALID_CHARS.
(maybe_load_unicows_dll): Initialize multiByteToWideCharFlags as
appropriate for the underlying OS version. For details, see
http://lists.gnu.org/archive/html/emacs-devel/2016-01/msg00835.html.
* src/w32.h: Declare multiByteToWideCharFlags.
* src/w32fns.c (Fx_file_dialog, Fw32_shell_execute)
(add_tray_notification): Use multiByteToWideCharFlags instead of
the literal MB_ERR_INVALID_CHARS.
(_resetstkoflw_proc): New typedef.
(w32_reset_stack_overflow_guard): Call _resetstkoflw via a
pointer, as this function is absent in msvcrt.dll shipped with W2K
and older systems.
Eli Zaretskii [Sat, 16 Jan 2016 09:23:42 +0000 (11:23 +0200)]
Mention in PROBLEMS an issue with MS-Windows NT4
* etc/PROBLEMS (MS-Windows): Mention the problem with Shell32.dll
on Windows NT4. For the details, see
http://lists.gnu.org/archive/html/emacs-devel/2016-01/msg00835.html.
Ensure 8-byte aligned memory allocation on MS-Windows 9X
* src/w32heap.c (init_heap): Redirect malloc, realloc, and free to
special functions on Windows 9X. Refuse to dump Emacs on Windows 9X.
(malloc_after_dump_9x, realloc_after_dump_9x)
(free_after_dump_9x): New functions. (Bug#22379) See also
http://lists.gnu.org/archive/html/emacs-devel/2016-01/msg00852.html
for more details about the original problem.
Eli Zaretskii [Sat, 16 Jan 2016 07:55:00 +0000 (09:55 +0200)]
Fix tests for active region in hideif.el
* lisp/progmodes/hideif.el (hif-evaluate-macro, hide-ifdef-block): Use
'use-region-p' to test whether to operate on region, instead of
testing 'mark-active'.
Eli Zaretskii [Sat, 16 Jan 2016 07:40:12 +0000 (09:40 +0200)]
Fix interactive specs in some hideif.el commands
* lisp/progmodes/hideif.el (hif-evaluate-macro)
(hide-ifdef-undef, show-ifdef-block): Don't use '(interactive "r")'
in commands that should only act on the region if it's active.
Eli Zaretskii [Fri, 15 Jan 2016 09:47:55 +0000 (11:47 +0200)]
Make 'random' seeds cryptographically secure if possible
* configure.ac: Check for "/dev/urandom".
* src/sysdep.c (init_random) [HAVE_DEV_URANDOM]: Read the stream
for the seed from "/dev/urandom".
[WINDOWSNT]: Obtain the stream for the seed from w32 APIs.
* src/fns.c (Frandom): Update the doc string to indicate that
system entropy is used when available.
* src/w32.c: Include wincrypt.h.
(w32_init_crypt_random, w32_init_random): New functions, use the
CryptGenRandom API.
(globals_of_w32): Initialize w32_crypto_hprov handle to zero.
* src/w32.h (w32_init_random): Add prototype.
* doc/lispref/numbers.texi (Random Numbers): Document more details
about 't' as the argument to 'random'.
* etc/NEWS: Mention that '(random t)' now uses a cryptographically
strong seed if possible.
Simen Heggestøyl [Thu, 14 Jan 2016 18:24:03 +0000 (19:24 +0100)]
Disallow parenthesis in non-pseudo CSS selectors
* lisp/textmodes/css-mode.el (css--font-lock-keywords): Disallow
parenthesis in selectors except for in the function notation that
might appear right after a pseudo-class.
* test/indent/scss-mode.scss: Add a test for it.
Eli Zaretskii [Wed, 13 Jan 2016 19:14:22 +0000 (21:14 +0200)]
Document obsoletion of 'intangible' and 'point-entered/left'
* doc/lispref/text.texi (Special Properties): Document the new
properties 'cursor-intangible' and 'cursor-sensor-functions'.
Document the obsolete status of 'intangible', 'pointer-left',
and 'point-entered' properties, and of 'inhibit-point-motion-hooks'.
* doc/lispref/display.texi (Overlay Properties): Document that
'intangible' overlay property is obsolete.