Artur Malabarba [Sun, 15 Nov 2015 21:28:37 +0000 (21:28 +0000)]
Backport: * lisp/emacs-lisp/package.el: Fix a decoding issue.
* lisp/url/url-handlers.el (url-insert-file-contents): Move some code to
`url-insert-buffer-contents'.
(url-insert-buffer-contents): New function
(package--with-response-buffer): Use `url-insert-buffer-contents'.
The previous code had some issues with decoding. Refactoring that
function allows us to use the decoding from url-handlers while still
treating both sync and async requests the same.
Anders Lindgren [Sun, 15 Nov 2015 19:19:34 +0000 (20:19 +0100)]
Enhance NSTRACE (trace output for NextStep).
Trace can be disabled for groups of functions. By default, event
functions and functions that generate lots of output are disabled.
Trace output of Objective-C functions now use the "[ClassName
parameter:]" form.
* src/nsterm.h (NSTRACE_ALL_GROUPS, NSTRACE_GROUP_EVENTS)
(NSTRACE_GROUP_UPDATES, NSTRACE_GROUP_FRINGE, NSTRACE_GROUP_COLOR)
(NSTRACE_GROUP_GLYPHS, NSTRACE_GROUP_FOCUS): New macros,
controlling in which function groups trace should be active.
(NSTRACE_WHEN): Support for silencing a function, this also
silencing all called functions.
(NSTRACE_UNSILENCE): New macro, used to re-enable trace.
(NSTRACE_FMT_FSTYPE, NSTRACE_ARG_FSTYPE): New macros, used to
print the full screen state in NSTRACE functions.
* src/nsterm.m (nstrace_depth, nstrace_num): Made volatile as they
can be accessed from multiple threads.
(nstrace_enabled_global): New variable, when FALSE, trace is
silenced.
(nstrace_restore_global_trace_state): New function, used to
restore `nstrace_enabled_global' at end of block.
([EmacsView setFrame:], [EmacsWindow setFrame:display:])
([EmacsWindow setFrame:display:animation:])
([EmacsWindow setFrameTopLeftPoint:]): New functions, print trace
and call corresponding super function.
(Many functions): Add or enhance trace output.
Anders Lindgren [Sun, 15 Nov 2015 18:17:53 +0000 (19:17 +0100)]
Fixed a toolbar related issue on OS X.
Earlier, when toggling the tool-bar in a maximized frame, the
frame size didn't match the number of text lines, leaving an
unused area at the bottom of the frame.
* nsfns.m (x_set_tool_bar_lines): Exit maximized and full height
fullscreen modes when tool bar is disabled.
Anders Lindgren [Sun, 15 Nov 2015 17:46:04 +0000 (18:46 +0100)]
Fixed OS X 10.6.8 build issue (bug#21862).
* src/nsterm.h (EmacsView): Add missing declarations.
* src/nsterm.m ([EmacsView windowDidBecomeKey]): New method, like
the standard method but without the notification parameter.
Intended to be used for direct calls.
([EmacsView windowDidEnterFullScreen]): Call the non-notification
version of `windowDidBecomeKey'. Made the notification method call
the non-notification method instead of the vice versa.
(NSWindowDidEnterFullScreenNotification): Deleted, no longer
needed.
Paul Eggert [Sun, 15 Nov 2015 09:14:39 +0000 (01:14 -0800)]
Fix regex abort when it tries to reenter itself
Problem reported by Ken Raeburn.
Solution suggested by Stefan Monnier (Bug#21688).
* src/regex.c (re_match_2_internal):
Use new _FAST functions to avoid regex code reentering itself.
* src/syntax.c (update_syntax_table_forward): New arg PROPERTIZE.
All callers changed.
* src/syntax.h (UPDATE_SYNTAX_TABLE_FORWARD_FAST)
(UPDATE_SYNTAX_TABLE_FAST): New inline functions.
Dmitry Gutov [Sun, 15 Nov 2015 05:25:19 +0000 (07:25 +0200)]
Improve Ruby 1.9-style keyword keys highlighting
* lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords):
Handle required keyword arguments (bug#21367).
And highlight the colon together with the name.
* lisp/progmodes/xref.el (xref-query-replace): Store the end
of each match as a marker again, instead of length.
(xref--query-replace-1): Update accordingly.
(package--with-work-buffer-async): Reimplement as
`package--with-response-buffer'.
(package--with-work-buffer): Mark obsolete.
(package--with-response-buffer): New macro. This is a more self
contained and less contrived version of
`package--with-work-buffer-async'. It uses keyword arguments,
doesn't have async on the name, doesn't fallback on
`package--with-work-buffer', and has _much_ simpler error
handling. On master, this macro will soon be part of another
library (either standalone or inside url.el), which is why this
commit is not to be merged back.
(package--check-signature, package--download-one-archive)
(package-install-from-archive, describe-package-1): Use it.
(package--download-and-read-archives): Let
`package--download-one-archive' take care of calling
`package--update-downloads-in-progress'.
Dmitry Gutov [Sat, 14 Nov 2015 00:37:01 +0000 (02:37 +0200)]
Use generic dispatch for xref backends
* lisp/progmodes/xref.el (xref-backend-functions):
New variable.
(xref-find-function): Remove.
(xref-find-backend)
(xref--etags-backend): New functions.
(xref-identifier-at-point-function)
(xref-identifier-completion-table-function): Remove.
(xref-backend-definitions, xref-backend-references)
(xref-backend-apropos, xref-backend-identifier-at-point)
(xref-backend-identifier-completion-table):
New generic functions.
* lisp/progmodes/elisp-mode.el (emacs-lisp-mode): Add
`elisp--xref-backend' to the beginning of
`xref-backend-functions', locally. Delete references to
removed functions and vars.
(elisp-xref-find): Remove.
(elisp--xref-backend): New function.
(elisp--xref-find-references, elisp--xref-find-apropos)
(elisp--xref-identifier-completion-table):
Turn into appropriately named generic methods.
Juri Linkov [Fri, 13 Nov 2015 23:28:03 +0000 (01:28 +0200)]
Support rectangular regions for more commands
* lisp/simple.el (region-extract-function): Handle the arg value ‘bounds’.
(region-insert-function): New function.
(shell-command-on-region): Add arg ‘region-noncontiguous-p’.
If non-nil, operate on multiple chunks.
(region-noncontiguous-p): New function.
* lisp/rect.el: Add function rectangle--insert-region
around region-insert-function.
(extract-rectangle-bounds): New function.
(rectangle--extract-region): Handle the arg value ‘bounds’.
(rectangle--insert-region): New function.
* lisp/emulation/cua-rect.el: Add function cua--insert-rectangle
around region-insert-function.
(cua--extract-rectangle-bounds): New function.
(cua--rectangle-region-extract): Handle the arg value ‘bounds’.
* lisp/replace.el (query-replace, query-replace-regexp): Add arg
‘region-noncontiguous-p’. Use ‘use-region-p’.
(query-replace-regexp-eval, map-query-replace-regexp)
(replace-string, replace-regexp): Use ‘use-region-p’.
(keep-lines, flush-lines, how-many): Use ‘use-region-p’.
(perform-replace): Add arg ‘region-noncontiguous-p’.
If non-nil, operate on multiple chunks.
* src/casefiddle.c (Fdowncase_region): Add arg ‘region-noncontiguous-p’.
If non-nil, operate on multiple chunks. (Bug#19829)
Dmitry Gutov [Mon, 9 Nov 2015 03:24:23 +0000 (05:24 +0200)]
Handle multiple matches on the same line; add highlighting
* lisp/progmodes/xref.el (xref-location-marker): Interpret the
column value in characters.
(xref--collect-matches): Rename from `xref--collect-match'.
Search for all matches in the hit line. Add `highlight' face to
the matched region in the summary. Update both callers.
Dmitry Gutov [Sun, 8 Nov 2015 03:01:05 +0000 (05:01 +0200)]
Replace xref-match-bounds with xref-match-length
Relying on xref-location-marker to point to the beginning of the match
* lisp/progmodes/xref.el (xref-match-bounds): Remove.
(xref-match-length): Add.
(xref-make-match): Change the arguments.
(xref--match-buffer-bounds): Remove.
(xref-match-item): Store length, instead of end-column.
(xref-pulse-momentarily)
(xref--collect-match)
(xref--query-replace-1): Update accordingly.
(xref-query-replace): Ditto. And check that the search results
are up-to-date.
Paul Eggert [Fri, 13 Nov 2015 20:02:21 +0000 (12:02 -0800)]
Spruce up ftfont.c memory allocation
* src/ftfont.c (setup_otf_gstring):
Avoid O(N**2) behavior when reallocating.
(ftfont_shape_by_flt): Prefer xpalloc to xrealloc when
reallocating buffers; this simplifies the code. Do not trust
mflt_run to leave the output areas unchanged on failure, as
this isn’t part of its interface spec.
Paul Eggert [Fri, 13 Nov 2015 17:28:53 +0000 (09:28 -0800)]
Port recent XCB changes to 64-bit ‘long int’
For historical reasons, libX11 represents 32-bit values like Atoms as
‘long int’ even on platforms where ‘long int’ is 64 bits. XCB doesn’t
do that, so adapt the recent XCB code to behave properly on 64-bit
platforms. Also, fix what appears to be a bug in the interpretation
of xcb_get_property_value_length, at least on my Fedora platform
which is running libxcb-1.11-5.fc21.
* src/xfns.c (x_real_pos_and_offsets):
* src/xterm.c (get_current_wm_state):
xcb_get_property_value_length returns a byte count, not a word count.
For 32-bit quantities, xcb_get_property_value returns a vector
of 32-bit words, not of (possibly 64-bit) long int.
Eli Zaretskii [Fri, 13 Nov 2015 13:33:29 +0000 (15:33 +0200)]
Remove support for ':timeout' from w32 tray notifications
* src/w32fns.c (Fw32_notification_notify): Delete the code that
supports ':timeout'.
(syms_of_w32fns): Don't DEFSYM ':timeout'. This avoids clashes
with dbusbind.c when D-Bus is compiled in.
Eli Barzilay [Fri, 13 Nov 2015 09:46:20 +0000 (11:46 +0200)]
Fix point positioning after transposing with negative arg
* lisp/simple.el (transpose-subr): When invoked with a negative
argument, move point to after the transposed text, like we do
when invoked with a positive argument. (Bug#21885)
Eli Zaretskii [Fri, 13 Nov 2015 09:02:04 +0000 (11:02 +0200)]
Another fix for MinGW64 and Cygwin builds due to notifications
* src/w32fns.c: Ifdef away tray notification code if D-Bus is
being compiled into Emacs.
(syms_of_w32fns) [WINDOWSNT && !HAVE_DBUS]: Don't defsubr
Sw32_notification_notify and Sw32_notification_close if the code
is not compiled. Reported by Andy Moreton <andrewjmoreton@gmail.com>.
Remove intern calls and XXX comments from Fx_export_frames
* src/xfns.c (Fx_export_frames): Use Qpdf, Qpng, Qpostscript, and
Qsvg instead of intern calls. Use "postscript" instead of "ps"
for consistency with image types. Remove XXX comments.
(syms_of_xfns) <Qpdf>: DEFSYM it.
Paul Eggert [Fri, 13 Nov 2015 17:28:53 +0000 (09:28 -0800)]
Port recent XCB changes to 64-bit ‘long int’
For historical reasons, libX11 represents 32-bit values like Atoms as
‘long int’ even on platforms where ‘long int’ is 64 bits. XCB doesn’t
do that, so adapt the recent XCB code to behave properly on 64-bit
platforms. Also, fix what appears to be a bug in the interpretation
of xcb_get_property_value_length, at least on my Fedora platform
which is running libxcb-1.11-5.fc21.
* src/xfns.c (x_real_pos_and_offsets):
* src/xterm.c (get_current_wm_state):
xcb_get_property_value_length returns a byte count, not a word count.
For 32-bit quantities, xcb_get_property_value returns a vector
of 32-bit words, not of (possibly 64-bit) long int.
Eli Zaretskii [Fri, 13 Nov 2015 13:33:29 +0000 (15:33 +0200)]
Remove support for ':timeout' from w32 tray notifications
* src/w32fns.c (Fw32_notification_notify): Delete the code that
supports ':timeout'.
(syms_of_w32fns): Don't DEFSYM ':timeout'. This avoids clashes
with dbusbind.c when D-Bus is compiled in.
Eli Barzilay [Fri, 13 Nov 2015 09:46:20 +0000 (11:46 +0200)]
Fix point positioning after transposing with negative arg
* lisp/simple.el (transpose-subr): When invoked with a negative
argument, move point to after the transposed text, like we do
when invoked with a positive argument. (Bug#21885)
Eli Zaretskii [Fri, 13 Nov 2015 09:02:04 +0000 (11:02 +0200)]
Another fix for MinGW64 and Cygwin builds due to notifications
* src/w32fns.c: Ifdef away tray notification code if D-Bus is
being compiled into Emacs.
(syms_of_w32fns) [WINDOWSNT && !HAVE_DBUS]: Don't defsubr
Sw32_notification_notify and Sw32_notification_close if the code
is not compiled. Reported by Andy Moreton <andrewjmoreton@gmail.com>.
Remove intern calls and XXX comments from Fx_export_frames
* src/xfns.c (Fx_export_frames): Use Qpdf, Qpng, Qpostscript, and
Qsvg instead of intern calls. Use "postscript" instead of "ps"
for consistency with image types. Remove XXX comments.
(syms_of_xfns) <Qpdf>: DEFSYM it.
* test/automated/keymaps-test.el: Fix test to make it repeatable
(keymap-store_in_keymap-FASTINT-on-nonchars): Reset Buffer-menu-mode-map
entry to its initial value to make the test repeatable in interactive
sessions (assuming it doesn't fail and crashes Emacs, of course).
Phillip Lord [Thu, 6 Aug 2015 20:33:58 +0000 (21:33 +0100)]
The heuristic that Emacs uses to add an `undo-boundary' has been
reworked, as it interacts poorly with functions on `post-command-hook'
or `after-change-functions'.
* lisp/simple.el: New section added.
* src/cmds.c (remove_excessive_undo_boundaries): Now in lisp.
(self_insert_command): Calls simple.el to amalgamate.
(delete_char): Calls simple.el to amalgamate.
* src/keyboard.c (last_undo_boundary): Removed.
* src/undo.c (run_undoable_change): New function.
Eli Zaretskii [Thu, 12 Nov 2015 20:40:31 +0000 (22:40 +0200)]
Fix the MinGW64 and Cygwin-w32 builds
* src/w32fns.c (MYNOTIFYICONDATAW_V1_SIZE)
(MYNOTIFYICONDATAW_V2_SIZE, MYNOTIFYICONDATAW_V3_SIZE): Define and
use instead of the corresponding NOTIFYICONDATAW_Vn_SIZE macros,
which cause trouble with MinGW42 headers. Ifdef away tray
notifications code for Cygwin. Reported by Andy Moreton
<andrewjmoreton@gmail.com>.
Simen Heggestøyl [Thu, 12 Nov 2015 17:30:37 +0000 (18:30 +0100)]
Enable sorting of JSON object keys when encoding
* lisp/json.el (json-encoding-object-sort-predicate): New variable for
specifying a sorting predicate for JSON objects during encoding.
(json--plist-to-alist): New utility function.
(json-encode-hash-table): Re-use `json-encode-alist' when object keys
are to be sorted.
(json-encode-alist): Sort output by
`json-encoding-object-sort-predicate, when set.
(json-encode-plist): Re-use `json-encode-alist' when object keys are
to be sorted.
(json-pretty-print-buffer-ordered): New command to pretty print the
buffer with object keys sorted alphabetically.
(json-pretty-print-ordered): New command to pretty print the region with
object keys sorted alphabetically.
* test/automated/json-tests.el (test-json-plist-to-alist)
(test-json-encode-plist, test-json-encode-hash-table)
(test-json-encode-alist-with-sort-predicate)
(test-json-encode-plist-with-sort-predicate): New tests.
Ken Raeburn [Sat, 7 Nov 2015 08:06:32 +0000 (03:06 -0500)]
Speed up x_real_pos_and_offsets using XCB
* src/xfns.c (x_real_pos_and_offsets) [USE_XCB]: Add XCB flavors of
all X calls, and pipeline requests when possible, collecting results
later. Eliminate use of x_catch_errors (and thus XSync) in XCB case.
Ken Raeburn [Sat, 7 Nov 2015 08:06:32 +0000 (03:06 -0500)]
Enable use of XCB for checking window manager state
* src/xterm.c (get_current_wm_state) [USE_XCB]: Use XCB calls instead
of XGetWindowProperty plus error-catching, since we can explicitly
check for errors in the XCB version. This eliminates 3 XSync calls on
top of the round-trip actually fetching the information.
Ken Raeburn [Sat, 7 Nov 2015 08:06:32 +0000 (03:06 -0500)]
Reduce some data dependencies between X calls
Gains nothing in the traditional-Xlib code, but more closely aligns
with how the XCB version will work.
* src/xfns.c (x_real_pos_and_offsets): When translating coordinates,
send coordinates (0,0) to the X server and add in the real coordinates
after getting the response. Move XGetGeometry for outer window inside
error-trapping block. Use DPY variable more, since it's available.
Eli Barzilay [Thu, 12 Nov 2015 08:07:38 +0000 (03:07 -0500)]
Add "^" to the interactive specs of `dired-next/previous-line'
* lisp/dired.el (dired-next-line, dired-previous-line): It makes sense
to bind these commands to the arrow keys, and that means that they work
better with a "^" in the `interactive' declaration so selection works
as expected.
Alan Mackenzie [Wed, 11 Nov 2015 22:06:12 +0000 (22:06 +0000)]
CC Mode: Respect users' settings of open-paren-in-column-0-is-defun-start.
lisp/progmodes/cc-engine.el (c-backward-single-comment, c-backward-comments)
(c-invalidate-state-cache-1, c-parse-state-1, c-guess-basic-syntax):
remove bindings of open-paren-in-column-0-is-defun-start to nil.
(c-get-fallback-scan-pos): "New" function (existed several years ago).
(c-parse-state-get-strategy): Reintroduce the 'BOD strategy, using
c-get-fallback-scan-pos.
(c-parse-state-1): Handle 'BOD strategy.
lisp/progmodes/cc-mode.el (c-before-change, c-after-change)
c-font-lock-fontify-region): remove bindings of
open-paren-in-column-0-is-defun-start to nil.
cc-mode.texi (Performance Issues, Limitations and Known Bugs): Fix mix up
between @chapter and @appendix.
Nicolas Petton [Wed, 11 Nov 2015 17:18:32 +0000 (18:18 +0100)]
Rename seq-p and map-p to seqp and mapp
* lisp/emacs-lisp/seq.el (seqp): New name.
* lisp/emacs-lisp/map.el (mapp): New name.
* doc/lispref/sequences.texi: Update the documentation for seqp.
* test/automated/map-tests.el: Update the tests for mapp.
David Reitter [Tue, 10 Nov 2015 20:41:17 +0000 (15:41 -0500)]
Avoid creating notification objects when possible
* src/nsterm.m (windowWillEnterFullScreen, windowWillExitFullScreen:,
windowDidEnterFullScreen, windowDidExitFullScreen): provide
convenience functions that do not require a notification object. When
needed, define NSWindowDidEnterFullScreenNotification to allow for
compilation on OS X 10.6.8.
Paul Eggert [Tue, 10 Nov 2015 20:46:22 +0000 (12:46 -0800)]
Move INTEGER_TO_CONS body out of .h file
* src/data.c (INTBIG_TO_LISP): New macro, with most
of the contents of the old INTEGER_TO_CONS.
(intbig_to_lisp, uintbig_to_lisp): New functions.
* src/lisp.h (INTEGER_TO_CONS):
Simplify by using EXPR_SIGNED and the new functions.
This shrinks code size a bit, and makes it easier to
put a breakpoint on handling of large integers.
Artur Malabarba [Tue, 10 Nov 2015 13:26:00 +0000 (13:26 +0000)]
* lisp/files.el: Don't allow customization of dir-locals sorting
In retrospect, this is not a good idea for the same reason that
`dir-locals-file' is a defconst, because it is important that this
behaviour be "uniform across different environments and users".
Sure, the user can still change the sorting with a hack, but we
shouldn't encourage them to change it.
(dir-locals--all-files): Return list in the order returned by
`file-expand-wildcards'.
(file-expand-wildcards): Document the sorting predicate used.
(dir-locals-sort-predicate): Delete variable.