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.
Paul Eggert [Tue, 5 Mar 2013 21:56:36 +0000 (13:56 -0800)]
Fix a build failure on OpenBSD 4.x and MirBSD.
* sysdep.c (list_system_processes) [__OpenBSD__ || __MirBSD__]:
Make it a stub in this case; otherwise the build might fail,
and even if the build worked the function would just return nil anyway.
Problem reported by Nelson H. F. Beebe in
<http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00021.html>
and analyzed by Jérémie Courrèges-Anglas in
<http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00062.html>.
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)
Michael Albinus [Fri, 1 Mar 2013 21:12:26 +0000 (22:12 +0100)]
* net/tramp-adb.el (tramp-adb-prompt): Extend regexp.
(tramp-adb-handle-process-file): Remove superfluous setting.
(tramp-adb-command-exit-status): Handle case that COMMAND is nil.
(tramp-adb-barf-unless-okay): Use `tramp-adb-command-exit-status'.
(tramp-adb-maybe-open-connection): Apply "su" if user is defined.
Stefan Monnier [Fri, 1 Mar 2013 17:46:57 +0000 (12:46 -0500)]
* lisp/textmodes/ispell.el: Fix nitpicks and byte-compiler warnings.
(ispell-print-if-debug): Build `format' in. Avoid end-of-buffer.
(ispell-parse-hunspell-affix-file): Avoid beginning-of-buffer.
Use dict-key rather than dict-name for the error message.
* textmodes/ispell.el (ispell-find-hunspell-dictionaries):
Always expand affix-file before storing to protect against changed
`default-directory'.
(ispell-print-if-debug): Make sure message is printed at the end
of the debug buffer.
Paul Eggert [Fri, 1 Mar 2013 15:16:43 +0000 (07:16 -0800)]
Merge from gnulib.
2013-02-21 putenv: port better to native Windows
2013-02-18 extern-inline: avoid compilation error with HP-UX cc
2013-02-14 putenv: fix heap corruption with mixed putenv/_putenv
Michael Albinus [Fri, 1 Mar 2013 08:16:13 +0000 (09:16 +0100)]
* tramp.texi (Inline methods): Remove "ssh1", "ssh2", "plink1"
and "plink2" entries. "plink2" is obsolete for a long time.
(External methods): Remove "scp1" and "scp2" entries.
Michael Albinus [Fri, 1 Mar 2013 08:13:53 +0000 (09:13 +0100)]
* net/tramp.el (tramp-obsolete-methods): New defconst.
(tramp-warned-obsolete-methods): New defvar.
(tramp-find-method): Check for obsolete methods. Map them to a
replacement method if appropriate.
Dale Sedivec [Fri, 1 Mar 2013 03:43:57 +0000 (22:43 -0500)]
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-function):
Return valid syntax-table property value when converting
quotes within text from string syntax to punctuation syntax.
Juri Linkov [Thu, 28 Feb 2013 21:51:11 +0000 (23:51 +0200)]
* lisp/dired-aux.el (dired-diff): If file at point is a backup file,
use its original as the default value, and reverse the order
of arguments to the `diff' call. Doc fix.
Agustín Martín [Thu, 28 Feb 2013 19:01:34 +0000 (20:01 +0100)]
Initial support for hunspell dictionaries auto-detection (Bug#13639)
* textmodes/ispell.el (ispell-find-hunspell-dictionaries):
Ask hunspell about available and default dictionaries.
(ispell-parse-hunspell-affix-file): Extract relevant info from
hunspell affix file.
(ispell-hunspell-fill-dictionary-entry): Fill non-initialized
`ispell-dictionary-alist' entry for given dictionary after info
provided by `ispell-parse-hunspell-affix-file'.
(ispell-hunspell-dict-paths-alist): New defvar to contain an alist
of parsed hunspell dicts and associated affix files.
(ispell-hunspell-dictionary-alist): New defvar to contain an alist
of parsed hunspell dicts and associated parameters.
(ispell-set-spellchecker-params):
Call `ispell-find-hunspell-dictionaries' if hunspell and not
previously done.
(ispell-start-process):
Call `ispell-hunspell-fill-dictionary-entry' for current
dictionary if it is not initialized.
Some additional details about the implementation:
(ispell-hunspell-dict-paths-alist): Alist that contains a list of
parsed hunspell dicts and associated affix files.
(ispell-hunspell-dictionary-alist): Alist of parsed hunspell dicts and
associated parameters. It is initially just a list of found
dictionaries except for the default dictionary where is filled with
proper parameters.
When spellchecker is initialized by (ispell-set-spellchecker-params)
if the conditions: is hunspell, communication can be set to UTF-8 and
Emacs flavor supports [:alpha:] are matched installed hunspell
dictionaries are parsed and info passed to
`ispell-hunspell-dictionary-alist', either full for default dictionary
or just name for other dictionaries. These entries are used for
`ispell-dictionary-alist' if not overriden.
Before starting hunspell process in (ispell-start-process), if
`ispell-dictionary-alist' entry is not yet initialized
(ispell-hunspell-fill-dictionary-entry) is called to fill that entry
(and all pending entries using the same affix file) after info
extracted by (ispell-parse-hunspell-affix-file) from the associated
affix file.
hunspell process will then be started as usual. This delayed procedure
is used to avoid that in systems containing many hunspell dictionaries
all affix files are parsed (if there are many, time may be noticeable)
for just one used dictionary.
* lisp/net/net-utils.el (net-utils--revert-function): New fun.
(net-utils-mode): Use it.
(net-utils--revert-cmd): New var.
(net-utils-run-simple): Set it, and remove bogus interactive spec.
(traceroute): Use net-utils-run-simple.