Paul Eggert [Tue, 23 Sep 2014 05:42:47 +0000 (22:42 -0700)]
Fix SAFE_ALLOCA to not exhaust the stack when in a loop.
Problem reported by Dmietry Antipov in thread leading to:
http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00713.html
This patch fixes only SAFE_ALLOCA, SAFE_NALLOCA, and SAFE_ALLOCA_LISP;
the experimental local_* macros enabled by USE_LOCAL_ALLOCATORS
remain unfixed.
* callproc.c (call_process): Save and restore sa_avail.
* lisp.h (USE_SAFE_ALLOCA): Define sa_avail.
(AVAIL_ALLOCA): New macro.
(SAFE_ALLOCA, SAFE_NALLOCA, SAFE_ALLOCA_LISP):
Use it, and check against sa_avail rather than MAX_ALLOCA.
Stefan Monnier [Mon, 22 Sep 2014 18:22:02 +0000 (14:22 -0400)]
Add pcase-defmacro, as well as `quote' and `app' patterns.
* loadup.el: Increase max-lisp-eval-depth when macroexpanding macroexp.
* emacs-lisp/pcase.el: Allow (F . ARGS) in `app' patterns.
(pcase--funcall, pcase--eval): New functions.
(pcase--u1): Use them for guard, pred, let, and app.
(\`): Use the new feature to generate better code for vector patterns.
* emacs-lisp/pcase.el: Use pcase-defmacro to handle backquote.
(pcase--upat): Remove.
(pcase--macroexpand): Don't hardcode handling of `.
(pcase--split-consp, pcase--split-vector): Remove.
(pcase--split-equal): Disregard ` since it's expanded away.
(pcase--split-member): Optimize for quote rather than for `.
(pcase--split-pred): Optimize for quote rather than for `.
(pcase--u1): Remove handling of ` (and of `or' and `and').
Quote non-selfquoting values when passing them to `eq'.
Drop `app's let-binding if the variable is not used.
(pcase--q1): Remove.
(`): Define as a pattern macro.
* emacs-lisp/pcase.el (pcase--match): New smart-constructor function.
(pcase--expand pcase--q1, pcase--app-subst-match): Use it.
(pcase--macroexpand): Handle self-quoting patterns here, expand them to
quote patterns.
(pcase--split-match): Don't hoist or/and here any more.
(pcase--split-equal): Optimize quote patterns as well as ` patterns.
(pcase--flip): New helper macro.
(pcase--u1): Optimize the memq case directly.
Don't handle neither self-quoting nor and/or patterns any more.
* emacs-lisp/pcase.el (pcase-defmacro): New macro.
(pcase--macroexpand): New function.
(pcase--expand): Use it.
* emacs-lisp/pcase.el (pcase--app-subst-match, pcase--app-subst-rest):
New optimization functions.
(pcase--u1): Add support for `quote' and `app'.
(pcase): Document them in the docstring.
Stefan Monnier [Mon, 22 Sep 2014 18:05:22 +0000 (14:05 -0400)]
* lisp/emacs-lisp/pcase.el: Allow (F . ARGS) in `app' patterns.
(pcase--funcall, pcase--eval): New functions.
(pcase--u1): Use them for guard, pred, let, and app.
(\`): Use the new feature to generate better code for vector patterns.
Stefan Monnier [Mon, 22 Sep 2014 17:24:46 +0000 (13:24 -0400)]
* lisp/emacs-lisp/pcase.el: Use pcase-defmacro to handle backquote.
(pcase--upat): Remove.
(pcase--macroexpand): Don't hardcode handling of `.
(pcase--split-consp, pcase--split-vector): Remove.
(pcase--split-equal): Disregard ` since it's expanded away.
(pcase--split-member): Optimize for quote rather than for `.
(pcase--split-pred): Optimize for quote rather than for `.
(pcase--u1): Remove handling of ` (and of `or' and `and').
Quote non-selfquoting values when passing them to `eq'.
Drop `app's let-binding if the variable is not used.
(pcase--q1): Remove.
(`): Define as a pattern macro.
Stefan Monnier [Mon, 22 Sep 2014 16:22:50 +0000 (12:22 -0400)]
* lisp/emacs-lisp/pcase.el (pcase--match): New smart-constructor function.
(pcase--expand pcase--q1, pcase--app-subst-match): Use it.
(pcase--macroexpand): Handle self-quoting patterns here, expand them to
quote patterns.
(pcase--split-match): Don't hoist or/and here any more.
(pcase--split-equal): Optimize quote patterns as well as ` patterns.
(pcase--flip): New helper macro.
(pcase--u1): Optimize the memq case directly.
Don't handle neither self-quoting nor and/or patterns any more.
Stefan Monnier [Mon, 22 Sep 2014 14:30:47 +0000 (10:30 -0400)]
Add support for `quote' and `app'.
* lisp/emacs-lisp/pcase.el (pcase--app-subst-match, pcase--app-subst-rest):
New optimization functions.
(pcase--u1): Add support for `quote' and `app'.
(pcase): Document them in the docstring.
Stefan Monnier [Mon, 22 Sep 2014 14:10:53 +0000 (10:10 -0400)]
Use lexical-bindin in Ibuffer.
* lisp/ibuffer.el (ibuffer-do-toggle-read-only): `arg' is unused.
(ibuffer-compile-format): Simplify.
(ibuffer-clear-summary-columns): Simplify.
* lisp/ibuf-ext.el (ibuffer-generate-filter-groups): Don't use the third
elem of dotimes when we don't refer to the iteration var from it.
(ibuffer-toggle-sorting-mode): Avoid add-to-list.
* lisp/ibuf-macs.el (define-ibuffer-column, define-ibuffer-op):
Silence byte-compiler.
Stefan Monnier [Mon, 22 Sep 2014 13:42:57 +0000 (09:42 -0400)]
* lisp/mpc.el (mpc-data-directory): Use locate-user-emacs-file.
(mpc-volume-refresh): Make sure the corresponding header-line is updated.
(mpc-songs-jump-to, mpc-play): Use user-error.
Avoid extra call to oblookup when interning symbols.
* lisp.h (intern_driver): Add prototype.
* lread.c (intern_driver): New function.
(intern1, intern_c_string_1, Fintern):
* font.c (font_intern_prop):
* w32font.c (intern_font_name): Use it.
On OSX, do not free font-specific data more than once (Bug#18501).
* macfont.m (macfont_close): Release and free font-specific data
only if it wasn't previously freed.
Paul Eggert [Sun, 21 Sep 2014 22:49:24 +0000 (15:49 -0700)]
Minor improvements to new stack-allocated Lisp objects.
* frame.h (FRAME_PARAMETER):
Prefer scoped_list1 to local_list1 where either would do.
* lisp.h (scoped_list4): New macro.
(local_cons, local_list1, local_list2, local_list3, local_list4)
(make_local_vector, make_local_string, build_local_string):
Prefer functions to macros where either would do.
* xdisp.c (build_desired_tool_bar_string):
Prefer scoped_list4 to local_list4 where either would do.
Use font-lock-face property; derive from special-mode
* lisp/textmodes/reftex-sel.el (reftex-select-label-mode)
(reftex-select-bib-mode, reftex-insert-docstruct): Derive modes
from special-mode (instead of fundamental-mode) and propertize
with font-lock-face instead of just face.
* lisp/emacs-lisp/lisp.el (lisp-completion-at-point): Only calculate
`table-etc' when `end' is non-nil.
(lisp-completion-at-point): Move `end' back if it's after quote.
If in comment or string, only complete when after backquote.
* lisp/emacs-lisp/lisp.el (lisp--expect-function-p)
(lisp--form-quoted-p): New functions.
(lisp-completion-at-point): Use them to see if we're completing a
variable reference, a function name, or just any symbol.
http://lists.gnu.org/archive/html/emacs-devel/2014-02/msg00229.html
David Engster [Thu, 18 Sep 2014 20:37:19 +0000 (22:37 +0200)]
Do not call egrep to determine emacs version in EDE.
* ede/emacs.el (ede-emacs-version): Do not call 'egrep' to
determine Emacs version (it was dead code anyway). Make sure that
configure.ac or configure.in exist. (Bug#18476)
Ivan Kanis [Thu, 18 Sep 2014 19:18:34 +0000 (21:18 +0200)]
Allow users to specify `shr-width'
* net/shr.el, net/eww.el: Don't override `shr-width', but
introduce a new variable `shr-internal-width'. This allows users
to specify a width themselves.
Preserve the aspect ratio when fitting to width/height
* image-mode.el (image-toggle-display-image): If we have a
`fit-width' or a `fit-height', don't limit the size of the image
to the window size, because that doesn't preserve the aspect
ratio.
* window.el (fit-window-to-buffer): When counting buffer width,
count the whole visible buffer. Correctly convert the body-height
to pixel size for window-text-pixel-size (Bug#18498).
More and more stack-allocated Lisp objects if USE_LOCAL_ALLOCATORS.
* lisp.h (local_list4) [USE_LOCAL_ALLOCATORS]: New macro.
[!USE_LOCAL_ALLOCATORS]: Fall back to regular list4.
* frame.h (FRAME_PARAMETER): New macro.
* dispnew.c (init_display):
* fontset.c (Fset_fontset_font):
* frame.c (x_default_parameter):
* xfaces.c (set_font_frame_param, Finternal_merge_in_global_face):
* xfns.c (x_default_scroll_bar_color_parameter)
(x_default_font_parameter, x_create_tip_frame): Use it.
* editfns.c (Fpropertize): Use local_cons.
* process.c (status_message): Use build_local_string.
* xfont.c (xfont_open): Use make_local_string.
* xdisp.c (build_desired_tool_bar_string): Use local_list4.
Paul Eggert [Thu, 18 Sep 2014 05:40:17 +0000 (22:40 -0700)]
Port USE_LOCAL_ALLOCATORS code to clang 3.4 x86-64.
Revert previous lisp.h change, and install the following instead.
* lisp.h (USE_LOCAL_ALLOCATORS): Define only if __GNUC__ &&
!__clang__. This works with GCC and with clang and is safer for
compilers we don't know about.
Paul Eggert [Thu, 18 Sep 2014 01:03:40 +0000 (18:03 -0700)]
Port USE_LOCAL_ALLOCATORS code to clang 3.4 x86-64.
* lisp.h (ALLOCA_FIXUP): New constant.
(LOCAL_ALLOCA): New macro.
(local_cons, make_local_vector, make_local_string): Use them.
(local_cons): Rename parameter to make capture less likely.
Paul Eggert [Wed, 17 Sep 2014 00:07:12 +0000 (17:07 -0700)]
Don't assume 'grep' supports GREP_OPTIONS.
The GREP_OPTIONS environment variable is planned to be marked
obsolescent in GNU grep, due to problems in its use, so stop
relying on it.
* progmodes/grep.el (grep-highlight-matches): Document this.
(grep-process-setup): Do not set GREP_OPTIONS.
(grep-compute-defaults): Use an explicit --color option if supported.
Eli Zaretskii [Tue, 16 Sep 2014 15:53:36 +0000 (18:53 +0300)]
Fix display of hollow-box and hbar cursors on r2L lines.
src/xterm.c (x_draw_hollow_cursor, x_draw_bar_cursor):
src/w32term.c (x_draw_hollow_cursor, x_draw_bar_cursor): In R2L
lines, draw the hollow-box and hbar cursors on the right side of
cursor-glyph. Thanks to Martin Rudalics <rudalics@gmx.at> for
testing on X.
Eli Zaretskii [Tue, 16 Sep 2014 15:44:51 +0000 (18:44 +0300)]
Fix block cursor display in R2L lines.
src/xterm.c (x_draw_stretch_glyph_string):
src/w32term.c (x_draw_stretch_glyph_string): Fix a thinko that
caused the block cursor to disappear on a TAB in R2L lines in
every window except the leftmost one. Reported by Martin Rudalics
<rudalics@gmx.at>.
Always use matched specpdl entry to record call arguments (Bug#18473).
* lisp.h (record_in_backtrace): Adjust prototype.
* eval.c (record_in_backtrace): Return current specpdl level.
(set_backtrace_args, set_backtrace_nargs): Merge. Adjust all users.
(eval_sub, Ffuncall): Record call arguments in matched specpdl
entry and use that entry in call to backtrace_debug_on_exit.
(apply_lambda): Likewise. Get current specpdl level as 3rd arg.
(do_debug_on_call): Get current specpdl level as 2nd arg.
Eli Zaretskii [Mon, 15 Sep 2014 15:51:57 +0000 (18:51 +0300)]
Support playing on MS-Windows non-ASCII sound files using Unicode APIs.
src/sound.c [WINDOWSNT]: Include w32common.h and mbstring.h.
(SOUND_WARNING) [WINDOWSNT]: Include in do..while and improve the
error message format. Use message_with_string to have non-ASCII
file names properly displayed.
(do_play_sound) [WINDOWSNT]: Use Unicode APIs to play sound files
when w32-unicode-filenames is non-nil, but not on Windows 9X,
where these APIs are not available even in UNICOWS.DLL. Improve
the format of error messages and include the file name in them
where appropriate.
(Fplay_sound_internal) [WINDOWSNT]: Make the MS-Windows branch
call play-sound-functions, per documentation.
src/w32.c (w32_get_long_filename, w32_get_short_filename): Constify
the input file name arguments.
src/w32.h (w32_get_long_filename, w32_get_short_filename): Update
prototypes.
Eli Zaretskii [Mon, 15 Sep 2014 15:25:54 +0000 (18:25 +0300)]
Fix display of R2L lines in partial-width windows.
src/xdisp.c (init_iterator): Don't use it->bidi_p before it is
assigned the correct value.
(extend_face_to_end_of_line): Account for truncation and
continuation glyphs in R2L rows when one of the fringes is not
displayed.
(display_line): Don't assign negative X offset to a row if we are
going to produce a truncation glyph for it. When handling
truncated R2L rows, consider the width of the left fringe instead
of the right one.
(produce_special_glyphs): Fix bogus assignments.
Eli Zaretskii [Sun, 14 Sep 2014 15:18:39 +0000 (18:18 +0300)]
Fix bug #18420 with deadlocks communicating with subprocess on MS-Windows.
src/w32.c (fcntl): Support O_NONBLOCK fcntl on the write side of
pipes.
(sys_write): When a write to a non-blocking pipe returns ENOSPC,
set errno to EAGAIN instead, to allow the caller to retry the
write after some waiting. Fixes deadlocks when Emacs exchanges a
lot of data through the pipe.
* etc/NEWS: Mention nil `calendar-mode-line-format' will not modify
the mode line of the calendar buffer.
* lisp/calendar/calendar.el (calendar-update-mode-line):
Do not overwrite mode-line-format if calendar-mode-line-format is nil.
(Bug#18467)
Eli Zaretskii [Sat, 13 Sep 2014 09:25:38 +0000 (12:25 +0300)]
Fix HTML rendering by shr-insert-document in Rmail.
lisp/mail/rmailmm.el (rmail-mime-insert-html): Decode the HTML part
using the specified transfer-encoding, if any, or 'undecided'.
(rmail-mime-render-html-shr): Bind shr-width to nil, so lines are
broken at the window margin.
Ken Olum [Sat, 13 Sep 2014 09:01:56 +0000 (12:01 +0300)]
Support rendering of HTML parts in Rmail (bug #4258).
lisp/mail/rmailmm.el (rmail-mime-process): Handle text/html
separately from other text/ types. Suppress tagline for
multipart body.
(rmail-mime-parse): Don't change visibility of tagline here.
(rmail-mime-set-bulk-data, rmail-mime-insert-bulk):
Handle text/html specially.
(rmail-mime-render-html-function,rmail-mime-prefer-html): New variables.
(rmail-mime-insert-html, rmail-mime-render-html-shr)
(rmail-mime-render-html-lynx): New functions.
(rmail-mime-fix-inserted-faces): New function.
(rmail-mime-process-multipart): Find the best part to show
following rmail-mime-prefer-html if set.
(rmail-mime-searching): New variable.
(rmail-search-mime-message): Bind rmail-mime-searching to
suppress rendering while searching.
Eli Zaretskii [Sat, 13 Sep 2014 08:26:44 +0000 (11:26 +0300)]
Fix expansion and encoding of sound file names on MS-Windows.
src/sound.c (Fplay_sound_internal): Encode the sound file name in
the ANSI codepage. Expand it against data-directory, as per docs,
not against the current directory. No need to make a local copy
of the file name; pass the encoded file name directly to
do_play_sound. (Bug#18463)
src/w32.c (ansi_encode_filename): If w32_get_short_filename returns
NULL, and the file name is not encodable in ANSI codepage, return
the string with "?" replacement characters, which will fail the
caller. This avoids returning a random value in that case.
Sam Steingold [Fri, 12 Sep 2014 19:57:40 +0000 (15:57 -0400)]
Add support for Vertica SQL.
* lisp/progmodes/sql.el (sql-product-alist): Add vertica.
(sql-vertica-program, sql-vertica-options)
(sql-vertica-login-params, sql-comint-vertica, sql-vertica):
New functions and variables to support Vertica.
Inspired by code by Roman Scherer <roman@burningswell.com>.
Remove redundant GCPROs around Ffuncall and Fapply calls. This
is safe because Ffuncall protects all of its arguments by itself.
* charset.c (map_charset_for_dump): Remove redundant GCPRO.
* eval.c (Fapply, apply1, call0, call1, call2, call3, call4, call5)
(call6, call7): Likewise. Use compound literals where applicable.
(run_hook_with_args_2): Use compound literal.
More debugging aids around GCPROs.
* lisp.h (struct gcpro) [DEBUG_GCPRO]: Add extra members.
(GCPRO1, GCPRO2, GCPRO3, GCPRO4, GCPRO5, GCPRO6, GCPRO7):
Minor restyle. If DEBUG_GCPRO, initialize extra fields.
Paul Eggert [Thu, 11 Sep 2014 00:48:57 +0000 (17:48 -0700)]
Pacify --enable-gcc-warnings when no window system is used.
These warnings found that subscript error, so they seem worthwhile.
* composite.c (char_composable_p): Simplify a bit.
* frame.c (x_set_frame_parameters): Add an IF_LINT.
* frame.c (x_set_horizontal_scroll_bars, x_set_scroll_bar_height):
* frame.h (FRAME_HAS_HORIZONTAL_SCROLL_BARS):
* window.c (set_window_scroll_bars):
Use USE_HORIZONTAL_SCROLL_BARS for simplicity.
* frame.h [! USE_HORIZONTAL_SCROLL_BARS]:
Ignore -Wsuggest-attribute=const.
* window.h (USE_HORIZONTAL_SCROLL_BARS): New macro.
(WINDOW_HAS_HORIZONTAL_SCROLL_BAR): Use it.
Use check_iso_charset_parameter instead of doing the checks by hand.
(check_iso_charset_parameter): Move up. Check parameters a bit
more carefully, and return true for 96-char sets. All callers changed.
Alan Mackenzie [Wed, 10 Sep 2014 21:38:11 +0000 (21:38 +0000)]
CC Mode: revert recent changes and fix bug 17463 (cc-langs.elc gets
loaded at run-time).
* progmodes/cc-langs.el (c-no-parens-syntax-table): Rename the
c-lang-const to c-make-no-parens-syntax-table and correct the
logic.
(c-no-parens-syntax-table): Correct the logic of the c-lang-defvar.
Paul Eggert [Wed, 10 Sep 2014 20:56:05 +0000 (13:56 -0700)]
Simplify lisp.h by removing the __COUNTER__ business.
Problem reported by Dmitry Antipov in:
http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00220.html
* lisp.h (make_local_vector, make_local_string)
(build_local_string): Simplify by not bothering with __COUNTER__.
The __COUNTER__ business wasn't working properly, and was needed
only for hypothetical future expansion anyway.