summaryrefslogtreecommitdiff
path: root/src
Commit message (Expand)AuthorAgeFilesLines
* Some final fixes in file notification before merging with master...* lisp/filenotify.el (file-notify--rm-descriptor): Remove WHAT arg. (file-notify-callback): Improve check for `stopped' event. Call `file-notify-rm-watch' rather than `file-notify--rm-descriptor'. (file-notify-add-watch): In case FILE is not a directory, call the file monitor for the kqueue backend. Otherwise, call the directory monitor for the upper directory. * src/inotify.c (inotifyevent_to_event): Extract file name from watch_object if the event doesn't provide it. (Finotify_add_watch): Add file name to watch_object. * test/automated/file-notify-tests.el (file-notify--test-timeout): Use different timeouts for different libraries. (file-notify--test-with-events): Suppress lock files. Flush outstanding events before running the body. (file-notify-test02-events, file-notify-test04-file-validity): Do not skip cygwin tests. Add additional test for file creation. Adapt expected result for different backends. (file-notify-test03-autorevert): Some of the tests don't work for w32notify. (file-notify-test06-many-events): Rename into both directions. Michael Albinus2015-11-251-4/+5
* Rework file notifications, kqueue has problems with directory monitors...* lisp/filenotify.el (file-notify-add-watch): Call the native add-watch function on the file, not on the dir. * src/kqueue.c (kqueue_compare_dir_list): Make also bookkeeping about already deleted entries. * test/automated/auto-revert-tests.el (auto-revert-test01-auto-revert-several-files): Do not call "cp -f" since this deletes the target file first. * test/automated/file-notify-tests.el (file-notify--test-event-test): Make stronger checks. (file-notify-test01-add-watch, file-notify-test02-events) (file-notify-test04-file-validity, file-notify-test05-dir-validity): Rewrite in order to call file monitors but directory monitors. (file-notify-test06-many-events): Ler rename work in both directions. Michael Albinus2015-11-251-16/+32
* Continie with pending events...* src/kqueue.c (pending_events): Remove global variable. (kqueue_compare_dir_list): Create `write' event for not used pending events. (globals_of_kqueue): Remove initialization of pending_events. Michael Albinus2015-11-251-14/+31
* Handle more complex rename operation in kqueue...* src/kqueue.c (pending_events): New variable. (kqueue_compare_dir_list): Handle more complex rename operation. (globals_of_kqueue): Initialize pending_events. * test/automated/file-notify-tests.el (file-notify-test06-many-events): Adapt expected events in the `rename-file' case. (file-notify-test06-many-events-remote): Declare. Michael Albinus2015-11-251-6/+19
* Further fixes for kqueue....* lisp/filenotify.el (file-notify-callback): Raise also event if directory name matches. (file-notify-add-watch): Add `create' to the flags for `kqueue'. * src/kqueue.c (kqueue_generate_event): Use watch_object as argument instead of ident. Remove callback argument. Adapt callees. Check actions whether they are monitored flags. * test/automated/file-notify-tests.el (file-notify--test-library): New defun. (file-notify-test00-availability, file-notify-test02-events) (file-notify-test04-file-validity) (file-notify-test05-dir-validity): Use it. (file-notify-test02-events, file-notify-test04-file-validity): Add `read-event' calls between different file actions, in order to give the backends a chance to rais an event. Needed especially for kqueue. In case of deleting a directory, there are two `deleted' events. Michael Albinus2015-11-251-37/+44
* Code cleanup of kqueue.c...* src/kqueue.c (kqueue_directory_listing): Skip "." and "..". (kqueue_compare_dir_list): Do not loop when calling directory_files_internal. Remove checks for "." and "..", this is done in kqueue_directory_listing now. (Fkqueue_add_watch): Check for proper emacs_open flags. Michael Albinus2015-11-251-52/+57
* Finish implementation in kqueue.c...* src/kqueue.c (kqueue_directory_listing, kqueue_callback): Simplify access to list. (kqueue_compare_dir_list): Simplify access to list. Raise `delete' event if directory does not exist any longer. Otherwise, wait until directory contents has changed. Fix error in check. Michael Albinus2015-11-251-23/+35
* More work on kqueue...* lisp/filenotify.el (file-notify-callback): Handle also the `rename' event from kqueue. (file-notify-add-watch): Do not register an entry twice. * src/kqueue.c (kqueue_directory_listing): New function. (kqueue_generate_event): New argument FILE1. Adapt callees. (kqueue_compare_dir_list): Rewrite in order to make it more robust. Michael Albinus2015-11-251-50/+140
* Implement directory events...* lisp/filenotify.el (file-notify-handle-event) (file-notify-callback): Remove traces. * src/kqueue.c: Include <sys/time.h>. (kqueue_generate_event, kqueue_compare_dir_list): New functions. (kqueue_callback): Use them. Call kevent() with a zero timeout. (Fkqueue_add_watch): Adapt docstring. Support directory events. Compute initial directory listing. Close file descriptor in case of errors. (syms_of_kqueue): Declare Qcreate. Michael Albinus2015-11-251-30/+119
* Build fixes for kqueue support....* src/kqueue.c (Fkqueue_add_watch): O_BINARY is not a POSIX open(3) flag. * configure.ac (HAVE_KQUEUE): There is no pkg-config module for native kqueue on *BSD. Wolfgang Jenkner2015-11-251-1/+1
* Continue kqueue implementation...* lisp/filenotify.el (file-notify-handle-event) (file-notify-callback): Enable trace messages. * src/kqueue.c: Include also <sys/types.h>. (kqueue_callback): Remove watch in case of NOTE_DELETE or NOTE_RENAME. (Fkqueue_rm_watch, Fkqueue_valid_p): New functions. (syms_of_kqueue): Add them. Michael Albinus2015-11-251-39/+41
* Work on kqueue...* lisp/filenotify.el (file-notify--library) (file-notify-descriptors, file-notify-callback) (file-notify-add-watch, file-notify-rm-watch) (file-notify-valid-p): Add kqueue support. * src/keyboard.c (make_lispy_event): Check also for HAVE_KQUEUE. Michael Albinus2015-11-252-172/+102
* Add kqueue support...* configure.ac (--with-file-notification): Add kqueue. (top): Remove special test for "${HAVE_NS}" and ${with_file_notification}, this is handled inside gfilenotify tests. Add kqueue tests. Use NOTIFY_CFLAGS and NOTIFY_LIBS instead of library specific variables. * src/Makefile.in: Use NOTIFY_CFLAGS and NOTIFY_LIBS. * src/emacs.c (main): Call globals_of_kqueue and syms_of_kqueue. * src/kqueue.c: New file. * src/lisp.h: Declare extern globals_of_kqueue and syms_of_kqueue. Michael Albinus2015-11-254-14/+368
* 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) Juri Linkov2015-11-141-3/+19
* 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 Eggert2015-11-131-56/+50
* 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. Paul Eggert2015-11-132-8/+15
* * src/undo.c (run_undoable_change): Now static.Paul Eggert2015-11-131-1/+1
* 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. * doc/lispref/os.texi (Desktop Notifications): Don't mention ':timeout'. Eli Zaretskii2015-11-131-15/+0
* * src/undo.c: Small fixes for previous change...(run_undoable_change): Mark void argument list. (record_property_change): Remove unused variable `boundary'. Juanma Barranquero2015-11-131-2/+1
* Fix last change...* src/w32fns.c (syms_of_w32fns) [WINDOWSNT && !HAVE_DBUS]: Don't DEFSYM tray notification symbols if D-Bus is being used. Eli Zaretskii2015-11-131-0/+2
* 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>. Eli Zaretskii2015-11-131-2/+4
* 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. YAMAMOTO Mitsuharu2015-11-131-7/+10
* ; Merge branch 'fix/no-undo-boundary-on-secondary-buffer-change'...Conflicts: src/cmds.c src/keyboard.c Phillip Lord2015-11-124-87/+37
|\
| * 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. Phillip Lord2015-11-124-80/+30
* | 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>. Eli Zaretskii2015-11-121-14/+12
* | 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 Raeburn2015-11-121-17/+200
* | 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 Raeburn2015-11-121-8/+37
* | Detect XCB and save a connection handle...* configure.ac: If using X11, check for XCB libraries and header. * src/Makefile.in (XCB_LIBS): Define. (LIBX_EXTRA): Include it. * src/xterm.h [USE_XCB]: Include X11/Xlib-xcb.h. (struct x_display_info) [USE_XCB]: Add an XCB connection handle field. * src/xterm.c (x_term_init) [USE_XCB]: Initialize the new field. Ken Raeburn2015-11-123-1/+35
* | 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. Ken Raeburn2015-11-121-19/+27
* | Use color cache for creating bitmap...* src/image.c (x_create_bitmap_from_xpm_data) [ALLOC_XPM_COLORS]: Set attributes to use the caching color allocator. Initialize and free the cache. Ken Raeburn2015-11-121-0/+11
* | Implement tray notifications for MS-Windows...* src/w32fns.c (MY_NOTIFYICONDATAW): New typedef. (NOTIFYICONDATAW_V1_SIZE, NOTIFYICONDATAW_V2_SIZE) (NOTIFYICONDATAW_V3_SIZE, NIF_INFO, NIIF_NONE, NIIF_INFO) (NIIF_WARNING, NIIF_ERROR, EMACS_TRAY_NOTIFICATION_ID) (EMACS_NOTIFICATION_MSG): New macros. (NI_Severity): New enumeration. (get_dll_version, utf8_mbslen_lim, add_tray_notification) (delete_tray_notification, Fw32_notification_notify) (Fw32_notification_close): New functions. (syms_of_w32fns): Defsubr functions exposed to Lisp. DEFSYM keywords used by w32-notification-notify. * doc/lispref/os.texi (Desktop Notifications): Describe the native w32 tray notifications. Eli Zaretskii2015-11-111-0/+478
* | 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. David Reitter2015-11-101-12/+28
* | 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. Paul Eggert2015-11-102-11/+30
* | Spelling fixes...* lisp/net/soap-inspect.el (soap-inspect-xs-simple-type): Fix misspelling in output. Paul Eggert2015-11-104-11/+11
* | 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>. Eli Zaretskii2015-11-091-1/+3
* | 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) Dima Kogan2015-11-091-3/+27
* | Use INT_ADD_WRAPV etc. to check integer overflow...* src/alloc.c (xnmalloc, xnrealloc, xpalloc, Fmake_string): * src/buffer.c (record_overlay_string, overlay_strings): * src/casefiddle.c (casify_object): * src/ccl.c (Fccl_execute_on_string): * src/character.c (char_width, c_string_width, lisp_string_width) (count_size_as_multibyte, string_escape_byte8): * src/coding.c (coding_alloc_by_realloc, produce_chars): * src/data.c (arith_driver): * src/dispnew.c (realloc_glyph_pool, init_display): * src/editfns.c (styled_format): * src/fns.c (Ffillarray): * src/ftfont.c (ftfont_shape_by_flt): * src/gnutls.c (gnutls_hex_string): * src/gtkutil.c (get_utf8_string): * src/image.c (x_to_xcolors, x_detect_edges, png_load_body): * src/keymap.c (Fkey_description): * src/lisp.h (SAFE_ALLOCA_LISP): * src/term.c (encode_terminal_code): * src/tparam.c (tparam1): * src/xselect.c (x_property_data_to_lisp): * src/xsmfns.c (smc_save_yourself_CB): * src/xterm.c (x_term_init): When checking for integer overflow, prefer INT_MULTIPLY_WRAPV to more-complicated code involving division and/or INT_MULTIPLY_OVERFLOW, and similarly for INT_ADD_WRAPV and subtraction and/or INT_ADD_OVERFLOW. * src/casefiddle.c (casify_object): Simplify multibyte size check. * src/character.c: Remove some obsolete ‘#ifdef emacs’s. * src/data.c (arith_driver): Also check for division overflow, as that’s now possible given that the accumulator can now contain any Emacs integer. * src/lisp.h (lisp_word_count): Remove; no longer used. Paul Eggert2015-11-0821-184/+150
* | * src/unexelf.c (NEW_PROGRAM_H): Remove unused macro (Bug#20614).Paul Eggert2015-11-081-3/+1
* | 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 Modra2015-11-081-474/+50
* | 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 Modra2015-11-081-213/+77
* | ELF unexec: R_*_NONE relocs...These should be ignored on all targets. * unexelf.c (unexec): Ignore R_*_NONE relocs for any target, not just Alpha. Comment on reloc size assumption. Alan Modra2015-11-081-7/+7
* | 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 Modra2015-11-081-13/+18
* | 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 Modra2015-11-081-4/+5
* | 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 Modra2015-11-081-67/+29
* | 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 Modra2015-11-081-114/+96
* | 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. Alan Modra2015-11-081-8/+8
* | 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. Paul Eggert2015-11-075-38/+24
* | Provide NS notification objects where required to eliminate warnings...* nsterm.m (windowDidResize:, toggleFullScreen:): Call notification functions with notification objects as per delegate APIs. David Reitter2015-11-071-5/+18
* | 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. May address Bug#21428. David Reitter2015-11-071-3/+15
* | 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 Zaretskii2015-11-071-2/+3