Dmitry Antipov [Tue, 22 Jan 2013 11:41:21 +0000 (15:41 +0400)]
* xdisp.c (mark_window_display_accurate): Simplify the loop
assuming that the only one of vchild, hchild or buffer window
slots is non-nil. Call mark_window_display_accurate_1 for
the leaf windows only.
(mark_window_display_accurate_1): Always assume leaf window.
Adjust comment.
Dmitry Antipov [Mon, 21 Jan 2013 17:01:09 +0000 (21:01 +0400)]
* fileio.c (Finsert_file_contents): Revert code introduced at
2013-01-18 in favor of the simpler and generally better fix.
Save stack space by removing 'buffer' and reusing 'read_buf'
where appropriate.
Michael Albinus [Mon, 21 Jan 2013 09:49:43 +0000 (10:49 +0100)]
Improve XEmacs compatibility.
* net/tramp.el (tramp-replace-environment-variables): Make it a defun.
* net/tramp-adb.el (top): Require `time-date'.
(tramp-adb-ls-output-time-less-p): Use `tramp-time-less-p'.
(tramp-adb-handle-copy-file, tramp-adb-handle-rename-file): Use
`tramp-file-name-handler'.
(tramp-adb-maybe-open-connection): Use
`tramp-compat-set-process-query-on-exit-flag'.
* net/tramp-sh.el (tramp-sh-handle-file-acl): Use
`tramp-compat-funcall'.
* net/tramp-smb.el (tramp-smb-handle-file-acl): Use `looking-at' and
`tramp-compat-funcall'.
Glenn Morris [Sun, 20 Jan 2013 02:39:59 +0000 (18:39 -0800)]
profiler.el tweaks
* profiler.el (profiler-running-p): New function.
(profiler-cpu-profile): Use profiler-running-p.
(profiler-report-mode-map): Add some more menu entries.
Paul Eggert [Sat, 19 Jan 2013 22:12:27 +0000 (14:12 -0800)]
* trouble.texi (Crashing): Suggest -p for recent addrline.
Without it, I don't see function names. Older addrlines will die
out sooner or later, so tailor the suggestion to recent addrline
and put in a comment about older ones.
Eli Zaretskii [Sat, 19 Jan 2013 20:04:33 +0000 (22:04 +0200)]
Fix crashes with lots of overlays.
src/editfns.c (get_pos_property): Use SAFE_ALLOCA_LISP, to avoid
segfault when there are lots of overlays.
src/buffer.c (sort_overlays): Use SAFE_NALLOCA, to avoid segfault
when there are lots of overlays. See
http://lists.gnu.org/archive/html/emacs-devel/2013-01/msg00421.html
for the details and a way to reproduce.
Paul Eggert [Sat, 19 Jan 2013 18:58:40 +0000 (10:58 -0800)]
* fileio.c: Use O_APPEND to append.
This corresponds better to the natural interpretation of "append",
and avoids the need to open the output file twice, or to invoke
lseek when APPEND is neither nil nor a number.
This relies on POSIX 1003.1-1988 or later, which is OK nowadays.
(Fwrite_region): Simplify. Use O_APPEND instead of opening the
file possibly twice, and lseeking to its end; this avoids the
need to lseek on non-regular files. Do not use O_EXCL and O_TRUNC
at the same time: the combination is never needed and apparently
it doesn't work with DOS_NT.
* image-mode.el (image-next-file, image-previous-file): New commands.
(image-mode-map): Bind them to n and p.
(image-mode--images-in-directory): New helper function.
Chong Yidong [Sat, 19 Jan 2013 10:34:07 +0000 (18:34 +0800)]
* image-mode.el (image-mode-fit-frame): Add a frame argument.
Suggested by Drew Adams. Handle window decorations;
save and restore the old window configuration.
Paul Eggert [Sat, 19 Jan 2013 09:59:51 +0000 (01:59 -0800)]
Allow floating-point file offsets.
Problem reported by Vitalie Spinu in
<http://lists.gnu.org/archive/html/emacs-devel/2013-01/msg00411.html>.
* doc/lispref/files.texi (Reading from Files, Writing to Files):
Say that file offsets can be numbers, not just integers.
* src/fileio.c (emacs_lseek): Remove.
(file_offset): New function.
(Finsert_file_contents, Fwrite_region): Use it.
Eli Zaretskii [Sat, 19 Jan 2013 07:13:19 +0000 (09:13 +0200)]
Minor fix in acl_set_file.
src/w32.c (acl_set_file): Treat ERROR_ACCESS_DENIED from
set_file_security as failure due to insufficient privileges.
Reported by Fabrice Popineau <fabrice.popineau@supelec.fr>.
Paul Eggert [Sat, 19 Jan 2013 04:44:34 +0000 (20:44 -0800)]
Work around bug in CIFS and vboxsf file systems.
The bug was observed on Ubuntu operating inside a virtual machine,
editing files mounted via CIFS or vboxsf from the MS Windows 7 host.
The workaround introduces a race condition on non-buggy hosts,
but it's an unlikely race and anyway there's a nearly identical
nearby race that can't be fixed.
* fileio.c (valid_timestamp_file_system, timestamp_file_system):
New static vars.
(Fwrite_region): Test for file system time stamp bug.
(init_fileio): New function.
* lisp.h (init_fileio): Declare it.
* emacs.c (main): Call it.
Dmitry Antipov [Fri, 18 Jan 2013 06:32:12 +0000 (10:32 +0400)]
Fix crash when inserting data from non-regular files. See
http://lists.gnu.org/archive/html/emacs-devel/2013-01/msg00406.html
for the error description produced by valgrind.
* fileio.c (read_non_regular): Rename to read_contents.
Free Lisp_Save_Value object used to pass parameters.
(read_non_regular_quit): Rename to read_contents_quit.
(Finsert_file_contents): Redesign internal file reading loop to adjust
gap and end positions after each read and so help make_gap to work
properly. Do not signal an I/O error too early and so do not leave
not yet decoded characters in a buffer, which was the reason of
redisplay crash. Use list2 to build return value. Adjust comments.
Paul Eggert [Fri, 18 Jan 2013 05:12:08 +0000 (21:12 -0800)]
Close a race when statting and reading files.
* fileio.c (Finsert_file_contents): Use open+fstat, not stat+open.
This avoids a race if the file is renamed between stat and open.
This race is not the problem originally noted in Bug#13149;
see <http://bugs.gnu.org/13149#73> and later messages in the thread.
Michael Albinus [Thu, 17 Jan 2013 09:06:47 +0000 (10:06 +0100)]
* autorevert.el (auto-revert-use-notify): In the :set function, do
not modify `kill-buffer-hook'.
(auto-revert-notify-rm-watch): Remove
`auto-revert-notify-rm-watch' from `kill-buffer-hook'.
(auto-revert-notify-add-watch): Do not call
`auto-revert-notify-rm-watch', but add it to a buffer local
`kill-buffer-hook'.
Dmitry Antipov [Thu, 17 Jan 2013 06:29:40 +0000 (10:29 +0400)]
* lisp.h (toplevel): Add comment about using Lisp_Save_Value
objects, related functions and macros.
(make_save_value): Adjust prototype.
(make_save_pointer): New prototype.
(SAFE_NALLOCA): Fix indentation. Use make_save_pointer.
(SAFE_ALLOCA_LISP): Adjust make_save_value usage.
* alloc.c (format_save_value): Rename to make_save_value.
(make_save_pointer): New function.
(record_xmalloc): Use make_save_pointer.
* dired.c, editfns.c, fileio.c, font.c, gtkutil.c, lread.c:
* nsmenu.m, nsterm.m, xfns.c, xmenu.c, xselect.c, keymap.c:
Change users of make_save_value to make_save_pointer.
Likewise for format_save_value and make_save_value.
Dmitry Antipov [Tue, 15 Jan 2013 08:38:07 +0000 (12:38 +0400)]
Some convenient bits to deal with Lisp_Save_Values.
* lisp.h (XSAVE_OBJECT): New macro to extract saved objects.
(allocate_misc): Remove prototype.
(format_save_value): New prototype.
* alloc.c (allocate_misc): Revert back to static.
(format_save_value): New function to build Lisp_Save_Value
object with the specified internal structure.
(make_save_value): Reimplement using format_save_value.
* editfns.c (save_excursion_save): Use format_save_value.
(save_excursion_restore): Use XSAVE_OBJECT.
Stefan Monnier [Tue, 15 Jan 2013 06:05:22 +0000 (01:05 -0500)]
* lisp/emacs-lisp/advice.el (ad-preactivate-advice): Adjust the cleanup to
the use of nadvice.el.
* lisp/emacs-lisp/nadvice.el (advice--tweak): Make it possible for `tweak'
to return an explicit nil.
(advice--remove-function): Change accordingly.
* test/automated/advice-tests.el: Split up. Add advice-test-preactivate.
Michael Mauger [Tue, 15 Jan 2013 03:21:56 +0000 (22:21 -0500)]
* progmodes/sql.el: (sql-imenu-generic-expression):
(sql-mode-font-lock-object-name): Match schema qualified names.
(sql-connect): Use string keys.
(sql-product-interactive): Wait for interpreter prompt.
(sql-comint-oracle): Set process coding based on NLS_LANG.
Dmitry Antipov [Mon, 14 Jan 2013 11:07:50 +0000 (15:07 +0400)]
Fix compilation with GC_MARK_STACK == GC_USE_GCPROS_AS_BEFORE.
* eval.c (eval_sub): Protect `form' from being GCed before its
car and cdr becomes protected with the backtrace entry.
Dmitry Antipov [Mon, 14 Jan 2013 09:55:21 +0000 (13:55 +0400)]
Make Lisp_Save_Value more versatile storage for up to four objects.
* lisp.h (toplevel): Enumeration to describe types of saved objects.
(struct Lisp_Save_Value): New layout. Adjust comments.
(XSAVE_POINTER): New macro.
(XSAVE_INTEGER): Likewise.
(allocate_misc): Add prototype.
(free_misc): Likewise.
* alloc.c (allocate_misc): Now global.
(free_misc): Likewise. Adjust comment.
(make_save_value): Use new Lisp_Save_Value layout. Adjust comment.
(free_save_value): Likewise.
(mark_object): Likewise.
* editfns.c (save_excursion_save): Pack everything within
Lisp_Save_Value and so avoid xmalloc.
(save_excursion_restore): Adjust to match new layout. Use free_misc
because we do not allocate extra memory any more. Add eassert.
* print.c (print_object): New code to print Lisp_Save_Value. Do not
rely on valid_lisp_object_p if !GC_MARK_STACK. Adjust comments.
* dired.c, fileio.c, font.c, ftfont.c, gtkutil.c, keymap.c,
* lread.c, nsmenu.m, nsterm.h, xfns.c, xmenu.c, xselect.c:
Use XSAVE_POINTER and XSAVE_INTEGER where appropriate.