Paul Eggert [Tue, 21 Jun 2011 16:47:56 +0000 (09:47 -0700)]
Port to Sun C.
* composite.c (find_automatic_composition): Omit needless 'return 0;'
that Sun C diagnosed.
* fns.c (secure_hash): Fix pointer signedness issue.
* intervals.c (static_offset_intervals): New function.
(offset_intervals): Use it.
Martin Rudalics [Tue, 21 Jun 2011 15:16:32 +0000 (17:16 +0200)]
Don't make popup frames unsplittable by default.
(display-buffer-alist, display-buffer-default-specifiers): Don't
make new frame unsplittable by default.
(display-buffer-normalize-argument): Fix doc-string typo and use
'same-frame-other-window instead of 'other-window when associating
with display-buffer-macro-specifiers.
Martin Rudalics [Tue, 21 Jun 2011 08:29:43 +0000 (10:29 +0200)]
Handle old buffer display options more faithfully.
* window.el (display-buffer-alist): In default value do not
enforce searching a window on any but the selected frame.
Reported by Katsumi Yamaoka <yamaoka@jpl.org>.
(display-buffer-select-window): Remove function.
(display-buffer-in-window): When a window on another frame gets
reused, do not select it any more but just raise its frame if
necessary (Bug#8851) and (Bug#8856).
(display-buffer-normalize-options): Handle pop-up-frames related
options more faithfully.
(pop-to-buffer): Don't rely on `display-buffer' selecting the
window if it is on another frame.
Drew Adams [Tue, 21 Jun 2011 01:49:36 +0000 (21:49 -0400)]
* lisp/menu-bar.el: Use function variable instead of switch-to-buffer.
(menu-bar-select-buffer-function): New variable.
(menu-bar-update-buffers): Use it.
Jan Djärv [Mon, 20 Jun 2011 20:49:12 +0000 (22:49 +0200)]
* x-dnd.el (x-dnd-version-from-flags)
(x-dnd-more-than-3-from-flags): New functions that handle long-as-cons
and long as number.
(x-dnd-handle-xdnd): Call functions above.
Stefan Monnier [Mon, 20 Jun 2011 20:16:20 +0000 (16:16 -0400)]
* lisp/minibuffer.el (completion-metadata): Prepend the alist with `metadata'.
(completion-try-completion, completion-all-completions): Compute the
metadata argument if it's missing; make it optional.
Stefan Monnier [Mon, 20 Jun 2011 16:02:31 +0000 (12:02 -0400)]
Use completion-at-point rather than completion-in-region.
* lisp/wid-edit.el: Use lexical scoping and move towards completion-at-point.
(widget-complete): Use new :completion-function property.
(widget-completions-at-point): New function.
(default): Use :completion-function instead of :complete.
(widget-default-completions): Rename from widget-default-complete, rewrite.
(widget-string-complete, widget-file-complete, widget-color-complete):
Remove functions.
(file, symbol, function, variable, coding-system, color):
* lisp/international/mule-cmds.el (default-input-method, charset)
(language-info-custom-alist):
* lisp/cus-edit.el (face): Use new property :completions.
* lisp/progmodes/pascal.el (pascal-completions-at-point): New function.
(pascal-mode): Use it.
(pascal-mode-map): Use completion-at-point.
(pascal-toggle-completions): Make obsolete.
(pascal-complete-word, pascal-show-completions):
* lisp/progmodes/octave-mod.el (octave-complete-symbol):
Redefine as obsolete alias.
* lisp/progmodes/octave-inf.el (inferior-octave-completion-at-point):
Signal absence of completion info for old Octave,
(inferior-octave-complete): Redefine as obsolete alias.
* lisp/progmodes/meta-mode.el: Use lexical-binding and completion-at-point.
(meta-completions-at-point): Rename from meta-complete-symbol and
adapt it for use on completion-at-point-functions.
(meta-common-mode): Use it.
(meta-looking-at-backward, meta-match-buffer): Remove.
(meta-complete-symbol): Redefine as obsolete alias.
(meta-common-mode-map): Use completion-at-point.
* lisp/progmodes/make-mode.el: Use lexical-binding and completion-at-point.
(makefile-mode-map): Use completion-at-point.
(makefile-completions-at-point): Rename from makefile-complete and
adapt it for use on completion-at-point-functions.
(makefile-mode): Use it.
(makefile-complete): Redefine as obsolete alias.
Martin Rudalics [Sun, 19 Jun 2011 09:59:58 +0000 (11:59 +0200)]
Sanitize processing of display specifiers; new option frame-auto-delete.
* window.el (display-buffer-other-window-means-other-frame):
Call display-buffer-normalize-alist.
(display-buffer-normalize-specifiers-1): Rename to
display-buffer-normalize-argument. New argument other-frame.
Rewrite.
(display-buffer-normalize-specifiers-2): Rename to
display-buffer-normalize-options.
(display-buffer-normalize-alist-1): New function.
(display-buffer-normalize-specifiers-3): Rename to
display-buffer-normalize-alist. Call
display-buffer-normalize-alist-1.
(display-buffer-normalize-options-inhibit): New variable.
(display-buffer-normalize-specifiers): Rewrite calling
display-buffer-normalize-alist,
display-buffer-normalize-argument, and
display-buffer-normalize-options. Don't call the latter if
display-buffer-normalize-options-inhibit is non-nil.
(frame-auto-delete): New option.
(window-deletable-p): Use frame-auto-delete.
Teodor Zlatanov [Sat, 18 Jun 2011 22:23:55 +0000 (22:23 +0000)]
auth-source.el (auth-source-netrc-use-gpg-tokens): Replace `auth-source-save-secrets' with a more sensitive alist that can be configured per file. Experimental, so defaults to 'never.
(auth-source-netrc-create): Use it. Still experimental code.
(with-auth-source-epa-overrides): Use `find-file-hooks' if `find-file-hook' is unbound (XEmacs fix). Fix backquoting bug.
Chong Yidong [Sat, 18 Jun 2011 19:15:06 +0000 (15:15 -0400)]
Fixes for GLYPH_DEBUG.
* dispnew.c (add_window_display_history): Use BVAR.
* xdisp.c (debug_method_add): Use BVAR.
(check_window_end, dump_glyph_matrix, dump_glyph)
(dump_glyph_row, dump_glyph_string): Convert arglist to ANSI C.
Chong Yidong [Sat, 18 Jun 2011 16:23:11 +0000 (12:23 -0400)]
Use define-derived-mode in delphi-mode.
* lisp/progmodes/delphi.el (delphi-mode-syntax-table): Use defvar.
(delphi-mode): Use define-derived-mode to inherit from prog-mode.
Remove unused argument.
Martin Rudalics [Sat, 18 Jun 2011 14:23:14 +0000 (16:23 +0200)]
Additional fixes in handling of buffer display specifiers.
* window.el (display-buffer-default-specifiers): Remove
pop-up-frame. Add pop-up-window-min-height,
pop-up-window-min-width, and another reuse-window specifier
(Bug#8882). Reported by Dan Nicolaescu <dann@gnu.org>.
(display-buffer-normalize-specifiers-2): Handle
split-height-threshold and split-width-threshold also when
pop-up-windows is unset. Add a reuse-window specifier for the
case popping up a new window fails.
(special-display-popup-frame): Remove double quoting.
Stefan Monnier [Fri, 17 Jun 2011 18:52:46 +0000 (14:52 -0400)]
* lisp/pcomplete.el: Convert to lexical binding and fix bug#8819.
(pcomplete-suffix-list): Mark as obsolete.
(pcomplete-completions-at-point): Capture pcomplete-norm-func and
pcomplete-seen in the closure.
(pcomplete-comint-setup): Setup completion-at-point as well.
(pcomplete--entries): New function.
(pcomplete--env-regexp): New var.
(pcomplete-entries): Rewrite to work with partial-completion and
without relying on pcomplete-suffix-list.
(pcomplete-pare-list): Remove, unused.
* lisp/shell.el (shell-completion-vars): Set pcomplete-termination-string
according to comint-completion-addsuffix.
Martin Rudalics [Fri, 17 Jun 2011 14:50:11 +0000 (16:50 +0200)]
Rewrite display-buffer-alist and display-buffer-normalize-specifiers.
* window.el (display-buffer-alist): Set pop-up-window-min-height
and pop-up-window-min-width in default value. Reported by
Thierry Volpiatto <thierry.volpiatto@gmail.com>. New specifier
other-window-means-other-frame.
(display-buffer-macro-specifiers): Comment out entry for
other-window specifier.
(display-buffer-other-window-means-other-frame): New function.
(display-buffer-normalize-specifiers-1): New arguments
buffer-name and label. Treat other-window case specially.
(display-buffer-normalize-specifiers-2): Treat other-window case
specially.
(display-buffer-normalize-specifiers-3): New function.
(display-buffer-normalize-specifiers): Call
display-buffer-normalize-specifiers-3.
Martin Rudalics [Fri, 17 Jun 2011 08:45:37 +0000 (10:45 +0200)]
Fix handling of old `display-buffer' options (bug#8851) (bug#8856).
* window.el (display-buffer-normalize-specifiers-1): Don't
check pop-up-frames for 'unset initialization.
(display-buffer-normalize-specifiers-2): Major rewrite using
special-display-p and same-window-p (Bug#8851) and (Bug#8856).
(pop-up-frames, display-buffer-reuse-frames)
(display-buffer-mark-dedicated): Don't initialize to 'unset.
Suggested by David Engster <deng@randomsample.de>.
(even-window-heights): Initialize to 'unset.
(display-buffer-alist-set): Handle new 'unset initializations.
Paul Eggert [Thu, 16 Jun 2011 21:18:12 +0000 (14:18 -0700)]
Improve buffer-overflow checking.
* fileio.c (Finsert_file_contents):
* insdel.c (insert_from_buffer_1, replace_range, replace_range_2):
Remove the old (too-loose) buffer overflow checks.
They weren't needed, since make_gap checks for buffer overflow.
* insdel.c (make_gap_larger): Catch buffer overflows that were missed.
The old code merely checked for Emacs fixnum overflow, and relied
on undefined (wraparound) behavior. The new code avoids undefined
behavior, and also checks for ptrdiff_t and/or size_t overflow.
Martin Rudalics [Thu, 16 Jun 2011 09:21:56 +0000 (11:21 +0200)]
Never ever pop up a new frame in noninteractive mode (bug#8857).
(display-buffer): Don't check noninteractive when calling
display-buffer-pop-up-frame.
(display-buffer-pop-up-frame): Never pop up a frame in
noninteractive mode (Bug#8857).
Martin Rudalics [Thu, 16 Jun 2011 07:31:51 +0000 (09:31 +0200)]
Improve cohabitation of pop-up-frames and second argument of display-buffer (bug#8865).
* window.el (display-buffer-normalize-specifiers-1): Respect
current value of pop-up-frames for most reasonable values of
second argument of display-buffer (Bug#8865).
Teodor Zlatanov [Thu, 16 Jun 2011 06:18:18 +0000 (06:18 +0000)]
Merge changes made in Gnus trunk.
auth-source.el (auth-source-save-secrets): New variable to control if secret tokens should be saved encrypted.
(auth-source-netrc-parse, auth-source-netrc-search): Pass the file name to `auth-source-netrc-normalize'.
(with-auth-source-epa-overrides): Add convenience macro. Don't depend on the EPA variables being defined.
(auth-source-epa-make-gpg-token): Convert text to a "gpg:" token.
(auth-source-netrc-normalize): Convert "gpg:" tokens back to text in the lexical-let closure.
(auth-source-netrc-create): Create "gpg:" tokens according to `auth-source-save-secrets'.
(open-network-stream): Add the keyword :always-query-capabilities.
This is for the case where you want to force a `plain' network
connection, but the protocol still requires the capabilitiy command
(i.e., SMTP and EHLO).
Alan Mackenzie [Wed, 15 Jun 2011 18:24:25 +0000 (18:24 +0000)]
progmodes/cc-fonts.el (c-font-lock-declarations): 1: Whilst checking for
declarators, disable knr checking to speed up for normal files. 2:
Refactor, replacing a sequence of nested if forms by a cond form.
Martin Rudalics [Wed, 15 Jun 2011 07:09:47 +0000 (09:09 +0200)]
Don't let display-buffer pop up new frames by default (bug#8857).
* window.el (display-buffer-alist): Trim default value to avoid
popping up a new frame (Bug#8857) or reusing an arbitrary window
on another frame.
(display-buffer): Do not fall back on popping up a new frame in
batch mode (Bug#8857).
Paul Eggert [Tue, 14 Jun 2011 22:32:12 +0000 (15:32 -0700)]
* fns.c: Don't overflow int when computing a list length.
(Fsafe_length): Return a float if the value is not representable
as a fixnum. This shouldn't happen except in contrived situations.
Use same QUIT_COUNT_HEURISTIC as Flength now does.
Paul Eggert [Tue, 14 Jun 2011 22:01:32 +0000 (15:01 -0700)]
* fns.c (Flength): Don't overflow int when computing a list length.
Use EMACS_INT, not int, to avoid unwanted truncation on 64-bit hosts.
Check for QUIT every 1024 entries rather than every other entry;
that's faster and is responsive enough. Report an error instead of
overflowing an integer.
Paul Eggert [Tue, 14 Jun 2011 21:30:16 +0000 (14:30 -0700)]
* alloc.c: Check that resized vectors' lengths fit in fixnums.
(header_size, word_size): New constants.
(allocate_vectorlike): Don't check size overflow here.
(allocate_vector): Check it here instead, since this is the only
caller of allocate_vectorlike that could cause overflow.
Check that the new vector's length is representable as a fixnum.
Jan Djärv [Tue, 14 Jun 2011 21:08:20 +0000 (23:08 +0200)]
Fix resize and change of scroll bar width for Gtk3.
* configure.in: Add emacsgtkfixed.o to GTK_OBJ if HAVE_GTK3.
* src/emacsgtkfixed.c, src/emacsgtkfixed.h: New files.
* src/gtkutil.c: Include src/emacsgtkfixed.h if HAVE_GTK3.
(int_gtk_range_get_value): Move to the scroll bar part of the file.
(style_changed_cb): Call update_theme_scrollbar_width and call
x_set_scroll_bar_default_width and xg_frame_set_char_size for
all frames.
(xg_create_frame_widgets): Call emacs_fixed_new if HAVE_GTK3 (Bug#8505).
Call gtk_window_set_resizable if HAVE_GTK3.
(x_wm_set_size_hint): Call emacs_fixed_set_min_size with min width
and height if HAVE_GTK3 (Bug#8505).
(scroll_bar_width_for_theme): New variable.
(update_theme_scrollbar_width): New function.
(xg_get_default_scrollbar_width): Move code to
update_theme_scrollbar_width, just return scroll_bar_width_for_theme.
(xg_initialize): Call update_theme_scrollbar_width.
Paul Eggert [Tue, 14 Jun 2011 20:57:33 +0000 (13:57 -0700)]
* fns.c (next_almost_prime): Don't return a multiple of 3 or 5.
The previous code was bogus. For example, next_almost_prime (32)
returned 39, which is undesirable as it is a multiple of 3; and
next_almost_prime (24) returned 25, which is a multiple of 5 so
why was the code bothering to check for multiples of 7?
Paul Eggert [Tue, 14 Jun 2011 18:57:19 +0000 (11:57 -0700)]
Variadic C functions now count arguments with ptrdiff_t.
This partly undoes my 2011-03-30 change, which replaced int with size_t.
Back then I didn't know that the Emacs coding style prefers signed int.
Also, in the meantime I found a few more instances where arguments
were being counted with int, which may truncate counts on 64-bit
machines, or EMACS_INT, which may be unnecessarily wide.
* lisp.h (struct Lisp_Subr.function.aMANY)
(DEFUN_ARGS_MANY, internal_condition_case_n, safe_call):
Arg counts are now ptrdiff_t, not size_t.
All variadic functions and their callers changed accordingly.
(struct gcpro.nvars): Now size_t, not size_t. All uses changed.
* bytecode.c (exec_byte_code): Check maxdepth for overflow,
to avoid potential buffer overrun. Don't assume arg counts fit in 'int'.
* callint.c (Fcall_interactively): Check arg count for overflow,
to avoid potential buffer overrun. Use signed char, not 'int',
for 'varies' array, so that we needn't bother to check its size
calculation for overflow.
* editfns.c (Fformat): Use ptrdiff_t, not EMACS_INT, to count args.
* eval.c (apply_lambda):
* fns.c (Fmapconcat): Use XFASTINT, not XINT, to get args length.
(struct textprop_rec.argnum): Now ptrdiff_t, not int. All uses changed.
(mapconcat): Use ptrdiff_t, not int and EMACS_INT, to count args.