aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix recently-introduced file descriptor leakPaul Eggert2017-08-181-0/+4
| | | | | * src/fileio.c (Fmake_temp_file_internal): Don’t leak a file descriptor if write_region signals an error.
* Improve make-temp-file performance on local filesPaul Eggert2017-08-182-7/+17
| | | | | | | * lisp/files.el (make-temp-file): Let make-temp-file-internal do the work of inserting the text. * src/fileio.c (Fmake_temp_file_internal): New arg TEXT. All callers changed.
* Implement HiDPI support for underwave on MS-WindowsEli Zaretskii2017-08-182-4/+24
| | | | | | | * src/w32term.c (x_get_scale_factor): New function. (w32_draw_underwave): Use it. * src/xterm.c (x_draw_underwave): Offset the wave starting point to make it identical with original code.
* Support HiDPI displays for wave style underlinesStephen Pegoraro2017-08-181-5/+25
| | | | | | | | * src/xterm.c (x_draw_underwave): Compute height, length and thickness based on scale factor. (x_get_scale_factor): New function. Copyright-paperwork-exempt: yes
* Support Posix semantics of 'rename' on MS-WindowsEli Zaretskii2017-08-171-6/+34
| | | | | | * src/w32.c (sys_rename_replace): Support Posix semantics of 'rename': return an error if OLD is a directory while NEW is not, or vice versa.
* * src/w32.c (sys_rename_replace): Support renaming a directory.Eli Zaretskii2017-08-171-6/+16
|
* Merge from Gnulib; use ‘open’ for O_CLOEXECPaul Eggert2017-08-162-11/+1
| | | | | | | | | | | | | | | | | | | | | | This incorporates: 2017-08-15 renameat: ensure declaration in <stdio.h> on NetBSD 2017-08-15 extensions: enable NetBSD specific extensions 2017-08-14 open: support O_CLOEXEC 2017-08-13 reallocarray: new module * admin/merge-gnulib (AVOIDED_MODULES): Remove ‘open’, since it now supports O_CLOEXEC and this simplifies Emacs. * build-aux/config.guess, lib/fcntl.in.h, lib/stdio.in.h: * lib/stdlib.in.h, m4/extensions.m4, m4/stdlib_h.m4: Copy from Gnulib. * lib/cloexec.c, lib/cloexec.h, lib/open.c: * m4/mode_t.m4, m4/open-cloexec.m4, m4/open.m4: New files, copied from Gnulib. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. * lib-src/etags.c (O_CLOEXEC) [WINDOWSNT]: Remove, as Gnulib does this for us. * src/filelock.c (create_lock_file): * src/sysdep.c (emacs_open, emacs_pipe): Don’t worry about O_CLOEXEC == 0, as Gnulib no longer sets it to 0.
* Allow use of run-time OS version checks on macOS (bug#27810)Alan Third2017-08-165-138/+211
| | | | | | | | | | | | | | | | | | | | | | * src/nsterm.h (NSWindowTabbingMode): Define in pre-Sierra macOS. (MAC_OS_X_VERSION_10_6, MAC_OS_X_VERSION_10_7, MAC_OS_X_VERSION_10_8, MAC_OS_X_VERSION_10_9, MAC_OS_X_VERSION_10_12, HAVE_NATIVE_FS): Remove defines. (NSWindowStyleMaskFullScreen, NSWindowCollectionBehaviorFullScreenPrimary, NSApplicationPresentationFullScreen, NSApplicationPresentationAutoHideToolbar): Define in macOS 10.6. * src/nsterm.m (colorForEmacsRed, colorUsingDefaultColorSpace, check_native_fs, ns_read_socket, ns_select, runAlertPanel, initFrameFromEmacs, windowDidMiniaturize, windowDidEnterFullScreen, windowDidExitFullScreen, isFullscreen, updateCollectionBehavior, toggleFullScreen, constrainFrameRect, scrollerWidth, syms_of_nsterm): Allow use of run-time checks and replace version check macros. * src/nsfns.m (ns_screen_name): Use run-time OS version checks. * src/macfont.m (macfont_draw): Use run-time OS version checks. * src/nsmenu.m (menuWillOpen): Use run-time OS version checks. Co-authored-by: Charles A. Roelli <charles@aurox.ch>
* Add multiframe image support to NS port (bug#21714)Alan Third2017-08-162-0/+62
| | | | | | | * src/nsimage.m (ns_load_image): Handle multiple frames. (EmacsImage::getMetadata, EmacsImage::setFrame): New functions. * src/nsterm.h (EmacsImage::getMetadata, EmacsImage::setFrame): New function prototypes.
* Fix the MS-Windows buildEli Zaretskii2017-08-151-1/+4
| | | | | * src/fileio.c (Frename_file): Don't use ENOTSUP if it is equal to ENOSYS. (Bug#28097) (Bug#27986)
* Improve rename-file port to macOSPaul Eggert2017-08-141-1/+1
| | | | | | * src/fileio.c (Frename_file): On macOS, renameat_noreplace can fail with errno == ENOTSUP on file systems where it is not supported, according to the Apple documentation.
* Improve rename-file behavior on macOSPaul Eggert2017-08-142-2/+6
| | | | | | | | Problem reported by Philipp Stephani (Bug#27986). * src/fileio.c (Frename_file): Worry about file name case sensitivity only if CYGWIN or DOS_NT. * src/sysdep.c (renameat_noreplace): Use renameatx_np on macOS, since this provides the necessary atomicity guarantees.
* Implement renameat_noreplace for MS-WindowsEli Zaretskii2017-08-141-0/+4
| | | | | * src/sysdep.c (renameat_noreplace) [WINDOWSNT]: Implement minimal emulation for MS-Windows. (Bug#27986)
* Fix 'rename' on MS-WindowsEli Zaretskii2017-08-141-4/+4
| | | | | * src/w32.c (sys_rename_replace): Use the FORCE argument only if the primitive rename errors out with EEXIST.
* Fix vertical cursor motion across too wide imagesEli Zaretskii2017-08-131-2/+2
| | | | | | * src/indent.c (Fvertical_motion): If lines are truncated and we end up beyond the right margin of the window, don't assume we are in the next screen line, unless VPOS actually says so. (Bug#28071)
* Fix make-temp-file bug with ""/"."/".." prefixPaul Eggert2017-08-121-5/+4
| | | | | | | | | | | | | | | | | The bug with "." and ".." has been present for a while; I introduced the bug with "" earlier today in my patch for Bug#28023. * lisp/files.el (make-temp-file): Do not use expand-file-name if PREFIX is empty or "." or "..", as it does the wrong thing. Compute absolute-prefix here ... (files--make-magic-temp-file): ... instead of here ... * src/fileio.c (Fmake_temp_file_internal): ... or here. * lisp/files.el (make-temp-file): If the prefix is empty, append "/" to the absolute prefix so that the new files are children rather than siblings of temporary-file-directory. This fixes a bug introduced in the previous change. * test/lisp/files-tests.el (files-test-make-temp-file-empty-prefix): New test, for the bug.
* Improve make-temp-file performance on local filesPaul Eggert2017-08-124-135/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | For the motivation behind this patch, please see Bug#28023 and: http://emacshorrors.com/posts/make-temp-name.html Although, given the recent changes to Tramp, the related security problem in make-temp-file is already fixed, make-temp-file still has several unnecessary system calls. In the typical case on GNU/Linux, this patch replaces 8 syscalls (symlink, open, close, readlinkat, uname, getpid, unlink, umask) by 2 (open, close). * admin/merge-gnulib (GNULIB_MODULES): Add tempname, now that Emacs is using it directly. * configure.ac (AUTO_DEPEND): Remove AC_SYS_LONG_FILE_NAMES; no longer needed. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. * lisp/files.el (files--make-magic-temp-file): Rename from make-temp-file. (make-temp-file): Use make-temp-file-internal for non-magic file names. * src/fileio.c: Include tempname.h. (make_temp_name_tbl, make_temp_name_count) (make_temp_name_count_initialized_p, make_temp_name): Remove. (Fmake_temp_file_internal): New function. (Fmake_temp_name): Use it. * src/filelock.c (get_boot_time): Use Fmake_temp_file_internal instead of make_temp_name.
* Fix completion on directory names on MS-DOS/MS-WindowsEli Zaretskii2017-08-122-4/+32
| | | | | | | * src/msdos.c (faccessat): * src/w32.c (faccessat): Support relative file names, and add D_OK to 'mode' if the argument is a directory. This unbreaks file-name completion when the completion result is a directory.
* Implement EXCL of write-region for TrampMichael Albinus2017-08-123-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | * lisp/net/ange-ftp.el (ange-ftp-write-region): * lisp/net/tramp-adb.el (tramp-adb-handle-write-region) * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-write-region): * lisp/net/tramp-sh.el (tramp-sh-handle-write-region) * lisp/net/tramp-smb.el (tramp-smb-handle-write-region): Implement MUSTBENEW. * lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file) * lisp/net/tramp-sh.el (tramp-sh-handle-make-symbolic-link) (tramp-sh-handle-add-name-to-file) (tramp-do-copy-or-rename-file) * lisp/net/tramp-smb.el (tramp-smb-handle-make-symbolic-link): Adapt error message for `file-already-exists'. * src/lisp.h: * src/eval.c (call8): New function. * src/fileio.c (write_region): Pass also lockname and mustbenew to the file name handler. * test/lisp/net/tramp-tests.el (tramp-test10-write-region): Add tests for MUSTBENEW.
* Use Gnulib 'tempname' on MS-WindowsEli Zaretskii2017-08-122-61/+1
| | | | | | | | | | | | | | | | | | | * lib-src/ntlib.h (mkdir, open): Remove redefinitions. They are now in nt/inc/ms-w32.h. * lib-src/ntlib.c (sys_mkdir, sys_open): New functions. (mkostemp): Remove. * src/w32.c (mkostemp): Remove. (sys_mkdir): Accept a second (unused) argument. * src/fileio.c (Fmake_directory_internal): Remove the WINDOWSNT specific call to mkdir. (Bug#28023) * nt/inc/ms-w32.h (mkdir): Remove from "#ifdef emacs" and redefine to accept 2 arguments. (open): Remove from "#ifdef emacs". * nt/mingw-cfg.site (ac_cv_func_mkostemp): Remove. * nt/gnulib-cfg.mk (OMIT_GNULIB_MODULE_mkostemp) (OMIT_GNULIB_MODULE_tempname): Remove.
* Improve performance for rename-file etc.Paul Eggert2017-08-111-61/+66
| | | | | | | | | | | | | | | | Although this does not fix Bug#27986, it is a step forward. I plan to propose a more-significant patch later. * lisp/files.el (directory-name-p): Move from here ... * src/fileio.c (Fdirectory_name_p): ... to here. (directory_like, cp_like_target): New static functions. (Fcopy_file, Frename_file, Fadd_name_to_file) (Fmake_symbolic_link): Use them, to avoid directory-testing syscalls on file names that must be directories if they exist. Omit unnecessary initializations and CHECK_STRING calls. (Frename_file): Don't call file_name_case_insensitive_p twice on the same file. Compare both file names expanded, instead of the old name expanded and the new one unexpanded.
* Fix crashing emacs-module tests on MS-WindowsEli Zaretskii2017-08-091-0/+8
| | | | | | | | | | | | * src/w32fns.c (syms_of_w32fns) <w32-disable-abort-dialog>: New variable. (emacs_abort): If w32-disable-abort-dialog is non-nil, abort right away, without displaying the Abort dialog, which waits for the user. * test/src/emacs-module-tests.el (module--test-assertion): Run the inferior Emacs with the w32 abort dialog disabled. Expect the status of the aborted Emacs sub-process to be 3 on MS-Windows and 2 on MS-DOS.
* Document make-temp-name magic limitationsPaul Eggert2017-08-081-1/+2
| | | | | | * doc/lispref/files.texi (Unique File Names): * src/fileio.c (Fmake_temp_name): Document that make-temp-name does not guarantee uniqueness on magic file names.
* Let `define-symbol-prop' take effect during compilationStefan Monnier2017-08-071-0/+11
| | | | | | | | | | | | * src/fns.c (syms_of_fns): New variable `overriding-plist-environment'. (Fget): Consult it. * lisp/emacs-lisp/bytecomp.el (byte-compile-close-variables): Let-bind it to nil. (byte-compile-define-symbol-prop): New function, handles compilation of top-level `define-symbol-prop' and `function-put' calls by putting the symbol setting into `overriding-plist-environment'. Co-authored-by: Noam Postavsky <npostavs@gmail.com>
* 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.