emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117154: Merge from emacs-24; up to r117155


From: Glenn Morris
Subject: [Emacs-diffs] trunk r117154: Merge from emacs-24; up to r117155
Date: Mon, 26 May 2014 02:28:57 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117154 [merge]
revision-id: address@hidden
parent: address@hidden
parent: address@hidden
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Sun 2014-05-25 19:28:09 -0700
message:
  Merge from emacs-24; up to r117155
modified:
  ChangeLog                      changelog-20091113204419-o5vbwnq5f7feedwu-1538
  admin/ChangeLog                changelog-20091113204419-o5vbwnq5f7feedwu-2226
  configure.ac                   
configure.in-20091113204419-o5vbwnq5f7feedwu-783
  doc/emacs/ChangeLog            changelog-20091113204419-o5vbwnq5f7feedwu-6227
  doc/emacs/frames.texi          
frames.texi-20091113204419-o5vbwnq5f7feedwu-6252
  doc/lispref/ChangeLog          changelog-20091113204419-o5vbwnq5f7feedwu-6155
  doc/lispref/display.texi       
display.texi-20091113204419-o5vbwnq5f7feedwu-6172
  doc/misc/ChangeLog             changelog-20091113204419-o5vbwnq5f7feedwu-6331
  doc/misc/htmlfontify.texi      
htmlfontify.texi-20130104093730-y0jp8j9c2zhxijnw-1
  doc/misc/org.texi              org.texi-20091113204419-o5vbwnq5f7feedwu-6313
  doc/misc/todo-mode.texi        todomode.texi-20130804212326-csuj921rpk9gy1gz-1
  etc/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1485
  etc/ETAGS.EBNF                 etags.ebnf-20091113204419-o5vbwnq5f7feedwu-2386
  etc/NEWS                       news-20100311060928-aoit31wvzf25yr1z-1
  etc/ORG-NEWS                   orgnews-20120426170211-2f5ift22efexnj6i-1
  lib-src/ChangeLog              changelog-20091113204419-o5vbwnq5f7feedwu-1608
  lib-src/rcs2log                rcs2log-20091113204419-o5vbwnq5f7feedwu-455
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/avoid.el                  avoid.el-20091113204419-o5vbwnq5f7feedwu-640
  lisp/calendar/todo-mode.el     todos.el-20120911155047-0ytqo2nidwqquefa-1
  lisp/cus-face.el               cusface.el-20091113204419-o5vbwnq5f7feedwu-1092
  lisp/emacs-lisp/eieio-opt.el   
eieioopt.el-20091113204419-o5vbwnq5f7feedwu-10971
  lisp/emacs-lisp/lisp.el        lisp.el-20091113204419-o5vbwnq5f7feedwu-131
  lisp/emacs-lisp/nadvice.el     nadvice.el-20121015213644-851fdxs2vximj8nr-1
  lisp/emacs-lisp/package.el     package.el-20100617020707-ybavz666awsxwin6-2
  lisp/emacs-lisp/timer.el       timer.el-20091113204419-o5vbwnq5f7feedwu-2591
  lisp/frame.el                  frame.el-20091113204419-o5vbwnq5f7feedwu-275
  lisp/hippie-exp.el             
hippieexp.el-20091113204419-o5vbwnq5f7feedwu-531
  lisp/menu-bar.el               menubar.el-20091113204419-o5vbwnq5f7feedwu-546
  lisp/minibuffer.el             
minibuffer.el-20091113204419-o5vbwnq5f7feedwu-8622
  lisp/mouse.el                  mouse.el-20091113204419-o5vbwnq5f7feedwu-123
  lisp/net/dbus.el               dbus.el-20091113204419-o5vbwnq5f7feedwu-7962
  lisp/net/tramp-sh.el           trampsh.el-20100913133439-a1faifh29eqoi4nh-1
  lisp/nxml/nxml-mode.el         
nxmlmode.el-20091113204419-o5vbwnq5f7feedwu-7813
  lisp/progmodes/scheme.el       scheme.el-20091113204419-o5vbwnq5f7feedwu-122
  lisp/simple.el                 simple.el-20091113204419-o5vbwnq5f7feedwu-403
  lisp/vc/vc-rcs.el              vcrcs.el-20091113204419-o5vbwnq5f7feedwu-1926
  lisp/window.el                 window.el-20091113204419-o5vbwnq5f7feedwu-94
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/lisp.h                     lisp.h-20091113204419-o5vbwnq5f7feedwu-253
  src/minibuf.c                  minibuf.c-20091113204419-o5vbwnq5f7feedwu-242
  src/unexaix.c                  unexaix.c-20091113204419-o5vbwnq5f7feedwu-147
  src/w32fns.c                   w32fns.c-20091113204419-o5vbwnq5f7feedwu-945
  src/w32term.c                  w32term.c-20091113204419-o5vbwnq5f7feedwu-950
  src/xdisp.c                    xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
  test/automated/advice-tests.el advice.el-20121111003311-i96f8i1au0zeaju7-1
=== modified file 'ChangeLog'
--- a/ChangeLog 2014-05-19 04:56:03 +0000
+++ b/ChangeLog 2014-05-26 02:28:09 +0000
@@ -1,3 +1,9 @@
+2014-05-26  Paul Eggert  <address@hidden>
+
+       Fix port to 32-bit AIX (Bug#17540).
+       * configure.ac (opsys): On Power Architecture, treat release 7 of
+       AIX like releases 5 and 6.
+
 2014-05-19  Paul Eggert  <address@hidden>
 
        Remove dependencies on getdelim and getline.

=== modified file 'admin/ChangeLog'
--- a/admin/ChangeLog   2014-05-25 13:44:14 +0000
+++ b/admin/ChangeLog   2014-05-26 02:28:09 +0000
@@ -1,7 +1,6 @@
-2014-05-25  Jan Djärv  <address@hidden>
+2014-05-25  YAMAMOTO Mitsuharu  <address@hidden>
 
-       * mac/uvs.el: New file from Mac port.  src/macuvs.h is generated
-       by it.
+       * mac/uvs.el: New file from Mac port.  Generates src/macuvs.h.
 
 2014-05-17  Paul Eggert  <address@hidden>
 

=== modified file 'configure.ac'
--- a/configure.ac      2014-05-19 04:56:03 +0000
+++ b/configure.ac      2014-05-26 02:28:09 +0000
@@ -547,7 +547,7 @@
   rs6000-ibm-aix[56]* )
     opsys=aix4-2
   ;;
-  powerpc-ibm-aix[56]*  )
+  powerpc-ibm-aix[5-9]* | powerpc-ibm-aix[1-9][0-9]* )
     opsys=aix4-2
   ;;
 
@@ -999,6 +999,15 @@
   LN_S="/bin/ln"
 fi
 
+dnl On some Debian versions, "install-info" prints irritating messages
+dnl "This is not dpkg install-info anymore, but GNU install-info"
+dnl if called via an absolute file name.
+dnl Use the entirely-identical-but-quieter ginstall-info instead if present.
+dnl Sadly some people may have an old ginstall-info installed on
+dnl non-Debian systems, so we can't use this.
+dnl AC_PATH_PROGS(INSTALL_INFO, [ginstall-info install-info], :,
+dnl   $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin)
+
 AC_PATH_PROG(INSTALL_INFO, install-info, :,
   $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin)
 dnl Don't use GZIP, which is used by gzip for additional parameters.

=== modified file 'doc/emacs/ChangeLog'
--- a/doc/emacs/ChangeLog       2014-05-14 17:01:29 +0000
+++ b/doc/emacs/ChangeLog       2014-05-26 02:28:09 +0000
@@ -1,3 +1,9 @@
+2014-05-26  Eli Zaretskii  <address@hidden>
+
+       * frames.texi (Fonts): Clarify which frames are affected by
+       setting font from the menu and in default-frame-alist.
+       (Bug#17532)
+
 2014-05-14  Eli Zaretskii  <address@hidden>
 
        * mule.texi (Language Environments): Remove unused @anchor.  (Bug#17479)

=== modified file 'doc/emacs/frames.texi'
--- a/doc/emacs/frames.texi     2014-04-29 14:45:24 +0000
+++ b/doc/emacs/frames.texi     2014-05-21 16:35:31 +0000
@@ -494,13 +494,14 @@
 @cindex fonts
 
   By default, Emacs displays text on graphical displays using a
-12-point monospace font.  There are several different ways to specify
+10-point monospace font.  There are several different ways to specify
 a different font:
 
 @itemize
 @item
-Click on @samp{Set Default Font} in the @samp{Options} menu.  To save
-this for future sessions, click on @samp{Save Options} in the
+Click on @samp{Set Default Font} in the @samp{Options} menu.  This
+makes the selected font the default on all existing graphical frames.
+To save this for future sessions, click on @samp{Save Options} in the
 @samp{Options} menu.
 
 @item
@@ -513,6 +514,10 @@
              '(font . "DejaVu Sans Mono-10"))
 @end example
 
address@hidden
+This makes the font the default on all graphical frames created after
+restarting Emacs with that init file.
+
 @cindex X defaults file
 @cindex X resources file
 @item

=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog     2014-05-22 04:30:48 +0000
+++ b/doc/lispref/ChangeLog     2014-05-26 02:28:09 +0000
@@ -1,3 +1,8 @@
+2014-05-26  Eli Zaretskii  <address@hidden>
+
+       * display.texi (Invisible Text): Clarify the description of
+       line-move-ignore-invisible.  (Bug#17511)
+
 2014-05-22  Leo Liu  <address@hidden>
 
        * sequences.texi (Sequence Functions): Don't mention when and how

=== modified file 'doc/lispref/display.texi'
--- a/doc/lispref/display.texi  2014-04-15 13:21:18 +0000
+++ b/doc/lispref/display.texi  2014-05-17 08:58:17 +0000
@@ -930,12 +930,14 @@
 
 @vindex line-move-ignore-invisible
   Ordinarily, functions that operate on text or move point do not care
-whether the text is invisible.  The user-level line motion commands
-ignore invisible newlines if @code{line-move-ignore-invisible} is
address@hidden (the default), but only because they are explicitly
-programmed to do so.
+whether the text is invisible, they process invisible characters and
+visible characters alike.  The user-level line motion commands,
+such as @code{next-line}, @code{previous-line}, ignore invisible
+newlines if @code{line-move-ignore-invisible} is address@hidden (the
+default), i.e., behave like these invisible newlines didn't exist in
+the buffer, but only because they are explicitly programmed to do so.
 
-  However, if a command ends with point inside or at the boundary of
+  If a command ends with point inside or at the boundary of
 invisible text, the main editing loop relocates point to one of the
 two ends of the invisible text.  Emacs chooses the direction of
 relocation so that it is the same as the overall movement direction of
@@ -952,6 +954,10 @@
 to the first visible character that follows the invisible text and then forward
 one more character.
 
+  These @dfn{adjustments} of point that ended up in the middle of
+invisible text can be disabled by setting @code{disable-point-adjustment}
+to a address@hidden value.  @xref{Adjusting Point}.
+
   Incremental search can make invisible overlays visible temporarily
 and/or permanently when a match includes invisible text.  To enable
 this, the overlay should have a address@hidden

=== modified file 'doc/misc/ChangeLog'
--- a/doc/misc/ChangeLog        2014-05-20 00:59:36 +0000
+++ b/doc/misc/ChangeLog        2014-05-26 02:28:09 +0000
@@ -1,3 +1,16 @@
+2014-05-26  Paul Eggert  <address@hidden>
+
+       Specify coding if Latin-1 Emacs would misinterpret (Bug#17575).
+       * htmlfontify.texi, org.texi: Add "coding: utf-8".
+
+2014-05-26  Stephen Berman  <address@hidden>
+
+       * todo-mode.texi: Update in light of changes due to bug#17482.
+       Replace numerous mistaken uses of literal quotes with proper
+       Texinfo markup.
+       (Todo Mode Entry Points): Comment out reference to using find-file
+       or Dired to visit Todo files, since this has been disabled (bug#17482).
+
 2014-05-20  Leo Liu  <address@hidden>
 
        * cl.texi (List Functions, Efficiency Concerns): Update cl-endp.

=== modified file 'doc/misc/htmlfontify.texi'
--- a/doc/misc/htmlfontify.texi 2014-05-07 17:34:53 +0000
+++ b/doc/misc/htmlfontify.texi 2014-05-24 22:23:47 +0000
@@ -1589,3 +1589,7 @@
 
 @setchapternewpage odd
 @bye
+
address@hidden Local Variables:
address@hidden coding: utf-8
address@hidden End:

=== modified file 'doc/misc/org.texi'
--- a/doc/misc/org.texi 2014-05-07 17:34:53 +0000
+++ b/doc/misc/org.texi 2014-05-24 22:23:47 +0000
@@ -18208,6 +18208,7 @@
 @bye
 
 @c Local variables:
address@hidden coding: utf-8
 @c fill-column: 77
 @c indent-tabs-mode: nil
 @c paragraph-start:    "\\|address@hidden 
\n]\\|address@hidden(key\\|cmd\\)\\|\f\\|[  ]*$"

=== modified file 'doc/misc/todo-mode.texi'
--- a/doc/misc/todo-mode.texi   2014-05-07 17:34:53 +0000
+++ b/doc/misc/todo-mode.texi   2014-05-23 16:54:35 +0000
@@ -258,15 +258,15 @@
 @code{todo-insert-item}, since these commands are bound to @kbd{t},
 @kbd{j} and @kbd{i}, respectively, in Todo mode.
 
-You can also visit a Todo file via @code{find-file} or Dired, like any
-other file, and since Emacs recognizes it, the buffer will automatically
-be in the appropriate Todo mode.  Moreover, as long as the command you
-use to visit the file is listed in the option
address@hidden (which by default contains
address@hidden and @code{dired-find-file}), it will also correctly
-display the file's first category on first visiting the file (otherwise
-you have to use one of the commands for navigating between categories in
-order to get a proper display).
address@hidden You can also visit a Todo file via @code{find-file} or Dired, 
like any
address@hidden other file, and since Emacs recognizes it, the buffer will 
automatically
address@hidden be in the appropriate Todo mode.  Moreover, as long as the 
command you
address@hidden use to visit the file is listed in the option
address@hidden @code{todo-visit-files-commands} (which by default contains
address@hidden @code{find-file} and @code{dired-find-file}), it will also 
correctly
address@hidden display the file's first category on first visiting the file 
(otherwise
address@hidden you have to use one of the commands for navigating between 
categories in
address@hidden order to get a proper display).
 
 You can leave Todo mode by typing @kbd{q} (@code{todo-quit}), which
 buries the current todo file buffer.  Doing this also saves any changes
@@ -295,7 +295,7 @@
 number key.
 
 The predefined key bindings in Todo are more or less mnemonic.  As a
-rule, key sequences beginning with @kbd{C} (capital `C', not the
+rule, key sequences beginning with @kbd{C} (capital @samp{C}, not the
 control key) are bound to commands applying to categories, sequences
 beginning with @kbd{F} apply to (non-archive) file-level commands, and
 those beginning with @kbd{A} apply to archives (a special type of Todo
@@ -669,9 +669,9 @@
 @samp{region} (@kbd{r}): Use the text of the selected region as the
 text of the new item, and insert this in accordance with the item
 insertion options and other parameters passed.  If the option
-`todo-use-only-highlighted-region' is non-nil, then use the region
-only when it is highlighted; otherwise, use the region regardless of
-highlighting.
address@hidden is non-nil, then use the
+region only when it is highlighted; otherwise, use the region
+regardless of highlighting.
 @end enumerate
 
 Note that the parameters are divided into five numbered groups; within
@@ -715,9 +715,9 @@
 @noindent Notice that the pair @samp{k=>nonmarking} is now absent, since it
 belongs to the same group as the selected pair @samp{y=>diary}, hence
 is no longer available for this sequence.  Since @kbd{y} is a
-continuation key, it is still available, but now the string ":GO!" is
-appended to the pair to remind you that pressing this key again will
-complete the sequence.
+continuation key, it is still available, but now the string
address@hidden:GO!} is appended to the pair to remind you that pressing this
+key again will complete the sequence.
 
 
 
@@ -821,10 +821,10 @@
 
 @noindent
 Editing the text of a lengthy item in the minibuffer can be
-inconvenient; therefore, if you type `e e' or `e h' on an item whose
-text contains more than one logical line, the effect is the same as if
-you had typed `e m', that is, you switch a special buffer in Todo Edit
-mode.
+inconvenient; therefore, if you type @kbd{e e} or @kbd{e h} on an item
+whose text contains more than one logical line, the effect is the same
+as if you had typed @kbd{e m}, that is, you switch a special buffer in
+Todo Edit mode.
 
 When you pass any of the parameters of the preceding group, except for
 the @samp{date} parameter, this completes the item editing invocation
@@ -916,10 +916,10 @@
 Press a key (so far `e d'): f=>full c=>calendar a=>today n=>dayname y=>year 
m=>month d=>daynum
 @end example
 
-In addition to the item-level invocations `e y', to change the current
-item's diary inclusion status, and `e k', to change the current item's
-calendar marking status, Todo mode also has two related category-level
-commands:
+In addition to the item-level invocations @kbd{e y}, to change the
+current item's diary inclusion status, and @kbd{e k}, to change the
+current item's calendar marking status, Todo mode also has two related
+category-level commands:
 
 @table @kbd
 
@@ -932,7 +932,7 @@
 @end table
 
 @noindent
-Like `e k', `C e k' automatically removes @code{todo-nondiary-marker}
+Like @kbd{e k}, @kbd{C e k} automatically removes @code{todo-nondiary-marker}
 from all items it is present on, since only diary items can bear
 @code{diary-nonmarking-symbol}.
 
@@ -944,7 +944,7 @@
 category, and take a prefix argument to reverse the effect.  (If you
 really want to toggle the diary-inclusion and calendar-marking status
 of all items in the category, you can do this by marking all the items
-and then invoking `e y' or `e k', @pxref{Marked Items}).
+and then invoking @kbd{e y} or @kbd{e k}, @pxref{Marked Items}).
 
 @node  Relocating and Removing Items,  , Editing Item Headers and Text, Item 
Editing
 @subsection Relocating and Removing Items
@@ -1050,14 +1050,15 @@
 
 @anchor{todo-item-done}
 @item d
-This command (@code{todo-item-done}) removes the todo item at point from
-the todo list, appends to the original header a header consisting of
address@hidden (by default ``DONE '') and the current date, and
-if @code{todo-always-add-time-string} is enabled, also the current time,
-and adds the resulting done item to the top of the done items section of
-the category.  Invoked with a prefix argument, it also prompts you to
-enter a comment, which is appended to the end of the done item, prefixed
-with @code{todo-comment-string} (by default ``COMMENT: '').
+This command (@code{todo-item-done}) removes the todo item at point
+from the todo list, appends to the original header a header consisting
+of @code{todo-done-string} (by default @samp{DONE }) and the current
+date, and if @code{todo-always-add-time-string} is enabled, also the
+current time, and adds the resulting done item to the top of the done
+items section of the category.  Invoked with a prefix argument, it
+also prompts you to enter a comment, which is appended to the end of
+the done item, prefixed with @code{todo-comment-string} (by default
address@hidden: }).
 @end table
 
 A category's done items section is located below the last todo (i.e.,
@@ -1255,7 +1256,7 @@
 
 Since it is natural to visit an archive from the corresponding todo
 file, it would be convenient to easily return to the todo file when you
-have finished browsing the archive.  If you type `q' to quit Todo
+have finished browsing the archive.  If you type @kbd{q} to quit Todo
 Archive mode, this switches to the corresponding todo file and shows the
 todo category corresponding to the archive category you were just
 visiting.
@@ -1396,13 +1397,13 @@
 
 Each row of the table is also buttonized; pressing one of these exits
 the buffer (killing it), returns to the buffer of the file from which
-you had invoked `F c', and displays the category that was named in the
-row button you pressed (i.e., pressing this button jumps to that
-category).  However, if the category named in the row is in a todo file
-and all of its items have been archived, and you have enabled the option
address@hidden, then pressing the button jumps to
-the archive category instead of the empty todo category.  You can
-recognize such categories by their items counts in the table---all
+you had invoked @kbd{F c}, and displays the category that was named in
+the row button you pressed (i.e., pressing this button jumps to that
+category).  However, if the category named in the row is in a todo
+file and all of its items have been archived, and you have enabled the
+option @code{todo-skip-archived-categories}, then pressing the button
+jumps to the archive category instead of the empty todo category.  You
+can recognize such categories by their items counts in the table---all
 columns but the archived one have counts of zero---and in addition,
 their lines in the table are also distinguished from the others by a
 different face (@pxref{Faces}).
@@ -1586,7 +1587,7 @@
 current category.  To exclude a category or file from filtering by @kbd{F t t}
 and @kbd{F t m}, set the number to @samp{0}.
 @item
-You can invoke `F t t' and `F t m' with a numeric prefix argument,
+You can invoke @kbd{F t t} and @kbd{F t m} with a numeric prefix argument,
 which specifies the number of top priorities in each category just for
 this invocation, overriding both @code{todo-top-priorities-overrides} and
 @code{todo-top-priorities}.
@@ -1681,7 +1682,7 @@
 Aside from explicitly invoking an item filtering command to display a
 saved list of items filtered by a given method from given todo files,
 there are two other ways to visit a saved file of filtered items.  You
-can invoke a command similar to `find-file':
+can invoke a command similar to @code{find-file}:
 
 @table @kbd
 @item F f

=== modified file 'etc/ChangeLog'
--- a/etc/ChangeLog     2014-05-17 08:11:31 +0000
+++ b/etc/ChangeLog     2014-05-26 02:28:09 +0000
@@ -1,3 +1,8 @@
+2014-05-26  Paul Eggert  <address@hidden>
+
+       Specify coding if Latin-1 Emacs would misinterpret (Bug#17575).
+       * ETAGS.EBNF, NEWS, ORG-NEWS: Add "coding: utf-8".
+
 2014-05-17  Paul Eggert  <address@hidden>
 
        * NEWS: Assume C99 or later (Bug#17487).

=== modified file 'etc/ETAGS.EBNF'
--- a/etc/ETAGS.EBNF    2014-01-16 06:24:06 +0000
+++ b/etc/ETAGS.EBNF    2014-05-24 22:23:47 +0000
@@ -1,4 +1,4 @@
--*- indented-text -*-
+-*- mode: indented-text; coding: utf-8 -*-
 
 See the end of this file for copyright information.
 

=== modified file 'etc/NEWS'
--- a/etc/NEWS  2014-05-25 01:18:16 +0000
+++ b/etc/NEWS  2014-05-26 02:28:09 +0000
@@ -1476,7 +1476,6 @@
 *** `generic-make-keywords-list'
 *** `get-upcase-table' (use `case-table-get-table' instead).
 
-+++
 ** `with-wrapper-hook' is obsoleted by `add-function'.
 The few hooks that used with-wrapper-hook are replaced as follows:
 *** `abbrev-expand-function' obsoletes `abbrev-expand-functions'.
@@ -4187,6 +4186,7 @@
 
 
 Local variables:
+coding: utf-8
 mode: outline
 paragraph-separate: "[         ]*$"
 end:

=== modified file 'etc/ORG-NEWS'
--- a/etc/ORG-NEWS      2014-01-10 07:10:37 +0000
+++ b/etc/ORG-NEWS      2014-05-24 22:23:47 +0000
@@ -1,4 +1,4 @@
-ORG NEWS -- history of user-visible changes.           -*- org -*-
+ORG NEWS -- history of user-visible changes.   -*- mode: org; coding: utf-8 -*-
 
 #+LINK: doc http://orgmode.org/worg/doc.html#%s
 #+LINK: git http://orgmode.org/w/?p=org-mode.git;a=commit;h=%s

=== modified file 'lib-src/ChangeLog'
--- a/lib-src/ChangeLog 2014-05-19 04:56:03 +0000
+++ b/lib-src/ChangeLog 2014-05-26 02:28:09 +0000
@@ -1,3 +1,13 @@
+2014-05-26  Paul Eggert  <address@hidden>
+
+       Fix rcs2log problems with CVS.
+       Problem reported by Glenn Morris in
+       <http://lists.gnu.org/archive/html/emacs-devel/2014-05/msg00277.html>.
+       Plus, fix some security and filename quoting problems.
+       * rcs2log (logdir): Prefer mktemp if available.
+       (logdir, llogdir): Work even if TMPDIR begins with '-' or has spaces.
+       (output_authors, main awk script): Parse more-recent CVS output format.
+
 2014-05-19  Paul Eggert  <address@hidden>
 
        Remove dependencies on getline and getdelim.

=== modified file 'lib-src/rcs2log'
--- a/lib-src/rcs2log   2014-01-01 08:31:29 +0000
+++ b/lib-src/rcs2log   2014-05-20 07:59:28 +0000
@@ -205,11 +205,19 @@
        m[9]="Oct"; m[10]="Nov"; m[11]="Dec"
 '
 
-logdir=$TMPDIR/rcs2log$$
+if type mktemp >/dev/null 2>&1; then
+       logdir=`mktemp -d`
+else
+       logdir=$TMPDIR/rcs2log$$
+       (umask 077 && mkdir "$logdir")
+fi || exit
+case $logdir in
+-*) logdir=./$logdir;;
+esac
+trap exit 1 2 13 15
+trap "rm -fr \"$logdir\" 2>/dev/null" 0
+
 llogout=$logdir/l
-trap exit 1 2 13 15
-trap "rm -fr $logdir 2>/dev/null" 0
-(umask 077 && exec mkdir $logdir) || exit
 
 # If no rlog-format log file is given, generate one into $rlogfile.
 case $rlogfile in
@@ -417,10 +425,10 @@
 ?*)
        case $loginFullnameMailaddrs in
        *\"* | *\\*)
-               sed 's/["\\]/\\&/g' >$llogout <<EOF || exit
+               sed 's/["\\]/\\&/g' >"$llogout" <<EOF || exit
 $loginFullnameMailaddrs
 EOF
-               loginFullnameMailaddrs=`cat $llogout`;;
+               loginFullnameMailaddrs=`cat "$llogout"`;;
        esac
 
        oldIFS=$IFS
@@ -442,29 +450,33 @@
 
 case $logins in
 ?*)
-       sort -u -o $llogout <<EOF
+       sort -u -o "$llogout" <<EOF
 $logins
 EOF
        ;;
 '')
        : ;;
-esac >$llogout || exit
+esac >"$llogout" || exit
 
 output_authors='/^date: / {
-       if ($2 ~ /^[0-9]*[-\/][0-9][0-9][-\/][0-9][0-9]$/ && $3 ~ 
/^[0-9][0-9]:[0-9][0-9]:[0-9][0-9][-+0-9:]*;$/ && $4 == "author:" && $5 ~ 
/^[^;]*;$/) {
-               print substr($5, 1, length($5)-1)
+       cvsformat = $5 == "author:"
+       if ($2 ~ /^[0-9]*[-\/][0-9][0-9][-\/][0-9][0-9]$/ && (cvsformat ? $3 ~ 
/^[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/ && $4 ~ /^[-+][0-9:]*;$/ : $3 ~ 
/^[0-9][0-9]:[0-9][0-9]:[0-9][0-9][-+0-9:]*;$/)) {
+               author = $(5 + cvsformat)
+               if ($(4 + cvsformat) == "author:" && author ~ /^[^;]*;$/) {
+                       print substr(author, 1, length(author)-1)
+               }
        }
 }'
 authors=`
-       $AWK "$output_authors" <"$rlogfile" | sort -u | comm -23 - $llogout
+       $AWK "$output_authors" <"$rlogfile" | sort -u | comm -23 - "$llogout"
 `
 case $authors in
 ?*)
-       cat >$llogout <<EOF || exit
+       cat >"$llogout" <<EOF || exit
 $authors
 EOF
        initialize_author_script='s/["\\]/\\&/g; s/.*/author[\"&\"] = 1/'
-       initialize_author=`sed -e "$initialize_author_script" <$llogout`
+       initialize_author=`sed -e "$initialize_author_script" <"$llogout"`
        awkscript='
                BEGIN {
                        alphabet = "abcdefghijklmnopqrstuvwxyz"
@@ -644,8 +656,23 @@
                                }
                                date = newdate date
                        }
-                       time = substr($3, 1, length($3) - 1)
-                       author = substr($5, 1, length($5)-1)
+                       time = ""
+                       for (i = 3; i <= NF; i++) {
+                               time = time $i
+                               if (time ~ /;$/) {
+                                       time = substr(time, 1, length(time) - 1)
+                                       break
+                               }
+                       }
+                       i++
+                       if ($i == "author:") {
+                               author = $(i + 1)
+                               if (author ~ /;$/) {
+                                       author = substr(author, 1, 
length(author) - 1)
+                               }
+                       } else {
+                               author = ""
+                       }
                        printf "%s%s%s%s%s%s%s%s%s%s", filename, SOH, rev, SOH, 
date, SOH, time, SOH, author, SOH
                        rev = "?"
                        next
@@ -769,7 +796,7 @@
 
 # Exit successfully.
 
-exec rm -fr $logdir
+exec rm -fr "$logdir"
 
 # Local Variables:
 # tab-width:4

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-05-25 17:40:54 +0000
+++ b/lisp/ChangeLog    2014-05-26 02:28:09 +0000
@@ -1,3 +1,145 @@
+2014-05-26  Andreas Schwab  <address@hidden>
+
+       * cus-face.el (custom-face-attributes): Add :distant-foreground.
+
+2014-05-26  Martin Rudalics  <address@hidden>
+
+       * window.el (window--dump-frame): Remove interactive specification.
+
+2014-05-26  Glenn Morris  <address@hidden>
+
+       * hippie-exp.el (he-line-search-regexp):
+       Handle comint-prompt-regexp containing subgroups.  (Bug#17529)
+
+2014-05-26  Stephen Berman  <address@hidden>
+
+       * calendar/todo-mode.el: Remove dependence on auto-mode-alist,
+       to avoid errors when trying to create or visit a file foo.todo
+       located outside to todo-directory, and to allow having such files
+       without them being tied to Todo mode (bug#17482).
+       (todo-show, todo-move-category, todo-merge-category, todo-find-archive)
+       (todo-archive-done-item, todo-find-filtered-items-file)
+       (todo-filter-items, todo-find-item, todo-diary-goto-entry)
+       (todo-category-completions, todo-read-category): When visiting a
+       Todo file, make sure we're in the right mode and the buffer local
+       variables are set.
+       (todo-make-categories-list, todo-reset-nondiary-marker)
+       (todo-reset-done-string, todo-reset-comment-string): After
+       processing all Todo files, kill the buffers of those files that
+       weren't being visited before the processing.
+       (todo-display-as-todo-file, todo-add-to-buffer-list)
+       (todo-visit-files-commands): Comment out.
+       (todo-modes-set-3, todo-mode): Comment out additions to find-file-hook.
+       (auto-mode-alist): Remove add-to-list calls making Todo file
+       extensions unrestrictedly tied to Todo modes.
+
+2014-05-26  Stefan Monnier  <address@hidden>
+
+       * emacs-lisp/nadvice.el (advice--member-p): Change second arg.
+       (advice-function-member-p): Tell it to check both names and functions
+       (bug#17531).
+       (advice--add-function): Adjust call accordingly.
+
+2014-05-26  Stephen Berman  <address@hidden>
+
+       * calendar/todo-mode.el: Miscellaneous bug fixes.
+       (todo-delete-file): When deleting an archive but not its todo
+       file, make sure to update the todo file's category sexp.
+       (todo-move-category): Keep the moved category's name unless the
+       file moved to already has a category with that name.  If the
+       numerically last category of the source file was moved, make the
+       first category current to avoid selecting a nonexisting category.
+       (todo-merge-category): Fix implementation to make merging to a
+       category in another file work as documented.  Eliminate now
+       insufficient and unnecessary renaming of archive category, correct
+       document string accordingly, and clarify it.  If the numerically
+       last category of the source file was merged, make the first
+       category current to avoid selecting a nonexisting category.
+       (todo-archive-done-item): When there are marked items and point
+       happens to be on an unmarked item, ignore the latter.  Don't leave
+       point below last item after archiving marked items.
+       (todo-unarchive-items): Fix logic to ensure unarchiving an item
+       from an archive with only one category deletes the archive only
+       when the category is empty after unarchiving.  Make sure the todo
+       file's category sexp is updated.
+       (todo-read-file-name): Allow an existing file name even when it is
+       not required (todo-move-category needs this to work as documented).
+       (todo-add-file): Call todo-validate-name to reject the name of an
+       existing todo file (needed due to fix in todo-read-file-name).
+       (todo-reset-nondiary-marker): Also reset in filtered items files.
+       (todo-reset-done-string, todo-reset-comment-string): Also reset in
+       regexp filtered items files.
+       (todo-reset-highlight-item): Also reset in filtered items files.
+       Fix incorrect variable reference in document string.
+
+2014-05-26  Glenn Morris  <address@hidden>
+
+       * window.el (window--dump-frame): Avoid error in --without-x builds.
+
+2014-05-26  Glenn Morris  <address@hidden>
+
+       * nxml/nxml-mode.el (xml-mode): Only define this alias once.
+
+2014-05-26  Eli Zaretskii  <address@hidden>
+
+       * frame.el (set-frame-font): Doc fix.
+
+       * menu-bar.el (menu-set-font): Doc fix.  (Bug#17532)
+
+2014-05-26  Dmitry Gutov  <address@hidden>
+
+       * emacs-lisp/package.el (package--download-one-archive): Use
+       `write-region' instead of `save-buffer' to avoid running various
+       hooks.  (Bug#17155)
+       (describe-package-1): Same.  Insert newline at the end of the
+       buffer if appropriate.
+
+2014-05-26  Juri Linkov  <address@hidden>
+
+       * avoid.el (mouse-avoidance-set-mouse-position): Don't raise frame.
+       (mouse-avoidance-ignore-p): Remove `switch-frame', add `focus-out'.
+       Add more modifiers: meta, control, shift, hyper, super, alt.
+       (Bug#17439)
+
+       * avoid.el (mouse-avoidance-banish-position): Fix defcustom :options
+       to allow changing its value with `set-variable'.
+
+2014-05-26  Stefan Monnier  <address@hidden>
+
+       * progmodes/scheme.el (scheme-mode-syntax-table): Remove hack for
+       #; comments.
+       (scheme-syntax-propertize, scheme-syntax-propertize-sexp-comment):
+       New functions.
+       (scheme-mode-variables): Set syntax-propertize-function instead of
+       font-lock-syntactic-face-function.
+       (scheme-font-lock-syntactic-face-function): Delete.
+
+       * emacs-lisp/lisp.el (end-of-defun): Ensure we move (bug#17274).
+
+       * emacs-lisp/timer.el (timer-event-handler): Don't run if canceled
+       (bug#17392).
+
+2014-05-26  Michael Albinus  <address@hidden>
+
+       * net/tramp-sh.el (tramp-find-inline-encoding): Do not match "%%t"
+       for a temporary file name.
+
+2014-05-26  Eli Zaretskii  <address@hidden>
+
+       * simple.el (line-move-ignore-invisible): Doc fix.  (Bug#17511)
+
+2014-05-26  Michael Albinus  <address@hidden>
+
+       * net/dbus.el (dbus-init-bus, dbus-call-method)
+       (dbus-call-method-asynchronously, dbus-send-signal)
+       (dbus-method-return-internal, dbus-method-error-internal):
+       Check, whether Emacs has been compiled with D-Bus support.  (Bug#17508)
+
+2014-05-26  Nicolas Richard  <address@hidden>
+
+       * emacs-lisp/eieio-opt.el (eieio-help-class): Correctly deal with
+       methods which do not have a doc string.  (Bug#17490)
+
 2014-05-25  Tassilo Horn  <address@hidden>
 
        * textmodes/reftex-ref.el (reftex-format-special): Make it work

=== modified file 'lisp/avoid.el'
--- a/lisp/avoid.el     2014-01-01 07:43:34 +0000
+++ b/lisp/avoid.el     2014-05-20 21:20:36 +0000
@@ -52,9 +52,6 @@
 ;;
 ;; - Using this code does slow Emacs down.  "banish" mode shouldn't
 ;;   be too bad, and on my workstation even "animate" is reasonable.
-;;
-;; - It ought to find out where any overlapping frames are and avoid them,
-;;   rather than always raising the frame.
 
 ;; Credits:
 ;; This code was helped by all those who contributed suggestions,
@@ -129,9 +126,9 @@
 TOP-OR-BOTTOM-POS: Distance from top or bottom edge of frame or window."
   :group   'avoid
   :version "24.3"
-  :type    '(alist :key-type symbol :value-type symbol)
-  :options '(frame-or-window side (side-pos integer)
-             top-or-bottom (top-or-bottom-pos integer)))
+  :type    '(alist :key-type symbol :value-type (choice symbol integer))
+  :options '((frame-or-window symbol) (side symbol) (side-pos integer)
+             (top-or-bottom symbol) (top-or-bottom-pos integer)))
 
 ;; Internal variables
 (defvar mouse-avoidance-state nil)
@@ -172,12 +169,8 @@
 
 (defun mouse-avoidance-set-mouse-position (pos)
   ;; Carefully set mouse position to given position (X . Y)
-  ;; Ideally, should check if X,Y is in the current frame, and if not,
-  ;; leave the mouse where it was.  However, this is currently
-  ;; difficult to do, so we just raise the frame to avoid frame switches.
   ;; Returns t if it moved the mouse.
   (let ((f (selected-frame)))
-    (raise-frame f)
     (set-mouse-position f (car pos) (cdr pos))
     t))
 
@@ -342,12 +335,18 @@
             (let ((modifiers (event-modifiers (car last-input-event))))
               (or (memq (car last-input-event)
                         '(mouse-movement scroll-bar-movement
-                          select-window switch-frame))
+                          select-window focus-out))
                   (memq 'click modifiers)
                   (memq 'double modifiers)
                   (memq 'triple modifiers)
                   (memq 'drag modifiers)
-                  (memq 'down modifiers)))))))
+                  (memq 'down modifiers)
+                  (memq 'meta modifiers)
+                  (memq 'control modifiers)
+                  (memq 'shift modifiers)
+                  (memq 'hyper modifiers)
+                  (memq 'super modifiers)
+                  (memq 'alt modifiers)))))))
 
 (defun mouse-avoidance-banish ()
   (if (not (mouse-avoidance-ignore-p))
@@ -403,8 +402,6 @@
  * cat-and-mouse: Same as `animate'.
  * proteus: As `animate', but changes the shape of the mouse pointer too.
 
-Whenever the mouse is moved, the frame is also raised.
-
 \(See `mouse-avoidance-threshold' for definition of \"too close\",
 and `mouse-avoidance-nudge-dist' and `mouse-avoidance-nudge-var' for
 definition of \"random distance\".)"

=== modified file 'lisp/calendar/todo-mode.el'
--- a/lisp/calendar/todo-mode.el        2014-05-09 07:50:42 +0000
+++ b/lisp/calendar/todo-mode.el        2014-05-23 16:54:35 +0000
@@ -566,13 +566,13 @@
 ;;; Entering and exiting
 ;; 
-----------------------------------------------------------------------------
 
-(defcustom todo-visit-files-commands (list 'find-file 'dired-find-file)
-  "List of file finding commands for `todo-display-as-todo-file'.
-Invoking these commands to visit a todo file or todo archive file
-calls `todo-show' or `todo-find-archive', so that the file is
-displayed correctly."
-  :type '(repeat function)
-  :group 'todo)
+;; (defcustom todo-visit-files-commands (list 'find-file 'dired-find-file)
+;;   "List of file finding commands for `todo-display-as-todo-file'.
+;; Invoking these commands to visit a todo file or todo archive file
+;; calls `todo-show' or `todo-find-archive', so that the file is
+;; displayed correctly."
+;;   :type '(repeat function)
+;;   :group 'todo)
 
 (defun todo-short-file-name (file)
   "Return the short form of todo file FILE's name.
@@ -740,9 +740,12 @@
                                             "Choose a regexp items file: "
                                             rxf) 'regexp))))))
                     (if (file-exists-p fi-file)
-                        (set-window-buffer
-                         (selected-window)
-                         (set-buffer (find-file-noselect fi-file 'nowarn)))
+                        (progn
+                          (set-window-buffer
+                           (selected-window)
+                           (set-buffer (find-file-noselect fi-file 'nowarn)))
+                          (unless (derived-mode-p 'todo-filtered-items-mode)
+                            (todo-filtered-items-mode)))
                       (message "There is no %s file for %s"
                                (cond ((eq todo-show-first 'top)
                                       "top priorities")
@@ -757,6 +760,9 @@
          (unless (todo-check-file file) (throw 'end nil))
          (set-window-buffer (selected-window)
                             (set-buffer (find-file-noselect file 'nowarn)))
+         (if (equal (file-name-extension (buffer-file-name)) "toda")
+             (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
+           (unless (derived-mode-p 'todo-mode) (todo-mode)))
          ;; When quitting an archive file, show the corresponding
          ;; category in the corresponding todo file, if it exists.
          (when (assoc cat todo-categories)
@@ -1090,6 +1096,9 @@
   (let* ((prompt (concat "Enter name of new todo file "
                         "(TAB or SPC to see current names): "))
         (file (todo-read-file-name prompt)))
+    ;; Don't accept the name of an existing todo file.
+    (setq file (todo-absolute-file-name
+               (todo-validate-name (todo-short-file-name file) 'file)))
     (with-current-buffer (get-buffer-create file)
       (erase-buffer)
       (write-region (point-min) (point-max) file nil 'nomessage nil t)
@@ -1179,10 +1188,28 @@
       (when (file-exists-p file1) (delete-file file1))
       (setq todo-visited (delete file1 todo-visited))
       (kill-buffer buf1)
-      (when delete2
-       (when (file-exists-p file2) (delete-file file2))
-       (setq todo-visited (delete file2 todo-visited))
-       (and buf2 (kill-buffer buf2)))
+      (if delete2
+         (progn
+           (when (file-exists-p file2) (delete-file file2))
+           (setq todo-visited (delete file2 todo-visited))
+           (and buf2 (kill-buffer buf2)))
+       ;; If we deleted an archive but not its todo file, update the
+       ;; latter's category sexp.
+       (when (equal (file-name-extension file2) "todo")
+         (with-current-buffer (or buf2 (find-file-noselect file2))
+           (save-excursion
+             (save-restriction
+               (widen)
+               (goto-char (point-min))
+               (let ((sexp (read (buffer-substring-no-properties
+                                  (line-beginning-position)
+                                  (line-end-position))))
+                     (buffer-read-only nil))
+                 (mapc (lambda (x) (aset (cdr x) 3 0)) sexp)
+                 (delete-region (line-beginning-position) (line-end-position))
+                 (prin1 sexp (current-buffer)))))
+           (todo-set-categories)
+           (unless buf2 (kill-buffer)))))
       (setq todo-files (funcall todo-files-function)
            todo-archives (funcall todo-files-function t))
       (when (or (string=  file1-sn todo-default-todo-file)
@@ -1197,7 +1224,8 @@
                         (concat "and its "
                                 (cond (todo "archive") (archive "todo"))
                                 " file "))
-                      "deleted") file1-sn))))
+                      "deleted")
+              file1-sn))))
 
 (defvar todo-edit-buffer "*Todo Edit*"
   "Name of current buffer in Todo Edit mode.")
@@ -1385,8 +1413,7 @@
                                    "Do you want to proceed? ")))
     (let* ((ofile todo-current-todo-file)
           (cat (todo-current-category))
-          (nfile (todo-read-file-name
-                  "Todo file to move this category to: " nil))
+          (nfile (todo-read-file-name "Todo file to move this category to: "))
           (archive (concat (file-name-sans-extension ofile) ".toda"))
           (buffers (append (list ofile)
                            (unless (zerop (todo-get-count 'archived cat))
@@ -1394,7 +1421,7 @@
           new)
       (while (equal nfile (file-truename ofile))
        (setq nfile (todo-read-file-name
-                    "Choose a file distinct from this file: " nil)))
+                    "Choose a file distinct from this file: ")))
       (unless (member nfile todo-files)
        (with-current-buffer (get-buffer-create nfile)
          (erase-buffer)
@@ -1428,6 +1455,10 @@
                 (if (member buf (funcall todo-files-function t))
                     (concat (file-name-sans-extension nfile) ".toda")
                   nfile))
+             (if (equal (file-name-extension (buffer-file-name)) "toda")
+                 (unless (derived-mode-p 'todo-archive-mode)
+                   (todo-archive-mode))
+               (unless (derived-mode-p 'todo-mode) (todo-mode)))
              (let* ((nfile-short (todo-short-file-name nfile))
                     (prompt (concat
                              (format "Todo file \"%s\" already has "
@@ -1453,7 +1484,7 @@
                           "\\(" (regexp-quote cat) "\\)$") nil t)
                  (replace-match new nil nil nil 1)))
              (setq todo-categories
-                   (append todo-categories (list (cons new counts))))
+                   (append todo-categories (list (cons (or new cat) counts))))
              (todo-update-categories-sexp)
              ;; If archive was just created, save it to avoid "File
              ;; <xyz> no longer exists!" message on invoking
@@ -1481,6 +1512,8 @@
              (setq todo-categories (delete (assoc cat todo-categories)
                                             todo-categories))
              (todo-update-categories-sexp)
+             (when (> todo-category-number (length todo-categories))
+               (setq todo-category-number 1))
              (todo-category-select)))))
       (set-window-buffer (selected-window)
                         (set-buffer (find-file-noselect nfile)))
@@ -1495,25 +1528,25 @@
 otherwise, choose and merge into a category in either the
 current todo file or a file in `todo-category-completions-files'.
 
-After merging, the current category's todo and done items are
+After merging, the source category's todo and done items are
 appended to the chosen goal category's todo and done items,
 respectively.  The goal category becomes the current category,
-and the previous current category is deleted.
+and the source category is deleted.
 
-If both the first and goal categories also have archived items,
-the former are merged to the latter.  If only the first category
-has archived items, the archived category is renamed to the goal
-category."
+If both the source and goal categories also have archived items,
+they are also merged.  If only the source category has archived
+items, the goal category is added as a new category to the
+archive file and the source category is deleted."
   (interactive "P")
   (let* ((tfile todo-current-todo-file)
         (cat (todo-current-category))
         (cat+file (todo-read-category "Merge into category: " 'todo file))
         (goal (car cat+file))
         (gfile  (cdr cat+file))
-        (archive (concat (file-name-sans-extension (if file gfile tfile))
-                         ".toda"))
-        archived-count here)
-    ;; Merge in todo file.
+        (tarchive (concat (file-name-sans-extension tfile) ".toda"))
+        (garchive (concat (file-name-sans-extension gfile) ".toda"))
+        (archived-count (todo-get-count 'archived))
+        here)
     (with-current-buffer (get-buffer (find-file-noselect tfile))
       (widen)
       (let* ((buffer-read-only nil)
@@ -1536,94 +1569,102 @@
                           (point-marker))
                       (point-max-marker))))
             (todo (buffer-substring-no-properties tbeg tend))
-            (done (buffer-substring-no-properties dbeg cend)))
-       (goto-char (point-min))
-       ;; Merge any todo items.
-       (unless (zerop (length todo))
-         (re-search-forward
-          (concat "^" (regexp-quote (concat todo-category-beg goal)) "$")
-          nil t)
-         (re-search-forward
-          (concat "^" (regexp-quote todo-category-done)) nil t)
-         (forward-line -1)
-         (setq here (point-marker))
-         (insert todo)
-         (todo-update-count 'todo (todo-get-count 'todo cat) goal))
-       ;; Merge any done items.
-       (unless (zerop (length done))
-         (goto-char (if (re-search-forward
-                         (concat "^" (regexp-quote todo-category-beg)) nil t)
-                        (match-beginning 0)
-                      (point-max)))
-         (when (zerop (length todo)) (setq here (point-marker)))
-         (insert done)
-         (todo-update-count 'done (todo-get-count 'done cat) goal))
+            (done (buffer-substring-no-properties dbeg cend))
+            (todo-count (todo-get-count 'todo cat))
+            (done-count (todo-get-count 'done cat)))
+       ;; Merge into goal todo category.
+       (with-current-buffer (get-buffer (find-file-noselect gfile))
+         (unless (derived-mode-p 'todo-mode) (todo-mode))
+         (widen)
+         (goto-char (point-min))
+         (let ((buffer-read-only nil))
+           ;; Merge any todo items.
+           (unless (zerop (length todo))
+             (re-search-forward
+              (concat "^" (regexp-quote (concat todo-category-beg goal)) "$")
+              nil t)
+             (re-search-forward
+              (concat "^" (regexp-quote todo-category-done)) nil t)
+             (forward-line -1)
+             (setq here (point-marker))
+             (insert todo)
+             (todo-update-count 'todo todo-count goal))
+           ;; Merge any done items.
+           (unless (zerop (length done))
+             (goto-char (if (re-search-forward
+                             (concat "^" (regexp-quote todo-category-beg))
+                             nil t)
+                            (match-beginning 0)
+                          (point-max)))
+             (when (zerop (length todo)) (setq here (point-marker)))
+             (insert done)
+             (todo-update-count 'done done-count goal)))
+         (todo-update-categories-sexp))
+       ;; Update and clean up source todo file.
        (remove-overlays cbeg cend)
        (delete-region cbeg cend)
        (setq todo-categories (delete (assoc cat todo-categories)
-                                      todo-categories))
+                                     todo-categories))
        (todo-update-categories-sexp)
-       (mapc (lambda (m) (set-marker m nil)) (list cbeg tbeg dbeg tend cend))))
-    (when (file-exists-p archive)
-      ;; Merge in archive file.
-      (with-current-buffer (get-buffer (find-file-noselect archive))
+       (when (> todo-category-number (length todo-categories))
+               (setq todo-category-number 1))
+       (todo-category-select)
+       (mapc (lambda (m) (set-marker m nil))
+             (list cbeg tbeg dbeg tend cend))))
+    (when (> archived-count 0)
+      (with-current-buffer (get-buffer (find-file-noselect tarchive))
        (widen)
        (goto-char (point-min))
-       (let ((buffer-read-only nil)
-             (cbeg (save-excursion
-                     (when (re-search-forward
-                            (concat "^" (regexp-quote
-                                         (concat todo-category-beg cat)) "$")
-                            nil t)
-                       (goto-char (match-beginning 0))
-                       (point-marker))))
-             (gbeg (save-excursion
-                     (when (re-search-forward
-                            (concat "^" (regexp-quote
-                                         (concat todo-category-beg goal)) "$")
-                            nil t)
-                       (goto-char (match-beginning 0))
-                       (point-marker))))
-             cend carch)
-         (when cbeg
-           (setq archived-count (todo-get-count 'done cat))
-           (setq cend (save-excursion
-                        (if (re-search-forward
-                             (concat "^" (regexp-quote todo-category-beg))
+       (let* ((buffer-read-only nil)
+              (cbeg (progn
+                      (when (re-search-forward
+                             (concat "^" (regexp-quote
+                                          (concat todo-category-beg cat)) "$")
                              nil t)
+                        (goto-char (match-beginning 0))
+                        (point-marker))))
+              (cend (if (re-search-forward
+                         (concat "^" (regexp-quote todo-category-beg)) nil t)
+                        (match-beginning 0)
+                      (point-max)))
+              (carch (progn
+                       (goto-char cbeg)
+                       (forward-line)
+                       (buffer-substring-no-properties (point) cend))))
+         ;; Merge into goal archive category, if it exists, else create it.
+         (with-current-buffer (get-buffer (find-file-noselect garchive))
+           (let ((gbeg (when (re-search-forward
+                              (concat "^" (regexp-quote
+                                           (concat todo-category-beg goal))
+                                      "$")
+                              nil t)
+                         (goto-char (match-beginning 0))
+                         (point-marker))))
+             (goto-char (if (and gbeg
+                                 (re-search-forward
+                                  (concat "^" (regexp-quote todo-category-beg))
+                                  nil t))
                             (match-beginning 0)
-                          (point-max))))
-           (setq carch (save-excursion (goto-char cbeg) (forward-line)
-                         (buffer-substring-no-properties (point) cend)))
-           ;; If both categories of the merge have archived items, merge the
-           ;; source items to the goal items, else "merge" by renaming the
-           ;; source category to goal.
-           (if gbeg
-               (progn
-                 (goto-char (if (re-search-forward
-                                 (concat "^" (regexp-quote todo-category-beg))
-                                 nil t)
-                                (match-beginning 0)
-                              (point-max)))
-                 (insert carch)
-                 (remove-overlays cbeg cend)
-                 (delete-region cbeg cend))
-             (goto-char cbeg)
-             (search-forward cat)
-             (replace-match goal))
-           (setq todo-categories (todo-make-categories-list t))
-           (todo-update-categories-sexp)))))
-    (with-current-buffer (get-file-buffer tfile)
-      (when archived-count
-       (unless (zerop archived-count)
-         (todo-update-count 'archived archived-count goal)
-         (todo-update-categories-sexp)))
-      (todo-category-number goal)
-      ;; If there are only merged done items, show them.
-      (let ((todo-show-with-done (zerop (todo-get-count 'todo goal))))
-       (todo-category-select)
-       ;; Put point on the first merged item.
-       (goto-char here)))
+                          (point-max)))
+             (unless gbeg (todo-add-category nil goal))
+             (insert carch)
+             (todo-update-categories-sexp)))
+         ;; Update and clean up source archive file.
+         (remove-overlays cbeg cend)
+         (delete-region cbeg cend)
+         (setq todo-categories (todo-make-categories-list t))
+         (todo-update-categories-sexp))))
+    ;; Update goal todo file for merged archived items and display it.
+    (set-window-buffer (selected-window) (set-buffer (get-file-buffer gfile)))
+    (unless (zerop archived-count)
+      (todo-update-count 'archived archived-count goal)
+      (todo-update-categories-sexp))
+    (todo-category-number goal)
+    ;; If there are only merged done items, show them.
+    (let ((todo-show-with-done (zerop (todo-get-count 'todo goal))))
+      (todo-category-select)
+      ;; Put point on the first merged item.
+      (goto-char here))
     (set-marker here nil)))
 
 ;; 
-----------------------------------------------------------------------------
@@ -2965,6 +3006,7 @@
       (when place
        (set-window-buffer (selected-window)
                           (set-buffer (find-file-noselect archive)))
+       (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
        (if (member place '(other-archive other-cat))
            (setq todo-category-number 1)
          (todo-category-number cat))
@@ -2997,7 +3039,7 @@
               (afile (concat (file-name-sans-extension
                               todo-current-todo-file) ".toda"))
               (archive (find-file-noselect afile t))
-              (item (and (todo-done-item-p)
+              (item (and (not marked) (todo-done-item-p)
                          (concat (todo-item-string) "\n")))
               (count 0)
               (opoint (unless (todo-done-item-p) (point)))
@@ -3040,6 +3082,7 @@
          (if (not (or marked all item))
              (throw 'end (message "Only done items can be archived"))
            (with-current-buffer archive
+             (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
              (let (buffer-read-only)
                (widen)
                (goto-char (point-min))
@@ -3061,12 +3104,12 @@
                (todo-update-categories-sexp)
                ;; If archive is new, save to file now (with
                ;; write-region to avoid prompt for file to save to)
-               ;; to update todo-archives, and to let auto-mode-alist
-               ;; take effect below on visiting the archive.
+               ;; to update todo-archives, and set the mode for
+               ;; visiting the archive below.
                (unless (nth 7 (file-attributes afile))
                  (write-region nil nil afile t t)
                  (setq todo-archives (funcall todo-files-function t))
-                 (kill-buffer))))
+                 (todo-archive-mode))))
            (with-current-buffer tbuf
              (cond
               (all
@@ -3092,7 +3135,8 @@
                          (todo-update-count 'done -1)
                          (todo-update-count 'archived 1)
                          ;; Don't leave point below last item.
-                         (and item (bolp) (eolp) (< (point-min) (point-max))
+                         (and (or marked item) (bolp) (eolp)
+                              (< (point-min) (point-max))
                               (todo-backward-item))
                          (when item
                            (throw 'done (setq item nil))))
@@ -3182,15 +3226,16 @@
                  (throw 'done (setq item nil))))
            (todo-forward-item))))
       (todo-update-count 'done (if marked (- marked-count) -1) cat)
-      ;; If that was the last category in the archive, delete the whole file.
-      (if (= (length todo-categories) 1)
-         (progn
-           (delete-file todo-current-todo-file)
-           ;; Kill the archive buffer silently.
-           (set-buffer-modified-p nil)
-           (kill-buffer))
-       ;; Otherwise, if the archive category is now empty, delete it.
-       (when (eq (point-min) (point-max))
+      ;; If we unarchived the last item in category, then if that was
+      ;; the only category, delete the whole file, otherwise, just
+      ;; delete the category.
+      (when (= 0 (todo-get-count 'done))
+       (if (= 1 (length todo-categories))
+           (progn
+             (delete-file todo-current-todo-file)
+             ;; Kill the archive buffer silently.
+             (set-buffer-modified-p nil)
+             (kill-buffer))
          (widen)
          (let ((beg (re-search-backward
                      (concat "^" (regexp-quote todo-category-beg) cat "$")
@@ -3203,8 +3248,8 @@
            (remove-overlays beg end)
            (delete-region beg end)
            (setq todo-categories (delete (assoc cat todo-categories)
-                                          todo-categories))
-           (todo-update-categories-sexp))))
+                                         todo-categories)))))
+      (todo-update-categories-sexp)
       ;; Visit category in todo file and show restored done items.
       (let ((tfile (buffer-file-name tbuf))
            (todo-show-with-done t))
@@ -3925,7 +3970,9 @@
     (setq file (completing-read "Choose a filtered items file: "
                                falist nil t nil nil (car falist)))
     (setq file (cdr (assoc-string file falist)))
-    (find-file file)))
+    (find-file file)
+    (unless (derived-mode-p 'todo-filtered-items-mode)
+      (todo-filtered-items-mode))))
 
 (defun todo-go-to-source-item ()
   "Display the file and category of the filtered item at point."
@@ -4056,6 +4103,8 @@
                            (completing-read "Choose a regexp items file: "
                                             rxf) 'regexp))))
           (find-file fname)
+          (unless (derived-mode-p 'todo-filtered-items-mode)
+            (todo-filtered-items-mode))
           (todo-prefix-overlays)
           (todo-check-filtered-items-file))
          (t
@@ -4309,6 +4358,9 @@
                   todo-global-current-todo-file)))
     (find-file-noselect file)
     (with-current-buffer (find-buffer-visiting file)
+      (if archive
+         (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
+       (unless (derived-mode-p 'todo-mode) (todo-mode)))
       (save-restriction
        (widen)
        (goto-char (point-min))
@@ -4885,23 +4937,28 @@
                 ;; Make sure to include newly created archives, e.g. due to
                 ;; todo-move-category.
                 (when (member archive (funcall todo-files-function t))
-                  (let ((archive-count 0))
-                    (with-current-buffer (find-file-noselect archive)
-                      (widen)
-                      (goto-char (point-min))
-                      (when (re-search-forward
-                             (concat "^" (regexp-quote todo-category-beg)
-                                     cat "$")
-                             (point-max) t)
-                        (forward-line)
-                        (while (not (or (looking-at
-                                         (concat
-                                          (regexp-quote todo-category-beg)
-                                          "\\(.*\\)\n"))
-                                        (eobp)))
-                          (when (looking-at todo-done-string-start)
-                            (setq archive-count (1+ archive-count)))
-                          (forward-line))))
+                  (let ((archive-count 0)
+                        (visiting (find-buffer-visiting archive)))
+                    (with-current-buffer (or visiting
+                                             (find-file-noselect archive))
+                      (save-excursion
+                        (save-restriction
+                          (widen)
+                          (goto-char (point-min))
+                          (when (re-search-forward
+                                 (concat "^" (regexp-quote todo-category-beg)
+                                         cat "$")
+                                 (point-max) t)
+                            (forward-line)
+                            (while (not (or (looking-at
+                                             (concat
+                                              (regexp-quote todo-category-beg)
+                                              "\\(.*\\)\n"))
+                                            (eobp)))
+                              (when (looking-at todo-done-string-start)
+                                (setq archive-count (1+ archive-count)))
+                              (forward-line)))))
+                      (unless visiting (kill-buffer)))
                     (todo-update-count 'archived archive-count cat))))
                ((looking-at todo-done-string-start)
                 (todo-update-count 'done 1 cat))
@@ -5125,6 +5182,11 @@
     (if (not (and (file-exists-p file)
                  (find-file-other-window file)))
        (message "Unable to locate this diary entry")
+      ;; If it's a Todo file, make sure it's in Todo mode.
+      (when (and (equal (file-name-directory (file-truename file))
+                       (file-truename todo-directory))
+                (not (derived-mode-p 'todo-mode)))
+       (todo-mode))
       (when (eq major-mode 'todo-mode) (widen))
       (goto-char (point-min))
       (when (re-search-forward (format "%s.*\\(%s\\)" date content) nil t)
@@ -5564,6 +5626,9 @@
        (add-to-list 'files curfile))
       (dolist (f files listall)
        (with-current-buffer (find-file-noselect f 'nowarn)
+         (if archive
+             (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
+           (unless (derived-mode-p 'todo-mode) (todo-mode)))
          ;; Ensure category is properly displayed in case user
          ;; switches to file via a non-Todo mode command.  And if
          ;; done items in category are visible, keep them visible.
@@ -5616,7 +5681,7 @@
                                  ""))))
     (unless (file-exists-p todo-directory)
       (make-directory todo-directory))
-    (unless mustmatch
+    (unless (or mustmatch (member file files))
       (setq file (todo-validate-name file 'file)))
     (setq file (file-truename (concat todo-directory file
                                      (if archive ".toda" ".todo"))))))
@@ -5649,6 +5714,7 @@
           (categories (cond (file0
                              (with-current-buffer
                                  (find-file-noselect file0 'nowarn)
+                               (unless (derived-mode-p 'todo-mode) (todo-mode))
                                (let ((todo-current-todo-file file0))
                                  todo-categories)))
                             ((and add (not file))
@@ -5915,8 +5981,9 @@
 
 (defun todo-reset-nondiary-marker (symbol value)
   "The :set function for user option `todo-nondiary-marker'."
-  (let ((oldvalue (symbol-value symbol))
-       (files (append todo-files todo-archives)))
+  (let* ((oldvalue (symbol-value symbol))
+        (files (append todo-files todo-archives
+                       (directory-files todo-directory t "\.tod[rty]$" t))))
     (custom-set-default symbol value)
     ;; Need to reset these to get font-locking right.
     (setq todo-nondiary-start (nth 0 todo-nondiary-marker)
@@ -5927,23 +5994,28 @@
                  (regexp-quote diary-nonmarking-symbol) "\\)?"))
     (when (not (equal value oldvalue))
       (dolist (f files)
-       (with-current-buffer (find-file-noselect f)
-         (let (buffer-read-only)
-           (widen)
-           (goto-char (point-min))
-           (while (not (eobp))
-             (if (re-search-forward
-                  (concat "^\\(" todo-done-string-start "[^][]+] \\)?"
-                          "\\(?1:" (regexp-quote (car oldvalue))
-                          "\\)" todo-date-pattern "\\( "
-                          diary-time-regexp "\\)?\\(?2:"
-                          (regexp-quote (cadr oldvalue)) "\\)")
-                  nil t)
-                 (progn
-                   (replace-match (nth 0 value) t t nil 1)
-                   (replace-match (nth 1 value) t t nil 2))
-               (forward-line)))
-           (todo-category-select)))))))
+       (let ((buf (find-buffer-visiting f)))
+         (with-current-buffer (find-file-noselect f)
+           (let (buffer-read-only)
+             (widen)
+             (goto-char (point-min))
+             (while (not (eobp))
+               (if (re-search-forward
+                    (concat "^\\(" todo-done-string-start "[^][]+] \\)?"
+                            "\\(?1:" (regexp-quote (car oldvalue))
+                            "\\)" todo-date-pattern "\\( "
+                            diary-time-regexp "\\)?\\(?2:"
+                            (regexp-quote (cadr oldvalue)) "\\)")
+                    nil t)
+                   (progn
+                     (replace-match (nth 0 value) t t nil 1)
+                     (replace-match (nth 1 value) t t nil 2))
+                 (forward-line)))
+             (if buf
+                 (when (derived-mode-p 'todo-mode 'todo-archive-mode)
+                   (todo-category-select))
+               (save-buffer)
+               (kill-buffer)))))))))
 
 (defun todo-reset-done-separator-string (symbol value)
   "The :set function for `todo-done-separator-string'."
@@ -5963,51 +6035,63 @@
 (defun todo-reset-done-string (symbol value)
   "The :set function for user option `todo-done-string'."
   (let ((oldvalue (symbol-value symbol))
-       (files (append todo-files todo-archives)))
+       (files (append todo-files todo-archives
+                      (directory-files todo-directory t "\.todr$" t))))
     (custom-set-default symbol value)
     ;; Need to reset this to get font-locking right.
     (setq todo-done-string-start
          (concat "^\\[" (regexp-quote todo-done-string)))
     (when (not (equal value oldvalue))
       (dolist (f files)
-       (with-current-buffer (find-file-noselect f)
-         (let (buffer-read-only)
-           (widen)
-           (goto-char (point-min))
-           (while (not (eobp))
-             (if (re-search-forward
-                  (concat "^" (regexp-quote todo-nondiary-start)
-                          "\\(" (regexp-quote oldvalue) "\\)")
-                  nil t)
-                 (replace-match value t t nil 1)
-               (forward-line)))
-           (todo-category-select)))))))
+       (let ((buf (find-buffer-visiting f)))
+         (with-current-buffer (find-file-noselect f)
+           (let (buffer-read-only)
+             (widen)
+             (goto-char (point-min))
+             (while (not (eobp))
+               (if (re-search-forward
+                    (concat "^" (regexp-quote todo-nondiary-start)
+                            "\\(" (regexp-quote oldvalue) "\\)")
+                    nil t)
+                   (replace-match value t t nil 1)
+                 (forward-line)))
+             (if buf
+                 (when (derived-mode-p 'todo-mode 'todo-archive-mode)
+                   (todo-category-select))
+               (save-buffer)
+               (kill-buffer)))))))))
 
 (defun todo-reset-comment-string (symbol value)
   "The :set function for user option `todo-comment-string'."
   (let ((oldvalue (symbol-value symbol))
-       (files (append todo-files todo-archives)))
+       (files (append todo-files todo-archives
+                      (directory-files todo-directory t "\.todr$" t))))
     (custom-set-default symbol value)
     (when (not (equal value oldvalue))
       (dolist (f files)
-       (with-current-buffer (find-file-noselect f)
-         (let (buffer-read-only)
-           (save-excursion
+       (let ((buf (find-buffer-visiting f)))
+         (with-current-buffer (find-file-noselect f)
+           (let (buffer-read-only)
              (widen)
              (goto-char (point-min))
              (while (not (eobp))
                (if (re-search-forward
-                    (concat
-                            "\\[\\(" (regexp-quote oldvalue) "\\): [^]]*\\]")
+                    (concat "\\[\\(" (regexp-quote oldvalue)
+                            "\\): [^]]*\\]")
                     nil t)
                    (replace-match value t t nil 1)
                  (forward-line)))
-             (todo-category-select))))))))
+             (if buf
+                 (when (derived-mode-p 'todo-mode 'todo-archive-mode)
+                   (todo-category-select))
+               (save-buffer)
+               (kill-buffer)))))))))
 
 (defun todo-reset-highlight-item (symbol value)
-  "The :set function for `todo-toggle-item-highlighting'."
+  "The :set function for user option `todo-highlight-item'."
   (let ((oldvalue (symbol-value symbol))
-       (files (append todo-files todo-archives)))
+       (files (append todo-files todo-archives
+                      (directory-files todo-directory t "\.tod[rty]$" t))))
     (custom-set-default symbol value)
     (when (not (equal value oldvalue))
       (dolist (f files)
@@ -6399,20 +6483,20 @@
 `todo-show-current-file' is set to non-nil."
   (setq todo-global-current-todo-file todo-current-todo-file))
 
-(defun todo-display-as-todo-file ()
-  "Show todo files correctly when visited from outside of Todo mode.
-Added to `find-file-hook' in Todo mode and Todo Archive mode."
-  (and (member this-command todo-visit-files-commands)
-       (= (- (point-max) (point-min)) (buffer-size))
-       (member major-mode '(todo-mode todo-archive-mode))
-       (todo-category-select)))
+;; (defun todo-display-as-todo-file ()
+;;   "Show todo files correctly when visited from outside of Todo mode.
+;; Added to `find-file-hook' in Todo mode and Todo Archive mode."
+;;   (and (member this-command todo-visit-files-commands)
+;;        (= (- (point-max) (point-min)) (buffer-size))
+;;        (member major-mode '(todo-mode todo-archive-mode))
+;;        (todo-category-select)))
 
-(defun todo-add-to-buffer-list ()
-  "Add name of just visited todo file to `todo-file-buffers'.
-This function is added to `find-file-hook' in Todo mode."
-  (let ((filename (file-truename (buffer-file-name))))
-    (when (member filename todo-files)
-      (add-to-list 'todo-file-buffers filename))))
+;; (defun todo-add-to-buffer-list ()
+;;   "Add name of just visited todo file to `todo-file-buffers'.
+;; This function is added to `find-file-hook' in Todo mode."
+;;   (let ((filename (file-truename (buffer-file-name))))
+;;     (when (member filename todo-files)
+;;       (add-to-list 'todo-file-buffers filename))))
 
 (defun todo-update-buffer-list ()
   "Make current Todo mode buffer file car of `todo-file-buffers'.
@@ -6467,7 +6551,8 @@
   "Make some settings that apply to multiple Todo modes."
   (setq-local todo-categories (todo-set-categories))
   (setq-local todo-category-number 1)
-  (add-hook 'find-file-hook 'todo-display-as-todo-file nil t))
+  ;; (add-hook 'find-file-hook 'todo-display-as-todo-file nil t)
+  )
 
 (put 'todo-mode 'mode-class 'special)
 
@@ -6486,7 +6571,7 @@
     (setq-local todo-current-todo-file (file-truename (buffer-file-name))))
   (setq-local todo-show-done-only nil)
   (setq-local todo-categories-with-marks nil)
-  (add-hook 'find-file-hook 'todo-add-to-buffer-list nil t)
+  ;; (add-hook 'find-file-hook 'todo-add-to-buffer-list nil t)
   (add-hook 'post-command-hook 'todo-update-buffer-list nil t)
   (when todo-show-current-file
     (add-hook 'pre-command-hook 'todo-show-current-file nil t))
@@ -6555,13 +6640,6 @@
   (todo-modes-set-1)
   (todo-modes-set-2))
 
-;;;###autoload
-(add-to-list 'auto-mode-alist '("\\.todo\\'" . todo-mode))
-;;;###autoload
-(add-to-list 'auto-mode-alist '("\\.toda\\'" . todo-archive-mode))
-;;;###autoload
-(add-to-list 'auto-mode-alist '("\\.tod[tyr]\\'" . todo-filtered-items-mode))
-
 ;; 
-----------------------------------------------------------------------------
 (provide 'todo-mode)
 

=== modified file 'lisp/cus-face.el'
--- a/lisp/cus-face.el  2014-01-01 07:43:34 +0000
+++ b/lisp/cus-face.el  2014-05-25 11:47:34 +0000
@@ -218,6 +218,10 @@
      (color :tag "Foreground"
            :help-echo "Set foreground color (name or #RRGGBB hex spec)."))
 
+    (:distant-foreground
+     (color :tag "Distant Foreground"
+           :help-echo "Set distant foreground color (name or #RRGGBB hex 
spec)."))
+
     (:background
      (color :tag "Background"
            :help-echo "Set background color (name or #RRGGBB hex spec)."))

=== modified file 'lisp/emacs-lisp/eieio-opt.el'
--- a/lisp/emacs-lisp/eieio-opt.el      2014-01-30 04:13:00 +0000
+++ b/lisp/emacs-lisp/eieio-opt.el      2014-05-14 20:41:53 +0000
@@ -141,7 +141,7 @@
              (insert " " (aref type counter) " "
                      (prin1-to-string (car cur) (current-buffer))
                      "\n"
-                     (cdr cur)))
+                     (or (cdr cur) "")))
            (setq counter (1+ counter))))
        (insert "\n\n")
        (setq methods (cdr methods))))))

=== modified file 'lisp/emacs-lisp/lisp.el'
--- a/lisp/emacs-lisp/lisp.el   2014-04-09 16:58:08 +0000
+++ b/lisp/emacs-lisp/lisp.el   2014-05-26 02:28:09 +0000
@@ -431,16 +431,18 @@
       (push-mark))
   (if (or (null arg) (= arg 0)) (setq arg 1))
   (let ((pos (point))
-        (beg (progn (end-of-line 1) (beginning-of-defun-raw 1) (point))))
+        (beg (progn (end-of-line 1) (beginning-of-defun-raw 1) (point)))
+       (skip (lambda ()
+               ;; When comparing point against pos, we want to consider that if
+               ;; point was right after the end of the function, it's still
+               ;; considered as "in that function".
+               ;; E.g. `eval-defun' from right after the last close-paren.
+               (unless (bolp)
+                 (skip-chars-forward " \t")
+                 (if (looking-at "\\s<\\|\n")
+                     (forward-line 1))))))
     (funcall end-of-defun-function)
-    ;; When comparing point against pos, we want to consider that if
-    ;; point was right after the end of the function, it's still
-    ;; considered as "in that function".
-    ;; E.g. `eval-defun' from right after the last close-paren.
-    (unless (bolp)
-      (skip-chars-forward " \t")
-      (if (looking-at "\\s<\\|\n")
-          (forward-line 1)))
+    (funcall skip)
     (cond
      ((> arg 0)
       ;; Moving forward.
@@ -463,11 +465,19 @@
         (goto-char beg))
       (unless (zerop arg)
         (beginning-of-defun-raw (- arg))
+       (setq beg (point))
         (funcall end-of-defun-function))))
-    (unless (bolp)
-      (skip-chars-forward " \t")
-      (if (looking-at "\\s<\\|\n")
-          (forward-line 1)))))
+    (funcall skip)
+    (while (and (< arg 0) (>= (point) pos))
+      ;; We intended to move backward, but this ended up not doing so:
+      ;; Try harder!
+      (goto-char beg)
+      (beginning-of-defun-raw (- arg))
+      (if (>= (point) beg)
+         (setq arg 0)
+       (setq beg (point))
+        (funcall end-of-defun-function)
+       (funcall skip)))))
 
 (defun mark-defun (&optional allow-extend)
   "Put mark at end of this defun, point at beginning.

=== modified file 'lisp/emacs-lisp/nadvice.el'
--- a/lisp/emacs-lisp/nadvice.el        2014-05-24 19:51:52 +0000
+++ b/lisp/emacs-lisp/nadvice.el        2014-05-26 02:28:09 +0000
@@ -180,12 +180,16 @@
         (advice--make-1 (nth 1 desc) (nth 2 desc)
                         function main props)))))
 
-(defun advice--member-p (function name definition)
+(defun advice--member-p (function use-name definition)
   (let ((found nil))
     (while (and (not found) (advice--p definition))
-      (if (if name
-              (equal name (cdr (assq 'name (advice--props definition))))
-            (equal function (advice--car definition)))
+      (if (if (eq use-name :use-both)
+             (or (equal function
+                        (cdr (assq 'name (advice--props definition))))
+                 (equal function (advice--car definition)))
+           (equal function (if use-name
+                               (cdr (assq 'name (advice--props definition)))
+                             (advice--car definition))))
           (setq found definition)
         (setq definition (advice--cdr definition))))
     found))
@@ -292,7 +296,7 @@
 ;;;###autoload
 (defun advice--add-function (where ref function props)
   (let* ((name (cdr (assq 'name props)))
-         (a (advice--member-p function name (gv-deref ref))))
+         (a (advice--member-p (or name function) (if name t) (gv-deref ref))))
     (when a
       ;; The advice is already present.  Remove the old one, first.
       (setf (gv-deref ref)
@@ -324,7 +328,7 @@
   "Return non-nil if ADVICE is already in FUNCTION-DEF.
 Instead of ADVICE being the actual function, it can also be the `name'
 of the piece of advice."
-  (advice--member-p advice advice function-def))
+  (advice--member-p advice :use-both function-def))
 
 ;;;; Specific application of add-function to `symbol-function' for advice.
 

=== modified file 'lisp/emacs-lisp/package.el'
--- a/lisp/emacs-lisp/package.el        2014-05-25 16:53:28 +0000
+++ b/lisp/emacs-lisp/package.el        2014-05-26 02:28:09 +0000
@@ -1266,10 +1266,7 @@
       ;; may fetch a URL redirect page).
       (when (listp (read (current-buffer)))
        (make-directory dir t)
-       (setq buffer-file-name (expand-file-name file dir))
-       (let ((version-control 'never)
-              (require-final-newline nil))
-         (save-buffer))))
+        (write-region nil nil (expand-file-name file dir) nil 'silent)))
     (when good-signatures
       ;; Write out good signatures into archive-contents.signed file.
       (write-region (mapconcat #'epg-signature-to-string good-signatures "\n")
@@ -1515,11 +1512,13 @@
                      (package--with-work-buffer
                          (package-archive-base desc)
                          (format "%s-readme.txt" name)
-                       (setq buffer-file-name
-                             (expand-file-name readme package-user-dir))
-                       (let ((version-control 'never)
-                             (require-final-newline t))
-                         (save-buffer))
+                       (save-excursion
+                         (goto-char (point-max))
+                         (unless (bolp)
+                           (insert ?\n)))
+                       (write-region nil nil
+                                     (expand-file-name readme package-user-dir)
+                                     nil 'silent)
                        (setq readme-string (buffer-string))
                        t))
                 (error nil))

=== modified file 'lisp/emacs-lisp/timer.el'
--- a/lisp/emacs-lisp/timer.el  2014-02-10 01:34:22 +0000
+++ b/lisp/emacs-lisp/timer.el  2014-05-18 13:17:10 +0000
@@ -290,42 +290,50 @@
           (cell
            ;; Delete from queue.  Record the cons cell that was used.
            (cancel-timer-internal timer)))
-      ;; Re-schedule if requested.
-      (if (timer--repeat-delay timer)
-          (if (timer--idle-delay timer)
-              (timer-activate-when-idle timer nil cell)
-            (timer-inc-time timer (timer--repeat-delay timer) 0)
-            ;; If real time has jumped forward,
-            ;; perhaps because Emacs was suspended for a long time,
-            ;; limit how many times things get repeated.
-            (if (and (numberp timer-max-repeats)
-                     (< 0 (timer-until timer (current-time))))
-                (let ((repeats (/ (timer-until timer (current-time))
-                                  (timer--repeat-delay timer))))
-                  (if (> repeats timer-max-repeats)
-                      (timer-inc-time timer (* (timer--repeat-delay timer)
-                                               repeats)))))
-            ;; Place it back on the timer-list before running
-            ;; timer--function, so it can cancel-timer itself.
-            (timer-activate timer t cell)
-            (setq retrigger t)))
-      ;; Run handler.
-      (condition-case-unless-debug err
-          ;; Timer functions should not change the current buffer.
-          ;; If they do, all kinds of nasty surprises can happen,
-          ;; and it can be hellish to track down their source.
-          (save-current-buffer
-            (apply (timer--function timer) (timer--args timer)))
-        (error (message "Error running timer%s: %S"
-                        (if (symbolp (timer--function timer))
-                            (format " `%s'" (timer--function timer)) "")
-                        err)))
-      (when (and retrigger
-                 ;; If the timer's been canceled, don't "retrigger" it
-                 ;; since it might still be in the copy of timer-list kept
-                 ;; by keyboard.c:timer_check (bug#14156).
-                 (memq timer timer-list))
-        (setf (timer--triggered timer) nil)))))
+      ;; If `cell' is nil, it means the timer was already canceled, so we
+      ;; shouldn't be running it at all.  This can happen for example with the
+      ;; following scenario (bug#17392):
+      ;; - we run timers, starting with A (and remembering the rest as (B C)).
+      ;; - A runs and a does a sit-for.
+      ;; - during sit-for we run timer D which cancels timer B.
+      ;; - timer A finally finishes, so we move on to timers B and C.
+      (when cell
+        ;; Re-schedule if requested.
+        (if (timer--repeat-delay timer)
+            (if (timer--idle-delay timer)
+                (timer-activate-when-idle timer nil cell)
+              (timer-inc-time timer (timer--repeat-delay timer) 0)
+              ;; If real time has jumped forward,
+              ;; perhaps because Emacs was suspended for a long time,
+              ;; limit how many times things get repeated.
+              (if (and (numberp timer-max-repeats)
+                       (< 0 (timer-until timer (current-time))))
+                  (let ((repeats (/ (timer-until timer (current-time))
+                                    (timer--repeat-delay timer))))
+                    (if (> repeats timer-max-repeats)
+                        (timer-inc-time timer (* (timer--repeat-delay timer)
+                                                 repeats)))))
+              ;; Place it back on the timer-list before running
+              ;; timer--function, so it can cancel-timer itself.
+              (timer-activate timer t cell)
+              (setq retrigger t)))
+        ;; Run handler.
+        (condition-case-unless-debug err
+            ;; Timer functions should not change the current buffer.
+            ;; If they do, all kinds of nasty surprises can happen,
+            ;; and it can be hellish to track down their source.
+            (save-current-buffer
+              (apply (timer--function timer) (timer--args timer)))
+          (error (message "Error running timer%s: %S"
+                          (if (symbolp (timer--function timer))
+                              (format " `%s'" (timer--function timer)) "")
+                          err)))
+        (when (and retrigger
+                   ;; If the timer's been canceled, don't "retrigger" it
+                   ;; since it might still be in the copy of timer-list kept
+                   ;; by keyboard.c:timer_check (bug#14156).
+                   (memq timer timer-list))
+          (setf (timer--triggered timer) nil))))))
 
 ;; This function is incompatible with the one in levents.el.
 (defun timeout-event-p (event)

=== modified file 'lisp/frame.el'
--- a/lisp/frame.el     2014-04-13 07:49:23 +0000
+++ b/lisp/frame.el     2014-05-21 16:35:31 +0000
@@ -1107,10 +1107,10 @@
 
 If FRAMES is nil, apply the font to the selected frame only.
 If FRAMES is non-nil, it should be a list of frames to act upon,
-or t meaning all graphical frames.  Also, if FRAME is non-nil,
-alter the user's Customization settings as though the
-font-related attributes of the `default' face had been \"set in
-this session\", so that the font is applied to future frames."
+or t meaning all existing graphical frames.
+Also, if FRAMES is non-nil, alter the user's Customization settings
+as though the font-related attributes of the `default' face had been
+\"set in this session\", so that the font is applied to future frames."
   (interactive
    (let* ((completion-ignore-case t)
          (font (completing-read "Font name: "
@@ -1822,9 +1822,7 @@
   :initialize 'custom-initialize-delay
   :group 'cursor
   :global t
-  (if blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer))
-  (setq blink-cursor-idle-timer nil)
-  (blink-cursor-end)
+  (blink-cursor-suspend)
   (remove-hook 'focus-in-hook #'blink-cursor-check)
   (remove-hook 'focus-out-hook #'blink-cursor-suspend)
   (when blink-cursor-mode

=== modified file 'lisp/hippie-exp.el'
--- a/lisp/hippie-exp.el        2014-02-10 01:34:22 +0000
+++ b/lisp/hippie-exp.el        2014-05-23 18:14:24 +0000
@@ -715,7 +715,7 @@
 
 (defun he-line-search-regexp (pat strip-prompt)
   (if strip-prompt
-      (concat "\\(" comint-prompt-regexp "\\|^\\s-*\\)\\("
+      (concat "\\(" comint-prompt-regexp "\\|^\\s-*\\)\\(?2:"
              (regexp-quote pat)
              "[^\n]*[^ \t\n]\\)")
       (concat "^\\(\\s-*\\)\\("

=== modified file 'lisp/menu-bar.el'
--- a/lisp/menu-bar.el  2014-05-01 23:55:25 +0000
+++ b/lisp/menu-bar.el  2014-05-21 16:35:31 +0000
@@ -662,7 +662,7 @@
 ;; Function for setting/saving default font.
 
 (defun menu-set-font ()
-  "Interactively select a font and make it the default."
+  "Interactively select a font and make it the default on all existing frames."
   (interactive)
   (set-frame-font (if (fboundp 'x-select-font)
                      (x-select-font)

=== modified file 'lisp/minibuffer.el'
--- a/lisp/minibuffer.el        2014-05-23 15:54:44 +0000
+++ b/lisp/minibuffer.el        2014-05-26 02:28:09 +0000
@@ -529,7 +529,7 @@
       (let* ((qpos pred)
             (ustring (funcall unquote string))
             (uprefix (funcall unquote (substring string 0 qpos)))
-            ;; FIXME: we really should pass `qpos' to `unuote' and have that
+            ;; FIXME: we really should pass `qpos' to `unquote' and have that
             ;; function give us the corresponding `uqpos'.  But for now we
             ;; presume (more or less) that `concat' and `unquote' commute.
             (uqpos (if (string-prefix-p uprefix ustring)

=== modified file 'lisp/mouse.el'
--- a/lisp/mouse.el     2014-05-11 05:49:14 +0000
+++ b/lisp/mouse.el     2014-05-26 02:28:09 +0000
@@ -26,8 +26,6 @@
 ;; This package provides various useful commands (including help
 ;; system access) through the mouse.  All this code assumes that mouse
 ;; interpretation has been abstracted into Emacs input events.
-;;
-;; The code is rather X-dependent.
 
 ;;; Code:
 

=== modified file 'lisp/net/dbus.el'
--- a/lisp/net/dbus.el  2014-02-27 15:41:13 +0000
+++ b/lisp/net/dbus.el  2014-05-16 13:11:09 +0000
@@ -277,6 +277,8 @@
 
   => \"i686\""
 
+  (or (featurep 'dbusbind)
+      (signal 'dbus-error (list "Emacs not compiled with dbus support")))
   (or (memq bus '(:system :session)) (stringp bus)
       (signal 'wrong-type-argument (list 'keywordp bus)))
   (or (stringp service)
@@ -380,6 +382,8 @@
 
   -| i686"
 
+  (or (featurep 'dbusbind)
+      (signal 'dbus-error (list "Emacs not compiled with dbus support")))
   (or (memq bus '(:system :session)) (stringp bus)
       (signal 'wrong-type-argument (list 'keywordp bus)))
   (or (stringp service)
@@ -428,6 +432,8 @@
   :session nil \"/org/gnu/Emacs\" \"org.gnu.Emacs.FileManager\"
   \"FileModified\" \"/home/albinus/.emacs\")"
 
+  (or (featurep 'dbusbind)
+      (signal 'dbus-error (list "Emacs not compiled with dbus support")))
   (or (memq bus '(:system :session)) (stringp bus)
       (signal 'wrong-type-argument (list 'keywordp bus)))
   (or (null service) (stringp service)
@@ -446,6 +452,8 @@
   "Return for message SERIAL on the D-Bus BUS.
 This is an internal function, it shall not be used outside dbus.el."
 
+  (or (featurep 'dbusbind)
+      (signal 'dbus-error (list "Emacs not compiled with dbus support")))
   (or (memq bus '(:system :session)) (stringp bus)
       (signal 'wrong-type-argument (list 'keywordp bus)))
   (or (stringp service)
@@ -460,6 +468,8 @@
   "Return error message for message SERIAL on the D-Bus BUS.
 This is an internal function, it shall not be used outside dbus.el."
 
+  (or (featurep 'dbusbind)
+      (signal 'dbus-error (list "Emacs not compiled with dbus support")))
   (or (memq bus '(:system :session)) (stringp bus)
       (signal 'wrong-type-argument (list 'keywordp bus)))
   (or (stringp service)
@@ -1763,6 +1773,8 @@
 GTK+.  It should be used with care for at least the `:system' and
 `:session' buses, because other Emacs Lisp packages might already use
 this connection to those buses."
+  (or (featurep 'dbusbind)
+      (signal 'dbus-error (list "Emacs not compiled with dbus support")))
   (dbus--init-bus bus private)
   (dbus-register-signal
    bus nil dbus-path-local dbus-interface-local

=== modified file 'lisp/net/tramp-sh.el'
--- a/lisp/net/tramp-sh.el      2014-05-06 09:51:05 +0000
+++ b/lisp/net/tramp-sh.el      2014-05-17 09:00:54 +0000
@@ -4137,7 +4137,7 @@
                          tmpfile)
                      (while (string-match (regexp-quote "-") name)
                        (setq name (replace-match "_" nil t name)))
-                     (when (string-match "%t" value)
+                     (when (string-match "\\(^\\|[^%]\\)%t" value)
                        (setq tmpfile
                              (make-temp-name
                               (expand-file-name

=== modified file 'lisp/nxml/nxml-mode.el'
--- a/lisp/nxml/nxml-mode.el    2014-04-16 15:28:26 +0000
+++ b/lisp/nxml/nxml-mode.el    2014-05-21 20:07:27 +0000
@@ -2630,8 +2630,9 @@
 (put 'entity-ref 'nxml-friendly-name "entity reference")
 (put 'char-ref 'nxml-friendly-name "character reference")
 
-;;;###autoload
-(defalias 'xml-mode 'nxml-mode)
+;; Only do this in loaddefs, so that if someone defines a different
+;; alias in .emacs, loading this file afterwards does not clobber it.
+;;;###autoload(defalias 'xml-mode 'nxml-mode)
 
 (provide 'nxml-mode)
 

=== modified file 'lisp/progmodes/scheme.el'
--- a/lisp/progmodes/scheme.el  2014-04-24 22:37:28 +0000
+++ b/lisp/progmodes/scheme.el  2014-05-26 02:28:09 +0000
@@ -99,7 +99,7 @@
     (modify-syntax-entry ?\( "()  " st)
     (modify-syntax-entry ?\) ")(  " st)
     ;; It's used for single-line comments as well as for #;(...) sexp-comments.
-    (modify-syntax-entry ?\; "< 2 " st)
+    (modify-syntax-entry ?\; "<"    st)
     (modify-syntax-entry ?\" "\"   " st)
     (modify-syntax-entry ?' "'   " st)
     (modify-syntax-entry ?` "'   " st)
@@ -147,19 +147,15 @@
   (setq-local lisp-indent-function 'scheme-indent-function)
   (setq mode-line-process '("" scheme-mode-line-process))
   (setq-local imenu-case-fold-search t)
-  (setq imenu-generic-expression scheme-imenu-generic-expression)
-  (setq-local imenu-syntax-alist
-       '(("+-*/.<>=?!$%_&~^:" . "w")))
+  (setq-local imenu-generic-expression scheme-imenu-generic-expression)
+  (setq-local imenu-syntax-alist '(("+-*/.<>=?!$%_&~^:" . "w")))
+  (setq-local syntax-propertize-function #'scheme-syntax-propertize)
   (setq font-lock-defaults
        '((scheme-font-lock-keywords
           scheme-font-lock-keywords-1 scheme-font-lock-keywords-2)
          nil t (("+-*/.<>=!?$%_&~^:" . "w") (?#. "w 14"))
          beginning-of-defun
-         (font-lock-mark-block-function . mark-defun)
-         (font-lock-syntactic-face-function
-          . scheme-font-lock-syntactic-face-function)
-         (parse-sexp-lookup-properties . t)
-         (font-lock-extra-managed-props syntax-table)))
+         (font-lock-mark-block-function . mark-defun)))
   (setq-local lisp-doc-string-elt-property 'scheme-doc-string-elt))
 
 (defvar scheme-mode-line-process "")
@@ -354,28 +350,28 @@
        (forward-comment (point-max))
        (if (eq (char-after) ?\() 2 0)))
 
-(defun scheme-font-lock-syntactic-face-function (state)
-  (when (and (null (nth 3 state))
-             (eq (char-after (nth 8 state)) ?#)
-             (eq (char-after (1+ (nth 8 state))) ?\;))
-    ;; It's a sexp-comment.  Tell parse-partial-sexp where it ends.
-    (save-excursion
-      (let ((pos (point))
-            (end
-             (condition-case err
-                 (let ((parse-sexp-lookup-properties nil))
-                   (goto-char (+ 2 (nth 8 state)))
-                   ;; FIXME: this doesn't handle the case where the sexp
-                   ;; itself contains a #; comment.
-                   (forward-sexp 1)
-                   (point))
-               (scan-error (nth 2 err)))))
-        (when (< pos (- end 2))
-          (put-text-property pos (- end 2)
-                             'syntax-table scheme-sexp-comment-syntax-table))
-        (put-text-property (- end 1) end 'syntax-table '(12)))))
-  ;; Choose the face to use.
-  (lisp-font-lock-syntactic-face-function state))
+(defun scheme-syntax-propertize (beg end)
+  (goto-char beg)
+  (scheme-syntax-propertize-sexp-comment (point) end)
+  (funcall
+   (syntax-propertize-rules
+    ("\\(#\\);" (1 (prog1 "< cn"
+                     (scheme-syntax-propertize-sexp-comment (point) end)))))
+   (point) end))
+
+(defun scheme-syntax-propertize-sexp-comment (_ end)
+  (let ((state (syntax-ppss)))
+    (when (eq 2 (nth 7 state))
+      ;; It's a sexp-comment.  Tell parse-partial-sexp where it ends.
+      (condition-case nil
+          (progn
+            (goto-char (+ 2 (nth 8 state)))
+            ;; FIXME: this doesn't handle the case where the sexp
+            ;; itself contains a #; comment.
+            (forward-sexp 1)
+            (put-text-property (1- (point)) (point)
+                               'syntax-table (string-to-syntax "> cn")))
+        (scan-error (goto-char end))))))
 
 ;;;###autoload
 (define-derived-mode dsssl-mode scheme-mode "DSSSL"

=== modified file 'lisp/simple.el'
--- a/lisp/simple.el    2014-05-13 20:34:12 +0000
+++ b/lisp/simple.el    2014-05-26 02:28:09 +0000
@@ -5069,7 +5069,15 @@
 `most-positive-fixnum'.")
 
 (defcustom line-move-ignore-invisible t
-  "Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines.
+  "Non-nil means commands that move by lines ignore invisible newlines.
+When this option is non-nil, \\[next-line], \\[previous-line], 
\\[move-end-of-line], and \\[move-beginning-of-line] behave
+as if newlines that are invisible didn't exist, and count
+only visible newlines.  Thus, moving across across 2 newlines
+one of which is invisible will be counted as a one-line move.
+Also, a non-nil value causes invisible text to be ignored when
+counting columns for the purposes of keeping point in the same
+column by \\[next-line] and \\[previous-line].
+
 Outline mode sets this."
   :type 'boolean
   :group 'editing-basics)

=== modified file 'lisp/vc/vc-rcs.el'
--- a/lisp/vc/vc-rcs.el 2014-01-01 07:43:34 +0000
+++ b/lisp/vc/vc-rcs.el 2014-05-20 15:46:21 +0000
@@ -886,10 +886,9 @@
          (minor-num (string-to-number (vc-rcs-minor-part rev))))
       (concat branch "." (number-to-string (1+ minor-num))))))
 
-;; Note that most GNU/Linux distributions seem to supply rcs2log in a
-;; standard bin directory.  Eg both Red Hat and Debian include it in
-;; their cvs packages.  It's not obvious why Emacs still needs to
-;; provide it as well...
+;; You might think that this should be distributed with RCS, but
+;; apparently not.  CVS sometimes provides a version of it.
+;; http://lists.gnu.org/archive/html/emacs-devel/2014-05/msg00288.html
 (defvar vc-rcs-rcs2log-program
   (let (exe)
     (cond ((file-executable-p

=== modified file 'lisp/window.el'
--- a/lisp/window.el    2014-03-16 09:26:58 +0000
+++ b/lisp/window.el    2014-05-25 10:06:35 +0000
@@ -1079,7 +1079,6 @@
 selected frame.  When WINDOW-OR-FRAME is a window, dump that
 window's frame.  The buffer *window-frame-dump* is erased before
 dumping to it."
-  (interactive)
   (let* ((window
          (cond
           ((or (not window-or-frame)
@@ -1102,7 +1101,9 @@
               (frame-text-width frame) (frame-text-height frame)
               (frame-text-cols frame) (frame-text-lines frame))
        (format "tool: %s  scroll: %s  fringe: %s  border: %s  right: %s  
bottom: %s\n\n"
-              (tool-bar-height frame t)
+              (if (fboundp 'tool-bar-height)
+                  (tool-bar-height frame t)
+                "0")
               (frame-scroll-bar-width frame)
               (frame-fringe-width frame)
               (frame-border-width frame)

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-05-25 10:28:52 +0000
+++ b/src/ChangeLog     2014-05-26 02:28:09 +0000
@@ -1,3 +1,52 @@
+2014-05-26  Eli Zaretskii  <address@hidden>
+
+       * xdisp.c (move_it_in_display_line_to): Don't record wrap position
+       if we are iterating over an object that generates glyphs for
+       marginal areas.  (Bug#17585)
+
+2014-05-26  Paul Eggert  <address@hidden>
+
+       * xdisp.c (safe__call1, safe__eval): Now static.
+
+2014-05-26  Eli Zaretskii  <address@hidden>
+
+       * xdisp.c (safe__call): Accept va_list argument instead of '...'.
+       (safe_call, safe__call1): Construct a va_list argument for safe_call.
+       (safe_call1): Call safe_call instead of safe__call directly.
+
+2014-05-26  Ken Brown  <address@hidden>
+
+       * w32term.c (x_delete_display) [CYGWIN]: Don't free
+       dpyinfo->w32_id_name, to make sure it doesn't get freed more than
+       once.  (Bug#17510)
+
+2014-05-26  Stefan Monnier  <address@hidden>
+
+       * xdisp.c: Bind inhibit-quit during pre-redisplay-function.
+       (safe__call, safe__call1, safe__eval): New functions.
+       (safe_call): Use it.
+       (prepare_menu_bars): Use it for pre-redisplay-function (bug#17577).
+       (display_mode_element): Same for `:eval'.
+
+2014-05-26  Paul Eggert  <address@hidden>
+
+       Fix port to 32-bit AIX (Bug#17540).
+       * unexaix.c (copy_text_and_data): Don't add text_scnptr to ptr
+       twice.  _text already includes this offset.
+       (unrelocate_symbols): Don't cast 64-bit integer to pointer.
+
+2014-05-26  Eli Zaretskii  <address@hidden>
+
+       * xdisp.c (move_it_in_display_line_to): Avoid infinite recursion:
+       when closest_pos is identical to to_charpos, don't recurse, since
+       we already tried that, and failed.  (Bug#17539)
+
+       * w32fns.c (unwind_create_frame) [GLYPH_DEBUG]: If we are
+       unwinding when frame's faces were not initialized yet, increment
+       the frame's image-cache reference count before calling
+       x_free_frame_resources.  Don't dereference
+       dpyinfo->terminal->image_cache if it is NULL.  (Bug#17524)
+
 2014-05-25  Jan Djärv  <address@hidden>
 
        * nsfont.m (nsfont_draw): Simplify as arguments are adjusted in

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2014-05-22 16:40:35 +0000
+++ b/src/lisp.h        2014-05-26 02:28:09 +0000
@@ -1718,8 +1718,8 @@
      ratio, a float.  */
   Lisp_Object rehash_threshold;
 
-  /* Vector of hash codes.. If hash[I] is nil, this means that that
-     entry I is unused.  */
+  /* Vector of hash codes.  If hash[I] is nil, this means that the
+     I-th entry is unused.  */
   Lisp_Object hash;
 
   /* Vector used to chain entries.  If entry I is free, next[I] is the

=== modified file 'src/minibuf.c'
--- a/src/minibuf.c     2014-05-08 03:41:21 +0000
+++ b/src/minibuf.c     2014-05-26 02:28:09 +0000
@@ -396,7 +396,8 @@
      in previous recursive minibuffer, but was not set explicitly
      to t for this invocation, so set it to nil in this minibuffer.
      Save the old value now, before we change it.  */
-  specbind (intern ("minibuffer-completing-file-name"), 
Vminibuffer_completing_file_name);
+  specbind (intern ("minibuffer-completing-file-name"),
+           Vminibuffer_completing_file_name);
   if (EQ (Vminibuffer_completing_file_name, Qlambda))
     Vminibuffer_completing_file_name = Qnil;
 

=== modified file 'src/unexaix.c'
--- a/src/unexaix.c     2014-01-01 07:43:34 +0000
+++ b/src/unexaix.c     2014-05-22 05:00:39 +0000
@@ -379,7 +379,7 @@
   char *ptr;
 
   lseek (new, text_scnptr, SEEK_SET);
-  ptr = _text + text_scnptr;
+  ptr = _text;
   end = ptr + f_ohdr.tsize;
   write_segment (new, ptr, end);
 
@@ -606,7 +606,7 @@
              PERROR (a_name);
            }
 
-          p = (int *) (ldrel.l_vaddr + d_reloc);
+          p = (int *) (intptr_t) (ldrel.l_vaddr + d_reloc);
 
          switch (ldrel.l_symndx) {
          case SYMNDX_TEXT:

=== modified file 'src/w32fns.c'
--- a/src/w32fns.c      2014-05-08 03:41:21 +0000
+++ b/src/w32fns.c      2014-05-26 02:28:09 +0000
@@ -4244,6 +4244,17 @@
     {
 #ifdef GLYPH_DEBUG
       struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+
+      /* If the frame's image cache refcount is still the same as our
+        private shadow variable, it means we are unwinding a frame
+        for which we didn't yet call init_frame_faces, where the
+        refcount is incremented.  Therefore, we increment it here, so
+        that free_frame_faces, called in x_free_frame_resources
+        below, will not mistakenly decrement the counter that was not
+        incremented yet to account for this new frame.  */
+      if (FRAME_IMAGE_CACHE (f) != NULL
+         && FRAME_IMAGE_CACHE (f)->refcount == image_cache_refcount)
+       FRAME_IMAGE_CACHE (f)->refcount++;
 #endif
 
       x_free_frame_resources (f);
@@ -4254,7 +4265,8 @@
       eassert (dpyinfo->reference_count == dpyinfo_refcount);
       eassert ((dpyinfo->terminal->image_cache == NULL
                && image_cache_refcount == 0)
-              || dpyinfo->terminal->image_cache->refcount == 
image_cache_refcount);
+              || (dpyinfo->terminal->image_cache != NULL
+                  && dpyinfo->terminal->image_cache->refcount == 
image_cache_refcount));
 #endif
       return Qt;
     }

=== modified file 'src/w32term.c'
--- a/src/w32term.c     2014-05-14 13:55:37 +0000
+++ b/src/w32term.c     2014-05-26 02:28:09 +0000
@@ -6419,7 +6419,11 @@
     if (dpyinfo->palette)
       DeleteObject (dpyinfo->palette);
   }
+  /* Avoid freeing dpyinfo->w32_id_name more than once if emacs is
+     running as a daemon; see bug#17510. */
+#ifndef CYGWIN
   xfree (dpyinfo->w32_id_name);
+#endif
 
   w32_reset_fringes ();
 }

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2014-05-12 08:57:59 +0000
+++ b/src/xdisp.c       2014-05-26 02:28:09 +0000
@@ -2591,8 +2591,8 @@
    following.  Return the result, or nil if something went
    wrong.  Prevent redisplay during the evaluation.  */
 
-Lisp_Object
-safe_call (ptrdiff_t nargs, Lisp_Object func, ...)
+static Lisp_Object
+safe__call (bool inhibit_quit, ptrdiff_t nargs, Lisp_Object func, va_list ap)
 {
   Lisp_Object val;
 
@@ -2600,21 +2600,20 @@
     val = Qnil;
   else
     {
-      va_list ap;
       ptrdiff_t i;
       ptrdiff_t count = SPECPDL_INDEX ();
       struct gcpro gcpro1;
       Lisp_Object *args = alloca (nargs * word_size);
 
       args[0] = func;
-      va_start (ap, func);
       for (i = 1; i < nargs; i++)
        args[i] = va_arg (ap, Lisp_Object);
-      va_end (ap);
 
       GCPRO1 (args[0]);
       gcpro1.nvars = nargs;
       specbind (Qinhibit_redisplay, Qt);
+      if (inhibit_quit)
+       specbind (Qinhibit_quit, Qt);
       /* Use Qt to ensure debugger does not run,
         so there is no possibility of wanting to redisplay.  */
       val = internal_condition_case_n (Ffuncall, nargs, args, Qt,
@@ -2626,6 +2625,17 @@
   return val;
 }
 
+Lisp_Object
+safe_call (ptrdiff_t nargs, Lisp_Object func, ...)
+{
+  Lisp_Object retval;
+  va_list ap;
+
+  va_start (ap, func);
+  retval = safe__call (false, nargs, func, ap);
+  va_end (ap);
+  return retval;
+}
 
 /* Call function FN with one argument ARG.
    Return the result, or nil if something went wrong.  */
@@ -2636,12 +2646,30 @@
   return safe_call (2, fn, arg);
 }
 
+static Lisp_Object
+safe__call1 (bool inhibit_quit, Lisp_Object fn, ...)
+{
+  Lisp_Object retval;
+  va_list ap;
+
+  va_start (ap, fn);
+  retval = safe__call (inhibit_quit, 2, fn, ap);
+  va_end (ap);
+  return retval;
+}
+
 static Lisp_Object Qeval;
 
 Lisp_Object
 safe_eval (Lisp_Object sexpr)
 {
-  return safe_call1 (Qeval, sexpr);
+  return safe__call1 (false, Qeval, sexpr);
+}
+
+static Lisp_Object
+safe__eval (bool inhibit_quit, Lisp_Object sexpr)
+{
+  return safe__call1 (inhibit_quit, Qeval, sexpr);
 }
 
 /* Call function FN with two arguments ARG1 and ARG2.
@@ -8528,7 +8556,7 @@
        }
       else
        {
-         if (it->line_wrap == WORD_WRAP)
+         if (it->line_wrap == WORD_WRAP && it->area == TEXT_AREA)
            {
              if (IT_DISPLAYING_WHITESPACE (it))
                may_wrap = 1;
@@ -8812,8 +8840,11 @@
                  if (closest_pos < ZV)
                    {
                      RESTORE_IT (it, &ppos_it, ppos_data);
-                     move_it_in_display_line_to (it, closest_pos, -1,
-                                                 MOVE_TO_POS);
+                     /* Don't recurse if closest_pos is equal to
+                        to_charpos, since we have just tried that.  */
+                     if (closest_pos != to_charpos)
+                       move_it_in_display_line_to (it, closest_pos, -1,
+                                                   MOVE_TO_POS);
                      result = MOVE_POS_MATCH_OR_ZV;
                    }
                  else
@@ -8874,8 +8905,9 @@
                      && !at_eob_p && closest_pos < ZV)
                    {
                      RESTORE_IT (it, &ppos_it, ppos_data);
-                     move_it_in_display_line_to (it, closest_pos, -1,
-                                                 MOVE_TO_POS);
+                     if (closest_pos != to_charpos)
+                       move_it_in_display_line_to (it, closest_pos, -1,
+                                                   MOVE_TO_POS);
                    }
                  result = MOVE_POS_MATCH_OR_ZV;
                  break;
@@ -8893,7 +8925,9 @@
              if (closest_pos < ZV)
                {
                  RESTORE_IT (it, &ppos_it, ppos_data);
-                 move_it_in_display_line_to (it, closest_pos, -1, MOVE_TO_POS);
+                 if (closest_pos != to_charpos)
+                   move_it_in_display_line_to (it, closest_pos, -1,
+                                               MOVE_TO_POS);
                }
              result = MOVE_POS_MATCH_OR_ZV;
              break;
@@ -11543,7 +11577,7 @@
                }
            }
        }
-      safe_call1 (Vpre_redisplay_function, windows);
+      safe__call1 (true, Vpre_redisplay_function, windows);
     }
 
   /* Update all frame titles based on their buffer names, etc.  We do
@@ -21857,7 +21891,7 @@
            if (CONSP (XCDR (elt)))
              {
                Lisp_Object spec;
-               spec = safe_eval (XCAR (XCDR (elt)));
+               spec = safe__eval (true, XCAR (XCDR (elt)));
                n += display_mode_element (it, depth, field_width - n,
                                           precision - n, spec, props,
                                           risky);

=== modified file 'test/automated/advice-tests.el'
--- a/test/automated/advice-tests.el    2014-05-10 20:07:01 +0000
+++ b/test/automated/advice-tests.el    2014-05-23 16:17:14 +0000
@@ -184,6 +184,7 @@
         (sm-advice (lambda (x) (if (consp x) (list (* 5 (car x))) (* 4 x)))))
     (should (equal (funcall sm-test10 5) 15))
     (add-function :filter-args (var sm-test10) sm-advice)
+    (should (advice-function-member-p sm-advice sm-test10))
     (should (equal (funcall sm-test10 5) 35))
     (add-function :filter-return (var sm-test10) sm-advice)
     (should (equal (funcall sm-test10 5) 60))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]