* lisp/progmodes/python.el (python-shell--package-depth): New var.
(python-shell-package-enable): New command.
(python-util-list-directories, python-util-list-files)
(python-util-list-packages): New functions.
* lisp/progmodes/python.el:
(python-comint-output-filter-function): Make obsolete.
(python-comint-postoutput-scroll-to-bottom): New function.
(inferior-python-mode): Set comint-output-filter-functions to a
minimum.
* lisp/progmodes/python.el:
(python-shell-prompt-input-regexps): Add iPython block prompt.
(python-shell-output-syntax-table): Delete var.
(python-shell-font-lock-with-font-lock-buffer): New macro.
(python-shell-font-lock-get-or-create-buffer)
(python-shell-font-lock-kill-buffer)
(python-shell-font-lock-cleanup-buffer)
(python-shell-font-lock-post-command-hook)
(python-shell-font-lock-turn-off): New functions.
(python-shell-font-lock-turn-on): New function.
(inferior-python-mode): Use it.
(python-shell-font-lock-toggle): New command.
(python-shell-font-lock-enable): Rename from
python-shell-enable-font-lock.
(run-python-internal): Use it.
(python-shell-font-lock-comint-output-filter-function): New function.
(python-shell-comint-end-of-output-p): New function.
(python-shell-output-filter): Use it.
(python-util-comint-last-prompt): New function.
(python-util-text-properties-replace-name): New function.
Paul Eggert [Sat, 26 Jul 2014 13:17:25 +0000 (06:17 -0700)]
Revert previous change.
There is certainly nothing wrong with writing code like 'lo <= i
&& i <= hi', even if LO happens to a constant. There isn't even
anything wrong in general with writing 'a <= b' if A happens to
be a constant. At any rate stylistic changes shouldn't
be done like this without discussion.
Work around the failures in icalendar-tests which occasionally occur
on hydra.nixos.org.
* automated/icalendar-tests.el (icalendar-tests--do-test-import):
Work around the failures in icalendar-tests which occasionally occur on
hydra.nixos.org.
Fix error reported by Angelo Graziosi <angelo.graziosi@alice.it> in
<http://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00274.html>
and complete previous change.
* frame.c (adjust_frame_height): New function.
(Fset_frame_height, Fset_frame_size): Use it.
(x_set_frame_parameters): Take frame top margin into account.
* frame.c (Fset_frame_height): Take frame top margin into account.
Incorrect behavior was reported by Martin Rudalics <rudalics@gmx.at> in
<http://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00258.html>
* xterm.h (struct x_output) [USE_LUCID && USE_TOOLKIT_SCROLL_BARS]:
Define scroll_bar_top_shadow_pixel and scroll_bar_bottom_shadow_pixel
as such. All related users changed.
Stefan Monnier [Mon, 21 Jul 2014 01:56:54 +0000 (21:56 -0400)]
* lisp/emacs-lisp/edebug.el: Use nadvice.
(edebug-original-read): Remove.
(edebug--read): Rename from edebug-read and add `orig' arg.
(edebug-uninstall-read-eval-functions)
(edebug-install-read-eval-functions): Use nadvice.
(edebug-read-sexp, edebug-read-storing-offsets, edebug-read-symbol)
(edebug-read-and-maybe-wrap-form1, edebug-instrument-callee)
(edebug-read-string, edebug-read-function): Use just `read'.
(edebug-original-debug-on-entry): Remove.
(edebug--debug-on-entry): Rename from edebug-debug-on-entry and add
`orig' arg.
(debug-on-entry): Override with nadvice.
* lisp/progmodes/python.el:
(python-shell-completion-setup-code): New value supporting iPython.
(python-shell-completion-string-code): New value supporting iPython.
(python-shell-completion-get-completions): Use them.
(python-shell-completion-module-string-code): Make obsolete.
(python-shell-prompt-input-regexps)
(python-shell-prompt-output-regexps): Add safeguard for ipdb.
(python-shell-output-filter): Fix comment typo.
* frame.h (struct frame) [USE_X_TOOLKIT]: New member shell_position.
* xfns.c (x_window): Use it to allow xfree later.
(x_encode_text): Drop 3rd arg; unused. Tweak comment and adjust users
where appropriate. Use bool for booleans and remove redundant checks.
(Fx_backspace_delete_keys_p): Use XkbFreeKeyboard; explain why.
* xterm.c (x_free_frame_resources): Free shell_position.
* nsterm.m (applicationDidFinishLaunching:): Call
antialiasThresholdDidChange, register for antialias changes.
(antialiasThresholdDidChange:): New method for EmacsApp.
* lisp/progmodes/python.el:
(python-shell-interpreter-interactive-arg)
(python-shell-prompt-detect-enabled)
(python-shell-prompt-detect-failure-warning)
(python-shell-prompt-input-regexps)
(python-shell-prompt-output-regexps): New vars.
(python-shell-prompt-calculated-input-regexp)
(python-shell-prompt-calculated-output-regexp): New vars.
(python-shell-get-process-name)
(python-shell-internal-get-process-name)
(python-shell-output-filter)
(python-shell-completion-get-completions): Use them.
(python-shell-prompt-detect)
(python-shell-prompt-validate-regexps): New functions.
(python-shell-prompt-set-calculated-regexps): New function.
(inferior-python-mode): Use it. Also honor overriden
python-shell-interpreter and python-shell-interpreter-args.
(python-shell-make-comint): Honor overriden
python-shell-interpreter and python-shell-interpreter-args.
(python-shell-get-or-create-process): Make it testable by allowing
to call run-python non-interactively.
(python-util-valid-regexp-p): New function.
(python-shell-prompt-regexp, python-shell-prompt-block-regexp)
(python-shell-prompt-output-regexp)
(python-shell-prompt-pdb-regexp): Use it as defcustom :safe.
* test/automated/python-tests.el (python-shell-make-comint-1):
(python-shell-make-comint-2): Fix indentation.
(python-shell-make-comint-3)
(python-shell-make-comint-4): New tests.
(python-shell-get-or-create-process-1): Fix test.
(python-shell-get-or-create-process-2)
(python-shell-get-or-create-process-3): New tests.
(python-shell-internal-get-or-create-process-1): Fix test.
(python-shell-prompt-detect-1): New test.
(python-shell-prompt-detect-2): New test. (Bug#17370)
(python-shell-prompt-detect-3)
(python-shell-prompt-detect-4)
(python-shell-prompt-detect-5)
(python-shell-prompt-detect-6)
(python-shell-prompt-validate-regexps-1)
(python-shell-prompt-validate-regexps-2)
(python-shell-prompt-validate-regexps-3)
(python-shell-prompt-validate-regexps-4)
(python-shell-prompt-validate-regexps-5)
(python-shell-prompt-validate-regexps-6)
(python-shell-prompt-validate-regexps-7)
(python-shell-prompt-set-calculated-regexps-1)
(python-shell-prompt-set-calculated-regexps-2)
(python-shell-prompt-set-calculated-regexps-3)
(python-shell-prompt-set-calculated-regexps-4)
(python-shell-prompt-set-calculated-regexps-5)
(python-shell-prompt-set-calculated-regexps-6)
(python-util-valid-regexp-p-1): New tests.
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.
Eli Zaretskii [Thu, 17 Jul 2014 15:37:48 +0000 (18:37 +0300)]
Fix setting up coding-systems for clipboard access on MS-Windows and MS-DOS.
src/w32select.c (setup_windows_coding_system): Apply
CODING_ANNOTATION_MASK to the common_flags member of struct
coding_system. Reported by Martin Rudalics <rudalics@gmx.at>.
src/w16select.c (Fw16_get_clipboard_data): Apply
CODING_ANNOTATION_MASK to the common_flags member of struct
coding_system.
Eli Zaretskii [Thu, 17 Jul 2014 15:25:21 +0000 (18:25 +0300)]
Fix assertion violation when restoring hscrolled window configurations.
src/xdisp.c (hscroll_window_tree): Don't try hscrolling windows whose cursor
row has zero buffer position as their start position. Reported by
Martin Rudalics <rudalics@gmx.at>.
Eli Zaretskii [Thu, 17 Jul 2014 15:17:52 +0000 (18:17 +0300)]
Fix part of bug #18035 with overlay strings on invisible text.
src/xdisp.c (init_iterator): Initialize it->stop_charpos to the
buffer position where we are to start the iteration.
(handle_invisible_prop): Record in it->stop_charpos the position
where the invisible text ends.
Eli Zaretskii [Wed, 16 Jul 2014 18:39:35 +0000 (21:39 +0300)]
Fix bug #18036 with infloop in redisplay with huge fringes.
src/xdisp.c (move_it_vertically_backward, move_it_by_lines): Prevent
infinite looping in redisplay when display lines don't have enough
space to display even a single character.
* 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.