Vincent Belaïche [Sun, 25 Nov 2012 05:05:34 +0000 (06:05 +0100)]
* textmodes/reftex-parse.el (reftex-parse-from-file): Use variable reftex-section-info-function in order to be compatible with Texinfo integration.
* textmodes/reftex.el (reftex-section-pre-regexp, reftex-section-post-regexp, reftex-section-info-function): New variable. (reftex-compile-variables): Use variables reftex-section-pre-regexp, reftex-section-post-regexp, and reftex-section-info-function in order to be compatible with Texinfo integration.
* textmodes/reftex-toc.el (reftex-toc-promote-action): use reftex-section-pre-regexp variable in order to be compatible with Texinfo integration.
Chong Yidong [Sun, 25 Nov 2012 04:50:20 +0000 (12:50 +0800)]
Revamp face-spec-set to be more analogous to setq for faces.
* lisp/faces.el (face-spec-set): Change the third arg to specify
whether this function is being called via defface, customize, or a
third party. Set the appropriate symbol properties. Clear the
override spec if setting via Custom. Initialize face if necessary.
(face-spec-recalc): Allow theme faces to completely replace the defface spec, in the same way as custom faces (Bug#8454).
* lisp/cus-edit.el (custom-face-set, custom-face-mark-to-save)
(custom-face-reset-saved, custom-face-mark-to-reset-standard):
Simplify by using the new arg to face-spec-set.
* lisp/cus-face.el (custom-declare-face): Move face initialization to
face-spec-set.
(custom-theme-set-faces): Don't initialize the face name here, as
that is now done in face-spec-set.
* lisp/emacs-lisp/lisp-mode.el (eval-defun-1): When evaluating defface,
reset face-override-spec too, and use custom-declare-face.
Chong Yidong [Sat, 24 Nov 2012 03:46:29 +0000 (11:46 +0800)]
Fix dependency sorting in custom-theme-set-variables.
* lisp/custom.el (custom-theme-set-variables): Use a topological sort
for ordering by custom dependencies.
(custom--sort-vars, custom--sort-vars-1): New functions.
Paul Eggert [Fri, 23 Nov 2012 22:20:31 +0000 (14:20 -0800)]
Fix a race condition with glib (Bug#8855).
This is a backport from the trunk, consisting of:
2012-11-17 Eli Zaretskii <eliz@gnu.org>
* nt/inc/sys/wait.h: New file, with prototype of waitpid and
definitions of macros it needs.
* nt/inc/ms-w32.h (wait): Don't define, 'wait' is not used anymore.
(sys_wait): Remove prototype.
* nt/config.nt (HAVE_SYS_WAIT_H): Define to 1.
* src/w32proc.c (create_child): Don't clip the PID of the child
process to fit into an Emacs integer, as this is no longer a
restriction.
(waitpid): Rename from sys_wait. Emulate a Posix 'waitpid' by
reaping only the process specified by PID argument, if that is
positive. Use PID instead of dead_child to know which process to
reap. Wait for the child to die only if WNOHANG is not in
OPTIONS.
(sys_select): Don't set dead_child.
* src/sysdep.c (wait_for_termination_1): Remove the WINDOWSNT portion,
as it is no longer needed.
* src/process.c (waitpid, WUNTRACED) [!WNOHANG]: Remove definitions,
no longer needed.
(record_child_status_change): Remove the setting of
record_at_most_one_child for the !WNOHANG case.
2012-11-03 Paul Eggert <eggert@cs.ucla.edu>
Fix a race condition that causes Emacs to mess up glib (Bug#8855).
This is a backport from the trunk.
The symptom is a diagnostic "GLib-WARNING **: In call to
g_spawn_sync(), exit status of a child process was requested but
SIGCHLD action was set to SIG_IGN and ECHILD was received by
waitpid(), so exit status can't be returned." The diagnostic
is partly wrong, as the SIGCHLD action is not set to SIG_IGN.
The real bug is a race condition between Emacs and glib: Emacs
does a waitpid (-1, ...) and reaps glib's subprocess by mistake,
so that glib can't find it. Work around the bug by invoking
waitpid only on subprocesses that Emacs itself creates.
* src/process.c (create_process, record_child_status_change):
Don't use special value -1 in pid field, as the caller now must
know the pid rather than having the callee infer it. The
inference was sometimes incorrect anyway, due to another race.
(create_process): Set new 'alive' member if child is created.
(process_status_retrieved): New function.
(record_child_status_change): Use it.
Accept negative 1st argument, which means to wait for the
processes that Emacs already knows about. Move special-case code
for DOS_NT (which lacks WNOHANG) here, from caller. Keep track of
processes that have already been waited for, by testing and
clearing new 'alive' member.
(CAN_HANDLE_MULTIPLE_CHILDREN): Remove, as record_child_status_change
now does this internally.
(handle_child_signal): Let record_child_status_change do all
the work, since we do not want to reap all exited child processes,
only the child processes that Emacs itself created.
* src/process.h (Lisp_Process): New boolean member 'alive'.
Dmitry Antipov [Fri, 23 Nov 2012 15:39:48 +0000 (19:39 +0400)]
* frame.h (struct frame): Remove display_preempted member
since all users are dead long ago.
* nsterm.h (struct x_output): Use the only dummy member.
* w32menu.c (pending_menu_activation): Remove since not
really used.
(set_frame_menubar): Adjust user.
* w32term.h (struct x_output): Drop outdated #if 0 code.
(struct w32_output): Use bitfields for explicit_parent,
asked_for_visible and menubar_active members. Drop
unused pending_menu_activation member.
* xterm.h (struct x_output): Drop outdated #if 0 code.
Use bitfields for explicit_parent, asked_for_visible,
has_been_visible and net_wm_state_hidden_seen members.
Eli Zaretskii [Fri, 23 Nov 2012 08:27:05 +0000 (10:27 +0200)]
Fix cursor display when several display strings follow each other.
src/xdisp.c (set_cursor_from_row): Skip step 2 only if point is not
between bpos_covered and bpos_max. This fixes cursor display when
several display strings follow each other.
Eli Zaretskii [Fri, 23 Nov 2012 07:54:33 +0000 (09:54 +0200)]
Fix pgx in .gdbinit when CHECK_LISP_OBJECT_TYPE is defined.
src/.gdbinit (pgx): If the glyph's object is a string, display the
pointer to string data, rather than the value of the string object
itself (which barfs under CHECK_LISP_OBJECT_TYPE).
Paul Eggert [Fri, 23 Nov 2012 07:48:43 +0000 (23:48 -0800)]
Assume POSIX 1003.1-1988 or later for dirent.h.
* admin/CPP-DEFINES (HAVE_CLOSEDIR, HAVE_DIRENT_H): Remove.
* admin/notes/copyright: Adjust to src/ndir.h -> nt/inc/dirent.h renaming.
* configure.ac: Do not check for dirent.h or closdir.
* nt/inc/dirent.h: Rename from ../src/ndir.h, with these changes:
(struct dirent): Rename from struct direct. All uses changed.
* nt/inc/sys/dir.h: Remove.
* src/dired.c: Assume HAVE_DIRENT_H.
(NAMLEN): Remove, replacing with ...
(dirent_namelen): New function. All uses changed. Use the GNU macro
_D_EXACT_NAMELEN if available, as it's faster than strlen.
(DIRENTRY): Remove, replacing all uses with 'struct dirent'.
(DIRENTRY_NONEMPTY): Remove. All callers now assume it's nonzero.
* src/makefile.w32-in (DIR_H): Remove. All uses replaced with
$(NT_INC)/dirent.h.
($(BLD)/w32.$(O)): Do not depend on $(SRC)/ndir.h.
* src/ndir.h: Rename to ../nt/inc/dirent.h.
* src/sysdep.h (closedir) [!HAVE_CLOSEDIR]: Remove.
Do not include <dirent.h>; no longer needed.
* src/w32.c: Include <dirent.h> rather than "ndir.h".
Juri Linkov [Fri, 23 Nov 2012 07:28:37 +0000 (09:28 +0200)]
* lisp/wdired.el: Revert 2012-10-17 change partly and replace it with
Patch by Christopher Schmidt <christopher@ch.ristopher.com>.
(wdired-finish-edit): Add marks for new file names to
`wdired-old-marks'. Restore marks using `dired-mark-remembered'
after `revert-buffer'.
(wdired-do-renames): Remove calls to `dired-remove-file',
`dired-add-file', `dired-add-entry'.
Paul Eggert [Thu, 22 Nov 2012 08:09:03 +0000 (00:09 -0800)]
* calc/calc.el (calc-gregorian-switch): In menu, put dates before regions.
This is easier to follow, lines up better in the menu, and lets us
coalesce regions that switch at the same time. Give country
names, not "Vatican", as that's better for non-expert users. Use
names that are stable between the date of switch and now, e.g.,
Bohemia and Moravia (which existed then and now) and not
Czechoslovakia (which didn't exist then and doesn't exist now).
What is now the U.S. mostly did not switch at the same time as
Britain, so omit the U.S. Correct spelling of "Britain".
Catholic Switzerland was too much of a mess, so omit it.
Dmitry Antipov [Thu, 22 Nov 2012 06:52:30 +0000 (10:52 +0400)]
* xdisp.c (window_buffer_changed): New function.
(update_menu_bar, update_tool_bar): Use it to
simplify large 'if' statements.
(redisplay_internal): Generalize commonly used
'tail' and 'frame' local variables.
Eli Zaretskii [Wed, 21 Nov 2012 19:28:14 +0000 (21:28 +0200)]
Fix bug #12930 with vertical-motion through a display string.
src/indent.c (Fvertical_motion): If the starting position is covered
by a display string, return to one position before that, to avoid
overshooting it inside move_it_to.
* doc/lispref/display.texi (Attribute Functions):
Add new "inherit" argument for face-bold-p etc.
Move description of this argument to a common section, like "frame".
Glenn Morris [Wed, 21 Nov 2012 08:27:13 +0000 (00:27 -0800)]
Remove -p suffix from set-face-* functions
* lisp/faces.el (set-face-inverse-video, set-face-bold, set-face-italic):
Remove -p suffix from names, for consistency with other set-face-*.
(set-face-inverse-video): Fix interactive spec.
* lisp/play/gamegrid.el (gamegrid-make-mono-tty-face):
* lisp/textmodes/table.el (table--update-cell-face):
Use set-face-inverse-video rather than now obsolete alias.
* doc/lispref/display.texi (Attribute Functions):
Update for set-face-* name changes.
Glenn Morris [Wed, 21 Nov 2012 01:52:03 +0000 (20:52 -0500)]
Add a bit more about profiling to the lispref
* doc/lispref/debugging.texi (Profiling):
Add some basic information about the profile report buffer.
(Debugging): Mention profiling in the introduction.
Stefan Monnier [Tue, 20 Nov 2012 20:06:17 +0000 (15:06 -0500)]
Conflate Qnil and Qunbound for `symbol-function'.
* src/alloc.c (Fmake_symbol): Initialize `function' to Qnil.
* src/lread.c (init_obarray): Set `function' fields to Qnil.
* src/eval.c (Fcommandp): Ignore Qunbound.
(Fautoload, eval_sub, Fapply, Ffuncall, Fmacroexpand):
* src/data.c (Ffset, Ffboundp, indirect_function, Findirect_function):
Test NILP rather than Qunbound.
(Ffmakunbound): Set to Qnil.
(Fsymbol_function): Never signal an error.
(Finteractive_form): Ignore Qunbound.
Stefan Monnier [Tue, 20 Nov 2012 19:30:37 +0000 (14:30 -0500)]
* lisp/emacs-lisp/trace.el: Rewrite, use nadvice and lexical-binding.
(trace-buffer): Don't purecopy.
(trace-entry-message, trace-exit-message): Add `context' arg.
(trace--timer): New var.
(trace-make-advice): Adjust for use in nadvice.
Add `context' argument. Delay `display-buffer' via a timer.
(trace-function-internal): Use advice-add.
(trace--read-args): New function.
(trace-function-foreground, trace-function-background): Use it.
(trace-function): Rename to trace-function-foreground and redefine as
an alias to that new name.
(untrace-function, untrace-all): Adjust to the use of nadvice.
Ken Brown [Tue, 20 Nov 2012 13:26:40 +0000 (08:26 -0500)]
Fix non-GTK builds on Cygwin
* src/emacs.c (main): Set the G_SLICE environment variable for all
Cygwin builds, not just GTK builds. See
https://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00368.html.
Dmitry Antipov [Tue, 20 Nov 2012 11:41:57 +0000 (15:41 +0400)]
Tiny adjustment around the previous redisplay change.
* xdisp.c (window_outdated): New function.
(text_outside_line_unchanged_p, redisplay_window): Use it.
(redisplay_internal): Likewise. Fix indentation.
Glenn Morris [Tue, 20 Nov 2012 08:02:54 +0000 (00:02 -0800)]
Make a start on a Profiling section in the lispref
* doc/lispref/debugging.texi (Profiling): New section, in progress.
* doc/lispref/tips.texi (Compilation Tips): Move profiling to separate section.
* doc/lispref/elisp.texi: Add Profiling to detailed menu.
Dmitry Antipov [Tue, 20 Nov 2012 07:53:04 +0000 (11:53 +0400)]
* xdisp.c (buffer_shared): Adjust comment.
(buffer_shared_and_changed): New function.
(prepare_menu_bars, redisplay_internal): Use it to
decide whether all windows or frames should be updated.
Stefan Monnier [Tue, 20 Nov 2012 04:24:09 +0000 (23:24 -0500)]
Make called-interactively-p work for edebug or advised code.
* lisp/subr.el (called-interactively-p-functions): New var.
(internal--called-interactively-p--get-frame): New macro.
(called-interactively-p, interactive-p): Rewrite in Lisp.
* lisp/emacs-lisp/nadvice.el (advice--called-interactively-skip): New fun.
(called-interactively-p-functions): Use it.
* lisp/emacs-lisp/edebug.el (edebug--called-interactively-skip): New fun.
(called-interactively-p-functions): Use it.
* lisp/allout.el (allout-called-interactively-p): Don't assume
called-interactively-p is a subr.
* src/eval.c (Finteractive_p, Fcalled_interactively_p, interactive_p): Remove.
(syms_of_eval): Remove corresponding defsubr.
* src/bytecode.c (exec_byte_code): `interactive-p' is now a Lisp function.
* test/automated/advice-tests.el (advice-tests--data): Remove.
(advice-tests): Move the tests directly here instead.
Add called-interactively-p tests.
Glenn Morris [Tue, 20 Nov 2012 00:57:23 +0000 (19:57 -0500)]
Add a menu for profiler report mode
* lisp/profiler.el (profiler-report-mode-map): Add a menu.
No need to bind `q' because we derive from special-mode.
(profiler-report-find-entry): Handle calls from the menu-bar.
Paul Eggert [Mon, 19 Nov 2012 23:39:28 +0000 (15:39 -0800)]
Improve static checking of integer overflow and stack smashing.
* configure.ac (WARN_CFLAGS): Add -Wstack-protector and
-Wstrict-overflow if using GCC 4.7.2 or later on a platform with
at least 64-bit long int. This improves static checking on these
platforms, when configured with --enable-gcc-warnings.
Stefan Monnier [Mon, 19 Nov 2012 21:30:55 +0000 (16:30 -0500)]
* lisp/emacs-lisp/byte-run.el (defun-declarations-alist):
Allow compiler-macros to be lambda expressions.
* lisp/progmodes/python.el: Use cl-lib. Move var declarations outside of
eval-when-compile.
(python-syntax-context): Add compiler-macro.
(python-font-lock-keywords): Simplify with De Morgan.
Stefan Monnier [Mon, 19 Nov 2012 19:22:07 +0000 (14:22 -0500)]
* lisp/eshell/em-cmpl.el (eshell-pcomplete): Refine fix for bug#12838:
Fallback on completion-at-point rather than
pcomplete-expand-and-complete, and only if pcomplete actually failed.
(eshell-cmpl-initialize): Setup completion-at-point.
* lisp/pcomplete.el (pcomplete--entries): Obey pcomplete-ignore-case.
Stefan Monnier [Mon, 19 Nov 2012 17:24:12 +0000 (12:24 -0500)]
Use cl-lib instead of cl, and interactive-p => called-interactively-p.
* lisp/erc/erc-track.el, lisp/erc/erc-networks.el, lisp/erc/erc-netsplit.el:
* lisp/erc/erc-dcc.el, lisp/erc/erc-backend.el: Use cl-lib, nth, pcase, and
called-interactively-p instead of cl.
* lisp/erc/erc-speedbar.el, lisp/erc/erc-services.el:
* lisp/erc/erc-pcomplete.el, lisp/erc/erc-notify.el, lisp/erc/erc-match.el:
* lisp/erc/erc-log.el, lisp/erc/erc-join.el, lisp/erc/erc-ezbounce.el:
* lisp/erc/erc-capab.el: Don't require cl since we don't use it.
* lisp/erc/erc.el: Use cl-lib, nth, pcase, and called-interactively-p i.s.o cl.
(erc-lurker-ignore-chars, erc-common-server-suffixes): Move before first use.
* lisp/json.el: Don't require cl since we don't use it.
* lisp/color.el: Don't require cl.
(color-complement): `caddr' -> `nth 2'.
* test/automated/ert-x-tests.el: Use cl-lib.
* test/automated/ert-tests.el: Use lexical-binding and cl-lib.
Jay Belanger [Mon, 19 Nov 2012 05:03:08 +0000 (23:03 -0600)]
* calc/calc-forms.el (math-leap-year-p): Fix formula for negative
year numbers.
(math-date-to-julian-dt): Adjust the initial approximation for the
year to deal with the new definition of the DATE.