1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-23 07:19:15 +00:00
Commit Graph

111918 Commits

Author SHA1 Message Date
Paul Eggert
067428c171 Make file descriptors close-on-exec when possible.
This simplifies Emacs a bit, since it no longer needs to worry
about closing file descriptors by hand in some cases.
It also fixes some unlikely races.  Not all such races, as
libraries often open files internally without setting
close-on-exec, but it's an improvement.
* admin/merge-gnulib (GNULIB_MODULES): Add fcntl, pipe2.
(GNULIB_TOOL_FLAGS): Avoid binary-io, close.  Do not avoid fcntl.
* configure.ac (mkostemp): New function to check for.
(PTY_OPEN): Pass O_CLOEXEC to posix_openpt.
* lib/fcntl.c, lib/getdtablesize.c, lib/pipe2.c, m4/fcntl.m4:
* m4/getdtablesize.m4, m4/pipe2.m4: New files, taken from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* nt/gnulib.mk: Remove empty gl_GNULIB_ENABLED_verify section;
otherwise, gnulib-tool complains given close-on-exec changes.
* nt/inc/ms-w32.h (pipe): Remove.
* nt/mingw-cfg.site (ac_cv_func_fcntl, gl_cv_func_fcntl_f_dupfd_cloexec)
(gl_cv_func_fcntl_f_dupfd_works, ac_cv_func_pipe2): New vars.
* src/alloc.c (valid_pointer_p) [!WINDOWSNT]:
* src/callproc.c (Fcall_process) [!MSDOS]:
* src/emacs.c (main) [!DOS_NT]:
* src/nsterm.m (ns_term_init):
* src/process.c (create_process):
Use 'pipe2' with O_CLOEXEC instead of 'pipe'.
* src/emacs.c (Fcall_process_region) [HAVE_MKOSTEMP]:
* src/filelock.c (create_lock_file) [HAVE_MKOSTEMP]:
Prefer mkostemp with O_CLOEXEC to mkstemp.
* src/callproc.c (relocate_fd) [!WINDOWSNT]:
* src/emacs.c (main): Use F_DUPFD_CLOEXEC, not plain F_DUPFD.
No need to use fcntl (..., F_SETFD, FD_CLOEXEC), since we're
now using pipe2.
* src/filelock.c (create_lock_file) [! HAVE_MKOSTEMP]:
Make the resulting file descriptor close-on-exec.
* src/lisp.h, src/lread.c, src/process.c (close_load_descs, close_process_descs):
* src/lread.c (load_descriptor_list, load_descriptor_unwind):
Remove; no longer needed.  All uses removed.
* src/process.c (SOCK_CLOEXEC): Define to 0 if not supplied by system.
(close_on_exec, accept4, process_socket) [!SOCK_CLOEXEC]:
New functions.
(socket) [!SOCK_CLOEXEC]: Supply a substitute.
(Fmake_network_process, Fnetwork_interface_list):
(Fnetwork_interface_info, server_accept_connection):
Make newly-created socket close-on-exec.
* src/sysdep.c (emacs_open, emacs_fopen):
Make new-created descriptor close-on-exec.
* src/w32.c (fcntl): Support F_DUPFD_CLOEXEC well enough for Emacs.
* src/w32.c, src/w32.h (pipe2): Rename from 'pipe', with new flags arg.

Fixes: debbugs:14803
2013-07-07 11:00:14 -07:00
Eli Zaretskii
9aff9b3864 Improve scrolling of windows whose font is different from frame's default.
lisp/simple.el (default-font-height, window-screen-lines): New
 functions.
 (line-move, line-move-partial): Use them instead of
 frame-char-height and window-text-height.  This makes scrolling
 text smoother when the buffer's default face uses a font that is
 different from the frame's default font.
2013-07-07 18:49:03 +03:00
Jan Djärv
0da857ddac *** empty log message *** 2013-07-07 10:41:09 +02:00
Paul Eggert
5f86adcd2c Fix openp errno handling.
* callproc.c (Fcall_process): Preserve openp errno around close.
* lread.c (openp): Set errno when returning -1, as some callers
expect this.
2013-07-07 00:28:29 -07:00
Gnus developers
6ed7a66a3f Merge changes made in Gnus master
2013-07-06 Lars Ingebrigtsen <larsi@gnus.org>
* gnus.texi (Group Parameters): Mention regexp
  substitutions (bug#11688).

2013-07-06 Nathan Trapuzzano <nbtrap@nbtrap.com> (tiny change)
* gnus.texi (Generic Marking Commands): Fix grammar (bug#13368).

2013-07-06 Lars Ingebrigtsen <larsi@gnus.org>
* gnus.texi (Emacsen): Fix version.
* gnus-faq.texi (FAQ 1-6): Mention the correct Emacs version.

2013-07-06 Lars Ingebrigtsen <larsi@gnus.org>
* gnus-art.el (gnus-block-private-groups): Allow `global' methods to
  display images.
* gnus.el (gnus-valid-select-methods): Mark nnrss as global.
* message.el (message-cancel-news): According to
  <mailman.216.1372942181.12400.help-gnu-emacs@gnu.org>, "cancel" is
  preferred over "cmsg cancel" in the Subject.
* nnir.el (nnir-engines): Note that the group specs are regexps
  (bug#13238).
* gnus-msg.el (gnus-copy-article-buffer): If the article buffer has
  gotten read-only text properties, ensure that those aren't heeded when
  copying stuff over (bug#13434).
* mm-view.el (mm-inline-text-html): Don't bug out on multipart messages
  (bug#13762).
2013-07-06 23:40:56 +00:00
Glenn Morris
219afb88d9 * etc/NEWS: Tweak +++/--- description 2013-07-06 12:17:22 -07:00
Glenn Morris
c7197e5231 * admin.el (make-manuals): Add the option to only make certain output types.
(manual-misc-html): Special-case ccmode and efaq.
(manual-html-mono, manual-html-node, manual-pdf, manual-ps):
Move creation of output directory here from make-manuals.
(manual-html-fix-index-2): Avoid dynamic reference to `f'.
2013-07-06 11:28:54 -07:00
Jan Djärv
1afb1d0715 * lisp/files.el (write-file): Do not display confirm dialog for NS,
it does its own dialog, which can't be cancelled.

* src/nsfns.m: Remove panelOK.
(ns_fd_data): New.
(ns_run_file_dialog): New function.
(Fns_read_file_name): Fill in ns_fd_data, post an event and start the
event loop, so file dialog is popped up by ns_run_file_dialog, called
by sendEvent (Bug#14578).
(EmacsSavePanel, EmacsOpenPanel): Remove ok and cancel methods.

* src/nsterm.h (NSSavePanel): Update comment.
(NSAPP_DATA2_RUNFILEDIALOG): Define.
(ns_run_file_dialog): Declare.

* src/nsterm.m (sendEvent:): Handle NSAPP_DATA2_RUNFILEDIALOG.
2013-07-06 19:58:41 +02:00
Eli Zaretskii
23de972aa7 Fix vertical cursor motion with non-default fonts.
lisp/simple.el (line-move-partial): Adjust the row returned by
 posn-at-point for the current window-vscroll.  (Bug#14567)
2013-07-06 20:38:24 +03:00
Michael Albinus
54a4248627 * net/tramp-sh.el (tramp-sh-file-gvfs-monitor-dir-process-filter):
(tramp-sh-file-inotifywait-process-filter): Handle file names with spaces.
2013-07-06 18:17:16 +02:00
Michael Albinus
47bd930132 Add TODO entry. 2013-07-06 18:12:04 +02:00
Martin Rudalics
34ada5f476 lisp/window.el (window-state-put): Remove window if buffer was not restored.
(window-state-put-stale-windows): New variable.
(window--state-put-2): Save list of windows without matching buffer.
(window-state-put): Remove "bufferless" windows if possible.
2013-07-06 16:24:54 +02:00
Juanma Barranquero
11e03d8900 lisp/simple.el (alternatives-define): Remove leftover :group keyword.
Tweak docstring.
2013-07-06 15:31:59 +02:00
David Kastrup
fa7f427c32 lisp/gnus/auth-source.el (auth-source-netrc-parse-one): Allow empty strings in authinfo file again (important for blank passwords). This had been broken with 2013-06-15 change 2013-07-06 12:49:38 +00:00
Leo Liu
3504a4beb8 * ido.el (ido-use-virtual-buffers): Allow new value 'auto.
(ido-enable-virtual-buffers): New variable.
(ido-buffer-internal, ido-toggle-virtual-buffers)
(ido-make-buffer-list): Use it.
(ido-exhibit): Support turning on and off virtual buffers
automatically.
2013-07-06 20:37:12 +08:00
Eli Zaretskii
fdda022055 Fix bug #14771 with scroll-step = 1 and non-nil line-spacing.
src/xdisp.c (default_line_pixel_height): New function.
 (pos_visible_p, move_it_vertically_backward, try_scrolling)
 (try_cursor_movement, redisplay_window, try_window)
 (try_window_id): Use it instead of FRAME_LINE_HEIGHT.  (Bug#14771)
 src/window.c (window_scroll_pixel_based): use
 default_line_pixel_height.
 src/dispextern.h (default_line_pixel_height): Add prototype.
 src/frame.c (x_set_line_spacing): Accept a float value for
 line-spacing parameter, per the documentation.
2013-07-06 13:41:38 +03:00
Juanma Barranquero
88c45e34b6 etc/NEWS: Fix typos. 2013-07-06 11:37:29 +02:00
Juanma Barranquero
61e56e2c8a lisp/simple.el (alternatives-define): New macro.
etc/NEWS: Document new "generic commands" support.
2013-07-06 11:35:37 +02:00
Eli Zaretskii
3323c263c7 Clarify documentation of multibyte-string-p.
src/data.c (Fmultibyte_string_p): Doc fix.

 doc/lispref/nonascii.texi (Text Representations): Document that
 multibyte-string-p returns nil for non-string objects.
2013-07-06 11:05:21 +03:00
Paul Eggert
406af475be Use emacs_open more consistently when opening files.
This handles EINTR more consistently now, and makes it easier
to introduce other uniform changes to file descriptor handling.
* src/systdio.h: New file.
* src/buffer.c (mmap_init):
* cygw32.c (chdir_to_default_directory):
* dispnew.c (Fopen_termscript):
* emacs.c (Fdaemon_initialized):
* fileio.c (Fdo_auto_save):
* image.c (slurp_file, png_load_body, jpeg_load_body):
* keyboard.c (Fopen_dribble_file):
* lread.c (Fload):
* print.c (Fredirect_debugging_output):
* sysdep.c (get_up_time, procfs_ttyname, procfs_get_total_memory):
* termcap.c (tgetent):
* unexaix.c, unexcoff.c (unexec, adjust_lnnoptrs):
* unexcw.c, unexelf.c, unexhp9k800.c, unexmacosx.c (unexec):
* w32term.c (w32_initialize) [CYGWIN]:
* xfaces.c (Fx_load_color_file):
Use emacs_open instead of plain open, and emacs_fopen instead of
plain fopen.
* dispnew.c, fileio.c, image.c, keyboard.c, lread.c, print.c, sysdep.c:
* xfaces.c: Include sysstdio.h rather than stdio.h, for emacs_fopen.
* callproc.c (default_output_mode): New constant.
(Fcall_process): Use it to call emacs_open instead of plain creat.
* dispnew.c (Fopen_termscript): Fix minor race in opening termscript.
* sysdep.c (emacs_open): Add commentary and don't call file name "path".
(emacs_fopen): New function.
* unexaix.c, unexcoff.c, unexelf.c, unexhp9k800.c, unexmacosx.c:
Include <lisp.h>, for emacs_open.
* unexelf.c (fatal): Remove decl; not needed with <lisp.h> included.
2013-07-05 19:40:50 -07:00
Glenn Morris
0773c61068 * admin/admin.el (make-manuals): Avoid hard-coding list of misc manuals.
(manual-misc-manuals): New function.
2013-07-05 19:32:13 -07:00
Glenn Morris
4431e6d9b3 Merge from emacs-24; up to 2012-12-30T19:34:25Z!jan.h.d@swipnet.se 2013-07-05 18:39:21 -07:00
Glenn Morris
3cab18a379 * mh-e.texi (Using This Manual): Printed elisp manuals no longer available. 2013-07-05 18:19:46 -07:00
Glenn Morris
7d622d4cfb * doc/misc/mh-e.texi (Using This Manual): Refer to shop.fsf.org. 2013-07-05 18:17:50 -07:00
Glenn Morris
5154917ed9 * doc/misc/mh-e.texi: Fix external links. 2013-07-05 18:05:20 -07:00
Stefan Monnier
321e1a9c42 * lisp/subr.el (read-quoted-char): Use read-key.
(sit-for): Let read-event decode tty input.

Fixes: debbugs:14782
2013-07-05 20:10:54 -04:00
Paul Eggert
47ba6d4383 Remove duplicate #include directives.
* alloc.c [GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES]:
* xfaces.c:
Don't include stdio.h twice.
* buffer.c [USE_MMAP_FOR_BUFFERS]:
Don't include sys/types.h or stdio.h twice.
* fileio.c [WINDOWSNT | MSDOS]: Don't include fcntl.h twice.
* lread.c: Don't include coding.h twice.
* nsfont.m: Don't include frame.h twice.
* process.c [HAVE_RES_INIT]: Don't include <netinet/in.h> twice.
* ralloc.c: Don't include <unistd.h> twice.
* xdisp.c: Don't include font.h twice.
* xterm.c: Don't include fontset.h twice.
* xterm.h [USE_X_TOOLKIT]: Don't include X11/StringDefs.h twice.
2013-07-05 09:58:01 -07:00
Glenn Morris
f114e6c3ca * admin/admin.el (make-manuals): Use a pdf/ subdirectory for pdf versions. 2013-07-05 09:10:47 -07:00
Michael Albinus
c074775889 Fix previous patch. 2013-07-05 17:17:16 +02:00
Michael Albinus
84b6d3df1a * automated/file-notify-tests.el
(file-notify-test-remote-temporary-file-directory): Use
`null-device' on w32.
(file-notify--test-tmpfile, file-notify--test-tmpfile1)
(file-notify--test-results, file-notify--test-event)
(file-notify--deftest-remote, file-notify--event-test)
(file-notify--test-event-handler)
(file-notify--test-make-temp-name): Renamed, in order to mark them
internal.
(tramp-message-show-message, tramp-read-passwd): Tweak them for
better fitting in noninteractive tests.
(file-notify-test00-availability): Renamed from `file-notify-test0'.
(file-notify-test01-add-watch): Renamed from `file-notify-test1'.
Use `temporary-file-directory '.
(file-notify-test01-add-watch-remote): New test.
(file-notify-test02-events): Renamed from `file-notify-test2'.
(file-notify-test02-events-remote): Renamed from `file-notify-test3'.
(file-notify-test03-autorevert): Renamed from
`file-notify-test4'.  Use timeouts.
(file-notify-test03-autorevert-remote): Renamed from
`file-notify-test5'.
2013-07-05 16:06:14 +02:00
Stephen Berman
d610f6dd0f * calendar/todo-mode.el: Add handling of file deletion, both by
mode command and externally.  Fix various related bugs.  Clarify
Commentary and improve some documentation strings and code.
(todo-delete-file): New command.
(todo-check-file): New function.
(todo-show): Handle external deletion of the file we're trying to
show.  Replace called-interactively-p by an optional
prefix argument to avoid problematic interaction with catch form
when byte compiled (bug#14702).
(todo-quit): Handle external deletion of the archive's todo file.
Make sure the buffer that was visiting the archive file is still
live before trying to bury it.
(todo-category-completions): Handle external deletion of any
category completion files.
(todo-jump-to-category, todo-basic-insert-item): Recalculate list
of todo files, in case of external deletion.
(todo-add-file): Replace unnecessary setq by let-binding.
(todo-find-archive): Check whether there are any archives.
Replace unnecessary setq by let-binding.
(todo-archive-done-item): Use find-file-noselect to get the
archive buffer whether or not the archive already exists.  Remove
superfluous code.  Use file size instead of buffer-file-name to
check if the archive is new; if it is, update list of archives.
(todo-default-todo-file): Allow nil to be a valid value for when
there are no todo files.
(todo-reevaluate-default-file-defcustom): Use corrected definition
of todo-default-todo-file.
(todo-key-bindings-t+a+f): Add key binding for todo-delete-file.
(todo-delete-category, todo-show-categories-table)
(todo-category-number): Clarify comment.
(todo-filter-items): Clarify documentation string.
(todo-show-current-file, todo-display-as-todo-file)
(todo-reset-and-enable-done-separator): Tweak documentation string.
(todo-done-separator): Make separator length window-width, since
bug#2749 is now fixed.

Fixes: debbugs:14688
2013-07-05 16:03:35 +02:00
Michael Albinus
ddbdfd6f90 * net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch): Support
both "gvfs-monitor-dir" and "inotifywait".
(tramp-sh-file-inotifywait-process-filter): Renamed from
`tramp-sh-file-notify-process-filter'.
(tramp-sh-file-gvfs-monitor-dir-process-filter)
(tramp-get-remote-gvfs-monitor-dir): New defuns.
2013-07-05 15:34:01 +02:00
Leo Liu
96eb829aa7 * autoinsert.el (auto-insert-alist): Default to lexical-binding. 2013-07-05 10:37:39 +08:00
Glenn Morris
9f1d94c0e6 * admin/admin.el (make-manuals): Use a standard location for lispintro. 2013-07-04 18:35:56 -07:00
Glenn Morris
d4aa7284bc Tweak html header for manuals
* doc/lispintro/emacs-lisp-intro.texi (Top):
Move WWW_GNU_ORG section outside @copying, update URL.

* doc/lispref/elisp.texi (Top): Move WWW_GNU_ORG section outside @copying.

@copying appears as a comment on every page, there is no need for the
WWW_GNU_ORG stuff to be in there.
2013-07-04 18:32:13 -07:00
Paul Eggert
b9ed53d535 Scale ImageMagick images more carefully.
* image.c (scale_image_size) [HAVE_IMAGEMAGICK]: New function.
(compute_image_size): Use it.  Define only if HAVE_IMAGEMAGICK.
Be more careful about avoiding undefined behavior after
integer overflow and division by zero.
2013-07-04 08:25:54 -07:00
YAMAMOTO Mitsuharu
cf13177e99 Add multi-monitor support on W32. 2013-07-04 19:25:54 +09:00
Michael Albinus
46e4f8217a * automated/file-notify-tests.el: New package. 2013-07-04 11:43:17 +02:00
Michael Albinus
f1c7dee92d Add file-notify.el and related changes in Tramp. 2013-07-04 11:40:56 +02:00
Michael Albinus
864c58ca5f * filenotify.el: New package.
* autorevert.el (top): Require filenotify.el.
(auto-revert-notify-enabled): Remove.  Use `file-notify-support'
instead.
(auto-revert-notify-rm-watch, auto-revert-notify-add-watch)
(auto-revert-notify-handler): Use `file-notify-*' functions.

* subr.el (file-notify-handle-event): Move function to filenotify.el.

* net/tramp.el (tramp-file-name-for-operation): Handle
`file-notify-add-watch' and `file-notify-rm-watch'.

* net/tramp-sh.el (tramp-sh-file-name-handler-alist): Add handler
for `file-notify-add-watch' and `file-notify-rm-watch'.
(tramp-process-sentinel): Improve trace.
(tramp-sh-handle-file-notify-add-watch)
(tramp-sh-file-notify-process-filter)
(tramp-sh-handle-file-notify-rm-watch)
(tramp-get-remote-inotifywait): New defuns.
2013-07-04 11:39:36 +02:00
Michael Albinus
86dfb7a815 * fileio.c (Qfile_notify_error): New error symbol.
* gfilenotify.c (Fgfile_add_watch, Fgfile_rm_watch):
* inotify.c (inotify_callback, symbol_to_inotifymask)
(Finotify_add_watch, Finotify_rm_watch): Use it.
(inotifyevent_to_event): Exchange order of cookie and file name.
(Finotify_add_watch): Adapt docstring.

* lisp.h (Qfile_notify_error): Declare.
2013-07-04 11:29:28 +02:00
Paul Eggert
2c1c974b06 Try again to fix FreeBSD bug re multithreaded memory alloc.
* emacs.c (main) [HAVE_PTHREAD && !SYSTEM_MALLOC && !DOUG_LEA_MALLOC]:
Do not clear _malloc_thread_enabled_p, undoing the previous change,
which did not work (see <http://bugs.gnu.org/14569#307>).
(main): Do not invoke malloc_enable_thread if (! CANNOT_DUMP
&& (!noninteractive || initialized)).  This attempts to thread
the needle between the Scylla of FreeBSD and the Charybdis of Cygwin.
2013-07-03 23:20:55 -07:00
Glenn Morris
8b09455e9c * admin/FOR-RELEASE: Add note about linc.py. 2013-07-03 19:30:36 -07:00
Juanma Barranquero
7a35b20f3b src/image: Remove unused variables.
(x_to_xcolors) [HAVE_NTGUI]: Remove unused var `hdc'.
(x_build_heuristic_mask) [HAVE_NTGUI]: Remove unused var `frame_dc'.
2013-07-04 04:08:56 +02:00
Glenn Morris
9d7a25d6ee * doc/misc/newsticker.texi (Overview): Update URL. 2013-07-03 18:55:25 -07:00
Glenn Morris
583873a92e * doc/misc/nxml-mode.texi (Introduction): Update @url. 2013-07-03 18:53:56 -07:00
Glenn Morris
91eea47bd7 * doc/misc/org.texi (JavaScript support): Fix @url. 2013-07-03 18:52:54 -07:00
Glenn Morris
bfd569a4e7 * doc/misc/wisent.texi (Wisent Overview): Remove incorrect, unnecessary uref.
We can use an htaccess redirect to make the previous xref work.
2013-07-03 18:52:12 -07:00
Paul Eggert
1ce5cd04df Try to fix FreeBSD bug re multithreaded memory allocation.
* src/emacs.c (main) [HAVE_PTHREAD && !SYSTEM_MALLOC && !DOUG_LEA_MALLOC]:
Clear _malloc_thread_enabled_p at startup.  Reported by Ashish SHUKLA in
<http://lists.gnu.org/archive/html/emacs-devel/2013-07/msg00088.html>.

Fixes: debbugs:14569
2013-07-03 17:53:13 -07:00
Juri Linkov
96673afeb2 * lisp/buff-menu.el (Buffer-menu-multi-occur): Add args and move the
call of `occur-read-primary-args' to interactive spec.

* lisp/ibuffer.el (ibuffer-mode-map): Bind "M-s a C-o" to
`ibuffer-do-occur' like in buff-menu.el.

Fixes: debbugs:14673
2013-07-04 02:11:58 +03:00