Chong Yidong [Thu, 16 Aug 2012 06:40:57 +0000 (14:40 +0800)]
Fix average font width calculation on NS.
* src/nsfont.m (nsfont_open): Similar to the Xft backend, set
min_width to space_width and average_width to the average over
printable ASCII characters.
(ns_char_width): Code cleanup.
(ns_ascii_average_width): New utility function.
Phil Sainty [Thu, 16 Aug 2012 06:25:27 +0000 (23:25 -0700)]
Make subword.el easier to customize (tiny change)
* lisp/progmodes/subword.el (subword-forward-function)
(subword-backward-function, subword-forward-regexp, subword-backward-regexp):
New variables.
(subword-forward, subword-forward-internal, subword-backward-internal):
Use new variables, eg so that different "word" definitions can be easily used.
Stefan Monnier [Wed, 15 Aug 2012 19:20:26 +0000 (15:20 -0400)]
* lisp/vc/vc-mtn.el (vc-mtn-revision-completion-table): Handle completion
for composite selectors.
* lisp/vc/vc.el (vc-diff-build-argument-list-internal): Don't prevent
operation just because we can't find a previous revision.
Jan Djärv [Wed, 15 Aug 2012 18:58:19 +0000 (20:58 +0200)]
Improve event loop on NS so that no polling is used.
* nsmenu.m (popupSession): Remove.
(pop_down_menu): Remove endModalSession.
(timeout_handler:): New method.
(runDialogAt:): Get next timeout. Start a NSTimer with that timeout.
Call runModalForWindow. Check timer_fired when it returns.
If not set, cancel timer and break out of loop.
Otherwise loop again, with a new timeout.
* nsterm.h (EmacsApp): fd_handler takes id argument.
(EmacsDialogPanel): Add timer_fired and timeout_handler.
* nsterm.m: Include fcntl.h if present.
(fd_entry, t_readfds, inNsSelect): Remove.
(select_writefds, select_valid, select_timeout, selfds)
(select_mutex, apploopnr): Add.
(EV_TRAILER): Call kbd_buffer_store_event_hold only if q_event_ptr.
Otherwise call kbd_buffer_store_event.
(ns_send_appdefined): Remove release of fd_entry.
(ns_read_socket): Always send appdefined. Remove inNsSelect check.
Increment and decrement apploopnr.
(ns_select): If no file descriptors, just do a NSTimer.
Otherwise copy read/write masks and start select thread (fd_handler).
Start main loop and wait for application defined event.
Inform select thread to stop selecting after main loop is exited.
(ns_term_init): Create selfds pipe and set non-blocking.
Initialize select_mutex. Start the select thread (fd_handler).
(fd_handler:): Loop forever, wait for info from the main thread
to either start or stop selecting. When select returns, send
and appdefined event.
(sendScrollEventAtLoc:fromEvent:): Check if q_event_ptr is set.
If not call kbd_buffer_store_event.
Dmitry Antipov [Wed, 15 Aug 2012 14:20:16 +0000 (18:20 +0400)]
Generalize and cleanup font subsystem checks.
* font.h (FONT_DEBUG, font_assert): Remove.
* font.c, fontset.c, w32font.c, xfont.c, xftfont.c: Change
font_assert to eassert. Use eassert where appropriate.
Chong Yidong [Wed, 15 Aug 2012 07:58:34 +0000 (15:58 +0800)]
Extract better font information from the GTK >= 3.2 font chooser.
* gtkutil.c (xg_get_font): Rename from xg_get_font_name. When
using the new font chooser, use gtk_font_chooser_get_font_desc to
extract the font descriptor instead of just the font name. In
that case, return a font spec instead of a string.
(x_last_font_name): Move to this file from xfns.c.
* xfns.c (Fx_select_font): The return value can also be a font
spec. Move x_last_font_name management to gtkutil.c.
* xfaces.c: Make font weight and style symbols non-static.
* lisp/frame.el (set-frame-font): Accept font objects.
Wolfgang Jenkner [Wed, 15 Aug 2012 03:37:07 +0000 (23:37 -0400)]
* lisp/man.el (Man-overstrike-face, Man-underline-face)
(Man-reverse-face): Remove variables.
(Man-overstrike, Man-underline, Man-reverse): New faces.
(Man-fontify-manpage): Use them instead of the variables.
(Man-cleanup-manpage): Comment change.
(Man-ansi-color-map): New variable.
(Man-fontify-manpage): Use it.
Call ansi-color-apply-on-region to replace ad hoc code.
Wolfgang Jenkner [Wed, 15 Aug 2012 03:33:55 +0000 (23:33 -0400)]
Implement ANSI SGR parameters 22-27.
* lisp/ansi-color.el (ansi-colors): Doc fix.
(ansi-color-context, ansi-color-context-region): Doc fix.
(ansi-color--find-face): New function.
(ansi-color-apply, ansi-color-apply-on-region): Use it.
Rename the local variable `face' to `codes' since it is now a list of
ansi codes. Doc fix.
(ansi-color-get-face): Remove.
(ansi-color-parse-sequence): New function, derived from
ansi-color-get-face.
(ansi-color-apply-sequence): Use it. Rewrite, and support ansi
codes 22-27.
Eli Zaretskii [Tue, 14 Aug 2012 18:48:39 +0000 (21:48 +0300)]
Fix and improve GUD Tooltip mode.
lisp/tooltip.el (tooltip-identifier-from-point): Don't treat tokens
inside comments and strings as identifiers.
lisp/progmodes/gud.el (gud-tooltip-print-command): Quote the
expression to evaluate. This allows to evaluate expressions with
embedded whitespace.
(gud-tooltip-tips): Add a blank before the newline in the
message-box text, for the benefit of message-box emulation on
MS-Windows.
lisp/progmodes/gdb-mi.el (gdb-tooltip-print): Don't ignore error
messages from GDB, pop them up in a tooltip to give feedback to
user.
(gdb-tooltip-print-1): Quote the expression to evaluate. This
allows to evaluate expressions with embedded whitespace.
(gdb-inferior-io--init-proc): Don't send "-inferior-tty" command
if the TTY name is nil or empty (which happens when communicating
with the inferior via pipes, e.g. on MS-Windows).
(gdb-internals): If GDB sends a "&\n" empty debugging message,
don't send that to the GUD buffer.
doc/emacs/building.texi (Debugger Operation): Correct and improve
documentation of the GUD Tooltip mode.
Eli Zaretskii [Tue, 14 Aug 2012 18:25:47 +0000 (21:25 +0300)]
Fix a problem with disabled mouse movement events.
src/keyboard.c (command_loop_1): Reset ignore_mouse_drag_p flag each
iteration through the command loop. Fixes a problem whereby mouse
movements are ignored until the first mouse click.
Paul Eggert [Tue, 14 Aug 2012 17:45:25 +0000 (10:45 -0700)]
Use bool for Emacs Lisp booleans.
This is more natural, and on my platform (GCC 4.7.1 x86-64) it
makes Emacs's text size .03% smaller and presumably a bit faster.
* admin/merge-gnulib (GNULIB_MODULES): Add stdbool. This documents a
new direct dependency; stdbool was already being used indirectly
via other gnulib modules.
* lib-src/make-docfile.c (enum global_type): Sort values roughly in
decreasing alignment, except put functions last.
(compare_globals): Use this new property of enum global_type.
(write_globals): Use bool, not int, for booleans.
* src/lisp.h: Include <stdbool.h>.
(struct Lisp_Boolfwd, defvar_bool):
* src/lread.c (defvar_bool): Use bool, not int, for Lisp booleans.
* src/regex.c [!emacs]: Include <stdbool.h>.
(false, true): Remove; <stdbool.h> does this for us now.
Dmitry Gutov [Tue, 14 Aug 2012 12:38:11 +0000 (08:38 -0400)]
* lisp/progmodes/ruby-mode.el (ruby-syntax-methods-before-regexp): New const.
(ruby-syntax-propertize-function): Use it to recognize regexps.
Don't look at the text after regexp, just use the whitelist.
* test/indent/ruby.rb: Rearrange examples, add new ones.
Dmitry Gutov [Tue, 14 Aug 2012 12:28:12 +0000 (08:28 -0400)]
* lisp/progmodes/ruby-mode.el: Improve percent literals.
(ruby-percent-literal-beg-re): New constant.
(ruby-syntax-general-delimiters-goto-beg): Rename to
`ruby-syntax-enclosing-percent-literal', improve literal type check.
(ruby-syntax-propertize-general-delimiters): Rename to
`ruby-syntax-propertize-percent-literal', it's a shorter and more
popular term. Adjust comments everywhere.
(ruby-syntax-propertize-percent-literal): Only propertize when not
inside a simple string or comment. When the literal is unclosed,
leave the text after it unpropertized.
Chong Yidong [Tue, 14 Aug 2012 06:52:59 +0000 (14:52 +0800)]
Fix highlight-regexp's use of Font Lock mode.
* hi-lock.el (hi-lock-mode): Do not unilaterally enable font lock.
(hi-lock-set-pattern): When deciding whether to use font lock or
overlays, look at font-lock-mode instead of font-lock-fontified.
(hi-lock-mode, hi-lock-line-face-buffer, hi-lock-unface-buffer)
(hi-lock-face-buffer, hi-lock-face-phrase-buffer): Doc fix.
Use `completion-table-dynamic' for completion functions.
* progmodes/python.el
(python-shell-completion--do-completion-at-point)
(python-shell-completion--get-completions): Remove
functions.
(python-shell-completion-complete-at-point): New function.
(python-completion-complete-at-point): Use it.
Stefan Monnier [Mon, 13 Aug 2012 21:23:09 +0000 (17:23 -0400)]
* lisp/subr.el (function-get): Refine `autoload' arg so it can also
autoload functions for gv.el.
* lisp/emacs-lisp/edebug.el (get-edebug-spec): Adjust so it only
autoloads macros.
Jan Djärv [Mon, 13 Aug 2012 19:12:26 +0000 (21:12 +0200)]
Don't redraw tool bar for Gtk+ unless out of date.
* gtkutil.c (xg_frame_tb_info): New struct.
(TB_INFO_KEY): New define.
(xg_free_frame_widgets): Free xg_frame_tb_info for frame if present.
(xg_mark_data): Mark Lisp_Objects in xg_frame_tb_info.
(xg_create_tool_bar): Allocate and initialize a xg_frame_tb_info
if not present.
(update_frame_tool_bar): Return early if data in xg_frame_tb_info
is up to date. Otherwise store new data.
(free_frame_tool_bar): Free xg_frame_tb_info if present.
Stefan Monnier [Mon, 13 Aug 2012 19:10:35 +0000 (15:10 -0400)]
* lisp/color.el (color-xyz-to-lab, color-lab-to-xyz, color-cie-de2000):
Prefer pcase-let over destructuring-bind.
* lisp/vc/diff-mode.el (diff-remove-trailing-whitespace): Same.
Also, remove whitespace as we go, rather than after accumulating the
various places.
Andreas Schwab [Mon, 13 Aug 2012 10:34:25 +0000 (12:34 +0200)]
* tar-mode.el (tar-header-data-end): Only ignore size for files of
type 1-6.
(tar-header-block-summarize, tar-get-descriptor): Handle pax
extended headers.
Stefan Monnier [Sun, 12 Aug 2012 22:52:33 +0000 (18:52 -0400)]
* lisp/subr.el (internal--before-with-seleted-window)
(internal--after-with-seleted-window): New functions.
(with-selected-window): Use them, to replace dependency on tty-top-frame.
Jay Belanger [Sun, 12 Aug 2012 04:32:28 +0000 (23:32 -0500)]
calc/calc-units.el (math-default-units-table): Give it an
initial value.
(math-put-default-units): Add options to put composite units and unit
systems in default units table.
(calc-convert-units): Send composite units to `math-put-default-units'
when appropriate.
Jan Djärv [Sat, 11 Aug 2012 09:10:08 +0000 (11:10 +0200)]
* nsterm.m (not_in_argv): New function.
(application:openFile, application:openTempFile:):
(application:openFileWithoutUI:, application:openFiles:): Open file
if not_in_argv returns non-zero.
Jan Djärv [Sat, 11 Aug 2012 08:54:35 +0000 (10:54 +0200)]
Use GtkFontChooser on Gtk+ 3.2 and up.
* src/gtkutil.c (gtk_font_chooser_dialog_new, GTK_FONT_CHOOSER)
(gtk_font_chooser_set_font, gtk_font_chooser_get_font): Define
for Gtk+ versions less than 3.2.
(xg_get_font_name): Use those functions/macros here.
Reported by Frans Oilinki <moilinki@gmail.com>.
Dmitry Gutov [Fri, 10 Aug 2012 20:25:43 +0000 (16:25 -0400)]
* test/automated/ruby-mode-tests.el (ruby-should-indent):
Add docstring, check (current-indentation) instead of (current-column).
(ruby-should-indent-buffer): New function.
Add tests for `ruby-deep-indent-paren' behavior.
Port all tests from test/misc/test_ruby_mode.rb in Ruby repo.
Dmitry Gutov [Fri, 10 Aug 2012 20:19:09 +0000 (16:19 -0400)]
Merge stuff from upsteam ruby-mode, part 1.
* lisp/progmodes/ruby-mode.el (ruby-mode-map): Remove deprecated
binding (use `M-;' instead).
(ruby-expr-beg, ruby-parse-partial): ?, _, and : are symbol
constituents, ! is not (but kinda should be).
(ruby-singleton-class-p): New function.
(ruby-expr-beg, ruby-in-here-doc-p)
(ruby-syntax-propertize-heredoc): Use it.
(ruby-syntax-propertize-function): Adjust for changes in
`ruby-syntax-propertize-heredoc'.
* test/automated/ruby-mode-tests.el (ruby-should-indent)
(ruby-assert-state): New functions.
Add new tests.
Chong Yidong [Fri, 10 Aug 2012 16:46:07 +0000 (00:46 +0800)]
Remove some unnecessary bindings of same-window-* variables.
* lisp/progmodes/python.el (python-shell-get-process-name): Don't mess
with same-window-buffer-names.
* lisp/eshell/eshell.el (eshell-add-to-window-buffer-names)
(eshell-remove-from-window-buffer-names): Make obsolete.
(eshell-buffer-name, eshell-unload-hook): Don't use them.
(eshell): Just use pop-to-buffer-same-window instead.
Stefan Monnier [Fri, 10 Aug 2012 14:47:12 +0000 (10:47 -0400)]
* lisp/term/x-win.el (x-menu-bar-open): Always pass last-nonmenu-event.
* lisp/subr.el (eventp): `nil' is not an event, and eventp is not hot.
(event-start, event-end): Use posn-at-point to return a more
informative posn.
(posnp): New function.
* lisp/mouse.el (popup-menu-normalize-position): Use it.
Dmitry Antipov [Fri, 10 Aug 2012 13:24:20 +0000 (17:24 +0400)]
Fix last change to allow compilation with low optimization levels.
* intervals.c (INTERVALS_INLINE): Define to EXTERN_INLINE.
Reported by Jan Djärv <jan.h.d@swipnet.se>.
Masatake YAMATO [Fri, 10 Aug 2012 12:44:06 +0000 (08:44 -0400)]
* lisp/mouse.el (popup-menu-normalize-position): New function.
(popup-menu): Use `popup-menu-normalize-position' to normalize
the form for POSITION argument.
* lisp/term/x-win.el (x-menu-bar-open):
Use the value returend from (posn-at-point) as position
passed to `popup-menu'.