Prefer 'x_display_info *' to 'Display *' in X selection code.
This helps to avoid unneeded calls to x_display_info_for_display.
* xterm.h (struct selection_input_event): Record 'x_display_info *'
instead of 'Display *'.
(SELECTION_EVENT_DPYINFO): New macro.
(SELECTION_EVENT_DISPLAY): Now inline function to prohibit using
it as an lvalue. Mention this in comment.
* xterm.c (handle_one_xevent): Use SELECTION_EVENT_DPYINFO.
* xselect.c (x_get_window_property_as_lisp_data, x_atom_to_symbol)
(selection_data_to_lisp_data, receive_incremental_selection):
Convert to use 'x_display_info *'. Adjust users where appropriate.
(lisp_data_to_selection_data): Likewise. Also pass 'struct
selection data *' as last arg to not return values in args.
(unexpect_property_change): Use common removal technique.
* frame.h (enum fullscreen_type) [HAVE_WINDOW_SYSTEM]: Use more natural
values. Add comment.
(struct frame): Re-arrange layout to avoid extra padding and use bit
fields for output_method, want_fullscreen and vertical_scroll_bar_type.
(FRAME_VERTICAL_SCROLL_BAR_TYPE, FRAME_HAS_VERTICAL_SCROLL_BARS)
(FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT)
(FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT) [!HAVE_WINDOW_SYSTEM]:
Define as no-ops because there are no scroll bars anyway.
* frame.c (make_frame, make_terminal_frame, make_initial_frame):
Adjust users.
* font.c (fset_font_data) [HAVE_XFT || HAVE_FREETYPE]:
Add convenient setter.
(font_put_frame_data, font_get_frame_data): Use it.
More precise control over values of some buffer-local variables.
* keyboard.c (Qvertical_scroll_bar):
* frame.c (Qleft, Qright): Move to ...
* buffer.c (Qleft, Qright, Qvertical_scroll_bar): ... here.
* buffer.c (Qchoice, Qrange, Qoverwrite_mode, Qfraction): New symbols.
(syms_of_buffer): DEFSYM all of the above, attach special properties.
Use special symbols to DEFVAR_PER_BUFFER overwrite-mode,
vertical-scroll-bar, scroll-up-aggressively
and scroll-down-aggressively.
* buffer.h (Qchoice, Qrange, Qleft, Qright, Qvertical_scroll_bar):
Add declarations.
* nsfns.m, frame.h (Qleft, Qright):
* nsterm.m (Qleft): Remove declarations.
* gtkutil.c (toplevel): Include buffer.h.
* data.c (wrong_choice, wrong_range): New functions.
(store_symval_forwarding): Handle special properties of buffer-local
variables and use functions from the above to signal error, if any.
Suggested by Jan Djärv in:
https://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00203.html
* w32gui.h (XChar2b, STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2):
Move the fallback definitions to dispextern.h.
* nsgui.h (XChar2b, STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2):
Likewise. Share the same definition with W32.
* xterm.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Move to ...
* dispextern.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2):
... here for the consistency with W32 and NS.
* lwlib/lwlib.h (toplevel): Use unsigned int for LWLIB_ID.
* src/xmenu.c (toplevel): Use LWLIB_ID for next_menubar_widget_id.
(pop_down_menu) [USE_X_TOOLKIT]: Accept integer arg.
(create_and_show_popup_menu, create_and_show_dialog) [USE_X_TOOLKIT]:
Use record_unwind_protect_int and avoid consing.
(syms_of_xmenu) [USE_X_TOOLKIT]: Declare WIDGET_ID_TICK_START.
Paul Eggert [Mon, 14 Jul 2014 19:23:18 +0000 (12:23 -0700)]
Use binary-io module, O_BINARY, and "b" flag.
* admin/merge-gnulib (GNULIB_MODULES): Add binary-io. It was already
present implicitly; this just makes the dependence explicit.
* lib-src/etags.c, lib-src/hexl.c, lib-src/make-docfile.c:
Include binary-io.h instead of fcntl.h and/or io.h.
(main): Use set_binary_mode or SET_BINARY
in place of handcrafted code.
* lib-src/etags.c (main) [DOS_NT]:
* lib-src/movemail.c (main) [WINDOWSNT]:
Don't mess with _fmode.
* lib-src/etags.c (main, process_file_name, analyse_regex):
Use fopen/popen's "b" flag instead.
* lib-src/movemail.c (main, popmail): Use open/lk_open/mkostemp's O_BINARY
instead.
* src/callproc.c (create_temp_file): Use mkostemp's O_BINARY flag.
* src/emacs.c [MSDOS]:
* src/emacs.c (main) [DOS_NT]: Don't mess with _fmode.
(main) [MSDOS]: Use SET_BINARY instead of setmode.
* src/minibuf.c: Include binary-io.h instead of fcntl.h.
(read_minibuf_noninteractive):
Use set_binary_mode instead of handcrafted code.
Don't call emacs_set_tty if emacs_get_tty failed.
* src/sysdep.c, src/systty.h (emacs_get_tty): Return int, not void.
* src/sysdep.c (emacs_open, emacs_pipe): Use O_BINARY.
* src/w32.c (pipe2): Adjust eassert to include O_BINARY.
* lisp.h (CHECK_VECTOR_OR_STRING): Return number of elements
or characters in string, respectively. Add comment.
* fringe.c (Fdefine_fringe_bitmap):
* fns.c (Fsubstring, substring_both): Use it.
* keymap.c (Fdefine_key, Flookup_key):
* macros.c (Fstart_kbd_macro): Likewise. Avoid call to Flength.
Paul Eggert [Mon, 14 Jul 2014 00:45:19 +0000 (17:45 -0700)]
* make-docfile.c: Simplify a bit, to simplify further refactoring.
(outfile): Remove static var. All uses changed to use stdout,
since it's always stdout anyway. While we're at it, prefer
putchar/puts/fputs to printf when there are no format strings.
(main): Use freopen rather than fopen, so that stdout is reused.
Move O_BINARY stuff after the freopen, so it affects the
reopened file.
(write_c_args): Omit first arg, since it's always stdout now.
All uses changed.
Paul Eggert [Sun, 13 Jul 2014 15:50:35 +0000 (08:50 -0700)]
Improve behavior of 'bzr up; cd src; make -k'.
* Makefile.in (ACLOCAL_INPUTS): Add all m4/*.m4 files.
* src/Makefile.in (top_srcdir): New var.
(ntsource, lispsource, ALL_CFLAGS, gl-stamp, emacs.res):
Use '$(top_srcdir)' instead of '$(srcdir)/..';
its expansion is a bit shorter.
(../config.status): Actually build config.status instead of
just complaining.
(ACLOCAL_INPUTS, AUTOCONF_INPUTS):
New macros, copied and relocated from ../Makefile.in.
($(top_srcdir)/aclocal.m4, $(top_srcdir)/configure, config.in)
(../config.status, Makefile): New dependencies and rules,
copied with relocation from ../Makefile.in. This should be more
likely to rebuild the build machinery properly if you do a 'make'
in the src directory.
Eli Zaretskii [Sun, 13 Jul 2014 14:49:59 +0000 (17:49 +0300)]
Fix bug #17986 with infloop in redisplay when default-directory is nil.
src/xdisp.c (decode_mode_spec): Call file-remote-p on the current
buffer's default-directory only if it is a string.
lisp/bindings.el (mode-line-remote): If default-directory is not a
string, don't call file-remote-p on it; instead state in the
help-echo that it is nil.
Eli Zaretskii [Sat, 12 Jul 2014 09:25:29 +0000 (12:25 +0300)]
Document the behavior of file selection dialogs on Windows 7 (bug #17950).
etc/PROBLEMS: Mention the problem from bug #17950.
src/w32fns.c (Fx_file_dialog): Mention in the doc string the
behavior on Windows 7 and later when the function is repeatedly
invoked with the same value of DIR.
src/xfns.c (Fx_file_dialog) [USE_MOTIF, USE_GTK]: Update the doc
string to match the one in w32fns.c.
Paul Eggert [Fri, 11 Jul 2014 17:55:24 +0000 (10:55 -0700)]
Coalesce extern decls.
* minibuf.c (emacs_get_tty, emacs_set_tty, suppress_echo_on_tty):
* sysdep.c (emacs_get_tty, emacs_set_tty):
Move duplicate extern decls from here ...
* systty.h: ... to here, so that there's just one copy.
Eli Zaretskii [Fri, 11 Jul 2014 13:58:02 +0000 (16:58 +0300)]
Implement echo suppression in non-interactive mode for MS-Windows.
src/minibuf.c (read_minibuf_noninteractive): Finish reading on '\r',
not only on '\n'.
src/sysdep.c (emacs_get_tty, emacs_set_tty, suppress_echo_on_tty)
[DOS_NT]: Implement for WINDOWSNT.
src/systty.h (struct emacs_tty) [DOS_NT]: The struct member is now
unsigned.
Eli Zaretskii [Fri, 11 Jul 2014 10:09:51 +0000 (13:09 +0300)]
Implement memory-info for MS-DOS.
src/dosfns.c (dos_memory_info): New function.
src/dosfns.h (dos_memory_info): Add prototype.
src/alloc.c (Fmemory_info) [MSDOS]: Call dos_memory_info.
src/vm-limit.c (get_lim_data) [MSDOS]: Call dos_memory_info, instead
of doing some of its job.
Michael Albinus [Fri, 11 Jul 2014 09:09:54 +0000 (11:09 +0200)]
Hide password in batch mode
* doc/lispref/minibuf.texi (Intro to Minibuffers, Reading a Password):
Password hiding is available in batch mode, do not mention it in
the exclusion list. Mention `read-hide-char'.
* lisp/subr.el (read-passwd): Use `read-hide-char' if non-nil. Bind it
when calling `read-string'.
* src/minibuf.c (top): Include systty.h. Declare external
emacs_get_tty and emacs_set_tty.
(Vread_hide_char): New lisp variable.
(read_minibuf_noninteractive): Hide characters with
Vread_hide_char if it is a character.
* src/sysdep.c (emacs_get_tty, emacs_set_tty): Make them externally visible.
* configure.ac: Check whether sys/sysinfo.h provides
Linux 'sysinfo' function and 'struct sysinfo' type.
* src/alloc.c (Fmemory_info): New function.
* lisp/files.el (warn-maybe-out-of-memory): New function.
(find-file-noselect): Use it.
Next minor cleanup of font subsystem.
* font.h (enum font_property_index): Remove FONT_ENTITY_INDEX (no
users) and FONT_FORMAT_INDEX (set by a few font drivers but never
really used).
(FONT_ENTITY_NOT_LOADABLE, FONT_ENTITY_SET_NOT_LOADABLE): Remove;
unused.
* ftfont.h (ftfont_font_format): Remove prototype.
* ftfont.c (ftfont_font_format): Remove; now unused.
(ftfont_open):
* nsfont.m (nsfont_open):
* w32font.c (w32font_open_internal):
* w32uniscribe.c (uniscribe_open):
* xfont.c (xfont_open):
* xftfont.c (xftfont_open): All users changed.
* lisp/progmodes/python.el
(python-rx-constituents): Add dedenter and block-ender.
(python-indent-dedenters, python-indent-block-enders): Delete.
(python-indent-context): Return new case for dedenter-statement.
(python-indent-calculate-indentation): Handle new case.
(python-indent-calculate-levels): Fix levels calculation for
dedenter statements.
(python-indent-post-self-insert-function): Fix colon handling.
(python-info-dedenter-opening-block-message): New function.
(python-indent-line): Use it.
(python-info-closing-block)
(python-info-closing-block-message): Remove.
(python-info-dedenter-opening-block-position)
(python-info-dedenter-opening-block-positions)
(python-info-dedenter-statement-p): New functions.
Stefan Monnier [Tue, 8 Jul 2014 16:51:35 +0000 (12:51 -0400)]
* lisp/progmodes/perl-mode.el: Use syntax-ppss; fix one indentation case.
(perl-indent-line): Use syntax-ppss to detect we're in a doc-section.
(perl-continuation-line-p): Don't skip over anything else than labels.
Return the previous char.
(perl-calculate-indent): Use syntax-ppss instead of parse-start
and update callers accordingly. For continuation lines, check the
the case of array hashes.
(perl-backward-to-noncomment): Make it non-interactive.
(perl-backward-to-start-of-continued-exp): Rewrite.
* test/indent/perl.perl: Add indentation pattern for hash-table entries.
* font.c (font_build_object) [HAVE_XFT || HAVE_FREETYPE || HAVE_NS]:
New function, with an intention to avoid code duplication between
a few font drivers.
* font.h (font_build_object) [HAVE_XFT || HAVE_FREETYPE || HAVE_NS]:
Add prototype.
* ftfont.c (ftfont_open):
* macfont.m (macfont_open):
* xftfont.c (xftfont_open): Use it.
Juri Linkov [Tue, 8 Jul 2014 08:55:00 +0000 (11:55 +0300)]
* lisp/facemenu.el (list-colors-print): In help-echo format use %.2f
instead of %d because now HSV values are floating-point components
between 0.0 and 1.0.
Juri Linkov [Tue, 8 Jul 2014 08:49:18 +0000 (11:49 +0300)]
* lisp/vc/vc-annotate.el (vc-annotate-background-mode): New defcustom.
(vc-annotate-color-map): Use less saturated colors (20%) for
background-mode.
(vc-annotate-very-old-color): Add default value for background-mode.
(vc-annotate-background): Set default value to nil since now text on
the default backgrounds should be legible in light and dark modes.
(vc-annotate-lines): Use `vc-annotate-background-mode'. Doc fix.
Juri Linkov [Tue, 8 Jul 2014 08:02:50 +0000 (11:02 +0300)]
* lisp/window.el (with-displayed-buffer-window): New macro.
(with-temp-buffer-window, with-current-buffer-window):
Use `macroexp-let2' to evaluate and bind variables
in the same order as macro arguments.
(display-buffer--action-function-custom-type): Add
`display-buffer-below-selected' and `display-buffer-at-bottom'.
* lisp/minibuffer.el (minibuffer-completion-help): Replace
`with-output-to-temp-buffer' with `with-displayed-buffer-window'
with actions that display *Completions* at-bottom when called
from the minibuffer, or below-selected in a normal buffer.
Associate `window-height' with `fit-window-to-buffer'.
Let-bind `pop-up-windows' to nil.
* lisp/dired.el (dired-mark-pop-up): Use `with-displayed-buffer-window'
instead of `with-current-buffer-window'.
* chartab.c (char_table_translate): Move to...
* character.h (char_table_translate): ... inline function here.
Avoid Faref and assume that args are always valid. This helps to
speedup search, which is especially important for a huge buffers.
* lisp.h (char_table_translate): Remove prototype.
Paul Eggert [Tue, 8 Jul 2014 06:24:07 +0000 (23:24 -0700)]
* process.c: Add sanity checks for file descriptors.
(wait_reading_process_output, Fprocess_filter_multibyte_p):
Check that infd is nonnegative before using it as an fd.
(read_and_dispose_of_process_output, Fprocess_send_eof):
Likewise, for outfd.
(wait_reading_process_output): Omit unnecessary check of infd.
Paul Eggert [Mon, 7 Jul 2014 23:25:13 +0000 (16:25 -0700)]
Minor ImageMagick safety fixes.
* image.c (imagemagick_compute_animated_image):
Remove useless assignment to local. Avoid problems if dest_width is 0.
(imagemagick_load_image): Use int for pixel counts that can't
exceed INT_MAX. Avoid problem if PixelGetNextIteratorRow returns
a row width greater than the image width (or greater than LONG_MAX!).
Luke Lee [Mon, 7 Jul 2014 08:59:32 +0000 (16:59 +0800)]
HideIfDef mode bug fixes and enhancements. This is #3 of 3 patches based
on the completed work posted on http://www.emacswiki.org/emacs/HideIfDef.
- Add macro evaluation function and key binding for a marked region.
- Merge continuous "..." lines into one.
- Fix old hideif bugs that fail to hide the correct #elif regions
- Support hide/show commands in a marked region.
- Expand top level for .h files to prevent re-inclusion protection.
- Change maintainer.
* lisp/progmodes/hideif.el (hide-ifdef-env): Change to global.
(hide-ifdef-env-backup): New variable.
(hide-ifdef-expand-reinclusion-protection, hide-ifdef-header-regexp):
New customizable variables.
(hif-clear-all-ifdef-defined): New defun.
(hif-merge-ifdef-region, hide-ifdef-region-internal, hide-ifdef-region)
(hif-show-ifdef-region): Merge hidden regions to prevent continuous "...".
(hif-tokenize): Fix for MS-DOS/Win EOL style.
(hif-endif-to-ifdef, hif-make-range, hif-find-range, hif-possibly-hide):
Fix bug to hide the correct #elif region(s).
(hif-range-elif): New defun.
(hif-recurse-level): New var.
(hif-evaluate-region, hif-evaluate-macro): New defun.
(hide-ifdef-guts): Prevent reinclusion protected C/C++ headers from
fully hidden.
(hide-ifdef-define, hide-ifdefs, hide-ifdef-block, show-ifdef-block):
Better interaction.
Stephen Berman [Sun, 6 Jul 2014 20:28:38 +0000 (22:28 +0200)]
* calendar/todo-mode.el: Fix wrong-type-argument error when
marking multiple consecutive items.
(todo-toggle-mark-item): Don't try to mark the empty lines at the
end of the todo and done items sections. Note in doc string that
items marked by passing a numeric prefix argument can include the
last todo and first done items.
(todo-mark-category): Don't try to mark the empty line between the
todo and done items sections.