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.
Eli Zaretskii [Wed, 27 Feb 2013 18:37:31 +0000 (20:37 +0200)]
Fix race conditions with MS-Windows lock files by using _sopen.
src/filelock.c (create_lock_file) [WINDOWSNT]: Use _sopen with
_SH_DENYRW flag, instead of emacs_open, to deny any other process
access to the lock file until it is written and closed.
Michael Albinus [Tue, 26 Feb 2013 08:46:38 +0000 (09:46 +0100)]
* net/tramp-sh.el (tramp-sh-handle-insert-directory): Add
"2>/dev/null" to the ls command, in case "en_US.utf8" is not
defined. POSIX environments fall back to the "C" locale then and
emit a warning, which shall be suppressed.
Paul Eggert [Tue, 26 Feb 2013 03:09:08 +0000 (19:09 -0800)]
Minor textprop integer cleanup.
* intervals.h, textprop.c (add_text_properties_from_list):
Return void, not int, since nobody uses the return value.
* textprop.c (validate_plist, add_properties, remove_properties)
(Fadd_text_properties):
Don't assume list length fits in int.
(interval_has_all_properties, interval_has_some_properties)
(interval_has_some_properties_list, add_properties, remove_properties)
(Fadd_text_properties, Fremove_text_properties)
(Fremove_list_of_text_properties, text_property_stickiness):
Use bool for booleans.
(Fadd_text_properties, Fremove_text_properties):
(Fremove_list_of_text_properties):
Reindent do-while as per GNU style.
Juri Linkov [Mon, 25 Feb 2013 20:57:44 +0000 (22:57 +0200)]
* lisp/replace.el (read-regexp): Let-bind `default' to the first
element of `defaults' if it's a list, otherwise it should be
a string or nil. Let-bind `suggestions' to `defaults' if it's
a list, otherwise make a list with the string value. Doc fix.
Eli Zaretskii [Mon, 25 Feb 2013 17:36:03 +0000 (19:36 +0200)]
Implement CLASH_DETECTION for MS-Windows.
src/filelock.c [WINDOWSNT]: Include w32.h.
(MAKE_LOCK_NAME): Don't use 'lock', it clashes with MS runtime
function of that name. Up-case the macro arguments.
(IS_LOCK_FILE): New macro.
(fill_in_lock_file_name): Use IS_LOCK_FILE instead of S_ISLNK.
(create_lock_file): New function, with body extracted from
lock_file_1.
[WINDOWSNT]: Implement lock files by writing a regular file with
the lock information as its contents.
(read_lock_data): New function, on Posix platforms just calls
emacs_readlinkat.
[WINDOWSNT]: Read the lock info from the file.
(current_lock_owner): Call read_lock_data instead of calling
emacs_readlinkat directly.
(lock_file) [WINDOWSNT]: Run the file name through
dostounix_filename.
src/w32proc.c (sys_kill): Support the case of SIG = 0, in which case
just check if the process by that PID exists.
src/w32.c (sys_open): Don't reset the _O_CREAT flag if _O_EXCL is
also present, as doing so will fail to error out if the file
already exists.
src/makefile.w32-in ($(BLD)/filelock.$(O)): Depend on src/w32.h.
nt/inc/ms-w32.h (BOOT_TIME_FILE): Define.
nt/config.nt (CLASH_DETECTION): Define to 1.
lisp/emacs-lisp/bytecomp.el (byte-recompile-directory): Reject files
that match "\`\.#", to avoid compiling lock files, even if they
are readable (as they are on MS-Windows).
doc/emacs/files.texi (Interlocking): Don't refer to symlinks as the
exclusive means of locking files.
etc/NEWS: Mention support for lock files on MS-Windows.
Eli Zaretskii [Mon, 25 Feb 2013 16:13:42 +0000 (18:13 +0200)]
Fix bug #13743 with crashes due to recursive add-text-properties.
src/textprop.c (Fadd_text_properties, Fremove_text_properties)
(Fremove_list_of_text_properties): Skip all of the intervals in
the region between START and END that already have resp. don't
have the requested properties, not just the first one. Add
assertions that the loop afterwards always modifies the
properties.
Paul Eggert [Mon, 25 Feb 2013 05:55:37 +0000 (21:55 -0800)]
Simplify data_start configuration.
This is a followon simplification to the fix for Bug#13650.
* admin/CPP-DEFINES (DATA_START, ORDINARY_LINK): Remove.
* configure.ac (CRT_DIR, LIB_STANDARD, START_FILES, DATA_START)
(LD_FIRSTFLAG, ORDINARY_LINK, LIB_GCC): Remove.
(AC_CHECK_HEADERS_ONCE): Remove sys/resource.h, as it's
not always needed.
(HAVE_DATA_START): New macro.
* etc/PROBLEMS (LIBS_SYSTEM, LIBS_MACHINE, LIBS_STANDARD): Remove.
Remove legacy-systems section, as this stuff is no longer
applicable with current linking strategies.
* src/Makefile.in (LD_FIRSTFLAG, LIB_GCC, CRT_DIR, LIB_STANDARD)
(START_FILES): Remove. All uses removed.
(otherobj): Remove $(VMLIMIT_OBJ), as it's now first.
(ALLOBJS): Move here from autodeps.mk, and with VMLIMITS_OBJ first.
(buildobj.h): Use it.
($(ALLOBJS)): Depend on globals.h.
(temacs$(EXEEXT)): Use $(ALLOBJS).
* src/autodeps.mk (ALLOBJS): Move to Makefile.in.
* src/deps.mk (vm-limit.o):
* src/makefile.w32-in ($(BLD)/vm-limit.$(O)):
Do not depend on mem-limits.h.
* src/emacs.c (__do_global_ctors, __do_global_ctors_aux)
(__do_global_dtors, __CTOR_LIST__, __DTOR_LIST__)
[__GNUC__ && !ORDINARY_LINK]: Remove.
* src/mem-limits.h, src/pre-crt0.c: Remove.
* src/unexaix.c, src/unexcoff.c: Don't include mem-limits.h.
* src/unexcoff.c (etext): New decl.
(make_hdr): Use it instead of start_of_data.
* src/vm-limit.c: Move most of mem-limits.h's contents here.
(data_start): New decl. It's OK if this is approximate,
so simplify-away some unnecessary exactness.
(POINTER): Remove; all uses removed.
(data_space_start): Now char *, to avoid casts.
(exceeds_lisp_ptr): New function, replacing the old
EXCEEDS_LISP_PTR macro. All uses changed.
(check_memory_limits): Simplify and remove casts.
(start_of_data) [!CANNOT_DUMP || !SYSTEM_MALLOC]: Remove.
(memory_warnings): Use data_start instead of start_of_data.
Michael Albinus [Sun, 24 Feb 2013 17:58:55 +0000 (18:58 +0100)]
Port documentation to Texinfo 5.0.
* tramp.texi (top) [xxx, yyy, trampfn]: Remove superfluous @c.
(Filename Syntax): Do not use @trampfn{} in @item.
(Filename completion): Use @columnfractions in @multitable.
Jay Belanger [Sun, 24 Feb 2013 01:05:13 +0000 (19:05 -0600)]
* calc/calc-ext.el (math-to-radians-2, math-from-radians-2):
Add option to force `pi' to remain symbolic.
* calc/calcalg2.el (calcFunc-sin, calcFunc-cos, calcFunc-tan)
(calcFunc-cot, calcFunc-csc, calcFunc-sec, calcFunc-arcsin)
(calcFunc-arccos, calcFunc-arctan): Use symbolic `pi' in the
derivatives, when necessary.
Paul Eggert [Sun, 24 Feb 2013 00:21:06 +0000 (16:21 -0800)]
Fix regression introduced by July 10 filelock.c patch.
* filelock.c (fill_in_lock_file_name): Fix crash caused by the
2012-07-10 patch to this file. Reported by Eli Zaretskii in
<http://lists.gnu.org/archive/html/emacs-devel/2013-02/msg00533.html>
and diagnosed by Andreas Schwab in
<http://lists.gnu.org/archive/html/emacs-devel/2013-02/msg00534.html>.
Glenn Morris [Sat, 23 Feb 2013 21:14:36 +0000 (13:14 -0800)]
Avoid recursive byte-compile-files fighting over input/output buffers
* lisp/emacs-lisp/bytecomp.el (byte-compile-level): New.
(byte-compile-file, byte-compile-from-buffer):
Use separate input/output buffers for each level of recursive
byte-compile-file calls.
Michael Albinus [Sat, 23 Feb 2013 12:40:14 +0000 (13:40 +0100)]
* net/tramp.el (tramp-methods): Fix docstring.
(tramp-ssh-controlmaster-options): Rename it from
`tramp-ssh-controlmaster-template'. Return a string.
(tramp-default-method): Adapt check for
`tramp-ssh-controlmaster-options'.
* net/tramp-sh.el (tramp-methods): Replace
`tramp-ssh-controlmaster-template' by "%c".
(tramp-do-copy-or-rename-file-out-of-band)
(tramp-maybe-open-connection): Use it in format spec. Ensure,
that it is applied for the first hop only.
David Engster [Fri, 22 Feb 2013 22:54:37 +0000 (22:54 +0000)]
gnus-registry.el (gnus-registry-save): Provide class name when calling `eieio-persistent-read' to avoid "unsafe call" warning Use `condition-case' to stay compatible with older EIEIO versions which only accept one argument
Paul Eggert [Fri, 22 Feb 2013 19:23:12 +0000 (11:23 -0800)]
Assume C89 or better.
* ralloc.c (SIZE, POINTER, NIL):
* vm-limit.c (POINTER):
Remove, replacing all uses with C89 equivalents. These old
symbols were present only for porting to pre-C89 platforms.
Paul Eggert [Thu, 21 Feb 2013 22:42:56 +0000 (14:42 -0800)]
Parallelize documentation builds.
This speeds up building of documentation on multiprocessor
platforms, and is motivated by Texinfo 5.0, which is much slower.
Add a toplevel rule 'make docs' to make all the documentation.
* .bzrignore: Add .dvi, .html, .ps.
* Makefile.in (DVIS, HTMLS, INFOS, PSS, DOCS): New macros.
($(DOCS), docs, vi, html, pdf, ps): New rules.
(info-real): Depend on $(INFOS) rather than doing it sequentially.
(dvi): Depend on $(DVIS) rather than doing it sequentially.
* doc/misc/Makefile.in (html): New rule.