Michael Albinus [Sat, 9 Mar 2013 11:06:23 +0000 (12:06 +0100)]
Major rewrite due to changed D-Bus interface of GVFS 1.14.
* net/tramp-gvfs.el (top): Extend check for gvfs availability.
(tramp-gvfs-methods-mounttracker, tramp-gvfs-listmounts)
(tramp-gvfs-mountlocation, tramp-gvfs-mountlocation-signature):
New defconst.
(tramp-gvfs-file-name-handler-alist) [directory-files]:
[directory-files-and-attributes, file-exists-p, file-modes]: Use
Tramp default handler.
[file-acl, file-selinux-context, process-file, set-file-acl]:
[set-file-modes, set-file-selinux-context, shell-command]:
[start-file-process ]: Remove handler.
[verify-visited-file-modtime]: New handler.
(tramp-gvfs-dbus-string-to-byte-array)
(tramp-gvfs-dbus-byte-array-to-string): New defuns. Replace all
calls of `dbus-string-to-byte-array' and
`tramp-gvfs-dbus-byte-array-to-string'.
(tramp-gvfs-handle-copy-file)
(tramp-gvfs-handle-delete-directory)
(tramp-gvfs-handle-delete-file, tramp-gvfs-handle-file-attributes)
(tramp-gvfs-handle-file-directory-p)
(tramp-gvfs-handle-file-executable-p)
(tramp-gvfs-handle-file-name-all-completions)
(tramp-gvfs-handle-file-readable-p)
(tramp-gvfs-handle-file-writable-p)
(tramp-gvfs-handle-insert-directory)
(tramp-gvfs-handle-insert-file-contents)
(tramp-gvfs-handle-make-directory, tramp-gvfs-handle-rename-file)
(tramp-gvfs-handle-set-visited-file-modtime)
(tramp-gvfs-handle-write-region): Rewrite.
(tramp-gvfs-handle-file-acl)
(tramp-gvfs-handle-file-selinux-context)
(tramp-gvfs-handle-process-file, tramp-gvfs-handle-set-file-acl)
(tramp-gvfs-handle-set-file-modes)
(tramp-gvfs-handle-set-file-selinux-context)
(tramp-gvfs-handle-shell-command)
(tramp-gvfs-handle-start-file-process)
(tramp-gvfs-handle-verify-visited-file-modtime): Remove defuns.
(tramp-gvfs-url-file-name): Do not use `file-truename', we work
over the symlinks. Fix user handling.
(top, tramp-gvfs-handler-mounted-unmounted): Handle different names
of the D-Bus signals.
(tramp-gvfs-connection-mounted-p): Handle different names of the
D-Bus methods.
(tramp-gvfs-mount-spec-entry): New defun.
(tramp-gvfs-mount-spec): Use it.
(tramp-gvfs-maybe-open-connection): Check, that in case of "smb"
there is a share name. Handle different names of the D-Bus
signals and methods.
(tramp-gvfs-maybe-open-connection): Set connection properties
needed for `tramp-check-cached-permissions'.
(tramp-gvfs-send-command): Apply `tramp-gvfs-maybe-open-connection'.
Return t or nil.
* net/tramp.el (tramp-backtrace): Move up.
(tramp-error): Apply a backtrace into the debug buffer when
`tramp-verbose > 9.
(tramp-file-mode-type-map, tramp-file-mode-from-int)
(tramp-file-mode-permissions, tramp-get-local-uid)
(tramp-get-local-gid, tramp-check-cached-permissions): Move from
tramp-sh.el.
Stefan Monnier [Sat, 9 Mar 2013 04:15:53 +0000 (23:15 -0500)]
Separate mouse-1-click-follows-link from mouse-drag-region.
* lisp/mouse.el (mouse--down-1-maybe-follows-link): New function.
(key-translation-map): Use it to implement mouse-1-click-follows-link.
(mouse-drag-line, mouse-drag-track): Remove mouse-1-click-follows-link code.
(mouse--remap-link-click-p): Remove.
* src/keyboard.c (access_keymap_keyremap): Accept nil return value from
functions to mean "no change".
* src/keyboard.h (EVENT_START, EVENT_END, POSN_WINDOW, POSN_POSN)
(POSN_WINDOW_POSN, POSN_TIMESTAMP): Be careful since events may come
from Elisp via unread-command-events.
Dmitry Antipov [Fri, 8 Mar 2013 09:34:35 +0000 (13:34 +0400)]
* search.c (find_newline): Accept start and end byte positions
as arguments and allow -1 if not known.
(find_newline_no_quit): Likewise for start position.
* lisp.h (find_newline, find_newline_no_quit): Adjust prototype.
* bidi.c (bidi_find_paragraph_start): Pass byte position to
find_newline_no_quit, thus eliminating CHAR_TO_BYTE.
* editfns.c (Fconstrain_to_field): Break long line. Adjust
call to find_newline.
* indent.c (vmotion): Adjust calls to find_newline_no_quit.
Use DEC_BOTH to start next search from the previous buffer
position, where appropriate.
* xdisp.c (back_to_previous_line_start, forward_to_next_line_start)
(get_visually_first_element, move_it_vertically_backward): Likewise.
Obtain byte position from the display iterator, where appropriate.
Dmitry Antipov [Thu, 7 Mar 2013 23:37:36 +0000 (03:37 +0400)]
* bidi.c (bidi_fetch_char): Swap first and second arguments
to match other functions accepting character and byte positions.
Adjust comment.
(bidi_resolve_explicit_1, bidi_level_of_next_char): Adjust users.
(bidi_paragraph_init): Likewise. Use DEC_BOTH which is faster
when you need just to move to the previous buffer position.
* xdisp.c (Fcurrent_bidi_paragraph_direction): Use DEC_BOTH.
Karl Fogel [Thu, 7 Mar 2013 22:35:47 +0000 (16:35 -0600)]
* bookmark.el: Define a face to highlight bookmark names in
bookmark menu buffers, where the default is a bold face similarly
to buffer names in buffer menu buffers. Patch by Matthias Meulien
<orontee {_AT_} gmail.com>.
(bookmark-menu-bookmark): New face to highlight bookmark names.
(bookmark-insert-location): Removes dupplicated text property to
conform to buffer list (see `list-buffers')
(bookmark-bmenu-list, bookmark-bmenu-hide-filenames): Apply face
`bookmark-menu-bookmark' to bookmark names.
Karl Fogel [Thu, 7 Mar 2013 22:33:22 +0000 (16:33 -0600)]
* bookmark.el: Display the bookmark list header similarly to the
buffer list header (see `list-buffers'), where the default is now
an immovable/immutable header line. Patch by Matthias Meulien
<orontee {_AT_} gmail.com> with a few tweaks by me.
(bookmark-bmenu-use-header-line): New variable.
(bookmark-bmenu-inline-header-height): New name for
`bookmark-bmenu-header-height', to avoid confusion with the code
for the new immovable header. All references changed.
(bookmark-bmenu-set-header): New function.
(bookmark-bmenu-list, bookmark-bmenu-toggle-filenames):
Conditionalize header construction accordingly.
(bookmark-bmenu-ensure-position): Conditionalize the skipping of
the inline header height.
(bookmark-bmenu-show-filenames, bookmark-bmenu-hide-filenames):
Conditionalize the skipping of the inline header height.
Dmitry Antipov [Thu, 7 Mar 2013 04:42:59 +0000 (08:42 +0400)]
Avoid character to byte conversions in motion subroutines.
* indent.h (compute_motion, vmotion): Add byte position argument.
* indent.c (compute_motion): Use it and avoid CHAR_TO_BYTE.
Add eassert.
(Fcompute_motion): Break long line. Adjust call to compute_motion.
Use list5 for return value.
(vmotion): Use byte position argument and avoid call to CHAR_TO_BYTE.
Adjust comments, style and calls to compute_motion.
(Fvertical_motion): Adjust call to vmotion.
* window.c (Fdelete_other_windows_internal): Record window start
byte position and adjust call to vmotion.
(window_scroll_line_based): Likewise with call to compute_motion.
Use SET_PT_BOTH.
(Frecenter): Adjust calls to vmotion.
Alan Mackenzie [Wed, 6 Mar 2013 14:24:39 +0000 (14:24 +0000)]
Correct the position of point in some line-up functions.
progmodes/cc-align.el (c-lineup-whitesmith-in-block, c-lineup-assignments)
(c-lineup-gcc-asm-reg ): take position of point at column 0 rather than
at a random place in the line.
doc/misc/cc-mode.texi (Custom Line-Up): State explicitly that point
starts at a random position in the line being indented.
Paul Eggert [Tue, 5 Mar 2013 22:35:41 +0000 (14:35 -0800)]
FILE's lock is now always .#FILE and may be a regular file.
* etc/NEWS: Document this.
* nt/inc/unistd.h (O_NOFOLLOW): New macro.
* src/filelock.c: Include <c-ctype.h>.
(MAX_LFINFO): New top-level constant.
(lock_info_type): Remove members pid, boot_time. Add members at,
dot, colon. Change user member to be the entire buffer, not a
pointer. This allows us to handle the case where a foreign
pid or boot time exceeds the local range. All uses changed.
(LINKS_MIGHT_NOT_WORK): New constant.
(FREE_LOCK_INFO): Remove, as the pieces no longer need freeing.
(defined_WINDOWSNT): Remove.
(MAKE_LOCK_NAME, file_in_lock_file_name):
Always use .#FILE (not .#-FILE) for the file lock,
even if it is a regular file.
(rename_lock_file): New function.
(create_lock_file): Use it.
(create_lock_file, read_lock_data):
Prefer a symbolic link for the lock file, falling back on a
regular file if symlinks don't work. Do not try to create
symlinks on MS-Windows, due to security hassles. Stick with
POSIXish functions (open, read, write, close, fchmod, readlink, symlink,
link, rename, unlink, mkstemp) when creating locks, as a GNUish
host may be using a Windowsish file system, and cannot use
MS-Windows-only system calls. Fall back on mktemp if mkstemp
doesn't work. Don't fail merely because of a symlink-contents
length limit in the current file system; fall back on regular
files. Increase the symlink contents length limit to 8 KiB, this
should be big enough for any real use and doesn't crunch the
stack.
(create_lock_file, lock_file_1, read_lock_data):
Simplify allocation of lock file buffers now that they fit in 8 KiB.
(lock_file_1): Return error number, not bool. All callers changed.
(ELOOP): New macro, if not already defined.
(read_lock_data): Return size of lock file contents, not Lisp object.
All callers changed. Handle a race condition if some other process
replaces a regular-file lock with a symlink lock or vice versa,
while we're trying to read the lock.
(current_lock_owner): Parse contents more carefully, to help avoid
confusing a regular-file lock with some other application's use
of the file. Check for lock file contents being too long, or
not parsing correctly.
(current_lock_owner, lock_file):
Allow foreign pid and boot times that exceed the local range.
(current_lock_owner, lock_if_free, lock_file):
Simplify allocation of lock file contents.
* src/w32.c (sys_rename_replace): New function, containing most of
the contents of the old sys_rename.
(sys_rename): Use it.
(fchmod): New dummy function.
* src/w32.h (sys_rename_replace, fchmod): New decls.
Eli Zaretskii [Tue, 5 Mar 2013 18:12:25 +0000 (20:12 +0200)]
Don't sync charpos and bytepos in bidi_resolve_explicit_1.
src/bidi.c (bidi_resolve_explicit_1): Don't call CHAR_TO_BYTE or
bidi_count_bytes, as the callers now arrange for bidi_it->charpos
to be in sync with bidi_it->bytepos. Suggested by Dmitry Antipov
<dmantipov@yandex.ru>.
Dmitry Gutov [Tue, 5 Mar 2013 07:38:16 +0000 (11:38 +0400)]
Keep pre-existing highlighting in completion candidates.
* lisp/minibuffer.el (completions-first-difference): State that the
face is "added" in the docstring.
(completions-common-part): Same. And don't inherit from default.
(completion-hilit-commonality): Prepend 'completions-common-part
and 'completion-first-difference faces to the 'face property,
instead of replacing the value(s).
(completion--insert-strings): Same with 'completions-annotations face.
(completion-hilit-commonality): Use 'face instead of
'font-lock-face, because it gets priority if the completion
strings already have 'face set.
Paul Eggert [Tue, 5 Mar 2013 02:03:05 +0000 (18:03 -0800)]
Fix a build failure on OpenBSD 4.x.
* sysdep.c (KERN_PROC, kinfo_proc) [BSD_SYSTEM && !KERN_PROC]:
Define to KERN_PROC2 and kinfo_proc2, for OpenBSD 4.9.
list-system-processes still returns nil, but at least it doesn't crash.
Problem reported by Nelson H. F. Beebe in
<http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00021.html>.
Alan Mackenzie [Mon, 4 Mar 2013 19:33:23 +0000 (19:33 +0000)]
Replace `last-command-event' by `last-command-char' in XEmacs.
progmodes/cc-defs.el (c-last-command-char): New macro.
progmodes/cc-align.el (c-semi&comma-inside-parenlist)
(c-semi&comma-no-newlines-before-nonblanks)
(c-semi&comma-no-newlines-for-oneline-inliners): Use the new macro in
place of `last-command-event'.
progmodes/cc-cmds.el (c-electric-pound, c-electric-brace)
(c-electric-slash, c-electric-semi&comma, c-electric-lt-gt)
(c-electric-paren, c-electric-continued-statement): Use the new macro in
place of `last-command-event'.
Paul Eggert [Mon, 4 Mar 2013 07:25:17 +0000 (23:25 -0800)]
Fix encoding problem in javat-wy.el.
* admin/grammars/java-tags.wy (CHAR): Remove "('\u0000' to '\uffff')"
from summary, as this causes javat-wy.el to contain both a null byte
and a byte sequence that is not valid UTF-8, which is inconvenient.
* lisp/cedet/semantic/wisent/javat-wy.el: Regenerate.
Paul Eggert [Sat, 2 Mar 2013 20:41:53 +0000 (12:41 -0800)]
The lock for FILE is now .#FILE or .#-FILE.
The old approach, which fell back on DIR/.#FILE.0 through
DIR/.#FILE.9, had race conditions that could not be easily fixed.
If DIR/.#FILE is a non-symlink file, Emacs now does not create a
lock file for DIR/FILE; that is, DIR/FILE is no longer partly
protected by a lock if DIR/.#FILE is a non-symlink file ("partly"
because the locking mechanism was never reliable in that case).
This patch fixes this and other bugs discovered by a code
inspection that was prompted by
<http://lists.gnu.org/archive/html/emacs-devel/2013-02/msg00531.html>.
Also, this patch switches to .#-FILE (not .#FILE) on MS-Windows,
to avoid interoperability problems between the MS-Windows and
non-MS-Windows implementations. MS-Windows and non-MS-Windows
instances of Emacs now ignore each others' locks.
* etc/NEWS: Document this.
* src/filelock.c (defined_WINDOWSNT): New constant.
(MAKE_LOCK_NAME, fill_in_lock_file_name):
Don't create DIR/.#FILE.0 through DIR/.#FILE.9. Instead, create
DIR/.#FILE symlinks on non-MS-Windows hosts, and DIR/.#-FILE
regular files on MS-Windows hosts.
(MAKE_LOCK_NAME, unlock_file, Ffile_locked_p):
Use SAFE_ALLOCA to avoid problems with long file names.
(MAX_LFINFO): Now a local constant, not a global macro.
(IS_LOCK_FILE): Remove.
(lock_file_1): Don't inspect errno if symlink call succeeds;
that's not portable.
(lock_file): Document that this function can return if lock
creation fails.
Eli Zaretskii [Sat, 2 Mar 2013 09:28:53 +0000 (11:28 +0200)]
Protect against changes of interval tree when adding/removing text props.
src/textprop.c (Fadd_text_properties, Fremove_text_properties): If
the interval tree changes as a side effect of calling
modify_region, re-do processing starting from the call to
validate_interval_range. (Bug#13743)