Dmitry Gutov [Wed, 9 Oct 2013 03:18:01 +0000 (06:18 +0300)]
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Indent after hanging
iuwu-mod token.
(ruby-smie--implicit-semi-p): Prohibit implicit semicolon after
hanging iuwu-mod token.
(ruby-smie--forward-token): Do not include a dot after a token in
that token.
(ruby-smie--backward-token): Likewise.
Juri Linkov [Tue, 8 Oct 2013 23:20:12 +0000 (02:20 +0300)]
* lisp/isearch.el (isearch-help-map, isearch-mode-map): Don't bind [t]
to isearch-other-control-char.
(isearch-mode): Add isearch-pre-command-hook to pre-command-hook
and isearch-post-command-hook to post-command-hook.
(isearch-done): Remove isearch-pre-command-hook from pre-command-hook
and isearch-post-command-hook from post-command-hook.
(isearch-unread-key-sequence)
(isearch-reread-key-sequence-naturally)
(isearch-lookup-scroll-key, isearch-other-control-char)
(isearch-other-meta-char): Remove functions.
(isearch-pre-command-hook, isearch-post-command-hook):
New functions based on isearch-other-meta-char rewritten
relying on the new behavior of overriding-terminal-local-map
that does not replace the local keymaps any more.
Paul Eggert [Tue, 8 Oct 2013 20:04:40 +0000 (13:04 -0700)]
Fix minor problems found by static checking.
* dispnew.c (save_current_matrix): Omit unnecessary casts.
* dispnew.c (update_frame_with_menu): Mark debug local as used.
* keyboard.c, keyboard.h (Qmouse_movement): Now static.
* keyboard.c (read_menu_command): Remove unused local.
* lisp.h (read_menu_command): New decl.
* menu.c, menu.h (menu_item_width): Arg is now unsigned char *, for
benefit of STRING_CHAR_AND_LENGTH. All uses changed.
Return ptrdiff_t, not int.
* term.c (tty_menu_struct): 'allocated' member is now ptrdiff_t,
not int, for benefit of xpalloc.
(tty_menu_create, tty_menu_make_room): Simplify by using xzalloc
and xpalloc.
(have_menus_p): Remove; unused.
(tty_menu_add_pane, tty_menu_add_selection): Change signedness of
local char * pointer to pacify STRING_CHAR_AND_LENGTH.
(tty_menu_add_selection, tty_menu_locate, tty_meny_destroy):
Now static.
(save_and_enable_current_matrix): Omit unnecessary casts.
(read_menu_input): Omit local extern decl (now in lisp.h).
Don't access uninitialized storage if mouse_get_xy fails.
(tty_menu_activate): Mark local as initialized, for lint.
(tty_menu_activate, tty_meny_show): Remove unused locals.
Eli Zaretskii [Tue, 8 Oct 2013 17:49:20 +0000 (20:49 +0300)]
Support menus on text-mode terminals.
src/xterm.h (xw_popup_dialog): Add prototype.
src/xmenu.c (Fx_popup_dialog): Function moved to menu.c.
(xmenu_show): Block input here, instead in Fx_popup_menu.
(xw_popup_dialog): New function, with X-specific bits of popup
dialogs.
src/xdisp.c (deep_copy_glyph_row, display_tty_menu_item): New
functions.
src/window.c (Fset_window_configuration): Use run-time tests of the
frame type instead of compile-time conditionals, when menu-bar
lines are considered.
src/w32term.h (w32con_hide_cursor, w32con_show_cursor)
(w32_popup_dialog): New prototypes.
src/w32menu.c (Fx_popup_dialog): Function deleted.
(w32_popup_dialog): New function, with w32 specific bits of popup
dialogs. Block input here.
src/w32inevt.c (w32_console_read_socket): Minor change to add
debugging TTY events.
src/w32fns.c (show_hourglass): If returning early because the frame
is not a GUI frame, unblock input.
src/w32console.c (w32con_hide_cursor, w32con_show_cursor, cursorX)
(cursorY): New functions.
src/termhooks.h (cursorX, cursorY): Prototypes of functions on
WINDOWSNT, macros that call curX and curY elsewhere.
src/termchar.h (struct tty_display_info) <showing_menu>: New flag.
src/term.c (tty_hide_cursor, tty_show_cursor) [WINDOWSNT]: Call w32
specific function to hide and show cursor on a text-mode terminal.
(tty_menu_struct, struct tty_menu_state): New structures.
(tty_menu_create, tty_menu_make_room, tty_menu_search_pane)
(tty_menu_calc_size, mouse_get_xy, tty_menu_display)
(have_menus_p, tty_menu_add_pane, tty_menu_add_selection)
(tty_menu_locate, save_and_enable_current_matrix)
(restore_desired_matrix, screen_update, read_menu_input)
(tty_menu_activate, tty_menu_destroy, tty_menu_help_callback)
(tty_pop_down_menu, tty_menu_last_menubar_item)
(tty_menu_new_item_coords, tty_menu_show): New functions.
(syms_of_term): New DEFSYMs for tty-menu-* symbols.
src/nsterm.h (ns_popup_dialog): Adjust prototype.
src/nsmenu.m (ns_menu_show): Block and unblock input here, instead
of in x-popup-menu.
(ns_popup_dialog): Adapt order of arguments to the other
*_menu_show implementations.
(Fx_popup_dialog): Function deleted.
src/msdos.c (x_set_menu_bar_lines): Delete unused function.
src/menu.h (tty_menu_show, menu_item_width): provide prototypes.
src/menu.c (have_boxes): New function.
(single_keymap_panes): Use it instead of a compile-time
conditional.
(single_menu_item): Use run-time tests of the frame type instead
of compile-time conditionals.
(encode_menu_string): New function.
(list_of_items, list_of_panes): Use it instead of ENCODE_STRING
the macro, since different types of frame need different encoding
of menu items.
(digest_single_submenu): Use run-time tests of frame type instead
of, or in addition to, compile-time conditionals.
(menu_item_width, Fmenu_bar_menu_at_x_y): New functions.
(Fx_popup_menu): Detect when the function is called from keyboard
on a TTY. Don't barf when invoked on a text-mode frame. Check
frame type at run time, instead of compile-time conditionals for
invoking terminal-specific menu-show functions. Call
tty_menu_show on text-mode frames.
(Fx_popup_dialog): Moved here from xmenu.c. Test frame types at
run time to determine which alternative to invoke; support dialogs
on TTYs.
src/keyboard.h <Qmouse_movement>: Declare.
src/keyboard.c <Qmouse_movement>: Now extern.
<Qecho_keystrokes>: New static variable.
(read_key_sequence): Accept an additional argument, a flag to
prevent redisplay during reading of the key sequence. All callers
changed.
(read_menu_command): New function.
(read_char): When COMMANDFLAG is -2, do not redisplay and do not
autosave.
(toolkit_menubar_in_use): New function.
(make_lispy_event): Use it instead of a compile-time test.
src/fns.c (Fyes_or_no_p) [HAVE_MENUS]: Don't condition on
window-system being available.
src/editfns.c (Fmessage_box) [HAVE_MENUS]: Don't condition the call
to x-popup-dialog on the frame type, they all now support popup
dialogs.
src/dispnew.c (save_current_matrix): Save the margin areas.
(restore_current_matrix): Restore margin areas.
(update_frame_with_menu): New function.
src/dispextern.h (display_tty_menu_item, update_frame_with_menu):
Add prototypes.
src/alloc.c (make_save_ptr): Now compiled unconditionally.
lisp/tmm.el (tmm-menubar): Adapt doc string to TTY menus
functionality.
lisp/tooltip.el (tooltip-mode): Don't error out on TTYs.
lisp/menu-bar.el (popup-menu, popup-menu-normalize-position): Moved
here from mouse.el.
(popup-menu): Support menu-bar navigation on TTYs using C-f/C-b
and arrow keys.
(tty-menu-navigation-map): New map for TTY menu navigation.
lisp/loadup.el ("tooltip"): Load even if x-show-tip is not available.
lisp/frame.el (display-mouse-p): Report text-mode mouse as available
on w32.
(display-popup-menus-p): Report availability if mouse is
available; don't condition on window-system.
lisp/faces.el (tty-menu-enabled-face, tty-menu-disabled-face)
(tty-menu-selected-face): New faces.
doc/emacs/screen.texi (Menu Bar): Adapt to TTY menus.
doc/emacs/frames.texi (Frames): Mention menu support on text terminals.
doc/emacs/files.texi (Visiting): Mention the "File" menu-bar menu.
doc/emacs/display.texi (Standard Faces): Mention TTY faces for menus.
doc/lispref/keymaps.texi (Defining Menus, Mouse Menus, Menu Bar): Modify
wording to the effect that menus are supported on TTYs.
doc/lisprefframes.texi (Pop-Up Menus, Dialog Boxes)
(Display Feature Testing): Update for menu support on TTYs.
Dmitry Antipov [Tue, 8 Oct 2013 14:56:15 +0000 (18:56 +0400)]
* dispnew.c (set_window_update_flags): Add buffer arg. Adjust comment.
(redraw_frame, update_frame): Adjust users.
* dispextern.h (set_window_update_flags): Adjust prototype.
* xdisp.c (redisplay_internal): When updating all frames with zero
windows_or_buffers_changed, assume that only the windows that shows
current buffer should be really updated.
Dmitry Antipov [Tue, 8 Oct 2013 06:40:09 +0000 (10:40 +0400)]
Do not allocate huge temporary memory areas and objects while encoding
for file I/O, thus reducing an enormous memory usage for large buffers.
See http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00180.html.
* coding.h (struct coding_system): New member raw_destination.
* coding.c (setup_coding_system): Initialize it to zero.
(encode_coding_object): If raw_destination is set, do not create
dst_object. Add comment.
* fileio.c (toplevel): New constant E_WRITE_MAX.
(e_write): Do not encode more than E_WRITE_MAX characters per one loop
iteration. Use raw_destination if E_WRITE_MAX characters is encoded.
Teemu Likonen [Tue, 8 Oct 2013 06:17:49 +0000 (02:17 -0400)]
* indent.el: Provide interactive indent-rigidly mode. Use lexical-binding.
(indent-rigidly--current-indentation): New function.
(indent-rigidly-map): New var.
(indent-rigidly): Use it to provide interactive mode.
(indent-region): Add progress reporter.
(tab-stop-list): Make it implicitly extend to infinity by repeating the
last step.
(indent--next-tab-stop): New function to implement this behavior.
(tab-to-tab-stop, move-to-tab-stop): Use it.
Stefan Monnier [Tue, 8 Oct 2013 05:10:10 +0000 (01:10 -0400)]
* lisp/progmodes/perl-mode.el: Use lexical-binding.
Remove redundant :group args.
(perl-nochange): Change default to be closer to other major modes's
standard behavior.
(perl-indent-line): Don't consider text on current line as a
valid beginning of function from which to indent.
Paul Eggert [Tue, 8 Oct 2013 04:25:33 +0000 (21:25 -0700)]
* lisp.h (bits_word, BITS_WORD_MAX): New type and macro.
All uses of 'size_t' and 'SIZE_MAX' changed to use them, when
they're talking about words in Lisp bool vectors.
(BITS_PER_BITS_WORD): Rename from BITS_PER_SIZE_T. All uses changed.
Stefan Monnier [Tue, 8 Oct 2013 03:47:24 +0000 (23:47 -0400)]
* lisp/vc/pcvs.el: Use lexical-binding.
(cvs-temp-buffer, cvs-make-cvs-buffer): Pass some vars in the lexical
environment of `eval'.
(cvs-mode-run, cvs-mode-do): Change `postproc' to be a function rather
than a list of expressions. Adjust callers.
* lisp/vc/pcvs-defs.el (cvs-postprocess): Remove, unused.
Paul Eggert [Mon, 7 Oct 2013 21:37:19 +0000 (14:37 -0700)]
Improve support for popcount and counting trailing zeros.
Do this by using the Gnulib modules for this.
This should generate faster code on non-GCC, non-MSC platforms,
and make the code a bit more portable, at least in theory.
* admin/merge-gnulib (GNULIB_MODULES): Add count-one-bits
and count-trailing-zeros.
* lib/count-one-bits.c, lib/count-one-bits.h:
* lib/count-trailing-zeros.c, lib/count-trailing-zeros.h:
* m4/count-one-bits.m4, m4/count-trailing-zeros.m4:
New files, copied from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* nt/gnulib.mk: Merge changes from lib/gnulib.mk.
* src/data.c: Include <count-one-bits.h>, <count-trailing-zeros.h>.
(USE_MSC_POPCOUNT, POPCOUNT_STATIC_INLINE)
(NEED_GENERIC_POPCOUNT, popcount_size_t_generic)
(popcount_size_t_msc, popcount_size_t_gcc):
Remove; now done by Gnulib.
(popcount_size_t): Now a macro that defers to Gnulib.
(count_trailing_zero_bits): Return int, for consistency with
Gnulib and because Emacs prefers signed to unsigned int.
Don't assume that size_t is either unsigned int or unsigned long
or unsigned long long.
(size_t_to_host_endian): Do not assume that size_t is either
exactly 32 or exactly 64 bits wide.
* src/lisp.h (BITS_PER_SIZE_T): Define consistently with BITS_PER_LONG
etc., so that it's now an enum constant, not a macro.
No need to assume that it's either 32 or 64.
Stefan Monnier [Mon, 7 Oct 2013 18:51:26 +0000 (14:51 -0400)]
* lisp/electric.el (electric-indent-inhibit): New var.
(electric-indent-post-self-insert-function): Use it.
* lisp/progmodes/python.el (python-mode): Set it.
Stefan Monnier [Mon, 7 Oct 2013 13:54:48 +0000 (09:54 -0400)]
* lisp/nxml/nxml-mode.el: Use lexical-binding and syntax-propertize.
(font-lock-beg, font-lock-end): Move before first use.
(nxml-mode): Use syntax-propertize-function.
(nxml-after-change, nxml-after-change1): Adjust accordingly.
(nxml-extend-after-change-region): Remove.
* lisp/nxml/nxml-ns.el: Use lexical-binding.
(nxml-ns-save): Use `declare'.
(nxml-ns-prefixes-for): Avoid add-to-list.
* lisp/nxml/nxml-util.el: Use lexical-binding.
(nxml-with-degradation-on-error, nxml-with-invisible-motion):
Use `declare'.
* lisp/nxml/rng-match.el: Use lexical-binding.
(rng--ipattern): Use cl-defstruct.
(rng-compute-start-tag-open-deriv, rng-compute-start-attribute-deriv)
(rng-cons-group-after, rng-subst-group-after)
(rng-subst-interleave-after, rng-apply-after, rng-compute-data-deriv):
Use closures instead of `(lambda...).
* lisp/nxml/xmltok.el: Use lexical-binding.
(xmltok-save): Use `declare'.
(xmltok-unclosed-reparse-p, xmltok-semi-closed-reparse-p): Remove.
Paul Eggert [Mon, 7 Oct 2013 08:05:00 +0000 (01:05 -0700)]
emacs_read and emacs_write now use void *, not char *.
* alloc.c (valid_pointer_p) [!WINDOWSNT]: Remove now-unnecessary cast.
* sysdep.c (emacs_read, emacs_write, emacs_write_sig):
Buffer arg is now void *, not char *. This matches plain
'read' and 'write' better, and avoids a constraint violation
on Solaris 9 with Oracle Studio.
Dmitry Antipov [Mon, 7 Oct 2013 07:15:37 +0000 (11:15 +0400)]
* alloc.c (Fmake_string): For ASCII char initializer, prefer
memset to explicit loop. Otherwise copy largest possible chunk
from initialized to uninitialized part, thus allowing the longer
memcpy runs and reducing the number of loop iterations.
Stefan Monnier [Mon, 7 Oct 2013 03:38:26 +0000 (23:38 -0400)]
* lisp/progmodes/ruby-mode.el: Fix recently added tests.
(ruby-smie-grammar): Add - and +.
(ruby-smie--redundant-do-p, ruby-smie--forward-id)
(ruby-smie--backward-id): New functions.
(ruby-smie--forward-token, ruby-smie--backward-token): Use them.
(ruby-smie-rules): Handle hanging do. Get rid of hack, not needed
any more.
* test/indent/ruby.rb: Add a few more tests; adjust some indentation.
Dato Simó [Sun, 6 Oct 2013 17:14:11 +0000 (19:14 +0200)]
* net/network-stream.el (network-stream-open-starttls): Don't add
--insecure if it's already present, because that gnutls-cli
rejects getting that parameter twice.
Jan Djärv [Sun, 6 Oct 2013 15:53:30 +0000 (17:53 +0200)]
* nsterm.m (ns_update_begin): If native fullscreen and no toolbar,
hide toolbar.
(windowDidEnterFullScreen:): If presentation options are zero,
set them here (Bug#15388).
Dmitry Gutov [Sat, 5 Oct 2013 23:40:16 +0000 (02:40 +0300)]
* lisp/newcomment.el (comment-use-global-state): Change default value
to t, mark obsolete.
(comment-beginning): In addition to `comment-to-syntax', check the
value of `comment-use-global-state'.
Stefan Monnier [Sat, 5 Oct 2013 18:37:08 +0000 (14:37 -0400)]
Get Ruby's SMIE code to pass the test suite.
* lisp/progmodes/ruby-mode.el (ruby-use-smie): Change default.
(ruby-comment-column): Follow the global default, by default.
(ruby-smie-grammar): Add assignment syntax.
(ruby-smie--implicit-semi-p): No implicit semi-colon after an
open-paren, a comma, or a \.
(ruby-smie--forward-token, ruby-smie--backward-token): Handle heredocs,
and line continuations.
(ruby-smie-rules): Adjust handling of open-paren, now that it's never
followed by implicit semi-colons. Add rule for string concatenation
and for indentation at BOB.
(ruby-forward-sexp, ruby-backward-sexp): Adjust for when smie is in use.
* lisp/emacs-lisp/smie.el (smie-next-sexp): Don't go back to pos before
calling next-sexp, since next-token may have skipped chars which
next-sexp doesn't know should be skipped!
* test/indent/ruby.rb: Port a few cases from automated/ruby-mode-tests.el.
Adjust indentation of continued line to the new SMIE behavior.
Dmitry Gutov [Sat, 5 Oct 2013 02:26:39 +0000 (05:26 +0300)]
* lisp/progmodes/ruby-mode.el (ruby-mode): Add `ruby-mode-set-encoding'
to `after-save-hook' instead of `before-save-hook', because then
we know exactly what encoding was used to write the file.
(ruby-mode-set-encoding): Use `last-coding-system-used' instead of
guessing. Call `basic-save-buffer-1' after modifying the buffer.
Stefan Monnier [Fri, 4 Oct 2013 19:06:45 +0000 (15:06 -0400)]
* lisp/subr.el (read-passwd): Hide chars even when called within a context
where after-change-functions is disabled.
(set-temporary-overlay-map): Don't remove oneself from pre-command-hook
until we removed ourself from overriding-terminal-local-map.
Leo Liu [Fri, 4 Oct 2013 09:45:25 +0000 (17:45 +0800)]
* progmodes/octave.el (inferior-octave-error-regexp-alist)
(inferior-octave-compilation-font-lock-keywords): New variables.
(compilation-error-regexp-alist)
(compilation-mode-font-lock-keywords): Defvar to pacify compiler.
(inferior-octave-mode): Use compilation-shell-minor-mode.
Paul Eggert [Thu, 3 Oct 2013 16:16:31 +0000 (09:16 -0700)]
* lisp.h (eassert): Assume that COND is true when optimizing.
In other words, take on the behavior of eassert_and_assume.
This makes Emacs 0.2% smaller on my platform (Fedora 19, x86-64).
(eassert_and_assume): Remove. All uses replaced by eassert.
Paul Eggert [Thu, 3 Oct 2013 07:06:52 +0000 (00:06 -0700)]
Merge from gnulib.
* src/conf_post.h (__has_builtin, assume): Remove; gnulib now does these.
* src/lisp.h: Include <verify.h>, for 'assume'.
This also incorpoprates:
2013-10-02 verify: new macro 'assume'
2013-09-26 dup2, dup3: work around another cygwin crasher
2013-09-26 getdtablesize: work around cygwin issue
Paul Eggert [Thu, 3 Oct 2013 06:31:06 +0000 (23:31 -0700)]
* eval.c (clobbered_eassert): New macro.
(internal_catch, internal_condition_case)
(internal_condition_case_1, internal_condition_case_2)
(internal_condition_case_n): Use it instead of eassert
when the argument contains locals clobbered by longjmp.
Don't use clobbered locals outside of clobbered_eassert.
(internal_lisp_condition_case): Use a volatile variable
to work around a local variable's getting clobbered.
Stefan Monnier [Thu, 3 Oct 2013 04:58:56 +0000 (00:58 -0400)]
Introduce new bytecodes for efficient catch/condition-case in lexbind.
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
Optimize under `condition-case' and `catch' if
byte-compile--use-old-handlers is nil.
(disassemble-offset): Handle new bytecodes.
* lisp/emacs-lisp/bytecomp.el (byte-pushcatch, byte-pushconditioncase)
(byte-pophandler): New byte codes.
(byte-goto-ops): Adjust accordingly.
(byte-compile--use-old-handlers): New var.
(byte-compile-catch): Use new byte codes depending on
byte-compile--use-old-handlers.
(byte-compile-condition-case--old): Rename from
byte-compile-condition-case.
(byte-compile-condition-case--new): New function.
(byte-compile-condition-case): New function that dispatches depending
on byte-compile--use-old-handlers.
(byte-compile-unwind-protect): Pass a function to byte-unwind-protect
when we can.
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv-analyse-form): Adjust for
the new compilation scheme using the new byte-codes.
* src/alloc.c (Fgarbage_collect): Merge scans of handlerlist and catchlist,
and make them unconditional now that they're heap-allocated.
* src/bytecode.c (BYTE_CODES): Add Bpushcatch, Bpushconditioncase
and Bpophandler.
(bcall0): New function.
(exec_byte_code): Add corresponding cases. Improve error message when
encountering an invalid byte-code. Let Bunwind_protect accept
a function (rather than a list of expressions) as argument.
* src/eval.c (catchlist): Remove (merge with handlerlist).
(handlerlist, lisp_eval_depth): Not static any more.
(internal_catch, internal_condition_case, internal_condition_case_1)
(internal_condition_case_2, internal_condition_case_n):
Use PUSH_HANDLER.
(unwind_to_catch, Fthrow, Fsignal): Adjust to merged
handlerlist/catchlist.
(internal_lisp_condition_case): Use PUSH_HANDLER. Adjust to new
handlerlist which can only handle a single condition-case handler at
a time.
(find_handler_clause): Simplify since we only a single branch here
any more.
* src/lisp.h (struct handler): Merge struct handler and struct catchtag.
(PUSH_HANDLER): New macro.
(catchlist): Remove.
(handlerlist): Always declare.
Stefan Monnier [Thu, 3 Oct 2013 04:41:23 +0000 (00:41 -0400)]
* lisp/subr.el (decode-char, encode-char): Use advertised-calling-convention
instead of the docstring to discourage use of the `restriction' arg.
(error): Use `declare'.
* src/charset.c (Fdecode_char, Fencode_char): Remove description of
`restriction' arg. now that it's hidden by advertised-calling-convention.
Daiki Ueno [Thu, 3 Oct 2013 01:29:17 +0000 (10:29 +0900)]
epg: doc improvement for verify functions
* epg.el (epg-verify-file): Add a comment saying that it does not
notify verification error as a return value nor a signal.
(epg-verify-string): Ditto.