bpt/emacs.git
13 years agoMerge from gnulib.
Paul Eggert [Mon, 6 Jun 2011 19:53:44 +0000 (12:53 -0700)]
Merge from gnulib.

* lib/careadlinkat.c, lib/careadlinkat.h, m4/gnulib-common.m4: Merge.

13 years agoMerge: Document wide integers better.
Paul Eggert [Mon, 6 Jun 2011 19:43:39 +0000 (12:43 -0700)]
Merge: Document wide integers better.

13 years agoAdd Bug#8794 to ChangeLog entry.
Paul Eggert [Mon, 6 Jun 2011 18:37:51 +0000 (11:37 -0700)]
Add Bug#8794 to ChangeLog entry.

13 years agoMerge: Cons<->int and similar integer overflow fixes.
Paul Eggert [Mon, 6 Jun 2011 18:36:36 +0000 (11:36 -0700)]
Merge: Cons<->int and similar integer overflow fixes.

13 years ago* Makefile.in (ALL_CFLAGS): Add -I$(srcdir)/../lib.
Paul Eggert [Mon, 6 Jun 2011 18:26:04 +0000 (11:26 -0700)]
* Makefile.in (ALL_CFLAGS): Add -I$(srcdir)/../lib.

This is needed because lisp.h includes intprops.h now.

13 years agoMerge from trunk.
Paul Eggert [Mon, 6 Jun 2011 17:58:07 +0000 (10:58 -0700)]
Merge from trunk.

13 years ago* src/window.h (Fwindow_frame): Declare.
Stefan Monnier [Mon, 6 Jun 2011 16:54:34 +0000 (13:54 -0300)]
* src/window.h (Fwindow_frame): Declare.

13 years ago* alloc.c: Simplify handling of large-request failures (Bug#8800).
Paul Eggert [Mon, 6 Jun 2011 16:41:21 +0000 (09:41 -0700)]
* alloc.c: Simplify handling of large-request failures (Bug#8800).

(SPARE_MEMORY): Always define.
(LARGE_REQUEST): Remove.
(memory_full): Use SPARE_MEMORY rather than LARGE_REQUEST.

13 years agoAdd window-tree based, atomic and side window functions to window.el.
Martin Rudalics [Mon, 6 Jun 2011 15:21:07 +0000 (17:21 +0200)]
Add window-tree based, atomic and side window functions to window.el.

* window.el (window-right, window-left, window-child)
(window-child-count, window-last-child, window-any-p)
(normalize-live-buffer, normalize-live-frame)
(normalize-any-window, normalize-live-window)
(window-iso-combination-p, window-iso-combined-p)
(window-iso-combinations)
(walk-window-tree-1, walk-window-tree, walk-window-subtree)
(windows-with-parameter, window-with-parameter)
(window-atom-root, make-window-atom, window-atom-check-1)
(window-atom-check, window-side-check, window-check): New
functions.
(ignore-window-parameters, window-sides, window-sides-vertical)
(window-sides-slots): New variables.
(window-size-fixed): Move down in code.  Minor doc-string fix.

13 years agoMove some window-related functions from frame.c to window.c.
Martin Rudalics [Mon, 6 Jun 2011 13:57:49 +0000 (15:57 +0200)]
Move some window-related functions from frame.c to window.c.

* lisp.h: Move EXFUNS for Fframe_root_window,
Fframe_first_window and Fset_frame_selected_window to window.h.

* window.h: Move EXFUNS for Fframe_root_window,
Fframe_first_window and Fset_frame_selected_window here from
lisp.h.

* frame.c (Fwindow_frame, Fframe_first_window)
(Fframe_root_window, Fframe_selected_window)
(Fset_frame_selected_window): Move to window.c.
(Factive_minibuffer_window): Move to minibuf.c.
(Fother_visible_frames_p): New function.

* minibuf.c (Factive_minibuffer_window): Move here from frame.c.

* window.c (Fwindow_frame): Move here from frame.c.  Accept any
window as argument.
(Fframe_root_window, Fframe_first_window)
(Fframe_selected_window): Move here from frame.c.  Accept frame
or arbitrary window as argument.  Update doc-strings.
(Fminibuffer_window): Move up in code.
(Fwindow_minibuffer_p): Move up in code and simplify.
(Fset_frame_selected_window): Move here from frame.c.  Marginal
rewrite.
(Fselected_window, select_window, Fselect_window): Move up in
code.  Minor doc-string fixes.

13 years agoExpose window-tree functions in Elisp.
Martin Rudalics [Mon, 6 Jun 2011 09:09:42 +0000 (11:09 +0200)]
Expose window-tree functions in Elisp.

(Fwindow_buffer): Move up and rewrite doc-string.
(Fwindow_parent, Fwindow_vchild, Fwindow_hchild, Fwindow_next)
(Fwindow_prev): New functions.

13 years agoCheck for overflow when converting integer to cons and back.
Paul Eggert [Mon, 6 Jun 2011 08:29:01 +0000 (01:29 -0700)]
Check for overflow when converting integer to cons and back.

* charset.c (Fdefine_charset_internal, Fdecode_char):
Use cons_to_unsigned to catch overflow.
(Fencode_char): Use INTEGER_TO_CONS.
* composite.h (LGLYPH_CODE): Use cons_to_unsigned.
(LGLYPH_SET_CODE): Use INTEGER_TO_CONS.
* data.c (long_to_cons, cons_to_long): Remove.
(cons_to_unsigned, cons_to_signed): New functions.
These signal an error for invalid or out-of-range values.
* dired.c (Ffile_attributes): Use INTEGER_TO_CONS.
* fileio.c (Fset_visited_file_modtime): Use CONS_TO_INTEGER.
* font.c (Ffont_variation_glyphs):
* fontset.c (Finternal_char_font): Use INTEGER_TO_CONS.
* lisp.h: Include <intprops.h>.
(INTEGER_TO_CONS, CONS_TO_INTEGER): New macros.
(cons_to_signed, cons_to_unsigned): New decls.
(long_to_cons, cons_to_long): Remove decls.
* undo.c (record_first_change): Use INTEGER_TO_CONS.
(Fprimitive_undo): Use CONS_TO_INTEGER.
* xfns.c (Fx_window_property): Likewise.
* xselect.c: Include <limits.h>.
(x_own_selection, selection_data_to_lisp_data):
Use INTEGER_TO_CONS.
(x_handle_selection_request, x_handle_selection_clear)
(x_get_foreign_selection, Fx_disown_selection_internal)
(Fx_get_atom_name, x_send_client_event): Use CONS_TO_INTEGER.
(lisp_data_to_selection_data): Use cons_to_unsigned.
(x_fill_property_data): Use cons_to_signed.
Report values out of range.

13 years agoPrepare for exposing window-tree functions in Elisp.
Martin Rudalics [Mon, 6 Jun 2011 08:13:36 +0000 (10:13 +0200)]
Prepare for exposing window-tree functions in Elisp.

* window.c (decode_window, decode_any_window): Move up in code.
(Fwindowp, Fwindow_live_p): Rewrite doc-strings.
(inhibit_frame_unsplittable): Remove unused variable.

13 years agoCheck for buffer and string overflow more precisely.
Paul Eggert [Mon, 6 Jun 2011 06:16:12 +0000 (23:16 -0700)]
Check for buffer and string overflow more precisely.

* buffer.h (BUF_BYTES_MAX): New macro.
* lisp.h (STRING_BYTES_MAX): New macro.
* alloc.c (Fmake_string):
* character.c (string_escape_byte8):
* coding.c (coding_alloc_by_realloc):
* doprnt.c (doprnt):
* editfns.c (Fformat):
* eval.c (verror):
Use STRING_BYTES_MAX, not MOST_POSITIVE_FIXNUM,
since they may not be the same number.
* editfns.c (Finsert_char):
* fileio.c (Finsert_file_contents):
Likewise for BUF_BYTES_MAX.

13 years ago* image.c: Use ptrdiff_t, not int, for sizes.
Paul Eggert [Mon, 6 Jun 2011 06:10:06 +0000 (23:10 -0700)]
* image.c: Use ptrdiff_t, not int, for sizes.

(slurp_file): Switch from int to ptrdiff_t.
All uses changed.
(slurp_file): Check that file size fits in both size_t (for
malloc) and ptrdiff_t (for sanity and safety).

13 years ago* fileio.c (Fverify_visited_file_modtime): Avoid time overflow
Paul Eggert [Mon, 6 Jun 2011 05:57:31 +0000 (22:57 -0700)]
* fileio.c (Fverify_visited_file_modtime): Avoid time overflow

if b->modtime has its maximal value.

13 years ago* dired.c (Ffile_attributes): Don't assume EMACS_INT has >32 bits.
Paul Eggert [Mon, 6 Jun 2011 05:55:38 +0000 (22:55 -0700)]
* dired.c (Ffile_attributes): Don't assume EMACS_INT has >32 bits.

13 years agoDon't assume time_t can fit into int.
Paul Eggert [Mon, 6 Jun 2011 05:50:29 +0000 (22:50 -0700)]
Don't assume time_t can fit into int.

* buffer.h (struct buffer.modtime): Now time_t, not int.
* fileio.c (Fvisited_file_modtime): No need for time_t cast now.
* undo.c (Fprimitive_undo): Use time_t, not int, for time_t value.

13 years agoMinor fixes for signed vs unsigned integers.
Paul Eggert [Mon, 6 Jun 2011 05:48:28 +0000 (22:48 -0700)]
Minor fixes for signed vs unsigned integers.

* character.h (MAYBE_UNIFY_CHAR):
* charset.c (maybe_unify_char):
* keyboard.c (read_char, reorder_modifiers):
XINT -> XFASTINT, since the integer must be nonnegative.
* ftfont.c (ftfont_spec_pattern):
* keymap.c (access_keymap, silly_event_symbol_error):
XUINT -> XFASTINT, since the integer must be nonnegative.
(Fsingle_key_description, preferred_sequence_p): XUINT -> XINT,
since it makes no difference and we prefer signed.
* keyboard.c (record_char): Use XUINT when all the neighbors do.
(access_keymap): NATNUMP -> INTEGERP, since the integer must be
nonnegative.

13 years ago* alloc.c (memory_full) [SYSTEM_MALLOC]: Port to MacO).
Paul Eggert [Mon, 6 Jun 2011 04:54:23 +0000 (21:54 -0700)]
* alloc.c (memory_full) [SYSTEM_MALLOC]: Port to MacO).

Fixes: debbugs:8800

13 years ago* lisp/comint.el (comint-dynamic-complete-as-filename)
Andreas Schwab [Sun, 5 Jun 2011 23:20:16 +0000 (01:20 +0200)]
* lisp/comint.el (comint-dynamic-complete-as-filename)
(comint-dynamic-complete-filename): Correctly call
completion-in-region.

13 years agoFixes: debbugs:8806
Andreas Schwab [Sun, 5 Jun 2011 22:46:26 +0000 (00:46 +0200)]
Fixes: debbugs:8806

* src/editfns.c (Fformat): Correctly handle zero flag with hexadecimal
format.

13 years ago* src/gtkutil.c (xg_get_default_scrollbar_width): Avoid warning.
Andreas Schwab [Sun, 5 Jun 2011 22:20:42 +0000 (00:20 +0200)]
* src/gtkutil.c (xg_get_default_scrollbar_width): Avoid warning.

13 years ago* src/xfns.c (x_set_scroll_bar_default_width): Move declarations
Andreas Schwab [Sun, 5 Jun 2011 22:20:42 +0000 (00:20 +0200)]
* src/xfns.c (x_set_scroll_bar_default_width): Move declarations
before statements.

13 years ago* lisp/net/rcirc.el (rcirc-prompt-for-encryption): Fix bug introduced in last change.
Deniz Dogan [Sun, 5 Jun 2011 19:39:17 +0000 (21:39 +0200)]
* lisp/net/rcirc.el (rcirc-prompt-for-encryption): Fix bug introduced in last change.

13 years agoHandle scroll bar width larger than 16 for GTK3.
Jan Djärv [Sun, 5 Jun 2011 19:04:51 +0000 (21:04 +0200)]
Handle scroll bar width larger than 16 for GTK3.

* gtkutil.c (xg_get_default_scrollbar_width): New function.

* gtkutil.h: Declare xg_get_default_scrollbar_width.

* xfns.c (x_set_scroll_bar_default_width): If USE_GTK, get
min width by calling x_set_scroll_bar_default_width.

Fixes: debbugs:8505

13 years ago* lisp/net/rcirc.el (rcirc-prompt-for-encryption): New function.
Deniz Dogan [Sun, 5 Jun 2011 19:03:28 +0000 (21:03 +0200)]
* lisp/net/rcirc.el (rcirc-prompt-for-encryption): New function.
(rcirc): Use it to prompt for encryption.

13 years agolisp/textmodes/bibtex.el: new command bibtex-search-entries
Roland Winkler [Sun, 5 Jun 2011 05:46:43 +0000 (00:46 -0500)]
lisp/textmodes/bibtex.el: new command bibtex-search-entries

13 years agolisp/textmodes/bibtex.el: various small bug fixes
Roland Winkler [Sun, 5 Jun 2011 04:58:39 +0000 (23:58 -0500)]
lisp/textmodes/bibtex.el: various small bug fixes

13 years agolisp/textmodes/bibtex.el (bibtex-search-entry-globally): New variable
Roland Winkler [Sun, 5 Jun 2011 04:47:45 +0000 (23:47 -0500)]
lisp/textmodes/bibtex.el (bibtex-search-entry-globally): New variable

13 years agolisp/textmodes/bibtex.el (bibtex-entry-format): new option sort-fields
Roland Winkler [Sun, 5 Jun 2011 04:39:40 +0000 (23:39 -0500)]
lisp/textmodes/bibtex.el (bibtex-entry-format): new option sort-fields

13 years agolisp/doc-view.el: Silence compiler warning.
Juanma Barranquero [Sun, 5 Jun 2011 00:18:46 +0000 (02:18 +0200)]
lisp/doc-view.el: Silence compiler warning.

13 years agosrc/xdisp.c (single_display_spec_intangible_p): Remove declaration.
Juanma Barranquero [Sun, 5 Jun 2011 00:14:08 +0000 (02:14 +0200)]
src/xdisp.c (single_display_spec_intangible_p): Remove declaration.

13 years agoDoc fixes for timer.el (Bug#8793).
Chong Yidong [Sat, 4 Jun 2011 22:46:26 +0000 (18:46 -0400)]
Doc fixes for timer.el (Bug#8793).

* emacs-lisp/timer.el (timer-activate): Remove unused arg.
(timer-activate, timer-activate-when-idle): Doc fix.

13 years ago* src/xselect.c (x_get_foreign_selection): Reduce scope of x_catch_errors (Bug#8790).
Chong Yidong [Sat, 4 Jun 2011 22:08:32 +0000 (18:08 -0400)]
* src/xselect.c (x_get_foreign_selection): Reduce scope of x_catch_errors (Bug#8790).

13 years agoHandle errors when saving to clipboard manager (Bug#8779).
Chong Yidong [Sat, 4 Jun 2011 21:02:42 +0000 (17:02 -0400)]
Handle errors when saving to clipboard manager (Bug#8779).

* src/xselect.c (x_clipboard_manager_save): Remove redundant arg.
(x_clipboard_manager_save): Add return value.
(x_clipboard_manager_error_1, x_clipboard_manager_error_2): New
error handlers.
(x_clipboard_manager_save_frame, x_clipboard_manager_save_all):
Obey Vx_select_enable_clipboard_manager.  Catch errors in
x_clipboard_manager_save (Bug#8779).
(Vx_select_enable_clipboard_manager): New variable.

13 years agoMerge from emacs-23; up to 2010-06-12T17:12:15Z!cyd@stupidchicken.com.
Glenn Morris [Sat, 4 Jun 2011 18:29:18 +0000 (11:29 -0700)]
Merge from emacs-23; up to 2010-06-12T17:12:15Z!cyd@stupidchicken.com.

13 years ago* lib/getopt.c: Merge trivial change from gnulib.
Paul Eggert [Sat, 4 Jun 2011 16:51:28 +0000 (09:51 -0700)]
* lib/getopt.c: Merge trivial change from gnulib.

13 years agoFix mistake in last iswitchb.el bug fix.
Deniz Dogan [Sat, 4 Jun 2011 15:13:11 +0000 (17:13 +0200)]
Fix mistake in last iswitchb.el bug fix.

13 years ago* net/tramp-sh.el (tramp-find-shell): Apply workaround also for
Michael Albinus [Sat, 4 Jun 2011 14:11:26 +0000 (16:11 +0200)]
* net/tramp-sh.el (tramp-find-shell): Apply workaround also for
"SunOS 5.10".

13 years ago* net/tramp.el (tramp-set-completion-function, tramp-parse-rhosts)
Michael Albinus [Sat, 4 Jun 2011 13:58:37 +0000 (15:58 +0200)]
* net/tramp.el (tramp-set-completion-function, tramp-parse-rhosts)
(tramp-parse-shosts, tramp-parse-sconfig, tramp-parse-shostkeys)
(tramp-parse-hosts, tramp-parse-passwd, tramp-parse-netrc)
(tramp-parse-putty):
* net/tramp-sh.el (tramp-completion-function-alist-rsh)
(tramp-completion-function-alist-ssh)
(tramp-completion-function-alist-telnet)
(tramp-completion-function-alist-su)
(tramp-completion-function-alist-putty): Set `tramp-autoload'
cookie.

* net/tramp-ftp.el:
* net/tramp-sh.el:
* net/tramp-smb.el: Set `tramp-autoload' cookie, and eval after
load "tramp.el" `tramp-set-completion-function'.

13 years ago* lisp/shell.el: Require and use pcomplete.
Stefan Monnier [Sat, 4 Jun 2011 12:31:34 +0000 (09:31 -0300)]
* lisp/shell.el: Require and use pcomplete.
(shell-dynamic-complete-functions): Add pcomplete-completions-at-point.
(shell-completion-vars): Set pcomplete-default-completion-function.

13 years ago* lisp/iswitchb.el (iswitchb-window-buffer-p): Use `member' instead of `memq'.
Deniz Dogan [Sat, 4 Jun 2011 11:02:37 +0000 (13:02 +0200)]
* lisp/iswitchb.el (iswitchb-window-buffer-p): Use `member' instead of `memq'.

Fixes: debbugs:8799

13 years agosrc/bidi.c (bidi_level_of_next_char): Fix last change.
Eli Zaretskii [Sat, 4 Jun 2011 08:04:48 +0000 (11:04 +0300)]
src/bidi.c (bidi_level_of_next_char): Fix last change.

13 years ago* lisp/url/url-future.el (url-future-test): Fix scope of `saver'.
Andreas Schwab [Sat, 4 Jun 2011 07:53:22 +0000 (09:53 +0200)]
* lisp/url/url-future.el (url-future-test): Fix scope of `saver'.

13 years agoSupport bidi reordering of text covered by display properties.
Eli Zaretskii [Sat, 4 Jun 2011 07:41:44 +0000 (10:41 +0300)]
Support bidi reordering of text covered by display properties.

 src/bidi.c (bidi_copy_it): Use offsetof instead of emulating it.
 (bidi_fetch_char, bidi_fetch_char_advance): New functions.
 (bidi_cache_search, bidi_cache_iterator_state)
 (bidi_paragraph_init, bidi_resolve_explicit, bidi_resolve_weak)
 (bidi_level_of_next_char, bidi_move_to_visually_next): Support
 character positions inside a run of characters covered by a
 display string.
 (bidi_paragraph_init, bidi_resolve_explicit_1)
 (bidi_level_of_next_char): Call bidi_fetch_char and
 bidi_fetch_char_advance instead of FETCH_CHAR and
 FETCH_CHAR_ADVANCE.
 (bidi_init_it): Initialize new members.
 (LRE_CHAR, RLE_CHAR, PDF_CHAR, LRO_CHAR, RLO_CHAR): Remove macro
 definitions.
 (bidi_explicit_dir_char): Lookup character type in bidi_type_table,
 instead of using explicit *_CHAR codes.
 (bidi_resolve_explicit, bidi_resolve_weak): Use
 FETCH_MULTIBYTE_CHAR instead of FETCH_CHAR, as reordering of
 bidirectional text is supported only in multibyte buffers.
 (bidi_init_it): Accept additional argument FRAME_WINDOW_P and use
 it to initialize the frame_window_p member of struct bidi_it.
 (bidi_cache_iterator_state, bidi_resolve_explicit_1)
 (bidi_resolve_explicit, bidi_resolve_weak)
 (bidi_level_of_next_char, bidi_move_to_visually_next): Abort if
 bidi_it->nchars is non-positive.
 (bidi_level_of_next_char): Don't try to lookup the cache for the
 next/previous character if nothing is cached there yet, or if we
 were just reseat()'ed to a new position.
 src/xdisp.c (set_cursor_from_row): Set start and stop points
 according to the row's direction when priming the loop that looks
 for the glyph on which to display cursor.
 (single_display_spec_intangible_p): Function deleted.
 (display_prop_intangible_p): Reimplement to call
 handle_display_spec instead of single_display_spec_intangible_p.
 Accept 3 additional arguments needed by handle_display_spec.  This
 fixes incorrect cursor motion across display property with complex
 values: lists, `(when COND...)' forms, etc.
 (single_display_spec_string_p): Support property values that are
 lists with the argument STRING its top-level element.
 (display_prop_string_p): Fix the condition for processing a
 property that is a list to be consistent with handle_display_spec.
 (handle_display_spec): New function, refactored from the
 last portion of handle_display_prop.
 (compute_display_string_pos): Accept additional argument
 FRAME_WINDOW_P.  Call handle_display_spec to determine whether the
 value of a `display' property is a "replacing spec".
 (handle_single_display_spec): Accept 2 additional arguments BUFPOS
 and FRAME_WINDOW_P.  If IT is NULL, don't set up the iterator from
 the display property, but just return a value indicating whether
 the display property will replace the characters it covers.
 (Fcurrent_bidi_paragraph_direction): Initialize the nchars and
 frame_window_p members of struct bidi_it.
 (compute_display_string_pos, compute_display_string_end): New
 functions.
 (push_it): Accept second argument POSITION, where pop_it should
 jump to continue iteration.
 (reseat_1): Initialize bidi_it.disp_pos.
 src/keyboard.c (adjust_point_for_property): Adjust the call to
 display_prop_intangible_p to its new signature.
 src/dispextern.h (struct bidi_it): New member frame_window_p.
 (bidi_init_it): Update prototypes.
 (display_prop_intangible_p): Update prototype.
 (compute_display_string_pos, compute_display_string_end): Declare
 prototypes.
 (struct bidi_it): New members nchars and disp_pos.  ch_len is now
 EMACS_INT.

13 years ago* image.c (svg_load): Omit needless test.
Paul Eggert [Sat, 4 Jun 2011 03:24:42 +0000 (20:24 -0700)]
* image.c (svg_load): Omit needless test.

13 years agoCheck for buffer and string overflow more precisely.
Paul Eggert [Sat, 4 Jun 2011 02:49:51 +0000 (19:49 -0700)]
Check for buffer and string overflow more precisely.

* buffer.h (BUF_BYTES_MAX): New macro.
* lisp.h (STRING_BYTES_MAX): New macro.
* alloc.c (Fmake_string):
* character.c (string_escape_byte8):
* coding.c (coding_alloc_by_realloc):
* doprnt.c (doprnt):
* editfns.c (Fformat):
* eval.c (verror):
Use STRING_BYTES_MAX, not MOST_POSITIVE_FIXNUM,
since they may not be the same number.
* editfns.c (Finsert_char):
* fileio.c (Finsert_file_contents):
Likewise for BUF_BYTES_MAX.

13 years agoUse ptrdiff_t, not int, for sizes.
Paul Eggert [Sat, 4 Jun 2011 02:02:36 +0000 (19:02 -0700)]
Use ptrdiff_t, not int, for sizes.

* image.c (slurp_file): Switch from int to ptrdiff_t.
All uses changed.
(slurp_file, svg_load): Check that file size fits in both
size_t (for malloc) and ptrdiff_t (for sanity and safety).

13 years ago* buffers.texi (Buffers): Correct the size limit.
Paul Eggert [Fri, 3 Jun 2011 23:21:13 +0000 (16:21 -0700)]
* buffers.texi (Buffers): Correct the size limit.

13 years ago* xselect.c: Include <limits.h>.
Paul Eggert [Fri, 3 Jun 2011 20:14:12 +0000 (13:14 -0700)]
* xselect.c: Include <limits.h>.

13 years agoDocument wide integers better.
Paul Eggert [Fri, 3 Jun 2011 19:04:41 +0000 (12:04 -0700)]
Document wide integers better.

* files.texi (File Attributes):
ino_t values no longer map to anything larger than a single cons.

13 years agoCheck for overflow when converting integer to cons and back.
Paul Eggert [Fri, 3 Jun 2011 19:02:25 +0000 (12:02 -0700)]
Check for overflow when converting integer to cons and back.

* charset.c (Fdefine_charset_internal, Fdecode_char):
Use cons_to_unsigned to catch overflow.
(Fencode_char): Use INTEGER_TO_CONS.
* composite.h (LGLYPH_CODE): Use cons_to_unsigned.
(LGLYPH_SET_CODE): Use INTEGER_TO_CONS.
* data.c (long_to_cons, cons_to_long): Remove.
(cons_to_unsigned, cons_to_signed): New functions.
These signal an error for invalid or out-of-range values.
* dired.c (Ffile_attributes): Use INTEGER_TO_CONS.
* fileio.c (Fset_visited_file_modtime): Use CONS_TO_INTEGER.
* font.c (Ffont_variation_glyphs):
* fontset.c (Finternal_char_font): Use INTEGER_TO_CONS.
* lisp.h (INTEGER_TO_CONS, CONS_TO_INTEGER): New macros.
(cons_to_signed, cons_to_unsigned): New decls.
(long_to_cons, cons_to_long): Remove decls.
* undo.c (record_first_change): Use INTEGER_TO_CONS.
(Fprimitive_undo): Use CONS_TO_INTEGER.
* xfns.c (Fx_window_property): Likewise.
* xselect.c (x_own_selection, selection_data_to_lisp_data):
Use INTEGER_TO_CONS.
(x_handle_selection_request, x_handle_selection_clear)
(x_get_foreign_selection, Fx_disown_selection_internal)
(Fx_get_atom_name, x_send_client_event): Use CONS_TO_INTEGER.
(lisp_data_to_selection_data): Use cons_to_unsigned.
(x_fill_property_data): Use cons_to_signed.  Report values out of range.

13 years agoDocument wide integers better.
Paul Eggert [Fri, 3 Jun 2011 18:49:33 +0000 (11:49 -0700)]
Document wide integers better.

* files.texi (File Attributes): Document ino_t values better.
* numbers.texi (Integer Basics, Integer Basics, Arithmetic Operations):
(Bitwise Operations):
* objects.texi (Integer Type): Integers are typically 62 bits now.
* os.texi (Time Conversion): Document time_t values better.

13 years agoDocument wide integers better.
Paul Eggert [Fri, 3 Jun 2011 18:47:14 +0000 (11:47 -0700)]
Document wide integers better.

* buffers.texi (Buffers):
* files.texi (Visiting): Default buffer maximum is now 2 EiB typically.

13 years agoFix doc for machines with wider system times such as time_t.
Paul Eggert [Fri, 3 Jun 2011 18:42:59 +0000 (11:42 -0700)]
Fix doc for machines with wider system times such as time_t.

On such machines, it's now safe to assume that EMACS_INT is as
wide as the system times, so that shifting right by 16 will
result in an integer that always fits in EMACS_INT.
* dired.c (Ffile_attributes): Document large inode number handling.
* termhooks.h: Fix comment for large time stamp handling.

13 years ago* NEWS: 62-bit integers are typical now.
Paul Eggert [Fri, 3 Jun 2011 18:42:04 +0000 (11:42 -0700)]
* NEWS: 62-bit integers are typical now.

13 years ago* lisp.h (WIDE_EMACS_INT): Now defaults to 1.
Paul Eggert [Fri, 3 Jun 2011 18:28:20 +0000 (11:28 -0700)]
* lisp.h (WIDE_EMACS_INT): Now defaults to 1.

13 years ago* xselect.c: Use 'unsigned' more consistently.
Paul Eggert [Fri, 3 Jun 2011 18:22:12 +0000 (11:22 -0700)]
* xselect.c: Use 'unsigned' more consistently.

(selection_data_to_lisp_data, lisp_data_to_selection_data):
Use 'unsigned' consistently when computing sizes of unsigned objects.

13 years ago* fileio.c (Fverify_visited_file_modtime): Avoid time overflow
Paul Eggert [Fri, 3 Jun 2011 18:17:13 +0000 (11:17 -0700)]
* fileio.c (Fverify_visited_file_modtime): Avoid time overflow

if b->modtime has its maximal value.

13 years ago* dired.c (Ffile_attributes): Don't assume EMACS_INT has >32 bits.
Paul Eggert [Fri, 3 Jun 2011 18:15:45 +0000 (11:15 -0700)]
* dired.c (Ffile_attributes): Don't assume EMACS_INT has >32 bits.

13 years ago* lisp.h: Include <intprops.h>, as it'll useful in later changes.
Paul Eggert [Fri, 3 Jun 2011 18:14:49 +0000 (11:14 -0700)]
* lisp.h: Include <intprops.h>, as it'll useful in later changes.

* character.c, data.c, editfns.c, insdel.c, intervals.c:
Don't include <intprops.h>, since lisp.h does.

13 years agoDon't assume time_t can fit into int.
Paul Eggert [Fri, 3 Jun 2011 18:12:45 +0000 (11:12 -0700)]
Don't assume time_t can fit into int.

* buffer.h (struct buffer.modtime): Now time_t, not int.
* fileio.c (Fvisited_file_modtime): No need for time_t cast now.
* undo.c (Fprimitive_undo): Use time_t, not int, for time_t value.

13 years agoMinor fixes for signed vs unsigned integers.
Paul Eggert [Fri, 3 Jun 2011 18:11:17 +0000 (11:11 -0700)]
Minor fixes for signed vs unsigned integers.

* character.h (MAYBE_UNIFY_CHAR):
* charset.c (maybe_unify_char):
* keyboard.c (read_char, reorder_modifiers):
XINT -> XFASTINT, since the integer must be nonnegative.
* ftfont.c (ftfont_spec_pattern):
* keymap.c (access_keymap, silly_event_symbol_error):
XUINT -> XFASTINT, since the integer must be nonnegative.
(Fsingle_key_description, preferred_sequence_p): XUINT -> XINT,
since it makes no difference and we prefer signed.
* keyboard.c (record_char): Use XUINT when all the neighbors do.
(access_keymap): NATNUMP -> INTEGERP, since the integer must be
nonnegative.

13 years agoCleanup. Tested in -nw and verified that bug #7616 didn't become worse.
Eli Zaretskii [Fri, 3 Jun 2011 13:34:52 +0000 (16:34 +0300)]
Cleanup.  Tested in -nw and verified that bug #7616 didn't become worse.

 src/bidi.c (bidi_fetch_char_advance): Remove unused and
 unimplemented function.

13 years ago* lisp/subr.el (make-progress-reporter): Add "..." by default.
Stefan Monnier [Thu, 2 Jun 2011 18:04:44 +0000 (15:04 -0300)]
* lisp/subr.el (make-progress-reporter): Add "..." by default.

Fixes: debbugs:8785

13 years agoMerge: memory_full, gnutls improvements
Paul Eggert [Thu, 2 Jun 2011 17:16:09 +0000 (10:16 -0700)]
Merge: memory_full, gnutls improvements

13 years ago* src/emacs.c (main): Warn when starting a GTK emacs in daemon mode.
Dan Nicolaescu [Thu, 2 Jun 2011 16:56:04 +0000 (09:56 -0700)]
* src/emacs.c (main): Warn when starting a GTK emacs in daemon mode.

13 years agoSilence warning for unused `dotimes' counter variables.
Juanma Barranquero [Thu, 2 Jun 2011 11:24:12 +0000 (13:24 +0200)]
Silence warning for unused `dotimes' counter variables.

* mpc.el (mpc-select-extend, mpc-songpointer-context):
* vc/log-view.el (log-view-beginning-of-defun):
* vc/smerge-mode.el (smerge-apply-resolution-patch)
  (smerge-refine-forward, smerge-refine-chopup-region):

13 years agoAuto-commit of loaddefs files.
Glenn Morris [Thu, 2 Jun 2011 10:21:27 +0000 (06:21 -0400)]
Auto-commit of loaddefs files.

13 years agoMerge ChangeLog from trunk better.
Paul Eggert [Thu, 2 Jun 2011 08:40:41 +0000 (01:40 -0700)]
Merge ChangeLog from trunk better.

13 years ago* alloc.c (allocate_vectorlike): Adjust to memory_full API change.
Paul Eggert [Thu, 2 Jun 2011 08:35:28 +0000 (01:35 -0700)]
* alloc.c (allocate_vectorlike): Adjust to memory_full API change.

13 years agoMerge from trunk.
Paul Eggert [Thu, 2 Jun 2011 08:25:28 +0000 (01:25 -0700)]
Merge from trunk.

13 years ago* lib/allocator.h, lib/careadlinkat.c: Merge from gnulib.
Paul Eggert [Thu, 2 Jun 2011 08:22:57 +0000 (01:22 -0700)]
* lib/allocator.h, lib/careadlinkat.c: Merge from gnulib.

13 years agoMerge: Remove arbitrary limit of 2**31 entries in hash tables.
Paul Eggert [Thu, 2 Jun 2011 08:02:59 +0000 (01:02 -0700)]
Merge: Remove arbitrary limit of 2**31 entries in hash tables.

Fixes: debbugs:8771

13 years agoMerge from trunk.
Paul Eggert [Thu, 2 Jun 2011 07:42:55 +0000 (00:42 -0700)]
Merge from trunk.

13 years ago* lisp.h (WIDE_EMACS_INT): Now defaults to 1.
Paul Eggert [Thu, 2 Jun 2011 06:29:14 +0000 (23:29 -0700)]
* lisp.h (WIDE_EMACS_INT): Now defaults to 1.

13 years ago* fileio.c (Fverify_visited_file_modtime): Avoid time overflow
Paul Eggert [Thu, 2 Jun 2011 06:23:20 +0000 (23:23 -0700)]
* fileio.c (Fverify_visited_file_modtime): Avoid time overflow

if b->modtime has its maximal value.

13 years ago* dired.c (Ffile_attributes): Don't assume EMACS_INT has >32 bits.
Paul Eggert [Thu, 2 Jun 2011 06:21:13 +0000 (23:21 -0700)]
* dired.c (Ffile_attributes): Don't assume EMACS_INT has >32 bits.

13 years ago* lisp.h: Include <intprops.h>, as it'll useful in later changes.
Paul Eggert [Thu, 2 Jun 2011 06:17:35 +0000 (23:17 -0700)]
* lisp.h: Include <intprops.h>, as it'll useful in later changes.

* character.c, data.c, editfns.c, insdel.c, intervals.c:
Don't include <intprops.h>, since lisp.h does.

13 years agoDon't assume time_t can fit into int.
Paul Eggert [Thu, 2 Jun 2011 06:15:15 +0000 (23:15 -0700)]
Don't assume time_t can fit into int.

* buffer.h (struct buffer.modtime): Now time_t, not int.
* fileio.c (Fvisited_file_modtime): No need for time_t cast now.
* undo.c (Fprimitive_undo): Use time_t, not int, for time_t value.

13 years agoMerge: Minor fixes for signed vs unsigned integers.
Paul Eggert [Thu, 2 Jun 2011 05:33:33 +0000 (22:33 -0700)]
Merge: Minor fixes for signed vs unsigned integers.

13 years ago* lisp/net/tramp.el (tramp-with-progress-reporter): Rename from
Stefan Monnier [Thu, 2 Jun 2011 03:48:23 +0000 (00:48 -0300)]
* lisp/net/tramp.el (tramp-with-progress-reporter): Rename from
with-progress-reporter.  Use `declare'.
* lisp/net/tramp-smb.el:
* lisp/net/tramp-sh.el:
* lisp/net/tramp-gvfs.el: Update all uses.

13 years ago* calc/calc.el (calc-kill-stack-buffer): Make sure that the trail
Jay Belanger [Thu, 2 Jun 2011 00:09:42 +0000 (19:09 -0500)]
* calc/calc.el (calc-kill-stack-buffer): Make sure that the trail
  buffer isn't killed before making it current.

13 years agognus-registry.el (gnus-registry-remove-ignored): New function to remove entries with...
Teodor Zlatanov [Wed, 1 Jun 2011 22:35:26 +0000 (22:35 +0000)]
gnus-registry.el (gnus-registry-remove-ignored): New function to remove entries with groups we ignore.

13 years agoMake it possible to build with GCC-4.6+ -O2 -flto.
Dan Nicolaescu [Wed, 1 Jun 2011 21:54:35 +0000 (14:54 -0700)]
Make it possible to build with GCC-4.6+ -O2 -flto.

* src/emacs.c (__malloc_initialize_hook): Mark as EXTERNALLY_VISIBLE.

13 years agoSilence various byte-compiler warnings.
Stefan Monnier [Wed, 1 Jun 2011 19:32:04 +0000 (16:32 -0300)]
Silence various byte-compiler warnings.
* lisp/emacs-lisp/byte-run.el (make-obsolete-variable): New argument
`access-type' and new obsolescence format.
* lisp/emacs-lisp/bytecomp.el (byte-compile-warn-obsolete): Adjust to
new format.
(byte-compile-check-variable): New `access-type' argument.
Only warn if the access-type is obsolete.
(byte-compile-dynamic-variable-bind, byte-compile-variable-ref)
(byte-compile-variable-set): Adjust callers.
* lisp/help-fns.el (describe-variable): Adjust to new obsolescence format.
* lisp/mail/sendmail.el (mail-mailer-swallows-blank-line): Only mark
setting it as obsolete.
* lisp/simple.el (minibuffer-completing-symbol):
* lisp/font-lock.el (font-lock-beginning-of-syntax-function): Only mark read
access as obsolete.
* lisp/minibuffer.el (minibuffer-completing-file-name): Don't make it
obsolete yet.
* lisp/international/quail.el (quail-mouse-choose-completion): Remove unused
code referring to obsolete var.
(quail-choose-completion-string): Remove.
* lisp/server.el (server-clients-with, server-kill-buffer-query-function)
(server-kill-emacs-query-function): Silence "unused `proc'" warnings.
* lisp/proced.el (proced-send-signal):
* lisp/emacs-lisp/lisp.el (lisp-complete-symbol):
Replace completion-annotate-function with completion-extra-properties.

13 years agoAdd :version tags for url-queue.el.
Glenn Morris [Wed, 1 Jun 2011 17:34:24 +0000 (10:34 -0700)]
Add :version tags for url-queue.el.

* lisp/url/url-queue.el (url-queue-parallel-processes, url-queue-timeout):
Add :version tag for options that will be new in 24.1.

13 years ago* lib-src/emacsclient.c (socket_status): Use constant pointer.
Dan Nicolaescu [Wed, 1 Jun 2011 17:15:27 +0000 (10:15 -0700)]
* lib-src/emacsclient.c (socket_status): Use constant pointer.

13 years ago* lisp/simple.el (goto-line): Use read-number.
Stefan Monnier [Wed, 1 Jun 2011 15:52:35 +0000 (12:52 -0300)]
* lisp/simple.el (goto-line): Use read-number.
(overriding-map-is-bound): Remove.
(saved-overriding-map): Change default.
(save&set-overriding-map): Rename from ensure-overriding-map-is-bound;
Take the map as argument.
(universal-argument, negative-argument, digit-argument): Use it.
(restore-overriding-map): Adjust.
(do-auto-fill): Use fill-forward-paragraph.
(keyboard-quit): Don't signal an error when debug-on-quit is non-nil.

13 years ago* lisp/minibuffer.el (minibuffer-inactive-mode-map): New var.
Stefan Monnier [Wed, 1 Jun 2011 15:34:41 +0000 (12:34 -0300)]
* lisp/minibuffer.el (minibuffer-inactive-mode-map): New var.
(minibuffer-inactive-mode): New major mode.
* src/minibuf.c (get_minibuffer, read_minibuf_unwind): Call it.
* lisp/mouse.el (mouse-drag-region): Remove the "mouse-1 pops up
the *Messages* buffer" hack.
(mouse-popup-menubar): Don't burp if the event is a normal key.

13 years ago* lisp/thingatpt.el (forward-whitespace): Typo.
Stefan Monnier [Wed, 1 Jun 2011 14:28:54 +0000 (11:28 -0300)]
* lisp/thingatpt.el (forward-whitespace): Typo.

13 years agoMiscellaneous tweaks.
Stefan Monnier [Wed, 1 Jun 2011 14:19:45 +0000 (11:19 -0300)]
Miscellaneous tweaks.
* lisp/emacs-lisp/cl-macs.el (dolist, dotimes): Use the same strategy for
lexical scoping as in subr.el's dolist and dotimes.
* lisp/emacs-lisp/bytecomp.el (byte-compile-unfold-bcf):
Silence compiler warning.
* lisp/thingatpt.el (forward-whitespace): Trivial coding style fix.
* lisp/subr.el (with-output-to-temp-buffer): Provide an edebug spec.
* lisp/international/ccl.el (ccl-compile): Trivial simplification.
* lisp/help-fns.el (help-do-arg-highlight): Silence compiler warning.
* lisp/emacs-lisp/testcover.el (testcover-end): Remove spurious
`printflag' argument.
* lisp/emacs-lisp/byte-run.el (make-obsolete, make-obsolete-variable):
Purecopy the whole obsolescence data.

13 years agoAuto-commit of loaddefs files.
Glenn Morris [Wed, 1 Jun 2011 10:19:26 +0000 (06:19 -0400)]
Auto-commit of loaddefs files.

13 years agoFix last change on rcirc-print and rcirc-decode-coding-system
Leo Liu [Wed, 1 Jun 2011 08:10:42 +0000 (16:10 +0800)]
Fix last change on rcirc-print and rcirc-decode-coding-system

13 years agoUse derived-mode-p in previous change.
Glenn Morris [Wed, 1 Jun 2011 03:50:20 +0000 (20:50 -0700)]
Use derived-mode-p in previous change.

13 years ago* lisp/mail/emacsbug.el (report-emacs-bug-hook): Mailclient ignores From.
Glenn Morris [Wed, 1 Jun 2011 03:35:49 +0000 (20:35 -0700)]
* lisp/mail/emacsbug.el (report-emacs-bug-hook): Mailclient ignores From.

13 years agoMerge from trunk.
Paul Eggert [Wed, 1 Jun 2011 02:49:51 +0000 (19:49 -0700)]
Merge from trunk.

13 years agoMinor fixes for signed vs unsigned integers.
Paul Eggert [Wed, 1 Jun 2011 02:49:12 +0000 (19:49 -0700)]
Minor fixes for signed vs unsigned integers.

* character.h (MAYBE_UNIFY_CHAR):
* charset.c (maybe_unify_char):
* keyboard.c (read_char, reorder_modifiers):
XINT -> XFASTINT, since the integer must be nonnegative.
* ftfont.c (ftfont_spec_pattern):
* keymap.c (access_keymap, silly_event_symbol_error):
XUINT -> XFASTINT, since the integer must be nonnegative.
(Fsingle_key_description, preferred_sequence_p): XUINT -> XINT,
since it makes no difference and we prefer signed.
* keyboard.c (record_char): Use XUINT when all the neighbors do.
(access_keymap): NATNUMP -> INTEGERP, since the integer must be
nonnegative.

13 years ago* fringe.c (update_window_fringes): Don't update overlay arrow bitmap in the current...
YAMAMOTO Mitsuharu [Wed, 1 Jun 2011 01:36:38 +0000 (10:36 +0900)]
* fringe.c (update_window_fringes): Don't update overlay arrow bitmap in the current matrix if keep_current_p is non-zero.