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.
(dir-locals-find-file, dir-locals-collect-variables)
(dir-locals-read-from-file): Update accordingly.
(hack-dir-local-variables): Rename a local variable.
Thanks to Juanma Barranquero for noticing the autoload problems
introduced by my recent commit adding/changing the above functions
(Sun Nov 8 14:16:43 2015 -0500, git commit 3812e17978).
Noah Friedman [Tue, 10 Nov 2015 01:34:40 +0000 (17:34 -0800)]
(ydump-buffer): Handle case where gap is at the start of buffer.
I don't recall if older versions of gdb were less strict but you
cannot dump a 0-length range in gdb 7.9.1.
Dmitry Gutov [Tue, 10 Nov 2015 00:41:06 +0000 (02:41 +0200)]
Fold `project-ask-user' into `project-current'
* lisp/progmodes/project.el (project-find-functions): Remove
`project-ask-user'.
(project-ask-user): Remove function and the corresponding
`project-roots' implementation.
(project-current): Add a new argument, MAYBE-PROMPT. Prompt the
user in case there's no project in the current directory. Update
all callers.
Karl Fogel [Mon, 9 Nov 2015 21:57:23 +0000 (15:57 -0600)]
When VC detects a conflict, specify which file
* lisp/vc/vc.el (vc-message-unresolved-conflicts): New function.
* lisp/vc/vc-svn.el (vc-svn-find-file-hook):
* lisp/vc/vc-hg.el (vc-hg-find-file-hook):
* lisp/vc/vc-bzr.el (vc-bzr-find-file-hook):
* lisp/vc/vc-git.el (vc-git-find-file-hook): Use above new function
to display a standard message that specifies the conflicted file.
Before this change, the message VC used for indicating a conflicted
file was just "There are unresolved conflicts in this file" without
naming the file (and this language was duplicated in several places).
After this change, it's "There are unresolved conflicts in file FOO"
(and this language is now centralized in one function in vc.el).
Justification: It's important for the message to name the conflicted
file because the moment when VC realizes a file is conflicted does not
always come interactively. For example, some people automatically
find a set of Org Mode files on startup, and may keep those .org files
under version control. If any of the files are conflicted, the user
just sees some messages fly by, and might later check the "*Messages*"
buffer to find out what files were conflicted. I'm not saying this
happened to me or anything; it's a purely hypothetical example.
Eli Zaretskii [Mon, 9 Nov 2015 18:31:45 +0000 (20:31 +0200)]
Fix assertion violation in define-key
* src/keymap.c (store_in_keymap): Don't use XFASTINT on non-character
objects. Reported by Drew Adams <drew.adams@oracle.com>
and Juanma Barranquero <lekktu@gmail.com>.
Dima Kogan [Mon, 9 Nov 2015 16:36:05 +0000 (18:36 +0200)]
Fix a memory leak in GC of font cache
* src/alloc.c (compact_font_cache_entry): Don't GC unmarked font
entities if some of the fonts it references are marked. This
plugs a memory leak. (Bug#21556)
Add support for retrieving the path to a JSON element. This can for
instance be useful to retrieve paths in deeply nested JSON
structures.
* lisp/json.el (json-pre-element-read-function)
(json-post-element-read-function): New variables to hold pre- and post
read callback functions for `json-read-array' and `json-read-object'.
(json--path): New variable used internally by `json-path-to-position'.
(json--record-path, json--check-position): New functions used
internally by `json-path-to-position'.
(json-path-to-position): New function for retrieving the path to a
JSON element at a given position.
(json-read-object, json-read-array): Call
`json-pre-element-read-function' and `json-post-element-read-function'
when set.
* test/automated/json-tests.el (test-json-path-to-position-with-objects)
(test-json-path-to-position-with-arrays)
(test-json-path-to-position-no-match): New tests for
`json-path-to-position'.
Karl Fogel [Sun, 8 Nov 2015 19:16:43 +0000 (14:16 -0500)]
Offer non-overwrite bookmark setter (Bug#15746)
* lisp/bookmark.el (bookmark-set-internal): New helper function to do
what `bookmark-set' used to do, but with more choices for overwrite
vs push, and with minor changes to the interactive prompt format.
(bookmark-set): Rewrite as wrapper around above.
If overwriting, inform the user of that in the prompt.
(bookmark-set-no-overwrite): New function, also done as wrapper.
Bind to "M" in `ctl-x-r-map' autoloads.
(bookmark-map): Similarly bind "M" here.
Alan Modra [Sun, 8 Nov 2015 17:29:00 +0000 (09:29 -0800)]
ELF unexec: Don't insert a new section
Reuse the .bss section instead, making it SHT_PROGBITS. This way we
don't need to mess with symbol st_shndx, or section sh_link and
sh_info.
This does lead to eu-elflint complaints about symbols defined in .bss
with a needed version, because normally it is undefined symbols that
have needed versions; Defined symbols have version definitions.
The exception is symbols defined by the linker in .dynbss for
variables copied from a shared library in order to avoid text
relocations, with copy relocs to copy their initial values from the
shared library. These symbols are both defined and have needed
versions, and eu-elflink only expects to see them in SHT_NOBITS
sections. Of course there is no real problem with having such symbols
in SHT_PROGBITS sections. glibc ld.so handles them fine.
* unexelf.c: Delete outdated comments.
(PATCH_INDEX): Delete.
(find_section): Delete.
(unexec): Don't add a new section. Instead reuse the last bss
section, extending it to cover dumped data. Make bss sections
SHT_PROGBITS. Remove all patching of sh_link, sh_info and
st_shndx. Rename bss sections.
Alan Modra [Sun, 8 Nov 2015 17:29:00 +0000 (09:29 -0800)]
ELF unexec: Drive from PT_LOAD header rather than sections
This rewrites bss handling in the ELF unexec code. Finding bss
sections by name results in complicated code that
- does not account for all names of possible bss sections,
- assumes specific ordering of bss sections,
- can wrongly choose a SHT_NOBITS section not in the bss segment,
- incorrectly calculates bss size (no accounting for alignment gaps),
- assumes .data and .bss are in the same segment.
All of these problems and more are solved by finding the bss segment
in PT_LOAD headers, ie. the address range included in p_memsz but not
p_filesz of the last PT_LOAD header, then matching SHT_NOBITS sections
in that address range.
* unexelf.c: Delete old ppc comment.
(OLD_PROGRAM_H): Define.
(round_up): Delete.
(unexec): Don't search for bss style sections by name. Instead,
use the last PT_LOAD header address range covered by p_memsz
but not p_filesz and match any SHT_NOBITS section in that
address range. Simplify initialisation of section header vars.
Don't assume that section headers are above bss segment. Move
copying of bss area out of section loop. Align .data2 section
to 1, since it now covers the entire bss area. For SHT_NOBITS
sections in the bss segment, leave sh_addr and sh_addralign
unchanged, but correct sh_offset. Clear memory corresponding
to SHT_NOBITS .plt section. Delete comment and hacks for
sections partly overlapping bss range now that the full range
is properly calculated. Delete now dead .sbss code.
(Bug#20614)
Alan Modra [Sun, 8 Nov 2015 17:29:00 +0000 (09:29 -0800)]
ELF unexec: _OBJC_ symbols in bss sections
This code assumed that there was only one bss section. Rather than
checking for a particular index, check the section type. Also, handle
the possibility that the section was SHT_NOBITS originally and is
unchanged, in which case no clearing is needed (and sh_offset isn't
necessarily valid, which can lead to a wild memset).
* unexelf.c (unexec): Properly handle _OBJC_ symbols in bss sections.
Alan Modra [Sun, 8 Nov 2015 17:29:00 +0000 (09:29 -0800)]
ELF unexec: Symbol table patching
No st_shndx value larger than SHN_LORESERVE should be changed.
* unexelf.c (unexec): Don't adjust any st_shndx larger than
SHN_LORESERVE. Error on SHN_XINDEX.
Alan Modra [Sun, 8 Nov 2015 17:28:59 +0000 (09:28 -0800)]
ELF unexec: Merge Alpha and MIPS COFF debug handling
* unexelf.c (unexec): Merge Alpha and MIPS COFF debug handling.
Don't find .mdebug section index, find the section in the loop.
Allow for unlikely possibility that .mdebug is located at sh_offset
before bss segment, by calculating move from difference in
sh_offset rather than just assuming new_data2_size. Simplify
cbLineOffset handling.
Alan Modra [Sun, 8 Nov 2015 17:28:59 +0000 (09:28 -0800)]
ELF unexec: Tidy code
Separate out some of the more mechanical changes so following patches
are smaller.
* unexelf.c (unexec): Rearrange initialisation of program
header vars. Use pointer vars in loops rather than indexing
section header array via macros. Simplify _OBJC_ sym code
and reloc handling code.
Alan Modra [Sun, 8 Nov 2015 17:28:59 +0000 (09:28 -0800)]
ELF unexec: Correct section header index
First a small fix. The code incorrectly uses "NEW_SECTION_H (n)" when
it should have been using "NEW_SECTION_H (nn)" to find the name of the
section currently being processed. Of course, before the bss
sections, n and nn have the same value, so this doesn't matter except
in the case of .sbss. For .sbss this probably meant .bss (most likely
the next section) was copied from memory. A later patch removes the
bogus .sbss handling anyway.
* unexelf.c (unexec): Use correct index to look up names.
Michael Albinus [Sun, 8 Nov 2015 14:22:09 +0000 (15:22 +0100)]
Fix Bug#21841
* lisp/filenotify.el (file-notify--rm-descriptor):
Use `descriptor' instead of computing its value.
(file-notify--descriptor): Additional argument FILE. Adapt all callees.
(file-notify-rm-watch): Use `descriptor' when calling file name handler.
(Bug#21841)
Dmitry Gutov [Sun, 8 Nov 2015 12:46:22 +0000 (14:46 +0200)]
Remove dirs in vc project roots from the the vc project library roots
* lisp/progmodes/project.el (project-library-roots): Remove
directories inside the project roots from the result.
(http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg00536.html)
Paul Eggert [Sun, 8 Nov 2015 07:52:17 +0000 (23:52 -0800)]
Prefer xpalloc to doubling buffers by hand
* src/lread.c (grow_read_buffer): New function, which uses xpalloc.
(read1): Use it for simplicity.
* src/macros.c (store_kbd_macro_char):
* src/minibuf.c (read_minibuf_noninteractive):
* src/term.c (encode_terminal_code):
* src/xrdb.c (magic_db):
Prefer xpalloc to growing buffers by hand.
This doesn’t fix any bugs, but simplifies the code a bit.
Dmitry Gutov [Fri, 6 Nov 2015 03:08:51 +0000 (05:08 +0200)]
Move and rename xref-find-regexp to the project package
* lisp/progmodes/project.el (project-find-regexp)
(project--read-regexp)
(project--find-regexp-in): New functions.
* lisp/progmodes/xref.el (xref--find-xrefs): Extract from
xref--show-xrefs. Use in existing callers in place of that
function.
(xref--show-xrefs): Only do the "show" part.
(xref-find-regexp): Rename, more or less, to
project-or-libraries-find-regexp.
David Reitter [Sat, 7 Nov 2015 13:32:59 +0000 (08:32 -0500)]
Ignore fullscreen exit notifications on NS when frame is dead
* nsterm.m (windowDidResize:,windowWillExitFullScreen:)
(windowDidExitFullScreen:): Return if frame is dead.
These functions may be called when a fullscreen frame
is closed; they are called before, not after.
Eli Zaretskii [Sat, 7 Nov 2015 13:32:45 +0000 (15:32 +0200)]
Speed up lookup in redisplay--variables
* lisp/frame.el (redisplay--variables): Make it a hash-table.
* src/xdisp.c (maybe_set_redisplay): Access redisplay--variables
as a hash-table. This speeds up this function by an order of
magnitude: where previously a setq was slowed down by 100% by
introducing the maybe_set_redisplay test, it is now only 5%
slower.
(syms_of_xdisp) <redisplay--variables>: Doc fix.
Eli Zaretskii [Fri, 6 Nov 2015 15:19:39 +0000 (17:19 +0200)]
Don't invoke overlay modification hooks in wrong buffer
* src/buffer.c (report_overlay_modification): When called with
AFTER non-zero, don't invoke overlay modification hooks if the
buffer recorded in last_overlay_modification_hooks is different
from the current buffer. (Bug#21824)
Dmitry Gutov [Tue, 3 Nov 2015 00:36:50 +0000 (02:36 +0200)]
Abolish temporary buffer management for xref
* lisp/progmodes/xref.el (xref--temporary-buffers)
(xref--current)
(xref--inhibit-mark-current)
(xref--mark-selected): Remove. Remove all references.
(xref--show-xrefs): Do not construct the
list of the temporary buffers, nor pass it along.
Dmitry Gutov [Tue, 3 Nov 2015 00:11:45 +0000 (02:11 +0200)]
Rename "search path" to "library roots"
* lisp/emacs-lisp/cl-seq.el (cl-set-difference): Retain the order
of the elements from CL-LIST1.
* test/automated/cl-lib-tests.el (cl-lib-test-set-functions):
Update WRT to the above change.
* lisp/progmodes/project.el (project-search-path-function): Rename
to project-library-roots-function, update the documentation and
references.
(project-search-path): Likewise, to project-library-roots.
(project-roots): Clarify documentation.
(project-vc-search-path): Likewise, to project-vc-library-roots.
(project-library-roots): In addition to the renames, thread the
results through file-name-as-directory.
(project-prune-directories): Accept a variable number of
arguments. Rename to project-combine-directories.
(project-subtract-directories): New function.
* lisp/progmodes/elisp-mode.el (elisp--xref-find-references):
Append project-roots and project-library-roots together.