aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix infinite recursion under prettify-symbols-mode and linum-modeEli Zaretskii2017-08-071-0/+3
| | | | | | | | | * src/xdisp.c (get_overlay_strings_1) (handle_single_display_spec, push_prefix_prop): Invalidate the composition information before starting to iterate on a string. Otherwise we might think in set_iterator_to_next that we are delivering characters from a composition, and do all kinds of nonsensical things, like over-step the string end. (Bug#27761)
* Fix some crashes on self-modifying Elisp codePaul Eggert2017-08-061-61/+67
| | | | | | | | | | | | | | | | | | | | | | | | Prompted by a problem report by Alex in: http://lists.gnu.org/archive/html/emacs-devel/2017-08/msg00143.html * src/eval.c (For, Fprogn, Fsetq, FletX, eval_sub): Compute XCDR (x) near XCAR (x); although this doesn't fix any bugs, it is likely to run a bit faster with typical hardware caches. (Fif): Use Fcdr instead of XCDR, to avoid crashing on self-modifying S-expressions. (Fsetq, Flet, eval_sub): Count the number of arguments as we go instead of trusting an Flength prepass, to avoid problems when the code is self-modifying. (Fquote, Ffunction, Fdefvar, Fdefconst): Prefer !NILP to CONSP where either will do. This is mostly to document the fact that the value must be a proper list. It's also a tiny bit faster on typical machines nowadays. (Fdefconst, FletX): Prefer XCAR+XCDR to Fcar+Fcdr when either will do. (eval_sub): Check that the args are a list as opposed to some other object that has a length. This prevents e.g. (if . "string") from making Emacs dump core in some cases. * test/src/eval-tests.el (eval-tests--if-dot-string) (eval-tests--let-with-circular-defs, eval-tests--mutating-cond): New tests.
* Respect comment-auto-fill-only-commentsTom Tromey2017-08-051-4/+7
| | | | | | | | | | | | Respect comment-auto-fill-only-comments when auto-filling and a comment syntax is defined. * lisp/newcomment.el (comment-indent-new-line): Do not check comment-auto-fill-only-comments. * lisp/simple.el (internal-auto-fill): New defun. * src/cmds.c (internal_self_insert): Call Qinternal_auto_fill, not auto_fill_function. (syms_of_cmds): Define Qinternal_auto_fill.
* Fix a bug in 'generate-new-buffer-name'Eli Zaretskii2017-08-051-1/+2
| | | | | | | | | * src/buffer.c (Fgenerate_new_buffer_name): Test IGNORE for being nil before calling string-equal, since the latter will compare "nil and 'nil' as equal. (Bug#27966) * test/src/buffer-tests.el (test-generate-new-buffer-name-bug27966): New test.
* Port recent rename changes to Ubuntu 14.04Paul Eggert2017-08-041-1/+1
| | | | | * src/sysdep.c (renameat_noreplace) [!RENAME_NOREPLACE]: Don’t use syscall. Problem reported by Tino Calancha (Bug#27946#10).
* Fix version numbers for some GnuTLS featuresPaul Eggert2017-08-032-215/+171
| | | | | | | | | | | | Problem reported by Glenn Morris (Bug#27708#58). * src/gnutls.c (HAVE_GNUTLS_X509_SYSTEM_TRUST): New macro. Use it instead of low-level version number checks. (HAVE_GNUTLS_AEAD): Move here from gnutls.h, and rename from HAVE_GNUTLS3_AEAD. All uses changed. Indent preprocessor lines. * src/gnutls.h (HAVE_GNUTLS3_CIPHER, HAVE_GNUTLS3_DIGEST) (HAVE_GNUTLS3_HMAC): Remove, since these were available before GnuTLS 3.0.0 and the code checks them only if HAVE_GNUTLS3 is defined. Remove all uses; this simplifies the code a bit.
* Port recent rename changes to RHEL 7 + NFSPaul Eggert2017-08-031-15/+30
| | | | | | | | | | | Problem reported by Ted Zlatanov in: http://lists.gnu.org/archive/html/emacs-devel/2017-08/msg00082.html * src/fileio.c (Frename_file): On RHEL 7 + NFS, renameat2 can fail with errno == EINVAL when it is not supported. So treat that case like errno == ENOSYS. Also, when ok_if_already_exists is neither nil nor an integer, just call plain rename; this avoids an extra syscall to renameat2 when the latter fails with errno == EINVAL or ENOSYS or ENOENT.
* Port GnuTLS usage to Ubuntu 16.04.2 LTSPaul Eggert2017-08-031-1/+10
| | | | | * src/gnutls.h (HAVE_GNUTLS3_AEAD): Define only if GnuTLS 3.5.1 or later, as opposed to the old 3.4.0 or later.
* Simplify configuration of HAVE_GNUTLS3 etc.Paul Eggert2017-08-021-2/+10
| | | | | | | | | | There's only one GnuTLS, so configuring these symbols at 'configure' time is overkill. Simplify things by moving their configuration to src/gnutls.h (Bug#27708). * configure.ac (HAVE_GNUTLS3, HAVE_GNUTLS3_HMAC, HAVE_GNUTLS3_AEAD) (HAVE_GNUTLS3_CIPHER, HAVE_GNUTLS3_DIGEST): Move these definitions from here ... * src/gnutls.h: ... to here, and simplify.
* When renaming a file, ask only if EEXIST or ENOSYSPaul Eggert2017-08-024-39/+73
| | | | | | | | | | | | | | * src/fileio.c (Frename_file): Avoid calling Ffile_directory_p more than once on FILE. Use renameat_noreplace, so that we can ask the user (and unlink and retry) only if this fails with errno == EEXIST or ENOSYS. This avoids the need to ask the user for permission to do an operation that will fail anyway. Simplify computation of ok_if_already_exists for subsidiary functions. * src/filelock.c (rename_lock_file): Prefer renameat_noreplace if it works, as this avoids the need to link and unlink. * src/lisp.h (renameat_noreplace): New decl. * src/sysdep.c [HAVE_LINUX_FS_H]: Include linux/fs.h and sys/syscall.h. (renameat_noreplace): New function.
* When creating a link, ask only if EEXISTPaul Eggert2017-08-021-31/+27
| | | | | | | * src/fileio.c (Fadd_name_to_file, Fmake_symbolic_link): Ask the user (and unlink and retry) only if link creation fails with errno == EEXIST. This avoids the need to ask the user for permission to do an operation that will fail anyway.
* Don’t worry about unlink if errno == ENOENTPaul Eggert2017-08-012-2/+3
| | | | | | | | | * src/fileio.c (Fdelete_file): * src/keyboard.c (Fopen_dribble_file): Do not report failure to remove a file if unlink fails with errno == ENOENT. This can happen even if Emacs is the only program removing the file, in case an NFS cache overflows. The file does not exist if errno == ENOENT, so it is OK to proceed.
* Avoid most stat calls when completing file namesPaul Eggert2017-07-311-30/+41
| | | | | | | | | | | | | | * admin/merge-gnulib (GNULIB_MODULES): Add d-type. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. * m4/d-type.m4: New file, copied from gnulib. * src/dired.c (DT_UNKNOWN, DT_DIR, DT_LINK) [!HAVE_STRUCT_DIRENT_D_TYPE]: New constants. (dirent_type): New function. (file_name_completion): Use it, to avoid unnecessary calls to stat-like functions on GNU/Linux and other platforms with d_type. (file_name_completion_stat): Just follow the link; there is no need to try first with AT_SYMLINK_NOFOLLOW since the directory entry was already checked to exist.
* ; Don't use non-ASCII quotes in commentsEli Zaretskii2017-07-302-5/+5
| | | | | | * src/regex.h: * src/regex.c (re_wctype_parse): Don't use non-ASCII quotes in comments.
* Preserve this-command-keys across recursive-edit invocationsEli Zaretskii2017-07-281-0/+7
| | | | | | * src/minibuf.c (read_minibuf, read_minibuf_unwind): Save and restore this-command-keys, to preserve it across recursive-edit. (Bug#27470)
* Properly align global lispsymAndreas Schwab2017-07-252-3/+3
| | | | | | | * lib-src/make-docfile.c (close_emacs_globals): Wrap struct Lisp_Symbols inside struct. * src/alloc.c (sweep_symbols): Update use of lispsym. * src/lisp.h (builtin_lisp_symbol): Likewise.
* Enable GUI Emacs without 'make install' on macOS (Bug #27645)Charles A. Roelli2017-07-231-0/+13
| | | | | | | | | | | * nextstep/INSTALL: Correct it, and mention that Emacs can be run from 'src/emacs'. * src/nsterm.m (applicationDidFinishLaunching:): When Emacs is launched outside of a macOS application bundle, change its activation policy from the default 'prohibited' to 'regular'. ; * etc/NEWS: Mention the change on macOS.
* Signal error for symbol names with strange quotes (Bug#2967)Noam Postavsky2017-07-221-0/+18
| | | | | | | | * src/lread.c (read1): Signal an error when a symbol starts with a non-escaped quote-like character. * test/src/lread-tests.el (lread-tests--funny-quote-symbols): New test. * etc/NEWS: Announce change.
* Add a minor mode interface for display-line-numbersAlexander Gramiak2017-07-221-1/+1
| | | | | | | | | | | | | | | * lisp/cus-start.el: Use the new display-line-numbers group. * lisp/display-line-numbers.el: New file. * doc/emacs/custom.texi (Init Rebinding): Re-add entry that used to belong to linum-mode. * doc/emacs/modes.texi (Minor Modes): Summarize the mode. * etc/NEWS: Document display-line-numbers-mode and its customization variables, and mention that display-line-numbers-width is buffer-local. * src/xdisp.c (syms_of_xdisp) <display-line-numbers-width>: Fix a typo.
* Simplify recent gnutls.c changesPaul Eggert2017-07-201-35/+10
| | | | | | | | * src/gnutls.c (clear_storage) [HAVE_GNUTLS3_AEAD]: Remove. All uses replaced by calls to explicit_bzero; that’s clear enough. (gnutls_symmetric_aead) [HAVE_GNUTLS3_AEAD]: Simplify by coalescing duplicate actions. There is no need to invoke SAFE_FREE before calling ‘error’.
* Fix hscrolling calculations when display-line-numbers is setEli Zaretskii2017-07-201-3/+17
| | | | | * src/xdisp.c (move_it_in_display_line_to): Account for line numbers in hscrolled lines. (Bug#27756)
* * src/gnutls.c (clear_storage): Define only if needed.Philipp Stephani2017-07-191-0/+4
|
* Avoid infloop due to Eshell's "smart" redisplayEli Zaretskii2017-07-181-0/+13
| | | | | * src/xdisp.c (pos_visible_p): Save and restore the window's mode-line and header-line height. (Bug#27752)
* Fix indentation when display-line-numbers is non-nilEli Zaretskii2017-07-181-1/+1
| | | | | * src/xdisp.c (x_produce_glyphs): Fix a typo in deciding whether to go one more tab stop to display a TAB. (Bug#27743)
* Don't use gtk_widget_get_scale_factor on old GTK3 versionsLars Ingebrigtsen2017-07-181-1/+1
| | | | | * src/gtkutil.c (xg_get_scale): gtk_widget_get_scale_factor is only present since GTK 3.10.
* Port gnutls.c to older (buggier?) GnuTLSPaul Eggert2017-07-181-2/+7
| | | | | | | | | | | Problem reported for GnuTLS 3.2.1 by Glenn Morris in: http://lists.gnu.org/archive/html/emacs-devel/2017-07/msg00716.html http://lists.gnu.org/archive/html/emacs-devel/2017-07/msg00742.html Although I don't see how this bug can occur with vanilla GnuTLS 3.2.1, perhaps hydra was using a modified GnuTLS. * src/gnutls.c (Fgnutls_ciphers): Don't assume GNUTLS_CIPHER_NULL is at the end of the list returned by gnutls_cipher_list, or that the earlier ciphers all have non-null names.
* Move comments aroundLars Ingebrigtsen2017-07-171-1/+1
|
* Make scaling work (?) on pre-GTK3 systemsLars Ingebrigtsen2017-07-171-1/+18
| | | | | * src/gtkutil.c (xg_get_gdk_scale): Reinstate function. (xg_get_scale): Use it on non-GTK3 systems.
* Always return the GDK scaleLars Ingebrigtsen2017-07-171-1/+1
| | | | * src/gtkutil.c (xg_get_scale): Return the GDK scale always.
* Remove usage of the GDK_SCALE variableLars Ingebrigtsen2017-07-173-31/+12
| | | | | | | | | | | | | | | * src/gtkutil.c (xg_get_gdk_scale): Remove. (xg_get_default_scrollbar_height) (xg_get_default_scrollbar_width): Pass in a frame to check for scaling. (xg_frame_set_char_size): Use the API for querying scale instead of looking at the GDK_SCALE variable. (xg_get_default_scrollbar_width): Ditto. (xg_get_default_scrollbar_height): Ditto. (xg_update_scrollbar_pos): Ditto. * src/xfns.c (x_set_scroll_bar_default_height): Pass in the frame to get the width.
* Get positions of menus and tooltips right on HiDPILars Ingebrigtsen2017-07-173-1/+16
| | | | | | | | * src/gtkutil.c (xg_get_scale): New function. (xg_show_tooltip): Use it. * src/xmenu.c (create_and_show_popup_menu): Put menus in the right place.
* Allow user control on what starts and ends a paragraph for bidiEli Zaretskii2017-07-173-7/+87
| | | | | | | | | | | | | | | | | | | | | | | | * src/buffer.h (struct buffer): New members bidi_paragraph_separate_re_ and bidi_paragraph_start_re_. * src/buffer.c (bset_bidi_paragraph_start_re) (bset_bidi_paragraph_separate_re): New setters/ (Fbuffer_swap_text): Swap the values of bidi-paragraph-start-re and bidi-paragraph-separate-re. (init_buffer_once): Init the values of bidi-paragraph-start-re and bidi-paragraph-separate-re. (syms_of_buffer) <bidi-paragraph-start-re, bidi-paragraph-separate-re>: New per-buffer variables. * src/bidi.c (bidi_at_paragraph_end, bidi_find_paragraph_start): Support bidi-paragraph-start-re and bidi-paragraph-separate-re. (bidi_move_to_visually_next): Handle correctly the case when the separator matches an empty string. (Bug#27526) * doc/emacs/mule.texi (Bidirectional Editing): * doc/lispref/display.texi (Bidirectional Display): Document bidi-paragraph-start-re and bidi-paragraph-separate-re. * etc/NEWS: Mention bidi-paragraph-start-re and bidi-paragraph-separate-re.
* Have Fgnutls_available_p return Qnil when GNUTLS is undefinedMartin Rudalics2017-07-171-1/+7
| | | | | * src/gnutls.c (Fgnutls_available_p): Return Qnil when GNUTLS is undefined to allow --with-gnutls=no builds to proceed.
* * src/gnutls.c: Restore some comments.Paul Eggert2017-07-161-4/+9
|
* Use memset, not bzeroPaul Eggert2017-07-161-3/+3
| | | | | * src/ftcrfont.c (ftcrfont_glyph_extents): Use memset instead of the (less-portable) bzero.
* Use explicit_bzero to clear GnuTLS keysPaul Eggert2017-07-161-2/+18
| | | | | | | | * admin/merge-gnulib (GNULIB_MODULES): Add explicit_bzero. * lib/explicit_bzero.c, m4/explicit_bzero.m4: New files. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. * src/gnutls.c (clear_storage): New function. (gnutls_symmetric_aead): Use it instead of memset.
* Fix some frame handling issues on NSAlan Third2017-07-152-0/+38
| | | | | | | * lisp/frame.el (mouse-absolute-pixel-position): Use new NS function. * src/nsfns.m (Sns_mouse_absolute_pixel_position): New function. * src/nsterm.m (x_make_frame_visible): Re-establish parent-child relationship if it's broken.
* Avoid link errors with older versions of GnuTLSEli Zaretskii2017-07-151-0/+6
| | | | | | | * src/gnutls.c (Fgnutls_ciphers, gnutls_symmetric_aead) (Fgnutls_macs, Fgnutls_digests): Conditionally compile code that calls GnuTLS functions which might be unavailable in older versions of GnuTLS.
* Improve some GnuTL error messagesEli Zaretskii2017-07-152-6/+14
| | | | | * src/gnutls.c (gnutls_symmetric_aead, gnutls_symmetric): * src/fns.c (Fsecure_hash_algorithms): Fix error messages.
* Fix compilation of gnutls.c with older GnuTLSEli Zaretskii2017-07-151-0/+2
| | | | | | * src/gnutrls.c (syms_of_gnutls): Condition some defsubr's on HAVE_GNUTLS3, to avoid compilation errors when GnuTLS v3.X is not available. Reported by Colin Baxter <m43cap@yandex.com>.
* Rearrange MS-Windows code that dynamically loads GnuTLS functionsEli Zaretskii2017-07-151-36/+62
| | | | | * src/gnutls.c [WINDOWSNT]: Reorganize definitions and loading of functions using the same preprocessing directives as in the code.
* Fix the MS-Windows build broken in gnutls.cEli Zaretskii2017-07-151-19/+19
| | | | | | * src/gnutls.c (Fgnutls_available_p) [WINDOWSNT]: Move the DLL loading code to after 'capabilities' has been calculated. Remove redundant comments.
* src/image.c (compute_image_size): Remove superfluous checks.Lars Ingebrigtsen2017-07-151-2/+2
| | | | * src/image.c (compute_image_size): Remove superfluous checks.
* Make combinations of :width/:max-height image specs work reliablyLars Ingebrigtsen2017-07-151-52/+45
| | | | | | | | | | | | * doc/lispref/display.texi (ImageMagick Images): Document :width/:max-height combinations (etc) (bug #25583). * src/image.c (compute_image_size): Handle :width/:max-height (etc) combinations consistently (by letting "max" win and preserve ratio). * test/manual/image-size-tests.el (image-size-tests): Add tests for :width/:max-height (etc) combinations.
* GnuTLS integer-overflow and style fixesPaul Eggert2017-07-143-305/+237
| | | | | | | | | | | | | | | | | | | | | | | | | | | This tweaks the recently-added GnuTLS improvements so that they avoid some integer-overflow problems and follow typical Emacs style a bit better. * configure.ac (HAVE_GNUTLS3_HMAC, HAVE_GNUTLS3_AEAD) (HAVE_GNUTLS3_CIPHER): Use AC_CACHE_CHECK so that the configure-time results are displayed. * src/fns.c (extract_data_from_object): Return char *, not char const *, since one gnutls caller wants a non-const pointer. Use CONSP rather than !NILP when testing for conses. Use CAR_SAFE instead of rolling our own code. Prefer signed types to unsigned when either will do. Report problems for lengths out of range, instead of silently mishandling them. * src/gnutls.c (emacs_gnutls_strerror): New function, to simplify callers. All callers of gnutls_sterror changed. (Fgnutls_boot): Check for integers out of range rather than silently truncating them. (gnutls_symmetric_aead): Check for integer overflow in size calculations. (gnutls_symmetric_aead, Fgnutls_macs, Fgnutls_digests): Prefer signed to unsigned integers where either will do. (gnutls_symmetric_aead, gnutls_symmetric): Work even if ptrdiff_t is wider than ‘long’. (gnutls_symmetric, Fgnutls_hash_mac, Fgnutls_hash_digest): Check for integer overflow in algorithm selection.
* Fix the MS-Windows build due to added GnuTLS functionsEli Zaretskii2017-07-143-3/+123
| | | | | | | | | | | | | | | | * src/gnutls.c [WINDOWSNT]: Add DEF_DLL_FN for new functions. (init_gnutls_functions) [WINDOWSNT]: Add LOAD_DLL_FN for new functions. Add #define redirections for new functions. (gnutls_symmetric_aead): Fix format specs to be more portable when printing ptrdiff_t arguments. * src/fns.c (gnutls_rnd) [WINDOWSNT]: Redirect to w32_gnutls_rnd wrapper. * src/gnutls.h [WINDOWSNT]: Add prototype for w32_gnutls_rnd. * test/lisp/net/gnutls-tests.el (gnutls-tests-tested-macs) (gnutls-tests-tested-digests, gnutls-tests-tested-ciphers): Call gnutls-available-p, otherwise GnuTLS functions might not be loaded from the DLL on MS-Windows.
* GnuTLS HMAC and symmetric cipher supportTed Zlatanov2017-07-144-29/+786
| | | | | | | | | | | | | | | | | | | | | | | | | | * etc/NEWS: Add news for new feature. * doc/lispref/text.texi (GnuTLS Cryptography): Add documentation. * configure.ac: Add macros HAVE_GNUTLS3_DIGEST, HAVE_GNUTLS3_CIPHER, HAVE_GNUTLS3_AEAD, HAVE_GNUTLS3_HMAC. * src/fns.c (Fsecure_hash_algorithms): Add function to list supported `secure-hash' algorithms. (extract_data_from_object): Add data extraction function that can operate on buffers and strings. (secure_hash): Use it. (Fsecure_hash): Mention `secure-hash-algorithms'. * src/gnutls.h: Include gnutls/crypto.h. * src/gnutls.c (Fgnutls_ciphers, gnutls_symmetric_aead) (gnutls_symmetric, Fgnutls_symmetric_encrypt, Fgnutls_symmetric_decrypt) (Fgnutls_macs, Fgnutls_digests, Fgnutls_hash_mac, Fgnutls_hash_digest) (Fgnutls_available_p): Implement GnuTLS cryptographic integration. * test/lisp/net/gnutls-tests.el: Add tests.
* Improve stack-overflow heuristic on GNU/LinuxPaul Eggert2017-07-147-17/+18
| | | | | | | | | | | | | | Problem reported by Steve Kemp (Bug#27585). * src/eval.c (near_C_stack_top): Remove. All uses replaced by current_thread->stack_top. (record_in_backtrace): Set current_thread->stack_top. This is for when the Lisp interpreter calls itself. * src/lread.c (read1): Set current_thread->stack_top. This is for recursive s-expression reads. * src/print.c (print_object): Set current_thread->stack_top. This is for recursive s-expression printing. * src/thread.c (mark_one_thread): Get stack top first. * src/thread.h (struct thread_state.stack_top): Now void *, not char *.
* Add assertion related to display-line-numbersEli Zaretskii2017-07-141-0/+2
| | | | | | * src/xdisp.c (maybe_produce_line_number): Add assertion for the condition regarding IT->glyph_row->used[TEXT_AREA] expected by the code. (Bug#27668)
* Prevent display corruption when display-line-numbers is setEli Zaretskii2017-07-141-3/+3
| | | | | | | | * src/xdisp.c (try_window_reusing_current_matrix): If giving up due to display-line-numbers, clear the window's desired glyph matrix before returning, as the following call to try_window will call display_line, which expects rows of the desired matrix cleared. (Bug#27668)