Michael Albinus [Wed, 10 Jul 2013 14:58:26 +0000 (16:58 +0200)]
Improve error messages. (Bug#14808)
* net/tramp.el (tramp-current-connection): New defvar, moved from
tramp-sh.el.
(tramp-message-show-progress-reporter-message): Removed, not
needed anymore.
(tramp-error-with-buffer): Show message in minibuffer. Discard
input before waiting. Reset connection timestamp.
(with-tramp-progress-reporter): Improve messages.
(tramp-process-actions): Use progress reporter. Delete process in
case of error. Improve messages.
* net/tramp-sh.el (tramp-barf-if-no-shell-prompt): Use
condition-case. Call `tramp-error-with-buffer' with vector and buffer.
(tramp-current-connection): Removed.
(tramp-maybe-open-connection): The car of
`tramp-current-connection' are the first 3 slots of the vector.
Paul Eggert [Wed, 10 Jul 2013 06:26:23 +0000 (23:26 -0700)]
Timestamp fixes for undo.
* doc/lispref/text.texi (Undo):
Document (t . 0) and (t . -1) in buffer-undo-list.
* etc/NEWS: Changes to visited-file-modtime, set-visited-file-modtime.
* lisp/files.el (clear-visited-file-modtime): Move here from fileio.c.
* src/atimer.c (schedule_atimer):
* src/fileio.c (Ffile_newer_than_file_p):
Minor cleanup: use EMACS_TIME_LT so that we can remove EMACS_TIME_GT.
* src/buffer.c (buffer-undo-list): Document (t . 0) and (t . -1).
* src/fileio.c (Fclear_visited_file_modtime): Move to lisp/files.el.
(syms_of_fileio): Remove Sclear_visited_file_name.
(Fvisited_file_modtime): Return -1, not (-1 ...), when the visited
file doesn't exist; this avoids an ambiguity with negative timestamps.
(Fset_visited_file_modtime): Accept -1 and 0 as time-list arg.
* src/systime.h (make_emacs_time, invalid_emacs_time):
Don't assume struct timespec layout; POSIX doesn't guarantee it.
(EMACS_TIME_NE, EMACS_TIME_GT, EMACS_TIME_GE): Remove.
* src/undo.c (record_first_change): Push (visited-file-modtime) onto
undo list rather than reimplementing it by hand, incorrectly.
Paul Eggert [Tue, 9 Jul 2013 17:16:21 +0000 (10:16 -0700)]
Port recent close-on-exec changes to Cygwin.
* lib/binary-io.c, lib/binary-io.h: New files.
Merge from gnulib, incorporating:
2013-07-09 accept4, dup3, pipe2: port to Cygwin
* lib/pipe2.c: Update from gnulib, as part of this merge.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
Paul Eggert [Tue, 9 Jul 2013 07:04:48 +0000 (00:04 -0700)]
Handle errno and exit status a bit more carefully.
* lib/ignore-value.h: Remove this gnulib-imported file.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* admin/merge-gnulib (GNULIB_MODULES): Remove ignore-value.
* src/callproc.c (child_setup) [!DOS_NT]: Don't try to stuff an error
number into an exit status. Instead, use EXIT_CANCELED.
(child_setup) [!MSDOS]: Avoid possible deadlock with vfork.
* src/callproc.c (relocate_fd):
* src/emacs.c (close_output_streams, main):
* src/process.c (create_process):
* src/sysdep.c (sys_subshell) [!DOS_NT || !WINDOWSNT]:
Use emacs_perror for simplicity.
* src/callproc.c (relocate_fd, main):
* src/sysdep.c (sys_subshell):
Exit with EXIT_CANCELED etc., not 1, when exec setup fails.
(shut_down_emacs): Use emacs_write, not write.
* src/emacs.c, src/sysdep.c: Don't include <ignore-value.h>.
* src/fileio.c (Fcopy_file, e_write):
* src/nsterm.m (ns_select):
* src/process.c (send_process):
* src/sound.c (vox_write):
Use emacs_write_sig, not emacs_write.
* src/lisp.h (emacs_write_sig, emacs_perror): New decls.
* src/process.h (EXIT_CANCELED), EXIT_CANNOT_INVOKE, EXIT_ENOENT):
New constants.
* src/sysdep.c (emacs_backtrace): Use emacs_write, not ignore_value
of write.
(emacs_full_write): New function.
(emacs_write): Rewrite to use it.
(emacswrite_sig, emacs_perror): New functions.
* src/xrdb.c (fatal): Don't invoke perror, since errno might be garbage.
Stefan Monnier [Mon, 8 Jul 2013 21:54:54 +0000 (17:54 -0400)]
* lisp/emacs-lisp/pcase.el (pcase--split-pred): Add `vars' argument to try
and detect when a guard/pred depends on local vars.
(pcase--u1): Adjust caller.
Jan Djärv [Mon, 8 Jul 2013 13:26:13 +0000 (15:26 +0200)]
configure.ac (HAVE_IMAGEMAGICK): Check on NS also.
image.c (imagemagick_load_image): Do not use MagickExportImagePixels
on NS even if it is present. Pixmap on NS is a void*.
Paul Eggert [Sun, 7 Jul 2013 23:22:43 +0000 (16:22 -0700)]
Port to Ubuntu 10.
Problem reported by T.V. Raman.
* configure.ac (accept4): New function to check for.
* src/process.c (close_on_exec, accept4, process_socket):
Define these if !HAVE_ACCEPT4, not if !SOCK_CLOEXEC.
Michael Kifer [Sun, 7 Jul 2013 19:35:54 +0000 (15:35 -0400)]
* faces.el (tty-run-terminal-initialization): function changed (Stefan
Monnier's patch).
* viper.el (viper-emacs-state-mode-list): add egg-status-buffer-mode.
(viper-version): version update.
(viper-go-away,viper-setup-hooks): function changed (Stefan Monnier's
patch).
(viper--lookup-key,viper-catch-tty-ESC,viper-uncatch-tty-ESC,
viper-setup-ESC-to-escape): new functions (Stefan Monnier's
patch).
* viper-cmd.el: (viper-del-forward-char-in-insert): new function.
(viper-save-kill-buffer): check if buffer is modified.
(viper-envelop-ESC-key): function deleted (Stefan Monnier's patch).
(viper-intercept-ESC-key): function changed (Stefan Monnier's patch).
* ediff.el (ediff-files-command,ediff3-files-command): new functions.
(ediff-merge-command,ediff-merge-with-ancestor-command): new functions.
(ediff-directories-command,ediff-directories3-command): new functions.
(ediff-merge-directories-command): new function.
(ediff-merge-directories-with-ancestor-command): new function.
All the above are command-line interfaces to ediff: facilitate calling
Emacs with the appropriate ediff functions invoked.
(ediff-version): version update.
Paul Eggert [Sun, 7 Jul 2013 18:00:14 +0000 (11:00 -0700)]
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.
Eli Zaretskii [Sun, 7 Jul 2013 15:49:03 +0000 (18:49 +0300)]
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-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).
* 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'.
Jan Djärv [Sat, 6 Jul 2013 17:58:41 +0000 (19:58 +0200)]
* 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.
Martin Rudalics [Sat, 6 Jul 2013 14:24:54 +0000 (16:24 +0200)]
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.
David Kastrup [Sat, 6 Jul 2013 12:49:38 +0000 (12:49 +0000)]
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
Leo Liu [Sat, 6 Jul 2013 12:37:12 +0000 (20:37 +0800)]
* 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.
Eli Zaretskii [Sat, 6 Jul 2013 10:41:38 +0000 (13:41 +0300)]
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.
Michael Albinus [Fri, 5 Jul 2013 14:06:14 +0000 (16:06 +0200)]
* 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'.
Stephen Berman [Fri, 5 Jul 2013 14:03:35 +0000 (16:03 +0200)]
* 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.
Michael Albinus [Fri, 5 Jul 2013 13:34:01 +0000 (15:34 +0200)]
* 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.
Paul Eggert [Thu, 4 Jul 2013 15:25:54 +0000 (08:25 -0700)]
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.
Michael Albinus [Thu, 4 Jul 2013 09:29:28 +0000 (11:29 +0200)]
* 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.
Paul Eggert [Thu, 4 Jul 2013 06:20:55 +0000 (23:20 -0700)]
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.
* lisp/buff-menu.el (Buffer-menu-mode-map): Bind "M-s a C-o" to
`Buffer-menu-multi-occur'. Add it to the menu.
(Buffer-menu-mode): Document it in docstring.
(Buffer-menu-multi-occur): New command.