aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2014-05-25 19:28:09 -0700
committerGlenn Morris2014-05-25 19:28:09 -0700
commit015936fba1bcaa51b7886a73144d4c088200c0aa (patch)
treec9628339352c1a97e574df28966e977143c43e41
parent5e26d9849a79bf78fda821979fc937f7e5e6df52 (diff)
parente8f2cc26e712f42f6391fa52cd67c3e791096f1e (diff)
downloademacs-015936fba1bcaa51b7886a73144d4c088200c0aa.tar.gz
emacs-015936fba1bcaa51b7886a73144d4c088200c0aa.zip
Merge from emacs-24; up to 2014-05-26T10:21:18Z!rgm@gnu.org
-rw-r--r--ChangeLog6
-rw-r--r--admin/ChangeLog5
-rw-r--r--configure.ac11
-rw-r--r--doc/emacs/ChangeLog6
-rw-r--r--doc/emacs/frames.texi11
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/display.texi18
-rw-r--r--doc/misc/ChangeLog13
-rw-r--r--doc/misc/htmlfontify.texi4
-rw-r--r--doc/misc/org.texi1
-rw-r--r--doc/misc/todo-mode.texi89
-rw-r--r--etc/ChangeLog5
-rw-r--r--etc/ETAGS.EBNF2
-rw-r--r--etc/NEWS2
-rw-r--r--etc/ORG-NEWS2
-rw-r--r--lib-src/ChangeLog10
-rwxr-xr-xlib-src/rcs2log59
-rw-r--r--lisp/ChangeLog142
-rw-r--r--lisp/avoid.el25
-rw-r--r--lisp/calendar/todo-mode.el494
-rw-r--r--lisp/cus-face.el4
-rw-r--r--lisp/emacs-lisp/eieio-opt.el2
-rw-r--r--lisp/emacs-lisp/lisp.el36
-rw-r--r--lisp/emacs-lisp/nadvice.el16
-rw-r--r--lisp/emacs-lisp/package.el17
-rw-r--r--lisp/emacs-lisp/timer.el80
-rw-r--r--lisp/frame.el12
-rw-r--r--lisp/hippie-exp.el2
-rw-r--r--lisp/menu-bar.el2
-rw-r--r--lisp/minibuffer.el2
-rw-r--r--lisp/mouse.el2
-rw-r--r--lisp/net/dbus.el12
-rw-r--r--lisp/net/tramp-sh.el2
-rw-r--r--lisp/nxml/nxml-mode.el5
-rw-r--r--lisp/progmodes/scheme.el58
-rw-r--r--lisp/simple.el10
-rw-r--r--lisp/vc/vc-rcs.el7
-rw-r--r--lisp/window.el5
-rw-r--r--src/ChangeLog49
-rw-r--r--src/lisp.h4
-rw-r--r--src/minibuf.c3
-rw-r--r--src/unexaix.c4
-rw-r--r--src/w32fns.c14
-rw-r--r--src/w32term.c4
-rw-r--r--src/xdisp.c62
-rw-r--r--test/automated/advice-tests.el1
46 files changed, 889 insertions, 436 deletions
diff --git a/ChangeLog b/ChangeLog
index 91b1b3ebc6c..8dfffbd9ba3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
12014-05-26 Paul Eggert <eggert@cs.ucla.edu>
2
3 Fix port to 32-bit AIX (Bug#17540).
4 * configure.ac (opsys): On Power Architecture, treat release 7 of
5 AIX like releases 5 and 6.
6
12014-05-19 Paul Eggert <eggert@cs.ucla.edu> 72014-05-19 Paul Eggert <eggert@cs.ucla.edu>
2 8
3 Remove dependencies on getdelim and getline. 9 Remove dependencies on getdelim and getline.
diff --git a/admin/ChangeLog b/admin/ChangeLog
index 35ad1744410..79adb4f543d 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,7 +1,6 @@
12014-05-25 Jan Djärv <jan.h.d@swipnet.se> 12014-05-25 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2 2
3 * mac/uvs.el: New file from Mac port. src/macuvs.h is generated 3 * mac/uvs.el: New file from Mac port. Generates src/macuvs.h.
4 by it.
5 4
62014-05-17 Paul Eggert <eggert@cs.ucla.edu> 52014-05-17 Paul Eggert <eggert@cs.ucla.edu>
7 6
diff --git a/configure.ac b/configure.ac
index 2cfc1ad1031..d727c0253f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -547,7 +547,7 @@ case "${canonical}" in
547 rs6000-ibm-aix[56]* ) 547 rs6000-ibm-aix[56]* )
548 opsys=aix4-2 548 opsys=aix4-2
549 ;; 549 ;;
550 powerpc-ibm-aix[56]* ) 550 powerpc-ibm-aix[5-9]* | powerpc-ibm-aix[1-9][0-9]* )
551 opsys=aix4-2 551 opsys=aix4-2
552 ;; 552 ;;
553 553
@@ -999,6 +999,15 @@ if test "$opsys" = "mingw32"; then
999 LN_S="/bin/ln" 999 LN_S="/bin/ln"
1000fi 1000fi
1001 1001
1002dnl On some Debian versions, "install-info" prints irritating messages
1003dnl "This is not dpkg install-info anymore, but GNU install-info"
1004dnl if called via an absolute file name.
1005dnl Use the entirely-identical-but-quieter ginstall-info instead if present.
1006dnl Sadly some people may have an old ginstall-info installed on
1007dnl non-Debian systems, so we can't use this.
1008dnl AC_PATH_PROGS(INSTALL_INFO, [ginstall-info install-info], :,
1009dnl $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin)
1010
1002AC_PATH_PROG(INSTALL_INFO, install-info, :, 1011AC_PATH_PROG(INSTALL_INFO, install-info, :,
1003 $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin) 1012 $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin)
1004dnl Don't use GZIP, which is used by gzip for additional parameters. 1013dnl Don't use GZIP, which is used by gzip for additional parameters.
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index afb8782ac75..db310ea37bd 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,9 @@
12014-05-26 Eli Zaretskii <eliz@gnu.org>
2
3 * frames.texi (Fonts): Clarify which frames are affected by
4 setting font from the menu and in default-frame-alist.
5 (Bug#17532)
6
12014-05-14 Eli Zaretskii <eliz@gnu.org> 72014-05-14 Eli Zaretskii <eliz@gnu.org>
2 8
3 * mule.texi (Language Environments): Remove unused @anchor. (Bug#17479) 9 * mule.texi (Language Environments): Remove unused @anchor. (Bug#17479)
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index 8dd387b5fa0..cd8347369d3 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -494,13 +494,14 @@ the mouse cursor to the chosen frame.
494@cindex fonts 494@cindex fonts
495 495
496 By default, Emacs displays text on graphical displays using a 496 By default, Emacs displays text on graphical displays using a
49712-point monospace font. There are several different ways to specify 49710-point monospace font. There are several different ways to specify
498a different font: 498a different font:
499 499
500@itemize 500@itemize
501@item 501@item
502Click on @samp{Set Default Font} in the @samp{Options} menu. To save 502Click on @samp{Set Default Font} in the @samp{Options} menu. This
503this for future sessions, click on @samp{Save Options} in the 503makes the selected font the default on all existing graphical frames.
504To save this for future sessions, click on @samp{Save Options} in the
504@samp{Options} menu. 505@samp{Options} menu.
505 506
506@item 507@item
@@ -513,6 +514,10 @@ Add a line to your init file, modifying the variable
513 '(font . "DejaVu Sans Mono-10")) 514 '(font . "DejaVu Sans Mono-10"))
514@end example 515@end example
515 516
517@noindent
518This makes the font the default on all graphical frames created after
519restarting Emacs with that init file.
520
516@cindex X defaults file 521@cindex X defaults file
517@cindex X resources file 522@cindex X resources file
518@item 523@item
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 334b5d8d91c..e810e75a80f 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12014-05-26 Eli Zaretskii <eliz@gnu.org>
2
3 * display.texi (Invisible Text): Clarify the description of
4 line-move-ignore-invisible. (Bug#17511)
5
12014-05-22 Leo Liu <sdl.web@gmail.com> 62014-05-22 Leo Liu <sdl.web@gmail.com>
2 7
3 * sequences.texi (Sequence Functions): Don't mention when and how 8 * sequences.texi (Sequence Functions): Don't mention when and how
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index acbef6b9495..e93f9ab5a4d 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -930,12 +930,14 @@ current value of @code{buffer-invisibility-spec}.
930 930
931@vindex line-move-ignore-invisible 931@vindex line-move-ignore-invisible
932 Ordinarily, functions that operate on text or move point do not care 932 Ordinarily, functions that operate on text or move point do not care
933whether the text is invisible. The user-level line motion commands 933whether the text is invisible, they process invisible characters and
934ignore invisible newlines if @code{line-move-ignore-invisible} is 934visible characters alike. The user-level line motion commands,
935non-@code{nil} (the default), but only because they are explicitly 935such as @code{next-line}, @code{previous-line}, ignore invisible
936programmed to do so. 936newlines if @code{line-move-ignore-invisible} is non-@code{nil} (the
937 937default), i.e., behave like these invisible newlines didn't exist in
938 However, if a command ends with point inside or at the boundary of 938the buffer, but only because they are explicitly programmed to do so.
939
940 If a command ends with point inside or at the boundary of
939invisible text, the main editing loop relocates point to one of the 941invisible text, the main editing loop relocates point to one of the
940two ends of the invisible text. Emacs chooses the direction of 942two ends of the invisible text. Emacs chooses the direction of
941relocation so that it is the same as the overall movement direction of 943relocation so that it is the same as the overall movement direction of
@@ -952,6 +954,10 @@ command moved point forward into an invisible range, Emacs moves point forward
952to the first visible character that follows the invisible text and then forward 954to the first visible character that follows the invisible text and then forward
953one more character. 955one more character.
954 956
957 These @dfn{adjustments} of point that ended up in the middle of
958invisible text can be disabled by setting @code{disable-point-adjustment}
959to a non-@code{nil} value. @xref{Adjusting Point}.
960
955 Incremental search can make invisible overlays visible temporarily 961 Incremental search can make invisible overlays visible temporarily
956and/or permanently when a match includes invisible text. To enable 962and/or permanently when a match includes invisible text. To enable
957this, the overlay should have a non-@code{nil} 963this, the overlay should have a non-@code{nil}
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 79474a52f40..ec790f1f7b0 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,16 @@
12014-05-26 Paul Eggert <eggert@cs.ucla.edu>
2
3 Specify coding if Latin-1 Emacs would misinterpret (Bug#17575).
4 * htmlfontify.texi, org.texi: Add "coding: utf-8".
5
62014-05-26 Stephen Berman <stephen.berman@gmx.net>
7
8 * todo-mode.texi: Update in light of changes due to bug#17482.
9 Replace numerous mistaken uses of literal quotes with proper
10 Texinfo markup.
11 (Todo Mode Entry Points): Comment out reference to using find-file
12 or Dired to visit Todo files, since this has been disabled (bug#17482).
13
12014-05-20 Leo Liu <sdl.web@gmail.com> 142014-05-20 Leo Liu <sdl.web@gmail.com>
2 15
3 * cl.texi (List Functions, Efficiency Concerns): Update cl-endp. 16 * cl.texi (List Functions, Efficiency Concerns): Update cl-endp.
diff --git a/doc/misc/htmlfontify.texi b/doc/misc/htmlfontify.texi
index 48b40eb84a4..1d8794d772d 100644
--- a/doc/misc/htmlfontify.texi
+++ b/doc/misc/htmlfontify.texi
@@ -1589,3 +1589,7 @@ A copy of the @code{file} command.
1589 1589
1590@setchapternewpage odd 1590@setchapternewpage odd
1591@bye 1591@bye
1592
1593@c Local Variables:
1594@c coding: utf-8
1595@c End:
diff --git a/doc/misc/org.texi b/doc/misc/org.texi
index 418eb1d6944..3800a41d239 100644
--- a/doc/misc/org.texi
+++ b/doc/misc/org.texi
@@ -18208,6 +18208,7 @@ org-customize @key{RET}} and then click yourself through the tree.
18208@bye 18208@bye
18209 18209
18210@c Local variables: 18210@c Local variables:
18211@c coding: utf-8
18211@c fill-column: 77 18212@c fill-column: 77
18212@c indent-tabs-mode: nil 18213@c indent-tabs-mode: nil
18213@c paragraph-start: "\\|^@[a-zA-Z]*[ \n]\\|^@x?org\\(key\\|cmd\\)\\|\f\\|[ ]*$" 18214@c paragraph-start: "\\|^@[a-zA-Z]*[ \n]\\|^@x?org\\(key\\|cmd\\)\\|\f\\|[ ]*$"
diff --git a/doc/misc/todo-mode.texi b/doc/misc/todo-mode.texi
index ad97e608156..44ea7fbf06e 100644
--- a/doc/misc/todo-mode.texi
+++ b/doc/misc/todo-mode.texi
@@ -258,15 +258,15 @@ are @kbd{C-c t} for @code{todo-show}, @kbd{C-c j} for
258@code{todo-insert-item}, since these commands are bound to @kbd{t}, 258@code{todo-insert-item}, since these commands are bound to @kbd{t},
259@kbd{j} and @kbd{i}, respectively, in Todo mode. 259@kbd{j} and @kbd{i}, respectively, in Todo mode.
260 260
261You can also visit a Todo file via @code{find-file} or Dired, like any 261@c You can also visit a Todo file via @code{find-file} or Dired, like any
262other file, and since Emacs recognizes it, the buffer will automatically 262@c other file, and since Emacs recognizes it, the buffer will automatically
263be in the appropriate Todo mode. Moreover, as long as the command you 263@c be in the appropriate Todo mode. Moreover, as long as the command you
264use to visit the file is listed in the option 264@c use to visit the file is listed in the option
265@code{todo-visit-files-commands} (which by default contains 265@c @code{todo-visit-files-commands} (which by default contains
266@code{find-file} and @code{dired-find-file}), it will also correctly 266@c @code{find-file} and @code{dired-find-file}), it will also correctly
267display the file's first category on first visiting the file (otherwise 267@c display the file's first category on first visiting the file (otherwise
268you have to use one of the commands for navigating between categories in 268@c you have to use one of the commands for navigating between categories in
269order to get a proper display). 269@c order to get a proper display).
270 270
271You can leave Todo mode by typing @kbd{q} (@code{todo-quit}), which 271You can leave Todo mode by typing @kbd{q} (@code{todo-quit}), which
272buries the current todo file buffer. Doing this also saves any changes 272buries the current todo file buffer. Doing this also saves any changes
@@ -295,7 +295,7 @@ for the shift key for capitalization and the raw prefix argument
295number key. 295number key.
296 296
297The predefined key bindings in Todo are more or less mnemonic. As a 297The predefined key bindings in Todo are more or less mnemonic. As a
298rule, key sequences beginning with @kbd{C} (capital `C', not the 298rule, key sequences beginning with @kbd{C} (capital @samp{C}, not the
299control key) are bound to commands applying to categories, sequences 299control key) are bound to commands applying to categories, sequences
300beginning with @kbd{F} apply to (non-archive) file-level commands, and 300beginning with @kbd{F} apply to (non-archive) file-level commands, and
301those beginning with @kbd{A} apply to archives (a special type of Todo 301those beginning with @kbd{A} apply to archives (a special type of Todo
@@ -669,9 +669,9 @@ down, i.e., lowering their priority, by one.
669@samp{region} (@kbd{r}): Use the text of the selected region as the 669@samp{region} (@kbd{r}): Use the text of the selected region as the
670text of the new item, and insert this in accordance with the item 670text of the new item, and insert this in accordance with the item
671insertion options and other parameters passed. If the option 671insertion options and other parameters passed. If the option
672`todo-use-only-highlighted-region' is non-nil, then use the region 672@code{todo-use-only-highlighted-region} is non-nil, then use the
673only when it is highlighted; otherwise, use the region regardless of 673region only when it is highlighted; otherwise, use the region
674highlighting. 674regardless of highlighting.
675@end enumerate 675@end enumerate
676 676
677Note that the parameters are divided into five numbered groups; within 677Note that the parameters are divided into five numbered groups; within
@@ -715,9 +715,9 @@ Press a key (so far `i y'): y=>diary:GO! @{ c=>calendar d=>date n=>dayname @} t
715@noindent Notice that the pair @samp{k=>nonmarking} is now absent, since it 715@noindent Notice that the pair @samp{k=>nonmarking} is now absent, since it
716belongs to the same group as the selected pair @samp{y=>diary}, hence 716belongs to the same group as the selected pair @samp{y=>diary}, hence
717is no longer available for this sequence. Since @kbd{y} is a 717is no longer available for this sequence. Since @kbd{y} is a
718continuation key, it is still available, but now the string ":GO!" is 718continuation key, it is still available, but now the string
719appended to the pair to remind you that pressing this key again will 719@samp{:GO!} is appended to the pair to remind you that pressing this
720complete the sequence. 720key again will complete the sequence.
721 721
722 722
723 723
@@ -821,10 +821,10 @@ otherwise it enters the empty string (i.e., no time string).
821 821
822@noindent 822@noindent
823Editing the text of a lengthy item in the minibuffer can be 823Editing the text of a lengthy item in the minibuffer can be
824inconvenient; therefore, if you type `e e' or `e h' on an item whose 824inconvenient; therefore, if you type @kbd{e e} or @kbd{e h} on an item
825text contains more than one logical line, the effect is the same as if 825whose text contains more than one logical line, the effect is the same
826you had typed `e m', that is, you switch a special buffer in Todo Edit 826as if you had typed @kbd{e m}, that is, you switch a special buffer in
827mode. 827Todo Edit mode.
828 828
829When you pass any of the parameters of the preceding group, except for 829When you pass any of the parameters of the preceding group, except for
830the @samp{date} parameter, this completes the item editing invocation 830the @samp{date} parameter, this completes the item editing invocation
@@ -916,10 +916,10 @@ invocation:
916Press a key (so far `e d'): f=>full c=>calendar a=>today n=>dayname y=>year m=>month d=>daynum 916Press a key (so far `e d'): f=>full c=>calendar a=>today n=>dayname y=>year m=>month d=>daynum
917@end example 917@end example
918 918
919In addition to the item-level invocations `e y', to change the current 919In addition to the item-level invocations @kbd{e y}, to change the
920item's diary inclusion status, and `e k', to change the current item's 920current item's diary inclusion status, and @kbd{e k}, to change the
921calendar marking status, Todo mode also has two related category-level 921current item's calendar marking status, Todo mode also has two related
922commands: 922category-level commands:
923 923
924@table @kbd 924@table @kbd
925 925
@@ -932,7 +932,7 @@ category.
932@end table 932@end table
933 933
934@noindent 934@noindent
935Like `e k', `C e k' automatically removes @code{todo-nondiary-marker} 935Like @kbd{e k}, @kbd{C e k} automatically removes @code{todo-nondiary-marker}
936from all items it is present on, since only diary items can bear 936from all items it is present on, since only diary items can bear
937@code{diary-nonmarking-symbol}. 937@code{diary-nonmarking-symbol}.
938 938
@@ -944,7 +944,7 @@ to be toggles, but to have the same effect on all items in the
944category, and take a prefix argument to reverse the effect. (If you 944category, and take a prefix argument to reverse the effect. (If you
945really want to toggle the diary-inclusion and calendar-marking status 945really want to toggle the diary-inclusion and calendar-marking status
946of all items in the category, you can do this by marking all the items 946of all items in the category, you can do this by marking all the items
947and then invoking `e y' or `e k', @pxref{Marked Items}). 947and then invoking @kbd{e y} or @kbd{e k}, @pxref{Marked Items}).
948 948
949@node Relocating and Removing Items, , Editing Item Headers and Text, Item Editing 949@node Relocating and Removing Items, , Editing Item Headers and Text, Item Editing
950@subsection Relocating and Removing Items 950@subsection Relocating and Removing Items
@@ -1050,14 +1050,15 @@ Archive Mode}).
1050 1050
1051@anchor{todo-item-done} 1051@anchor{todo-item-done}
1052@item d 1052@item d
1053This command (@code{todo-item-done}) removes the todo item at point from 1053This command (@code{todo-item-done}) removes the todo item at point
1054the todo list, appends to the original header a header consisting of 1054from the todo list, appends to the original header a header consisting
1055@code{todo-done-string} (by default ``DONE '') and the current date, and 1055of @code{todo-done-string} (by default @samp{DONE }) and the current
1056if @code{todo-always-add-time-string} is enabled, also the current time, 1056date, and if @code{todo-always-add-time-string} is enabled, also the
1057and adds the resulting done item to the top of the done items section of 1057current time, and adds the resulting done item to the top of the done
1058the category. Invoked with a prefix argument, it also prompts you to 1058items section of the category. Invoked with a prefix argument, it
1059enter a comment, which is appended to the end of the done item, prefixed 1059also prompts you to enter a comment, which is appended to the end of
1060with @code{todo-comment-string} (by default ``COMMENT: ''). 1060the done item, prefixed with @code{todo-comment-string} (by default
1061@samp{COMMENT: }).
1061@end table 1062@end table
1062 1063
1063A category's done items section is located below the last todo (i.e., 1064A category's done items section is located below the last todo (i.e.,
@@ -1255,7 +1256,7 @@ category in the archive, the archive file is also automatically deleted.
1255 1256
1256Since it is natural to visit an archive from the corresponding todo 1257Since it is natural to visit an archive from the corresponding todo
1257file, it would be convenient to easily return to the todo file when you 1258file, it would be convenient to easily return to the todo file when you
1258have finished browsing the archive. If you type `q' to quit Todo 1259have finished browsing the archive. If you type @kbd{q} to quit Todo
1259Archive mode, this switches to the corresponding todo file and shows the 1260Archive mode, this switches to the corresponding todo file and shows the
1260todo category corresponding to the archive category you were just 1261todo category corresponding to the archive category you were just
1261visiting. 1262visiting.
@@ -1396,13 +1397,13 @@ to sort by archived item counts.
1396 1397
1397Each row of the table is also buttonized; pressing one of these exits 1398Each row of the table is also buttonized; pressing one of these exits
1398the buffer (killing it), returns to the buffer of the file from which 1399the buffer (killing it), returns to the buffer of the file from which
1399you had invoked `F c', and displays the category that was named in the 1400you had invoked @kbd{F c}, and displays the category that was named in
1400row button you pressed (i.e., pressing this button jumps to that 1401the row button you pressed (i.e., pressing this button jumps to that
1401category). However, if the category named in the row is in a todo file 1402category). However, if the category named in the row is in a todo
1402and all of its items have been archived, and you have enabled the option 1403file and all of its items have been archived, and you have enabled the
1403@code{todo-skip-archived-categories}, then pressing the button jumps to 1404option @code{todo-skip-archived-categories}, then pressing the button
1404the archive category instead of the empty todo category. You can 1405jumps to the archive category instead of the empty todo category. You
1405recognize such categories by their items counts in the table---all 1406can recognize such categories by their items counts in the table---all
1406columns but the archived one have counts of zero---and in addition, 1407columns but the archived one have counts of zero---and in addition,
1407their lines in the table are also distinguished from the others by a 1408their lines in the table are also distinguished from the others by a
1408different face (@pxref{Faces}). 1409different face (@pxref{Faces}).
@@ -1586,7 +1587,7 @@ todo file, and the latter sets the number of top priorities for the
1586current category. To exclude a category or file from filtering by @kbd{F t t} 1587current category. To exclude a category or file from filtering by @kbd{F t t}
1587and @kbd{F t m}, set the number to @samp{0}. 1588and @kbd{F t m}, set the number to @samp{0}.
1588@item 1589@item
1589You can invoke `F t t' and `F t m' with a numeric prefix argument, 1590You can invoke @kbd{F t t} and @kbd{F t m} with a numeric prefix argument,
1590which specifies the number of top priorities in each category just for 1591which specifies the number of top priorities in each category just for
1591this invocation, overriding both @code{todo-top-priorities-overrides} and 1592this invocation, overriding both @code{todo-top-priorities-overrides} and
1592@code{todo-top-priorities}. 1593@code{todo-top-priorities}.
@@ -1681,7 +1682,7 @@ use the values of @code{todo-top-priorities-overrides} or
1681Aside from explicitly invoking an item filtering command to display a 1682Aside from explicitly invoking an item filtering command to display a
1682saved list of items filtered by a given method from given todo files, 1683saved list of items filtered by a given method from given todo files,
1683there are two other ways to visit a saved file of filtered items. You 1684there are two other ways to visit a saved file of filtered items. You
1684can invoke a command similar to `find-file': 1685can invoke a command similar to @code{find-file}:
1685 1686
1686@table @kbd 1687@table @kbd
1687@item F f 1688@item F f
diff --git a/etc/ChangeLog b/etc/ChangeLog
index 5a359e02863..49be20a5f79 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,8 @@
12014-05-26 Paul Eggert <eggert@cs.ucla.edu>
2
3 Specify coding if Latin-1 Emacs would misinterpret (Bug#17575).
4 * ETAGS.EBNF, NEWS, ORG-NEWS: Add "coding: utf-8".
5
12014-05-17 Paul Eggert <eggert@cs.ucla.edu> 62014-05-17 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 * NEWS: Assume C99 or later (Bug#17487). 8 * NEWS: Assume C99 or later (Bug#17487).
diff --git a/etc/ETAGS.EBNF b/etc/ETAGS.EBNF
index 66a974b948c..0d872383a16 100644
--- a/etc/ETAGS.EBNF
+++ b/etc/ETAGS.EBNF
@@ -1,4 +1,4 @@
1-*- indented-text -*- 1-*- mode: indented-text; coding: utf-8 -*-
2 2
3See the end of this file for copyright information. 3See the end of this file for copyright information.
4 4
diff --git a/etc/NEWS b/etc/NEWS
index 7c686a6502a..3d76642fe52 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1476,7 +1476,6 @@ This is like the old `eval-after-load', but better behaved.
1476*** `generic-make-keywords-list' 1476*** `generic-make-keywords-list'
1477*** `get-upcase-table' (use `case-table-get-table' instead). 1477*** `get-upcase-table' (use `case-table-get-table' instead).
1478 1478
1479+++
1480** `with-wrapper-hook' is obsoleted by `add-function'. 1479** `with-wrapper-hook' is obsoleted by `add-function'.
1481The few hooks that used with-wrapper-hook are replaced as follows: 1480The few hooks that used with-wrapper-hook are replaced as follows:
1482*** `abbrev-expand-function' obsoletes `abbrev-expand-functions'. 1481*** `abbrev-expand-function' obsoletes `abbrev-expand-functions'.
@@ -4187,6 +4186,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
4187 4186
4188 4187
4189Local variables: 4188Local variables:
4189coding: utf-8
4190mode: outline 4190mode: outline
4191paragraph-separate: "[ ]*$" 4191paragraph-separate: "[ ]*$"
4192end: 4192end:
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index c74506ce3ac..46b4c954ecd 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -1,4 +1,4 @@
1ORG NEWS -- history of user-visible changes. -*- org -*- 1ORG NEWS -- history of user-visible changes. -*- mode: org; coding: utf-8 -*-
2 2
3#+LINK: doc http://orgmode.org/worg/doc.html#%s 3#+LINK: doc http://orgmode.org/worg/doc.html#%s
4#+LINK: git http://orgmode.org/w/?p=org-mode.git;a=commit;h=%s 4#+LINK: git http://orgmode.org/w/?p=org-mode.git;a=commit;h=%s
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 3ac401b16a3..cedd9ab8965 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,13 @@
12014-05-26 Paul Eggert <eggert@cs.ucla.edu>
2
3 Fix rcs2log problems with CVS.
4 Problem reported by Glenn Morris in
5 <http://lists.gnu.org/archive/html/emacs-devel/2014-05/msg00277.html>.
6 Plus, fix some security and filename quoting problems.
7 * rcs2log (logdir): Prefer mktemp if available.
8 (logdir, llogdir): Work even if TMPDIR begins with '-' or has spaces.
9 (output_authors, main awk script): Parse more-recent CVS output format.
10
12014-05-19 Paul Eggert <eggert@cs.ucla.edu> 112014-05-19 Paul Eggert <eggert@cs.ucla.edu>
2 12
3 Remove dependencies on getline and getdelim. 13 Remove dependencies on getline and getdelim.
diff --git a/lib-src/rcs2log b/lib-src/rcs2log
index a0a75e390fb..8dd9cdcf2bb 100755
--- a/lib-src/rcs2log
+++ b/lib-src/rcs2log
@@ -205,11 +205,19 @@ month_data='
205 m[9]="Oct"; m[10]="Nov"; m[11]="Dec" 205 m[9]="Oct"; m[10]="Nov"; m[11]="Dec"
206' 206'
207 207
208logdir=$TMPDIR/rcs2log$$ 208if type mktemp >/dev/null 2>&1; then
209llogout=$logdir/l 209 logdir=`mktemp -d`
210else
211 logdir=$TMPDIR/rcs2log$$
212 (umask 077 && mkdir "$logdir")
213fi || exit
214case $logdir in
215-*) logdir=./$logdir;;
216esac
210trap exit 1 2 13 15 217trap exit 1 2 13 15
211trap "rm -fr $logdir 2>/dev/null" 0 218trap "rm -fr \"$logdir\" 2>/dev/null" 0
212(umask 077 && exec mkdir $logdir) || exit 219
220llogout=$logdir/l
213 221
214# If no rlog-format log file is given, generate one into $rlogfile. 222# If no rlog-format log file is given, generate one into $rlogfile.
215case $rlogfile in 223case $rlogfile in
@@ -417,10 +425,10 @@ case $loginFullnameMailaddrs in
417?*) 425?*)
418 case $loginFullnameMailaddrs in 426 case $loginFullnameMailaddrs in
419 *\"* | *\\*) 427 *\"* | *\\*)
420 sed 's/["\\]/\\&/g' >$llogout <<EOF || exit 428 sed 's/["\\]/\\&/g' >"$llogout" <<EOF || exit
421$loginFullnameMailaddrs 429$loginFullnameMailaddrs
422EOF 430EOF
423 loginFullnameMailaddrs=`cat $llogout`;; 431 loginFullnameMailaddrs=`cat "$llogout"`;;
424 esac 432 esac
425 433
426 oldIFS=$IFS 434 oldIFS=$IFS
@@ -442,29 +450,33 @@ esac
442 450
443case $logins in 451case $logins in
444?*) 452?*)
445 sort -u -o $llogout <<EOF 453 sort -u -o "$llogout" <<EOF
446$logins 454$logins
447EOF 455EOF
448 ;; 456 ;;
449'') 457'')
450 : ;; 458 : ;;
451esac >$llogout || exit 459esac >"$llogout" || exit
452 460
453output_authors='/^date: / { 461output_authors='/^date: / {
454 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 ~ /^[^;]*;$/) { 462 cvsformat = $5 == "author:"
455 print substr($5, 1, length($5)-1) 463 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:]*;$/)) {
464 author = $(5 + cvsformat)
465 if ($(4 + cvsformat) == "author:" && author ~ /^[^;]*;$/) {
466 print substr(author, 1, length(author)-1)
467 }
456 } 468 }
457}' 469}'
458authors=` 470authors=`
459 $AWK "$output_authors" <"$rlogfile" | sort -u | comm -23 - $llogout 471 $AWK "$output_authors" <"$rlogfile" | sort -u | comm -23 - "$llogout"
460` 472`
461case $authors in 473case $authors in
462?*) 474?*)
463 cat >$llogout <<EOF || exit 475 cat >"$llogout" <<EOF || exit
464$authors 476$authors
465EOF 477EOF
466 initialize_author_script='s/["\\]/\\&/g; s/.*/author[\"&\"] = 1/' 478 initialize_author_script='s/["\\]/\\&/g; s/.*/author[\"&\"] = 1/'
467 initialize_author=`sed -e "$initialize_author_script" <$llogout` 479 initialize_author=`sed -e "$initialize_author_script" <"$llogout"`
468 awkscript=' 480 awkscript='
469 BEGIN { 481 BEGIN {
470 alphabet = "abcdefghijklmnopqrstuvwxyz" 482 alphabet = "abcdefghijklmnopqrstuvwxyz"
@@ -644,8 +656,23 @@ $AWK '
644 } 656 }
645 date = newdate date 657 date = newdate date
646 } 658 }
647 time = substr($3, 1, length($3) - 1) 659 time = ""
648 author = substr($5, 1, length($5)-1) 660 for (i = 3; i <= NF; i++) {
661 time = time $i
662 if (time ~ /;$/) {
663 time = substr(time, 1, length(time) - 1)
664 break
665 }
666 }
667 i++
668 if ($i == "author:") {
669 author = $(i + 1)
670 if (author ~ /;$/) {
671 author = substr(author, 1, length(author) - 1)
672 }
673 } else {
674 author = ""
675 }
649 printf "%s%s%s%s%s%s%s%s%s%s", filename, SOH, rev, SOH, date, SOH, time, SOH, author, SOH 676 printf "%s%s%s%s%s%s%s%s%s%s", filename, SOH, rev, SOH, date, SOH, time, SOH, author, SOH
650 rev = "?" 677 rev = "?"
651 next 678 next
@@ -769,7 +796,7 @@ $AWK -F"$SOH" '
769 796
770# Exit successfully. 797# Exit successfully.
771 798
772exec rm -fr $logdir 799exec rm -fr "$logdir"
773 800
774# Local Variables: 801# Local Variables:
775# tab-width:4 802# tab-width:4
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 78dcac1399e..594feb08980 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,145 @@
12014-05-26 Andreas Schwab <schwab@linux-m68k.org>
2
3 * cus-face.el (custom-face-attributes): Add :distant-foreground.
4
52014-05-26 Martin Rudalics <rudalics@gmx.at>
6
7 * window.el (window--dump-frame): Remove interactive specification.
8
92014-05-26 Glenn Morris <rgm@gnu.org>
10
11 * hippie-exp.el (he-line-search-regexp):
12 Handle comint-prompt-regexp containing subgroups. (Bug#17529)
13
142014-05-26 Stephen Berman <stephen.berman@gmx.net>
15
16 * calendar/todo-mode.el: Remove dependence on auto-mode-alist,
17 to avoid errors when trying to create or visit a file foo.todo
18 located outside to todo-directory, and to allow having such files
19 without them being tied to Todo mode (bug#17482).
20 (todo-show, todo-move-category, todo-merge-category, todo-find-archive)
21 (todo-archive-done-item, todo-find-filtered-items-file)
22 (todo-filter-items, todo-find-item, todo-diary-goto-entry)
23 (todo-category-completions, todo-read-category): When visiting a
24 Todo file, make sure we're in the right mode and the buffer local
25 variables are set.
26 (todo-make-categories-list, todo-reset-nondiary-marker)
27 (todo-reset-done-string, todo-reset-comment-string): After
28 processing all Todo files, kill the buffers of those files that
29 weren't being visited before the processing.
30 (todo-display-as-todo-file, todo-add-to-buffer-list)
31 (todo-visit-files-commands): Comment out.
32 (todo-modes-set-3, todo-mode): Comment out additions to find-file-hook.
33 (auto-mode-alist): Remove add-to-list calls making Todo file
34 extensions unrestrictedly tied to Todo modes.
35
362014-05-26 Stefan Monnier <monnier@iro.umontreal.ca>
37
38 * emacs-lisp/nadvice.el (advice--member-p): Change second arg.
39 (advice-function-member-p): Tell it to check both names and functions
40 (bug#17531).
41 (advice--add-function): Adjust call accordingly.
42
432014-05-26 Stephen Berman <stephen.berman@gmx.net>
44
45 * calendar/todo-mode.el: Miscellaneous bug fixes.
46 (todo-delete-file): When deleting an archive but not its todo
47 file, make sure to update the todo file's category sexp.
48 (todo-move-category): Keep the moved category's name unless the
49 file moved to already has a category with that name. If the
50 numerically last category of the source file was moved, make the
51 first category current to avoid selecting a nonexisting category.
52 (todo-merge-category): Fix implementation to make merging to a
53 category in another file work as documented. Eliminate now
54 insufficient and unnecessary renaming of archive category, correct
55 document string accordingly, and clarify it. If the numerically
56 last category of the source file was merged, make the first
57 category current to avoid selecting a nonexisting category.
58 (todo-archive-done-item): When there are marked items and point
59 happens to be on an unmarked item, ignore the latter. Don't leave
60 point below last item after archiving marked items.
61 (todo-unarchive-items): Fix logic to ensure unarchiving an item
62 from an archive with only one category deletes the archive only
63 when the category is empty after unarchiving. Make sure the todo
64 file's category sexp is updated.
65 (todo-read-file-name): Allow an existing file name even when it is
66 not required (todo-move-category needs this to work as documented).
67 (todo-add-file): Call todo-validate-name to reject the name of an
68 existing todo file (needed due to fix in todo-read-file-name).
69 (todo-reset-nondiary-marker): Also reset in filtered items files.
70 (todo-reset-done-string, todo-reset-comment-string): Also reset in
71 regexp filtered items files.
72 (todo-reset-highlight-item): Also reset in filtered items files.
73 Fix incorrect variable reference in document string.
74
752014-05-26 Glenn Morris <rgm@gnu.org>
76
77 * window.el (window--dump-frame): Avoid error in --without-x builds.
78
792014-05-26 Glenn Morris <rgm@gnu.org>
80
81 * nxml/nxml-mode.el (xml-mode): Only define this alias once.
82
832014-05-26 Eli Zaretskii <eliz@gnu.org>
84
85 * frame.el (set-frame-font): Doc fix.
86
87 * menu-bar.el (menu-set-font): Doc fix. (Bug#17532)
88
892014-05-26 Dmitry Gutov <dgutov@yandex.ru>
90
91 * emacs-lisp/package.el (package--download-one-archive): Use
92 `write-region' instead of `save-buffer' to avoid running various
93 hooks. (Bug#17155)
94 (describe-package-1): Same. Insert newline at the end of the
95 buffer if appropriate.
96
972014-05-26 Juri Linkov <juri@jurta.org>
98
99 * avoid.el (mouse-avoidance-set-mouse-position): Don't raise frame.
100 (mouse-avoidance-ignore-p): Remove `switch-frame', add `focus-out'.
101 Add more modifiers: meta, control, shift, hyper, super, alt.
102 (Bug#17439)
103
104 * avoid.el (mouse-avoidance-banish-position): Fix defcustom :options
105 to allow changing its value with `set-variable'.
106
1072014-05-26 Stefan Monnier <monnier@iro.umontreal.ca>
108
109 * progmodes/scheme.el (scheme-mode-syntax-table): Remove hack for
110 #; comments.
111 (scheme-syntax-propertize, scheme-syntax-propertize-sexp-comment):
112 New functions.
113 (scheme-mode-variables): Set syntax-propertize-function instead of
114 font-lock-syntactic-face-function.
115 (scheme-font-lock-syntactic-face-function): Delete.
116
117 * emacs-lisp/lisp.el (end-of-defun): Ensure we move (bug#17274).
118
119 * emacs-lisp/timer.el (timer-event-handler): Don't run if canceled
120 (bug#17392).
121
1222014-05-26 Michael Albinus <michael.albinus@gmx.de>
123
124 * net/tramp-sh.el (tramp-find-inline-encoding): Do not match "%%t"
125 for a temporary file name.
126
1272014-05-26 Eli Zaretskii <eliz@gnu.org>
128
129 * simple.el (line-move-ignore-invisible): Doc fix. (Bug#17511)
130
1312014-05-26 Michael Albinus <michael.albinus@gmx.de>
132
133 * net/dbus.el (dbus-init-bus, dbus-call-method)
134 (dbus-call-method-asynchronously, dbus-send-signal)
135 (dbus-method-return-internal, dbus-method-error-internal):
136 Check, whether Emacs has been compiled with D-Bus support. (Bug#17508)
137
1382014-05-26 Nicolas Richard <theonewiththeevillook@yahoo.fr>
139
140 * emacs-lisp/eieio-opt.el (eieio-help-class): Correctly deal with
141 methods which do not have a doc string. (Bug#17490)
142
12014-05-25 Tassilo Horn <tsdh@gnu.org> 1432014-05-25 Tassilo Horn <tsdh@gnu.org>
2 144
3 * textmodes/reftex-ref.el (reftex-format-special): Make it work 145 * textmodes/reftex-ref.el (reftex-format-special): Make it work
diff --git a/lisp/avoid.el b/lisp/avoid.el
index f3013728931..680e509ceba 100644
--- a/lisp/avoid.el
+++ b/lisp/avoid.el
@@ -52,9 +52,6 @@
52;; 52;;
53;; - Using this code does slow Emacs down. "banish" mode shouldn't 53;; - Using this code does slow Emacs down. "banish" mode shouldn't
54;; be too bad, and on my workstation even "animate" is reasonable. 54;; be too bad, and on my workstation even "animate" is reasonable.
55;;
56;; - It ought to find out where any overlapping frames are and avoid them,
57;; rather than always raising the frame.
58 55
59;; Credits: 56;; Credits:
60;; This code was helped by all those who contributed suggestions, 57;; This code was helped by all those who contributed suggestions,
@@ -129,9 +126,9 @@ TOP-OR-BOTTOM: banish the mouse to top or bottom of frame or window.
129TOP-OR-BOTTOM-POS: Distance from top or bottom edge of frame or window." 126TOP-OR-BOTTOM-POS: Distance from top or bottom edge of frame or window."
130 :group 'avoid 127 :group 'avoid
131 :version "24.3" 128 :version "24.3"
132 :type '(alist :key-type symbol :value-type symbol) 129 :type '(alist :key-type symbol :value-type (choice symbol integer))
133 :options '(frame-or-window side (side-pos integer) 130 :options '((frame-or-window symbol) (side symbol) (side-pos integer)
134 top-or-bottom (top-or-bottom-pos integer))) 131 (top-or-bottom symbol) (top-or-bottom-pos integer)))
135 132
136;; Internal variables 133;; Internal variables
137(defvar mouse-avoidance-state nil) 134(defvar mouse-avoidance-state nil)
@@ -172,12 +169,8 @@ Analogous to `mouse-position'."
172 169
173(defun mouse-avoidance-set-mouse-position (pos) 170(defun mouse-avoidance-set-mouse-position (pos)
174 ;; Carefully set mouse position to given position (X . Y) 171 ;; Carefully set mouse position to given position (X . Y)
175 ;; Ideally, should check if X,Y is in the current frame, and if not,
176 ;; leave the mouse where it was. However, this is currently
177 ;; difficult to do, so we just raise the frame to avoid frame switches.
178 ;; Returns t if it moved the mouse. 172 ;; Returns t if it moved the mouse.
179 (let ((f (selected-frame))) 173 (let ((f (selected-frame)))
180 (raise-frame f)
181 (set-mouse-position f (car pos) (cdr pos)) 174 (set-mouse-position f (car pos) (cdr pos))
182 t)) 175 t))
183 176
@@ -342,12 +335,18 @@ redefine this function to suit your own tastes."
342 (let ((modifiers (event-modifiers (car last-input-event)))) 335 (let ((modifiers (event-modifiers (car last-input-event))))
343 (or (memq (car last-input-event) 336 (or (memq (car last-input-event)
344 '(mouse-movement scroll-bar-movement 337 '(mouse-movement scroll-bar-movement
345 select-window switch-frame)) 338 select-window focus-out))
346 (memq 'click modifiers) 339 (memq 'click modifiers)
347 (memq 'double modifiers) 340 (memq 'double modifiers)
348 (memq 'triple modifiers) 341 (memq 'triple modifiers)
349 (memq 'drag modifiers) 342 (memq 'drag modifiers)
350 (memq 'down modifiers))))))) 343 (memq 'down modifiers)
344 (memq 'meta modifiers)
345 (memq 'control modifiers)
346 (memq 'shift modifiers)
347 (memq 'hyper modifiers)
348 (memq 'super modifiers)
349 (memq 'alt modifiers)))))))
351 350
352(defun mouse-avoidance-banish () 351(defun mouse-avoidance-banish ()
353 (if (not (mouse-avoidance-ignore-p)) 352 (if (not (mouse-avoidance-ignore-p))
@@ -403,8 +402,6 @@ Effects of the different modes:
403 * cat-and-mouse: Same as `animate'. 402 * cat-and-mouse: Same as `animate'.
404 * proteus: As `animate', but changes the shape of the mouse pointer too. 403 * proteus: As `animate', but changes the shape of the mouse pointer too.
405 404
406Whenever the mouse is moved, the frame is also raised.
407
408\(See `mouse-avoidance-threshold' for definition of \"too close\", 405\(See `mouse-avoidance-threshold' for definition of \"too close\",
409and `mouse-avoidance-nudge-dist' and `mouse-avoidance-nudge-var' for 406and `mouse-avoidance-nudge-dist' and `mouse-avoidance-nudge-var' for
410definition of \"random distance\".)" 407definition of \"random distance\".)"
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index f7f2b1d1539..ab2ab3e4cb8 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -566,13 +566,13 @@ less than or equal the category's top priority setting."
566;;; Entering and exiting 566;;; Entering and exiting
567;; ----------------------------------------------------------------------------- 567;; -----------------------------------------------------------------------------
568 568
569(defcustom todo-visit-files-commands (list 'find-file 'dired-find-file) 569;; (defcustom todo-visit-files-commands (list 'find-file 'dired-find-file)
570 "List of file finding commands for `todo-display-as-todo-file'. 570;; "List of file finding commands for `todo-display-as-todo-file'.
571Invoking these commands to visit a todo file or todo archive file 571;; Invoking these commands to visit a todo file or todo archive file
572calls `todo-show' or `todo-find-archive', so that the file is 572;; calls `todo-show' or `todo-find-archive', so that the file is
573displayed correctly." 573;; displayed correctly."
574 :type '(repeat function) 574;; :type '(repeat function)
575 :group 'todo) 575;; :group 'todo)
576 576
577(defun todo-short-file-name (file) 577(defun todo-short-file-name (file)
578 "Return the short form of todo file FILE's name. 578 "Return the short form of todo file FILE's name.
@@ -740,9 +740,12 @@ corresponding todo file, displaying the corresponding category."
740 "Choose a regexp items file: " 740 "Choose a regexp items file: "
741 rxf) 'regexp)))))) 741 rxf) 'regexp))))))
742 (if (file-exists-p fi-file) 742 (if (file-exists-p fi-file)
743 (set-window-buffer 743 (progn
744 (selected-window) 744 (set-window-buffer
745 (set-buffer (find-file-noselect fi-file 'nowarn))) 745 (selected-window)
746 (set-buffer (find-file-noselect fi-file 'nowarn)))
747 (unless (derived-mode-p 'todo-filtered-items-mode)
748 (todo-filtered-items-mode)))
746 (message "There is no %s file for %s" 749 (message "There is no %s file for %s"
747 (cond ((eq todo-show-first 'top) 750 (cond ((eq todo-show-first 'top)
748 "top priorities") 751 "top priorities")
@@ -757,6 +760,9 @@ corresponding todo file, displaying the corresponding category."
757 (unless (todo-check-file file) (throw 'end nil)) 760 (unless (todo-check-file file) (throw 'end nil))
758 (set-window-buffer (selected-window) 761 (set-window-buffer (selected-window)
759 (set-buffer (find-file-noselect file 'nowarn))) 762 (set-buffer (find-file-noselect file 'nowarn)))
763 (if (equal (file-name-extension (buffer-file-name)) "toda")
764 (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
765 (unless (derived-mode-p 'todo-mode) (todo-mode)))
760 ;; When quitting an archive file, show the corresponding 766 ;; When quitting an archive file, show the corresponding
761 ;; category in the corresponding todo file, if it exists. 767 ;; category in the corresponding todo file, if it exists.
762 (when (assoc cat todo-categories) 768 (when (assoc cat todo-categories)
@@ -1090,6 +1096,9 @@ Noninteractively, return the name of the new file."
1090 (let* ((prompt (concat "Enter name of new todo file " 1096 (let* ((prompt (concat "Enter name of new todo file "
1091 "(TAB or SPC to see current names): ")) 1097 "(TAB or SPC to see current names): "))
1092 (file (todo-read-file-name prompt))) 1098 (file (todo-read-file-name prompt)))
1099 ;; Don't accept the name of an existing todo file.
1100 (setq file (todo-absolute-file-name
1101 (todo-validate-name (todo-short-file-name file) 'file)))
1093 (with-current-buffer (get-buffer-create file) 1102 (with-current-buffer (get-buffer-create file)
1094 (erase-buffer) 1103 (erase-buffer)
1095 (write-region (point-min) (point-max) file nil 'nomessage nil t) 1104 (write-region (point-min) (point-max) file nil 'nomessage nil t)
@@ -1179,10 +1188,28 @@ visiting the deleted files."
1179 (when (file-exists-p file1) (delete-file file1)) 1188 (when (file-exists-p file1) (delete-file file1))
1180 (setq todo-visited (delete file1 todo-visited)) 1189 (setq todo-visited (delete file1 todo-visited))
1181 (kill-buffer buf1) 1190 (kill-buffer buf1)
1182 (when delete2 1191 (if delete2
1183 (when (file-exists-p file2) (delete-file file2)) 1192 (progn
1184 (setq todo-visited (delete file2 todo-visited)) 1193 (when (file-exists-p file2) (delete-file file2))
1185 (and buf2 (kill-buffer buf2))) 1194 (setq todo-visited (delete file2 todo-visited))
1195 (and buf2 (kill-buffer buf2)))
1196 ;; If we deleted an archive but not its todo file, update the
1197 ;; latter's category sexp.
1198 (when (equal (file-name-extension file2) "todo")
1199 (with-current-buffer (or buf2 (find-file-noselect file2))
1200 (save-excursion
1201 (save-restriction
1202 (widen)
1203 (goto-char (point-min))
1204 (let ((sexp (read (buffer-substring-no-properties
1205 (line-beginning-position)
1206 (line-end-position))))
1207 (buffer-read-only nil))
1208 (mapc (lambda (x) (aset (cdr x) 3 0)) sexp)
1209 (delete-region (line-beginning-position) (line-end-position))
1210 (prin1 sexp (current-buffer)))))
1211 (todo-set-categories)
1212 (unless buf2 (kill-buffer)))))
1186 (setq todo-files (funcall todo-files-function) 1213 (setq todo-files (funcall todo-files-function)
1187 todo-archives (funcall todo-files-function t)) 1214 todo-archives (funcall todo-files-function t))
1188 (when (or (string= file1-sn todo-default-todo-file) 1215 (when (or (string= file1-sn todo-default-todo-file)
@@ -1197,7 +1224,8 @@ visiting the deleted files."
1197 (concat "and its " 1224 (concat "and its "
1198 (cond (todo "archive") (archive "todo")) 1225 (cond (todo "archive") (archive "todo"))
1199 " file ")) 1226 " file "))
1200 "deleted") file1-sn)))) 1227 "deleted")
1228 file1-sn))))
1201 1229
1202(defvar todo-edit-buffer "*Todo Edit*" 1230(defvar todo-edit-buffer "*Todo Edit*"
1203 "Name of current buffer in Todo Edit mode.") 1231 "Name of current buffer in Todo Edit mode.")
@@ -1385,8 +1413,7 @@ the archive of the file moved to, creating it if it does not exist."
1385 "Do you want to proceed? "))) 1413 "Do you want to proceed? ")))
1386 (let* ((ofile todo-current-todo-file) 1414 (let* ((ofile todo-current-todo-file)
1387 (cat (todo-current-category)) 1415 (cat (todo-current-category))
1388 (nfile (todo-read-file-name 1416 (nfile (todo-read-file-name "Todo file to move this category to: "))
1389 "Todo file to move this category to: " nil))
1390 (archive (concat (file-name-sans-extension ofile) ".toda")) 1417 (archive (concat (file-name-sans-extension ofile) ".toda"))
1391 (buffers (append (list ofile) 1418 (buffers (append (list ofile)
1392 (unless (zerop (todo-get-count 'archived cat)) 1419 (unless (zerop (todo-get-count 'archived cat))
@@ -1394,7 +1421,7 @@ the archive of the file moved to, creating it if it does not exist."
1394 new) 1421 new)
1395 (while (equal nfile (file-truename ofile)) 1422 (while (equal nfile (file-truename ofile))
1396 (setq nfile (todo-read-file-name 1423 (setq nfile (todo-read-file-name
1397 "Choose a file distinct from this file: " nil))) 1424 "Choose a file distinct from this file: ")))
1398 (unless (member nfile todo-files) 1425 (unless (member nfile todo-files)
1399 (with-current-buffer (get-buffer-create nfile) 1426 (with-current-buffer (get-buffer-create nfile)
1400 (erase-buffer) 1427 (erase-buffer)
@@ -1428,6 +1455,10 @@ the archive of the file moved to, creating it if it does not exist."
1428 (if (member buf (funcall todo-files-function t)) 1455 (if (member buf (funcall todo-files-function t))
1429 (concat (file-name-sans-extension nfile) ".toda") 1456 (concat (file-name-sans-extension nfile) ".toda")
1430 nfile)) 1457 nfile))
1458 (if (equal (file-name-extension (buffer-file-name)) "toda")
1459 (unless (derived-mode-p 'todo-archive-mode)
1460 (todo-archive-mode))
1461 (unless (derived-mode-p 'todo-mode) (todo-mode)))
1431 (let* ((nfile-short (todo-short-file-name nfile)) 1462 (let* ((nfile-short (todo-short-file-name nfile))
1432 (prompt (concat 1463 (prompt (concat
1433 (format "Todo file \"%s\" already has " 1464 (format "Todo file \"%s\" already has "
@@ -1453,7 +1484,7 @@ the archive of the file moved to, creating it if it does not exist."
1453 "\\(" (regexp-quote cat) "\\)$") nil t) 1484 "\\(" (regexp-quote cat) "\\)$") nil t)
1454 (replace-match new nil nil nil 1))) 1485 (replace-match new nil nil nil 1)))
1455 (setq todo-categories 1486 (setq todo-categories
1456 (append todo-categories (list (cons new counts)))) 1487 (append todo-categories (list (cons (or new cat) counts))))
1457 (todo-update-categories-sexp) 1488 (todo-update-categories-sexp)
1458 ;; If archive was just created, save it to avoid "File 1489 ;; If archive was just created, save it to avoid "File
1459 ;; <xyz> no longer exists!" message on invoking 1490 ;; <xyz> no longer exists!" message on invoking
@@ -1481,6 +1512,8 @@ the archive of the file moved to, creating it if it does not exist."
1481 (setq todo-categories (delete (assoc cat todo-categories) 1512 (setq todo-categories (delete (assoc cat todo-categories)
1482 todo-categories)) 1513 todo-categories))
1483 (todo-update-categories-sexp) 1514 (todo-update-categories-sexp)
1515 (when (> todo-category-number (length todo-categories))
1516 (setq todo-category-number 1))
1484 (todo-category-select))))) 1517 (todo-category-select)))))
1485 (set-window-buffer (selected-window) 1518 (set-window-buffer (selected-window)
1486 (set-buffer (find-file-noselect nfile))) 1519 (set-buffer (find-file-noselect nfile)))
@@ -1495,25 +1528,25 @@ choose (with TAB completion) a category in it to merge into;
1495otherwise, choose and merge into a category in either the 1528otherwise, choose and merge into a category in either the
1496current todo file or a file in `todo-category-completions-files'. 1529current todo file or a file in `todo-category-completions-files'.
1497 1530
1498After merging, the current category's todo and done items are 1531After merging, the source category's todo and done items are
1499appended to the chosen goal category's todo and done items, 1532appended to the chosen goal category's todo and done items,
1500respectively. The goal category becomes the current category, 1533respectively. The goal category becomes the current category,
1501and the previous current category is deleted. 1534and the source category is deleted.
1502 1535
1503If both the first and goal categories also have archived items, 1536If both the source and goal categories also have archived items,
1504the former are merged to the latter. If only the first category 1537they are also merged. If only the source category has archived
1505has archived items, the archived category is renamed to the goal 1538items, the goal category is added as a new category to the
1506category." 1539archive file and the source category is deleted."
1507 (interactive "P") 1540 (interactive "P")
1508 (let* ((tfile todo-current-todo-file) 1541 (let* ((tfile todo-current-todo-file)
1509 (cat (todo-current-category)) 1542 (cat (todo-current-category))
1510 (cat+file (todo-read-category "Merge into category: " 'todo file)) 1543 (cat+file (todo-read-category "Merge into category: " 'todo file))
1511 (goal (car cat+file)) 1544 (goal (car cat+file))
1512 (gfile (cdr cat+file)) 1545 (gfile (cdr cat+file))
1513 (archive (concat (file-name-sans-extension (if file gfile tfile)) 1546 (tarchive (concat (file-name-sans-extension tfile) ".toda"))
1514 ".toda")) 1547 (garchive (concat (file-name-sans-extension gfile) ".toda"))
1515 archived-count here) 1548 (archived-count (todo-get-count 'archived))
1516 ;; Merge in todo file. 1549 here)
1517 (with-current-buffer (get-buffer (find-file-noselect tfile)) 1550 (with-current-buffer (get-buffer (find-file-noselect tfile))
1518 (widen) 1551 (widen)
1519 (let* ((buffer-read-only nil) 1552 (let* ((buffer-read-only nil)
@@ -1536,94 +1569,102 @@ category."
1536 (point-marker)) 1569 (point-marker))
1537 (point-max-marker)))) 1570 (point-max-marker))))
1538 (todo (buffer-substring-no-properties tbeg tend)) 1571 (todo (buffer-substring-no-properties tbeg tend))
1539 (done (buffer-substring-no-properties dbeg cend))) 1572 (done (buffer-substring-no-properties dbeg cend))
1540 (goto-char (point-min)) 1573 (todo-count (todo-get-count 'todo cat))
1541 ;; Merge any todo items. 1574 (done-count (todo-get-count 'done cat)))
1542 (unless (zerop (length todo)) 1575 ;; Merge into goal todo category.
1543 (re-search-forward 1576 (with-current-buffer (get-buffer (find-file-noselect gfile))
1544 (concat "^" (regexp-quote (concat todo-category-beg goal)) "$") 1577 (unless (derived-mode-p 'todo-mode) (todo-mode))
1545 nil t) 1578 (widen)
1546 (re-search-forward 1579 (goto-char (point-min))
1547 (concat "^" (regexp-quote todo-category-done)) nil t) 1580 (let ((buffer-read-only nil))
1548 (forward-line -1) 1581 ;; Merge any todo items.
1549 (setq here (point-marker)) 1582 (unless (zerop (length todo))
1550 (insert todo) 1583 (re-search-forward
1551 (todo-update-count 'todo (todo-get-count 'todo cat) goal)) 1584 (concat "^" (regexp-quote (concat todo-category-beg goal)) "$")
1552 ;; Merge any done items. 1585 nil t)
1553 (unless (zerop (length done)) 1586 (re-search-forward
1554 (goto-char (if (re-search-forward 1587 (concat "^" (regexp-quote todo-category-done)) nil t)
1555 (concat "^" (regexp-quote todo-category-beg)) nil t) 1588 (forward-line -1)
1556 (match-beginning 0) 1589 (setq here (point-marker))
1557 (point-max))) 1590 (insert todo)
1558 (when (zerop (length todo)) (setq here (point-marker))) 1591 (todo-update-count 'todo todo-count goal))
1559 (insert done) 1592 ;; Merge any done items.
1560 (todo-update-count 'done (todo-get-count 'done cat) goal)) 1593 (unless (zerop (length done))
1594 (goto-char (if (re-search-forward
1595 (concat "^" (regexp-quote todo-category-beg))
1596 nil t)
1597 (match-beginning 0)
1598 (point-max)))
1599 (when (zerop (length todo)) (setq here (point-marker)))
1600 (insert done)
1601 (todo-update-count 'done done-count goal)))
1602 (todo-update-categories-sexp))
1603 ;; Update and clean up source todo file.
1561 (remove-overlays cbeg cend) 1604 (remove-overlays cbeg cend)
1562 (delete-region cbeg cend) 1605 (delete-region cbeg cend)
1563 (setq todo-categories (delete (assoc cat todo-categories) 1606 (setq todo-categories (delete (assoc cat todo-categories)
1564 todo-categories)) 1607 todo-categories))
1565 (todo-update-categories-sexp) 1608 (todo-update-categories-sexp)
1566 (mapc (lambda (m) (set-marker m nil)) (list cbeg tbeg dbeg tend cend)))) 1609 (when (> todo-category-number (length todo-categories))
1567 (when (file-exists-p archive) 1610 (setq todo-category-number 1))
1568 ;; Merge in archive file. 1611 (todo-category-select)
1569 (with-current-buffer (get-buffer (find-file-noselect archive)) 1612 (mapc (lambda (m) (set-marker m nil))
1613 (list cbeg tbeg dbeg tend cend))))
1614 (when (> archived-count 0)
1615 (with-current-buffer (get-buffer (find-file-noselect tarchive))
1570 (widen) 1616 (widen)
1571 (goto-char (point-min)) 1617 (goto-char (point-min))
1572 (let ((buffer-read-only nil) 1618 (let* ((buffer-read-only nil)
1573 (cbeg (save-excursion 1619 (cbeg (progn
1574 (when (re-search-forward 1620 (when (re-search-forward
1575 (concat "^" (regexp-quote 1621 (concat "^" (regexp-quote
1576 (concat todo-category-beg cat)) "$") 1622 (concat todo-category-beg cat)) "$")
1577 nil t)
1578 (goto-char (match-beginning 0))
1579 (point-marker))))
1580 (gbeg (save-excursion
1581 (when (re-search-forward
1582 (concat "^" (regexp-quote
1583 (concat todo-category-beg goal)) "$")
1584 nil t)
1585 (goto-char (match-beginning 0))
1586 (point-marker))))
1587 cend carch)
1588 (when cbeg
1589 (setq archived-count (todo-get-count 'done cat))
1590 (setq cend (save-excursion
1591 (if (re-search-forward
1592 (concat "^" (regexp-quote todo-category-beg))
1593 nil t) 1623 nil t)
1624 (goto-char (match-beginning 0))
1625 (point-marker))))
1626 (cend (if (re-search-forward
1627 (concat "^" (regexp-quote todo-category-beg)) nil t)
1628 (match-beginning 0)
1629 (point-max)))
1630 (carch (progn
1631 (goto-char cbeg)
1632 (forward-line)
1633 (buffer-substring-no-properties (point) cend))))
1634 ;; Merge into goal archive category, if it exists, else create it.
1635 (with-current-buffer (get-buffer (find-file-noselect garchive))
1636 (let ((gbeg (when (re-search-forward
1637 (concat "^" (regexp-quote
1638 (concat todo-category-beg goal))
1639 "$")
1640 nil t)
1641 (goto-char (match-beginning 0))
1642 (point-marker))))
1643 (goto-char (if (and gbeg
1644 (re-search-forward
1645 (concat "^" (regexp-quote todo-category-beg))
1646 nil t))
1594 (match-beginning 0) 1647 (match-beginning 0)
1595 (point-max)))) 1648 (point-max)))
1596 (setq carch (save-excursion (goto-char cbeg) (forward-line) 1649 (unless gbeg (todo-add-category nil goal))
1597 (buffer-substring-no-properties (point) cend))) 1650 (insert carch)
1598 ;; If both categories of the merge have archived items, merge the 1651 (todo-update-categories-sexp)))
1599 ;; source items to the goal items, else "merge" by renaming the 1652 ;; Update and clean up source archive file.
1600 ;; source category to goal. 1653 (remove-overlays cbeg cend)
1601 (if gbeg 1654 (delete-region cbeg cend)
1602 (progn 1655 (setq todo-categories (todo-make-categories-list t))
1603 (goto-char (if (re-search-forward 1656 (todo-update-categories-sexp))))
1604 (concat "^" (regexp-quote todo-category-beg)) 1657 ;; Update goal todo file for merged archived items and display it.
1605 nil t) 1658 (set-window-buffer (selected-window) (set-buffer (get-file-buffer gfile)))
1606 (match-beginning 0) 1659 (unless (zerop archived-count)
1607 (point-max))) 1660 (todo-update-count 'archived archived-count goal)
1608 (insert carch) 1661 (todo-update-categories-sexp))
1609 (remove-overlays cbeg cend) 1662 (todo-category-number goal)
1610 (delete-region cbeg cend)) 1663 ;; If there are only merged done items, show them.
1611 (goto-char cbeg) 1664 (let ((todo-show-with-done (zerop (todo-get-count 'todo goal))))
1612 (search-forward cat) 1665 (todo-category-select)
1613 (replace-match goal)) 1666 ;; Put point on the first merged item.
1614 (setq todo-categories (todo-make-categories-list t)) 1667 (goto-char here))
1615 (todo-update-categories-sexp)))))
1616 (with-current-buffer (get-file-buffer tfile)
1617 (when archived-count
1618 (unless (zerop archived-count)
1619 (todo-update-count 'archived archived-count goal)
1620 (todo-update-categories-sexp)))
1621 (todo-category-number goal)
1622 ;; If there are only merged done items, show them.
1623 (let ((todo-show-with-done (zerop (todo-get-count 'todo goal))))
1624 (todo-category-select)
1625 ;; Put point on the first merged item.
1626 (goto-char here)))
1627 (set-marker here nil))) 1668 (set-marker here nil)))
1628 1669
1629;; ----------------------------------------------------------------------------- 1670;; -----------------------------------------------------------------------------
@@ -2965,6 +3006,7 @@ displayed."
2965 (when place 3006 (when place
2966 (set-window-buffer (selected-window) 3007 (set-window-buffer (selected-window)
2967 (set-buffer (find-file-noselect archive))) 3008 (set-buffer (find-file-noselect archive)))
3009 (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
2968 (if (member place '(other-archive other-cat)) 3010 (if (member place '(other-archive other-cat))
2969 (setq todo-category-number 1) 3011 (setq todo-category-number 1)
2970 (todo-category-number cat)) 3012 (todo-category-number cat))
@@ -2997,7 +3039,7 @@ this category does not exist in the archive, it is created."
2997 (afile (concat (file-name-sans-extension 3039 (afile (concat (file-name-sans-extension
2998 todo-current-todo-file) ".toda")) 3040 todo-current-todo-file) ".toda"))
2999 (archive (find-file-noselect afile t)) 3041 (archive (find-file-noselect afile t))
3000 (item (and (todo-done-item-p) 3042 (item (and (not marked) (todo-done-item-p)
3001 (concat (todo-item-string) "\n"))) 3043 (concat (todo-item-string) "\n")))
3002 (count 0) 3044 (count 0)
3003 (opoint (unless (todo-done-item-p) (point))) 3045 (opoint (unless (todo-done-item-p) (point)))
@@ -3040,6 +3082,7 @@ this category does not exist in the archive, it is created."
3040 (if (not (or marked all item)) 3082 (if (not (or marked all item))
3041 (throw 'end (message "Only done items can be archived")) 3083 (throw 'end (message "Only done items can be archived"))
3042 (with-current-buffer archive 3084 (with-current-buffer archive
3085 (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
3043 (let (buffer-read-only) 3086 (let (buffer-read-only)
3044 (widen) 3087 (widen)
3045 (goto-char (point-min)) 3088 (goto-char (point-min))
@@ -3061,12 +3104,12 @@ this category does not exist in the archive, it is created."
3061 (todo-update-categories-sexp) 3104 (todo-update-categories-sexp)
3062 ;; If archive is new, save to file now (with 3105 ;; If archive is new, save to file now (with
3063 ;; write-region to avoid prompt for file to save to) 3106 ;; write-region to avoid prompt for file to save to)
3064 ;; to update todo-archives, and to let auto-mode-alist 3107 ;; to update todo-archives, and set the mode for
3065 ;; take effect below on visiting the archive. 3108 ;; visiting the archive below.
3066 (unless (nth 7 (file-attributes afile)) 3109 (unless (nth 7 (file-attributes afile))
3067 (write-region nil nil afile t t) 3110 (write-region nil nil afile t t)
3068 (setq todo-archives (funcall todo-files-function t)) 3111 (setq todo-archives (funcall todo-files-function t))
3069 (kill-buffer)))) 3112 (todo-archive-mode))))
3070 (with-current-buffer tbuf 3113 (with-current-buffer tbuf
3071 (cond 3114 (cond
3072 (all 3115 (all
@@ -3092,7 +3135,8 @@ this category does not exist in the archive, it is created."
3092 (todo-update-count 'done -1) 3135 (todo-update-count 'done -1)
3093 (todo-update-count 'archived 1) 3136 (todo-update-count 'archived 1)
3094 ;; Don't leave point below last item. 3137 ;; Don't leave point below last item.
3095 (and item (bolp) (eolp) (< (point-min) (point-max)) 3138 (and (or marked item) (bolp) (eolp)
3139 (< (point-min) (point-max))
3096 (todo-backward-item)) 3140 (todo-backward-item))
3097 (when item 3141 (when item
3098 (throw 'done (setq item nil)))) 3142 (throw 'done (setq item nil))))
@@ -3182,15 +3226,16 @@ the only category in the archive, the archive file is deleted."
3182 (throw 'done (setq item nil)))) 3226 (throw 'done (setq item nil))))
3183 (todo-forward-item)))) 3227 (todo-forward-item))))
3184 (todo-update-count 'done (if marked (- marked-count) -1) cat) 3228 (todo-update-count 'done (if marked (- marked-count) -1) cat)
3185 ;; If that was the last category in the archive, delete the whole file. 3229 ;; If we unarchived the last item in category, then if that was
3186 (if (= (length todo-categories) 1) 3230 ;; the only category, delete the whole file, otherwise, just
3187 (progn 3231 ;; delete the category.
3188 (delete-file todo-current-todo-file) 3232 (when (= 0 (todo-get-count 'done))
3189 ;; Kill the archive buffer silently. 3233 (if (= 1 (length todo-categories))
3190 (set-buffer-modified-p nil) 3234 (progn
3191 (kill-buffer)) 3235 (delete-file todo-current-todo-file)
3192 ;; Otherwise, if the archive category is now empty, delete it. 3236 ;; Kill the archive buffer silently.
3193 (when (eq (point-min) (point-max)) 3237 (set-buffer-modified-p nil)
3238 (kill-buffer))
3194 (widen) 3239 (widen)
3195 (let ((beg (re-search-backward 3240 (let ((beg (re-search-backward
3196 (concat "^" (regexp-quote todo-category-beg) cat "$") 3241 (concat "^" (regexp-quote todo-category-beg) cat "$")
@@ -3203,8 +3248,8 @@ the only category in the archive, the archive file is deleted."
3203 (remove-overlays beg end) 3248 (remove-overlays beg end)
3204 (delete-region beg end) 3249 (delete-region beg end)
3205 (setq todo-categories (delete (assoc cat todo-categories) 3250 (setq todo-categories (delete (assoc cat todo-categories)
3206 todo-categories)) 3251 todo-categories)))))
3207 (todo-update-categories-sexp)))) 3252 (todo-update-categories-sexp)
3208 ;; Visit category in todo file and show restored done items. 3253 ;; Visit category in todo file and show restored done items.
3209 (let ((tfile (buffer-file-name tbuf)) 3254 (let ((tfile (buffer-file-name tbuf))
3210 (todo-show-with-done t)) 3255 (todo-show-with-done t))
@@ -3925,7 +3970,9 @@ regexp items."
3925 (setq file (completing-read "Choose a filtered items file: " 3970 (setq file (completing-read "Choose a filtered items file: "
3926 falist nil t nil nil (car falist))) 3971 falist nil t nil nil (car falist)))
3927 (setq file (cdr (assoc-string file falist))) 3972 (setq file (cdr (assoc-string file falist)))
3928 (find-file file))) 3973 (find-file file)
3974 (unless (derived-mode-p 'todo-filtered-items-mode)
3975 (todo-filtered-items-mode))))
3929 3976
3930(defun todo-go-to-source-item () 3977(defun todo-go-to-source-item ()
3931 "Display the file and category of the filtered item at point." 3978 "Display the file and category of the filtered item at point."
@@ -4056,6 +4103,8 @@ multifile commands for further details."
4056 (completing-read "Choose a regexp items file: " 4103 (completing-read "Choose a regexp items file: "
4057 rxf) 'regexp)))) 4104 rxf) 'regexp))))
4058 (find-file fname) 4105 (find-file fname)
4106 (unless (derived-mode-p 'todo-filtered-items-mode)
4107 (todo-filtered-items-mode))
4059 (todo-prefix-overlays) 4108 (todo-prefix-overlays)
4060 (todo-check-filtered-items-file)) 4109 (todo-check-filtered-items-file))
4061 (t 4110 (t
@@ -4309,6 +4358,9 @@ its priority has changed, and `same' otherwise."
4309 todo-global-current-todo-file))) 4358 todo-global-current-todo-file)))
4310 (find-file-noselect file) 4359 (find-file-noselect file)
4311 (with-current-buffer (find-buffer-visiting file) 4360 (with-current-buffer (find-buffer-visiting file)
4361 (if archive
4362 (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
4363 (unless (derived-mode-p 'todo-mode) (todo-mode)))
4312 (save-restriction 4364 (save-restriction
4313 (widen) 4365 (widen)
4314 (goto-char (point-min)) 4366 (goto-char (point-min))
@@ -4885,23 +4937,28 @@ the file."
4885 ;; Make sure to include newly created archives, e.g. due to 4937 ;; Make sure to include newly created archives, e.g. due to
4886 ;; todo-move-category. 4938 ;; todo-move-category.
4887 (when (member archive (funcall todo-files-function t)) 4939 (when (member archive (funcall todo-files-function t))
4888 (let ((archive-count 0)) 4940 (let ((archive-count 0)
4889 (with-current-buffer (find-file-noselect archive) 4941 (visiting (find-buffer-visiting archive)))
4890 (widen) 4942 (with-current-buffer (or visiting
4891 (goto-char (point-min)) 4943 (find-file-noselect archive))
4892 (when (re-search-forward 4944 (save-excursion
4893 (concat "^" (regexp-quote todo-category-beg) 4945 (save-restriction
4894 cat "$") 4946 (widen)
4895 (point-max) t) 4947 (goto-char (point-min))
4896 (forward-line) 4948 (when (re-search-forward
4897 (while (not (or (looking-at 4949 (concat "^" (regexp-quote todo-category-beg)
4898 (concat 4950 cat "$")
4899 (regexp-quote todo-category-beg) 4951 (point-max) t)
4900 "\\(.*\\)\n")) 4952 (forward-line)
4901 (eobp))) 4953 (while (not (or (looking-at
4902 (when (looking-at todo-done-string-start) 4954 (concat
4903 (setq archive-count (1+ archive-count))) 4955 (regexp-quote todo-category-beg)
4904 (forward-line)))) 4956 "\\(.*\\)\n"))
4957 (eobp)))
4958 (when (looking-at todo-done-string-start)
4959 (setq archive-count (1+ archive-count)))
4960 (forward-line)))))
4961 (unless visiting (kill-buffer)))
4905 (todo-update-count 'archived archive-count cat)))) 4962 (todo-update-count 'archived archive-count cat))))
4906 ((looking-at todo-done-string-start) 4963 ((looking-at todo-done-string-start)
4907 (todo-update-count 'done 1 cat)) 4964 (todo-update-count 'done 1 cat))
@@ -5125,6 +5182,11 @@ Overrides `diary-goto-entry'."
5125 (if (not (and (file-exists-p file) 5182 (if (not (and (file-exists-p file)
5126 (find-file-other-window file))) 5183 (find-file-other-window file)))
5127 (message "Unable to locate this diary entry") 5184 (message "Unable to locate this diary entry")
5185 ;; If it's a Todo file, make sure it's in Todo mode.
5186 (when (and (equal (file-name-directory (file-truename file))
5187 (file-truename todo-directory))
5188 (not (derived-mode-p 'todo-mode)))
5189 (todo-mode))
5128 (when (eq major-mode 'todo-mode) (widen)) 5190 (when (eq major-mode 'todo-mode) (widen))
5129 (goto-char (point-min)) 5191 (goto-char (point-min))
5130 (when (re-search-forward (format "%s.*\\(%s\\)" date content) nil t) 5192 (when (re-search-forward (format "%s.*\\(%s\\)" date content) nil t)
@@ -5564,6 +5626,9 @@ have been removed."
5564 (add-to-list 'files curfile)) 5626 (add-to-list 'files curfile))
5565 (dolist (f files listall) 5627 (dolist (f files listall)
5566 (with-current-buffer (find-file-noselect f 'nowarn) 5628 (with-current-buffer (find-file-noselect f 'nowarn)
5629 (if archive
5630 (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
5631 (unless (derived-mode-p 'todo-mode) (todo-mode)))
5567 ;; Ensure category is properly displayed in case user 5632 ;; Ensure category is properly displayed in case user
5568 ;; switches to file via a non-Todo mode command. And if 5633 ;; switches to file via a non-Todo mode command. And if
5569 ;; done items in category are visible, keep them visible. 5634 ;; done items in category are visible, keep them visible.
@@ -5616,7 +5681,7 @@ otherwise, a new file name is allowed."
5616 "")))) 5681 ""))))
5617 (unless (file-exists-p todo-directory) 5682 (unless (file-exists-p todo-directory)
5618 (make-directory todo-directory)) 5683 (make-directory todo-directory))
5619 (unless mustmatch 5684 (unless (or mustmatch (member file files))
5620 (setq file (todo-validate-name file 'file))) 5685 (setq file (todo-validate-name file 'file)))
5621 (setq file (file-truename (concat todo-directory file 5686 (setq file (file-truename (concat todo-directory file
5622 (if archive ".toda" ".todo")))))) 5687 (if archive ".toda" ".todo"))))))
@@ -5649,6 +5714,7 @@ categories from `todo-category-completions-files'."
5649 (categories (cond (file0 5714 (categories (cond (file0
5650 (with-current-buffer 5715 (with-current-buffer
5651 (find-file-noselect file0 'nowarn) 5716 (find-file-noselect file0 'nowarn)
5717 (unless (derived-mode-p 'todo-mode) (todo-mode))
5652 (let ((todo-current-todo-file file0)) 5718 (let ((todo-current-todo-file file0))
5653 todo-categories))) 5719 todo-categories)))
5654 ((and add (not file)) 5720 ((and add (not file))
@@ -5915,8 +5981,9 @@ the empty string (i.e., no time string)."
5915 5981
5916(defun todo-reset-nondiary-marker (symbol value) 5982(defun todo-reset-nondiary-marker (symbol value)
5917 "The :set function for user option `todo-nondiary-marker'." 5983 "The :set function for user option `todo-nondiary-marker'."
5918 (let ((oldvalue (symbol-value symbol)) 5984 (let* ((oldvalue (symbol-value symbol))
5919 (files (append todo-files todo-archives))) 5985 (files (append todo-files todo-archives
5986 (directory-files todo-directory t "\.tod[rty]$" t))))
5920 (custom-set-default symbol value) 5987 (custom-set-default symbol value)
5921 ;; Need to reset these to get font-locking right. 5988 ;; Need to reset these to get font-locking right.
5922 (setq todo-nondiary-start (nth 0 todo-nondiary-marker) 5989 (setq todo-nondiary-start (nth 0 todo-nondiary-marker)
@@ -5927,23 +5994,28 @@ the empty string (i.e., no time string)."
5927 (regexp-quote diary-nonmarking-symbol) "\\)?")) 5994 (regexp-quote diary-nonmarking-symbol) "\\)?"))
5928 (when (not (equal value oldvalue)) 5995 (when (not (equal value oldvalue))
5929 (dolist (f files) 5996 (dolist (f files)
5930 (with-current-buffer (find-file-noselect f) 5997 (let ((buf (find-buffer-visiting f)))
5931 (let (buffer-read-only) 5998 (with-current-buffer (find-file-noselect f)
5932 (widen) 5999 (let (buffer-read-only)
5933 (goto-char (point-min)) 6000 (widen)
5934 (while (not (eobp)) 6001 (goto-char (point-min))
5935 (if (re-search-forward 6002 (while (not (eobp))
5936 (concat "^\\(" todo-done-string-start "[^][]+] \\)?" 6003 (if (re-search-forward
5937 "\\(?1:" (regexp-quote (car oldvalue)) 6004 (concat "^\\(" todo-done-string-start "[^][]+] \\)?"
5938 "\\)" todo-date-pattern "\\( " 6005 "\\(?1:" (regexp-quote (car oldvalue))
5939 diary-time-regexp "\\)?\\(?2:" 6006 "\\)" todo-date-pattern "\\( "
5940 (regexp-quote (cadr oldvalue)) "\\)") 6007 diary-time-regexp "\\)?\\(?2:"
5941 nil t) 6008 (regexp-quote (cadr oldvalue)) "\\)")
5942 (progn 6009 nil t)
5943 (replace-match (nth 0 value) t t nil 1) 6010 (progn
5944 (replace-match (nth 1 value) t t nil 2)) 6011 (replace-match (nth 0 value) t t nil 1)
5945 (forward-line))) 6012 (replace-match (nth 1 value) t t nil 2))
5946 (todo-category-select))))))) 6013 (forward-line)))
6014 (if buf
6015 (when (derived-mode-p 'todo-mode 'todo-archive-mode)
6016 (todo-category-select))
6017 (save-buffer)
6018 (kill-buffer)))))))))
5947 6019
5948(defun todo-reset-done-separator-string (symbol value) 6020(defun todo-reset-done-separator-string (symbol value)
5949 "The :set function for `todo-done-separator-string'." 6021 "The :set function for `todo-done-separator-string'."
@@ -5963,51 +6035,63 @@ the empty string (i.e., no time string)."
5963(defun todo-reset-done-string (symbol value) 6035(defun todo-reset-done-string (symbol value)
5964 "The :set function for user option `todo-done-string'." 6036 "The :set function for user option `todo-done-string'."
5965 (let ((oldvalue (symbol-value symbol)) 6037 (let ((oldvalue (symbol-value symbol))
5966 (files (append todo-files todo-archives))) 6038 (files (append todo-files todo-archives
6039 (directory-files todo-directory t "\.todr$" t))))
5967 (custom-set-default symbol value) 6040 (custom-set-default symbol value)
5968 ;; Need to reset this to get font-locking right. 6041 ;; Need to reset this to get font-locking right.
5969 (setq todo-done-string-start 6042 (setq todo-done-string-start
5970 (concat "^\\[" (regexp-quote todo-done-string))) 6043 (concat "^\\[" (regexp-quote todo-done-string)))
5971 (when (not (equal value oldvalue)) 6044 (when (not (equal value oldvalue))
5972 (dolist (f files) 6045 (dolist (f files)
5973 (with-current-buffer (find-file-noselect f) 6046 (let ((buf (find-buffer-visiting f)))
5974 (let (buffer-read-only) 6047 (with-current-buffer (find-file-noselect f)
5975 (widen) 6048 (let (buffer-read-only)
5976 (goto-char (point-min)) 6049 (widen)
5977 (while (not (eobp)) 6050 (goto-char (point-min))
5978 (if (re-search-forward 6051 (while (not (eobp))
5979 (concat "^" (regexp-quote todo-nondiary-start) 6052 (if (re-search-forward
5980 "\\(" (regexp-quote oldvalue) "\\)") 6053 (concat "^" (regexp-quote todo-nondiary-start)
5981 nil t) 6054 "\\(" (regexp-quote oldvalue) "\\)")
5982 (replace-match value t t nil 1) 6055 nil t)
5983 (forward-line))) 6056 (replace-match value t t nil 1)
5984 (todo-category-select))))))) 6057 (forward-line)))
6058 (if buf
6059 (when (derived-mode-p 'todo-mode 'todo-archive-mode)
6060 (todo-category-select))
6061 (save-buffer)
6062 (kill-buffer)))))))))
5985 6063
5986(defun todo-reset-comment-string (symbol value) 6064(defun todo-reset-comment-string (symbol value)
5987 "The :set function for user option `todo-comment-string'." 6065 "The :set function for user option `todo-comment-string'."
5988 (let ((oldvalue (symbol-value symbol)) 6066 (let ((oldvalue (symbol-value symbol))
5989 (files (append todo-files todo-archives))) 6067 (files (append todo-files todo-archives
6068 (directory-files todo-directory t "\.todr$" t))))
5990 (custom-set-default symbol value) 6069 (custom-set-default symbol value)
5991 (when (not (equal value oldvalue)) 6070 (when (not (equal value oldvalue))
5992 (dolist (f files) 6071 (dolist (f files)
5993 (with-current-buffer (find-file-noselect f) 6072 (let ((buf (find-buffer-visiting f)))
5994 (let (buffer-read-only) 6073 (with-current-buffer (find-file-noselect f)
5995 (save-excursion 6074 (let (buffer-read-only)
5996 (widen) 6075 (widen)
5997 (goto-char (point-min)) 6076 (goto-char (point-min))
5998 (while (not (eobp)) 6077 (while (not (eobp))
5999 (if (re-search-forward 6078 (if (re-search-forward
6000 (concat 6079 (concat "\\[\\(" (regexp-quote oldvalue)
6001 "\\[\\(" (regexp-quote oldvalue) "\\): [^]]*\\]") 6080 "\\): [^]]*\\]")
6002 nil t) 6081 nil t)
6003 (replace-match value t t nil 1) 6082 (replace-match value t t nil 1)
6004 (forward-line))) 6083 (forward-line)))
6005 (todo-category-select)))))))) 6084 (if buf
6085 (when (derived-mode-p 'todo-mode 'todo-archive-mode)
6086 (todo-category-select))
6087 (save-buffer)
6088 (kill-buffer)))))))))
6006 6089
6007(defun todo-reset-highlight-item (symbol value) 6090(defun todo-reset-highlight-item (symbol value)
6008 "The :set function for `todo-toggle-item-highlighting'." 6091 "The :set function for user option `todo-highlight-item'."
6009 (let ((oldvalue (symbol-value symbol)) 6092 (let ((oldvalue (symbol-value symbol))
6010 (files (append todo-files todo-archives))) 6093 (files (append todo-files todo-archives
6094 (directory-files todo-directory t "\.tod[rty]$" t))))
6011 (custom-set-default symbol value) 6095 (custom-set-default symbol value)
6012 (when (not (equal value oldvalue)) 6096 (when (not (equal value oldvalue))
6013 (dolist (f files) 6097 (dolist (f files)
@@ -6399,20 +6483,20 @@ Added to `pre-command-hook' in Todo mode when user option
6399`todo-show-current-file' is set to non-nil." 6483`todo-show-current-file' is set to non-nil."
6400 (setq todo-global-current-todo-file todo-current-todo-file)) 6484 (setq todo-global-current-todo-file todo-current-todo-file))
6401 6485
6402(defun todo-display-as-todo-file () 6486;; (defun todo-display-as-todo-file ()
6403 "Show todo files correctly when visited from outside of Todo mode. 6487;; "Show todo files correctly when visited from outside of Todo mode.
6404Added to `find-file-hook' in Todo mode and Todo Archive mode." 6488;; Added to `find-file-hook' in Todo mode and Todo Archive mode."
6405 (and (member this-command todo-visit-files-commands) 6489;; (and (member this-command todo-visit-files-commands)
6406 (= (- (point-max) (point-min)) (buffer-size)) 6490;; (= (- (point-max) (point-min)) (buffer-size))
6407 (member major-mode '(todo-mode todo-archive-mode)) 6491;; (member major-mode '(todo-mode todo-archive-mode))
6408 (todo-category-select))) 6492;; (todo-category-select)))
6409 6493
6410(defun todo-add-to-buffer-list () 6494;; (defun todo-add-to-buffer-list ()
6411 "Add name of just visited todo file to `todo-file-buffers'. 6495;; "Add name of just visited todo file to `todo-file-buffers'.
6412This function is added to `find-file-hook' in Todo mode." 6496;; This function is added to `find-file-hook' in Todo mode."
6413 (let ((filename (file-truename (buffer-file-name)))) 6497;; (let ((filename (file-truename (buffer-file-name))))
6414 (when (member filename todo-files) 6498;; (when (member filename todo-files)
6415 (add-to-list 'todo-file-buffers filename)))) 6499;; (add-to-list 'todo-file-buffers filename))))
6416 6500
6417(defun todo-update-buffer-list () 6501(defun todo-update-buffer-list ()
6418 "Make current Todo mode buffer file car of `todo-file-buffers'. 6502 "Make current Todo mode buffer file car of `todo-file-buffers'.
@@ -6467,7 +6551,8 @@ Added to `window-configuration-change-hook' in Todo mode."
6467 "Make some settings that apply to multiple Todo modes." 6551 "Make some settings that apply to multiple Todo modes."
6468 (setq-local todo-categories (todo-set-categories)) 6552 (setq-local todo-categories (todo-set-categories))
6469 (setq-local todo-category-number 1) 6553 (setq-local todo-category-number 1)
6470 (add-hook 'find-file-hook 'todo-display-as-todo-file nil t)) 6554 ;; (add-hook 'find-file-hook 'todo-display-as-todo-file nil t)
6555 )
6471 6556
6472(put 'todo-mode 'mode-class 'special) 6557(put 'todo-mode 'mode-class 'special)
6473 6558
@@ -6486,7 +6571,7 @@ Added to `window-configuration-change-hook' in Todo mode."
6486 (setq-local todo-current-todo-file (file-truename (buffer-file-name)))) 6571 (setq-local todo-current-todo-file (file-truename (buffer-file-name))))
6487 (setq-local todo-show-done-only nil) 6572 (setq-local todo-show-done-only nil)
6488 (setq-local todo-categories-with-marks nil) 6573 (setq-local todo-categories-with-marks nil)
6489 (add-hook 'find-file-hook 'todo-add-to-buffer-list nil t) 6574 ;; (add-hook 'find-file-hook 'todo-add-to-buffer-list nil t)
6490 (add-hook 'post-command-hook 'todo-update-buffer-list nil t) 6575 (add-hook 'post-command-hook 'todo-update-buffer-list nil t)
6491 (when todo-show-current-file 6576 (when todo-show-current-file
6492 (add-hook 'pre-command-hook 'todo-show-current-file nil t)) 6577 (add-hook 'pre-command-hook 'todo-show-current-file nil t))
@@ -6555,13 +6640,6 @@ Added to `window-configuration-change-hook' in Todo mode."
6555 (todo-modes-set-1) 6640 (todo-modes-set-1)
6556 (todo-modes-set-2)) 6641 (todo-modes-set-2))
6557 6642
6558;;;###autoload
6559(add-to-list 'auto-mode-alist '("\\.todo\\'" . todo-mode))
6560;;;###autoload
6561(add-to-list 'auto-mode-alist '("\\.toda\\'" . todo-archive-mode))
6562;;;###autoload
6563(add-to-list 'auto-mode-alist '("\\.tod[tyr]\\'" . todo-filtered-items-mode))
6564
6565;; ----------------------------------------------------------------------------- 6643;; -----------------------------------------------------------------------------
6566(provide 'todo-mode) 6644(provide 'todo-mode)
6567 6645
diff --git a/lisp/cus-face.el b/lisp/cus-face.el
index 913ef4cb8bf..a9e6f3f5b56 100644
--- a/lisp/cus-face.el
+++ b/lisp/cus-face.el
@@ -218,6 +218,10 @@
218 (color :tag "Foreground" 218 (color :tag "Foreground"
219 :help-echo "Set foreground color (name or #RRGGBB hex spec).")) 219 :help-echo "Set foreground color (name or #RRGGBB hex spec)."))
220 220
221 (:distant-foreground
222 (color :tag "Distant Foreground"
223 :help-echo "Set distant foreground color (name or #RRGGBB hex spec)."))
224
221 (:background 225 (:background
222 (color :tag "Background" 226 (color :tag "Background"
223 :help-echo "Set background color (name or #RRGGBB hex spec).")) 227 :help-echo "Set background color (name or #RRGGBB hex spec)."))
diff --git a/lisp/emacs-lisp/eieio-opt.el b/lisp/emacs-lisp/eieio-opt.el
index a502901a469..ca9b91bed58 100644
--- a/lisp/emacs-lisp/eieio-opt.el
+++ b/lisp/emacs-lisp/eieio-opt.el
@@ -141,7 +141,7 @@ If CLASS is actually an object, then also display current values of that object.
141 (insert " " (aref type counter) " " 141 (insert " " (aref type counter) " "
142 (prin1-to-string (car cur) (current-buffer)) 142 (prin1-to-string (car cur) (current-buffer))
143 "\n" 143 "\n"
144 (cdr cur))) 144 (or (cdr cur) "")))
145 (setq counter (1+ counter)))) 145 (setq counter (1+ counter))))
146 (insert "\n\n") 146 (insert "\n\n")
147 (setq methods (cdr methods)))))) 147 (setq methods (cdr methods))))))
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index 3ff65ff11cd..23b021df177 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -431,16 +431,18 @@ is called as a function to find the defun's end."
431 (push-mark)) 431 (push-mark))
432 (if (or (null arg) (= arg 0)) (setq arg 1)) 432 (if (or (null arg) (= arg 0)) (setq arg 1))
433 (let ((pos (point)) 433 (let ((pos (point))
434 (beg (progn (end-of-line 1) (beginning-of-defun-raw 1) (point)))) 434 (beg (progn (end-of-line 1) (beginning-of-defun-raw 1) (point)))
435 (skip (lambda ()
436 ;; When comparing point against pos, we want to consider that if
437 ;; point was right after the end of the function, it's still
438 ;; considered as "in that function".
439 ;; E.g. `eval-defun' from right after the last close-paren.
440 (unless (bolp)
441 (skip-chars-forward " \t")
442 (if (looking-at "\\s<\\|\n")
443 (forward-line 1))))))
435 (funcall end-of-defun-function) 444 (funcall end-of-defun-function)
436 ;; When comparing point against pos, we want to consider that if 445 (funcall skip)
437 ;; point was right after the end of the function, it's still
438 ;; considered as "in that function".
439 ;; E.g. `eval-defun' from right after the last close-paren.
440 (unless (bolp)
441 (skip-chars-forward " \t")
442 (if (looking-at "\\s<\\|\n")
443 (forward-line 1)))
444 (cond 446 (cond
445 ((> arg 0) 447 ((> arg 0)
446 ;; Moving forward. 448 ;; Moving forward.
@@ -463,11 +465,19 @@ is called as a function to find the defun's end."
463 (goto-char beg)) 465 (goto-char beg))
464 (unless (zerop arg) 466 (unless (zerop arg)
465 (beginning-of-defun-raw (- arg)) 467 (beginning-of-defun-raw (- arg))
468 (setq beg (point))
466 (funcall end-of-defun-function)))) 469 (funcall end-of-defun-function))))
467 (unless (bolp) 470 (funcall skip)
468 (skip-chars-forward " \t") 471 (while (and (< arg 0) (>= (point) pos))
469 (if (looking-at "\\s<\\|\n") 472 ;; We intended to move backward, but this ended up not doing so:
470 (forward-line 1))))) 473 ;; Try harder!
474 (goto-char beg)
475 (beginning-of-defun-raw (- arg))
476 (if (>= (point) beg)
477 (setq arg 0)
478 (setq beg (point))
479 (funcall end-of-defun-function)
480 (funcall skip)))))
471 481
472(defun mark-defun (&optional allow-extend) 482(defun mark-defun (&optional allow-extend)
473 "Put mark at end of this defun, point at beginning. 483 "Put mark at end of this defun, point at beginning.
diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el
index 66a4f8fdea7..bfd939d69e2 100644
--- a/lisp/emacs-lisp/nadvice.el
+++ b/lisp/emacs-lisp/nadvice.el
@@ -180,12 +180,16 @@ WHERE is a symbol to select an entry in `advice--where-alist'."
180 (advice--make-1 (nth 1 desc) (nth 2 desc) 180 (advice--make-1 (nth 1 desc) (nth 2 desc)
181 function main props))))) 181 function main props)))))
182 182
183(defun advice--member-p (function name definition) 183(defun advice--member-p (function use-name definition)
184 (let ((found nil)) 184 (let ((found nil))
185 (while (and (not found) (advice--p definition)) 185 (while (and (not found) (advice--p definition))
186 (if (if name 186 (if (if (eq use-name :use-both)
187 (equal name (cdr (assq 'name (advice--props definition)))) 187 (or (equal function
188 (equal function (advice--car definition))) 188 (cdr (assq 'name (advice--props definition))))
189 (equal function (advice--car definition)))
190 (equal function (if use-name
191 (cdr (assq 'name (advice--props definition)))
192 (advice--car definition))))
189 (setq found definition) 193 (setq found definition)
190 (setq definition (advice--cdr definition)))) 194 (setq definition (advice--cdr definition))))
191 found)) 195 found))
@@ -292,7 +296,7 @@ is also interactive. There are 3 cases:
292;;;###autoload 296;;;###autoload
293(defun advice--add-function (where ref function props) 297(defun advice--add-function (where ref function props)
294 (let* ((name (cdr (assq 'name props))) 298 (let* ((name (cdr (assq 'name props)))
295 (a (advice--member-p function name (gv-deref ref)))) 299 (a (advice--member-p (or name function) (if name t) (gv-deref ref))))
296 (when a 300 (when a
297 ;; The advice is already present. Remove the old one, first. 301 ;; The advice is already present. Remove the old one, first.
298 (setf (gv-deref ref) 302 (setf (gv-deref ref)
@@ -324,7 +328,7 @@ properties alist that was specified when it was added."
324 "Return non-nil if ADVICE is already in FUNCTION-DEF. 328 "Return non-nil if ADVICE is already in FUNCTION-DEF.
325Instead of ADVICE being the actual function, it can also be the `name' 329Instead of ADVICE being the actual function, it can also be the `name'
326of the piece of advice." 330of the piece of advice."
327 (advice--member-p advice advice function-def)) 331 (advice--member-p advice :use-both function-def))
328 332
329;;;; Specific application of add-function to `symbol-function' for advice. 333;;;; Specific application of add-function to `symbol-function' for advice.
330 334
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 5843724a596..e6bc8f9b485 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1266,10 +1266,7 @@ similar to an entry in `package-alist'. Save the cached copy to
1266 ;; may fetch a URL redirect page). 1266 ;; may fetch a URL redirect page).
1267 (when (listp (read (current-buffer))) 1267 (when (listp (read (current-buffer)))
1268 (make-directory dir t) 1268 (make-directory dir t)
1269 (setq buffer-file-name (expand-file-name file dir)) 1269 (write-region nil nil (expand-file-name file dir) nil 'silent)))
1270 (let ((version-control 'never)
1271 (require-final-newline nil))
1272 (save-buffer))))
1273 (when good-signatures 1270 (when good-signatures
1274 ;; Write out good signatures into archive-contents.signed file. 1271 ;; Write out good signatures into archive-contents.signed file.
1275 (write-region (mapconcat #'epg-signature-to-string good-signatures "\n") 1272 (write-region (mapconcat #'epg-signature-to-string good-signatures "\n")
@@ -1515,11 +1512,13 @@ If optional arg NO-ACTIVATE is non-nil, don't activate packages."
1515 (package--with-work-buffer 1512 (package--with-work-buffer
1516 (package-archive-base desc) 1513 (package-archive-base desc)
1517 (format "%s-readme.txt" name) 1514 (format "%s-readme.txt" name)
1518 (setq buffer-file-name 1515 (save-excursion
1519 (expand-file-name readme package-user-dir)) 1516 (goto-char (point-max))
1520 (let ((version-control 'never) 1517 (unless (bolp)
1521 (require-final-newline t)) 1518 (insert ?\n)))
1522 (save-buffer)) 1519 (write-region nil nil
1520 (expand-file-name readme package-user-dir)
1521 nil 'silent)
1523 (setq readme-string (buffer-string)) 1522 (setq readme-string (buffer-string))
1524 t)) 1523 t))
1525 (error nil)) 1524 (error nil))
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el
index 515bbc36a06..7fc6bf7b920 100644
--- a/lisp/emacs-lisp/timer.el
+++ b/lisp/emacs-lisp/timer.el
@@ -290,42 +290,50 @@ This function is called, by name, directly by the C code."
290 (cell 290 (cell
291 ;; Delete from queue. Record the cons cell that was used. 291 ;; Delete from queue. Record the cons cell that was used.
292 (cancel-timer-internal timer))) 292 (cancel-timer-internal timer)))
293 ;; Re-schedule if requested. 293 ;; If `cell' is nil, it means the timer was already canceled, so we
294 (if (timer--repeat-delay timer) 294 ;; shouldn't be running it at all. This can happen for example with the
295 (if (timer--idle-delay timer) 295 ;; following scenario (bug#17392):
296 (timer-activate-when-idle timer nil cell) 296 ;; - we run timers, starting with A (and remembering the rest as (B C)).
297 (timer-inc-time timer (timer--repeat-delay timer) 0) 297 ;; - A runs and a does a sit-for.
298 ;; If real time has jumped forward, 298 ;; - during sit-for we run timer D which cancels timer B.
299 ;; perhaps because Emacs was suspended for a long time, 299 ;; - timer A finally finishes, so we move on to timers B and C.
300 ;; limit how many times things get repeated. 300 (when cell
301 (if (and (numberp timer-max-repeats) 301 ;; Re-schedule if requested.
302 (< 0 (timer-until timer (current-time)))) 302 (if (timer--repeat-delay timer)
303 (let ((repeats (/ (timer-until timer (current-time)) 303 (if (timer--idle-delay timer)
304 (timer--repeat-delay timer)))) 304 (timer-activate-when-idle timer nil cell)
305 (if (> repeats timer-max-repeats) 305 (timer-inc-time timer (timer--repeat-delay timer) 0)
306 (timer-inc-time timer (* (timer--repeat-delay timer) 306 ;; If real time has jumped forward,
307 repeats))))) 307 ;; perhaps because Emacs was suspended for a long time,
308 ;; Place it back on the timer-list before running 308 ;; limit how many times things get repeated.
309 ;; timer--function, so it can cancel-timer itself. 309 (if (and (numberp timer-max-repeats)
310 (timer-activate timer t cell) 310 (< 0 (timer-until timer (current-time))))
311 (setq retrigger t))) 311 (let ((repeats (/ (timer-until timer (current-time))
312 ;; Run handler. 312 (timer--repeat-delay timer))))
313 (condition-case-unless-debug err 313 (if (> repeats timer-max-repeats)
314 ;; Timer functions should not change the current buffer. 314 (timer-inc-time timer (* (timer--repeat-delay timer)
315 ;; If they do, all kinds of nasty surprises can happen, 315 repeats)))))
316 ;; and it can be hellish to track down their source. 316 ;; Place it back on the timer-list before running
317 (save-current-buffer 317 ;; timer--function, so it can cancel-timer itself.
318 (apply (timer--function timer) (timer--args timer))) 318 (timer-activate timer t cell)
319 (error (message "Error running timer%s: %S" 319 (setq retrigger t)))
320 (if (symbolp (timer--function timer)) 320 ;; Run handler.
321 (format " `%s'" (timer--function timer)) "") 321 (condition-case-unless-debug err
322 err))) 322 ;; Timer functions should not change the current buffer.
323 (when (and retrigger 323 ;; If they do, all kinds of nasty surprises can happen,
324 ;; If the timer's been canceled, don't "retrigger" it 324 ;; and it can be hellish to track down their source.
325 ;; since it might still be in the copy of timer-list kept 325 (save-current-buffer
326 ;; by keyboard.c:timer_check (bug#14156). 326 (apply (timer--function timer) (timer--args timer)))
327 (memq timer timer-list)) 327 (error (message "Error running timer%s: %S"
328 (setf (timer--triggered timer) nil))))) 328 (if (symbolp (timer--function timer))
329 (format " `%s'" (timer--function timer)) "")
330 err)))
331 (when (and retrigger
332 ;; If the timer's been canceled, don't "retrigger" it
333 ;; since it might still be in the copy of timer-list kept
334 ;; by keyboard.c:timer_check (bug#14156).
335 (memq timer timer-list))
336 (setf (timer--triggered timer) nil))))))
329 337
330;; This function is incompatible with the one in levents.el. 338;; This function is incompatible with the one in levents.el.
331(defun timeout-event-p (event) 339(defun timeout-event-p (event)
diff --git a/lisp/frame.el b/lisp/frame.el
index f081df788ec..5e9b5351005 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -1107,10 +1107,10 @@ number of lines and columns.
1107 1107
1108If FRAMES is nil, apply the font to the selected frame only. 1108If FRAMES is nil, apply the font to the selected frame only.
1109If FRAMES is non-nil, it should be a list of frames to act upon, 1109If FRAMES is non-nil, it should be a list of frames to act upon,
1110or t meaning all graphical frames. Also, if FRAME is non-nil, 1110or t meaning all existing graphical frames.
1111alter the user's Customization settings as though the 1111Also, if FRAMES is non-nil, alter the user's Customization settings
1112font-related attributes of the `default' face had been \"set in 1112as though the font-related attributes of the `default' face had been
1113this session\", so that the font is applied to future frames." 1113\"set in this session\", so that the font is applied to future frames."
1114 (interactive 1114 (interactive
1115 (let* ((completion-ignore-case t) 1115 (let* ((completion-ignore-case t)
1116 (font (completing-read "Font name: " 1116 (font (completing-read "Font name: "
@@ -1822,9 +1822,7 @@ terminals, cursor blinking is controlled by the terminal."
1822 :initialize 'custom-initialize-delay 1822 :initialize 'custom-initialize-delay
1823 :group 'cursor 1823 :group 'cursor
1824 :global t 1824 :global t
1825 (if blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer)) 1825 (blink-cursor-suspend)
1826 (setq blink-cursor-idle-timer nil)
1827 (blink-cursor-end)
1828 (remove-hook 'focus-in-hook #'blink-cursor-check) 1826 (remove-hook 'focus-in-hook #'blink-cursor-check)
1829 (remove-hook 'focus-out-hook #'blink-cursor-suspend) 1827 (remove-hook 'focus-out-hook #'blink-cursor-suspend)
1830 (when blink-cursor-mode 1828 (when blink-cursor-mode
diff --git a/lisp/hippie-exp.el b/lisp/hippie-exp.el
index 51c8c3c3d7e..d3b8a2cf6c5 100644
--- a/lisp/hippie-exp.el
+++ b/lisp/hippie-exp.el
@@ -715,7 +715,7 @@ string). It returns t if a new completion is found, nil otherwise."
715 715
716(defun he-line-search-regexp (pat strip-prompt) 716(defun he-line-search-regexp (pat strip-prompt)
717 (if strip-prompt 717 (if strip-prompt
718 (concat "\\(" comint-prompt-regexp "\\|^\\s-*\\)\\(" 718 (concat "\\(" comint-prompt-regexp "\\|^\\s-*\\)\\(?2:"
719 (regexp-quote pat) 719 (regexp-quote pat)
720 "[^\n]*[^ \t\n]\\)") 720 "[^\n]*[^ \t\n]\\)")
721 (concat "^\\(\\s-*\\)\\(" 721 (concat "^\\(\\s-*\\)\\("
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 436d8f611a8..f9cbc62b464 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -662,7 +662,7 @@ by \"Save Options\" in Custom buffers.")
662;; Function for setting/saving default font. 662;; Function for setting/saving default font.
663 663
664(defun menu-set-font () 664(defun menu-set-font ()
665 "Interactively select a font and make it the default." 665 "Interactively select a font and make it the default on all existing frames."
666 (interactive) 666 (interactive)
667 (set-frame-font (if (fboundp 'x-select-font) 667 (set-frame-font (if (fboundp 'x-select-font)
668 (x-select-font) 668 (x-select-font)
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 2f898fa1ba5..cfff1533e48 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -529,7 +529,7 @@ for use at QPOS."
529 (let* ((qpos pred) 529 (let* ((qpos pred)
530 (ustring (funcall unquote string)) 530 (ustring (funcall unquote string))
531 (uprefix (funcall unquote (substring string 0 qpos))) 531 (uprefix (funcall unquote (substring string 0 qpos)))
532 ;; FIXME: we really should pass `qpos' to `unuote' and have that 532 ;; FIXME: we really should pass `qpos' to `unquote' and have that
533 ;; function give us the corresponding `uqpos'. But for now we 533 ;; function give us the corresponding `uqpos'. But for now we
534 ;; presume (more or less) that `concat' and `unquote' commute. 534 ;; presume (more or less) that `concat' and `unquote' commute.
535 (uqpos (if (string-prefix-p uprefix ustring) 535 (uqpos (if (string-prefix-p uprefix ustring)
diff --git a/lisp/mouse.el b/lisp/mouse.el
index ca94a343c1a..15f89291af9 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -26,8 +26,6 @@
26;; This package provides various useful commands (including help 26;; This package provides various useful commands (including help
27;; system access) through the mouse. All this code assumes that mouse 27;; system access) through the mouse. All this code assumes that mouse
28;; interpretation has been abstracted into Emacs input events. 28;; interpretation has been abstracted into Emacs input events.
29;;
30;; The code is rather X-dependent.
31 29
32;;; Code: 30;;; Code:
33 31
diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el
index 4d146a33248..7f230a9d2ab 100644
--- a/lisp/net/dbus.el
+++ b/lisp/net/dbus.el
@@ -277,6 +277,8 @@ object is returned instead of a list containing this single Lisp object.
277 277
278 => \"i686\"" 278 => \"i686\""
279 279
280 (or (featurep 'dbusbind)
281 (signal 'dbus-error (list "Emacs not compiled with dbus support")))
280 (or (memq bus '(:system :session)) (stringp bus) 282 (or (memq bus '(:system :session)) (stringp bus)
281 (signal 'wrong-type-argument (list 'keywordp bus))) 283 (signal 'wrong-type-argument (list 'keywordp bus)))
282 (or (stringp service) 284 (or (stringp service)
@@ -380,6 +382,8 @@ Example:
380 382
381 -| i686" 383 -| i686"
382 384
385 (or (featurep 'dbusbind)
386 (signal 'dbus-error (list "Emacs not compiled with dbus support")))
383 (or (memq bus '(:system :session)) (stringp bus) 387 (or (memq bus '(:system :session)) (stringp bus)
384 (signal 'wrong-type-argument (list 'keywordp bus))) 388 (signal 'wrong-type-argument (list 'keywordp bus)))
385 (or (stringp service) 389 (or (stringp service)
@@ -428,6 +432,8 @@ Example:
428 :session nil \"/org/gnu/Emacs\" \"org.gnu.Emacs.FileManager\" 432 :session nil \"/org/gnu/Emacs\" \"org.gnu.Emacs.FileManager\"
429 \"FileModified\" \"/home/albinus/.emacs\")" 433 \"FileModified\" \"/home/albinus/.emacs\")"
430 434
435 (or (featurep 'dbusbind)
436 (signal 'dbus-error (list "Emacs not compiled with dbus support")))
431 (or (memq bus '(:system :session)) (stringp bus) 437 (or (memq bus '(:system :session)) (stringp bus)
432 (signal 'wrong-type-argument (list 'keywordp bus))) 438 (signal 'wrong-type-argument (list 'keywordp bus)))
433 (or (null service) (stringp service) 439 (or (null service) (stringp service)
@@ -446,6 +452,8 @@ Example:
446 "Return for message SERIAL on the D-Bus BUS. 452 "Return for message SERIAL on the D-Bus BUS.
447This is an internal function, it shall not be used outside dbus.el." 453This is an internal function, it shall not be used outside dbus.el."
448 454
455 (or (featurep 'dbusbind)
456 (signal 'dbus-error (list "Emacs not compiled with dbus support")))
449 (or (memq bus '(:system :session)) (stringp bus) 457 (or (memq bus '(:system :session)) (stringp bus)
450 (signal 'wrong-type-argument (list 'keywordp bus))) 458 (signal 'wrong-type-argument (list 'keywordp bus)))
451 (or (stringp service) 459 (or (stringp service)
@@ -460,6 +468,8 @@ This is an internal function, it shall not be used outside dbus.el."
460 "Return error message for message SERIAL on the D-Bus BUS. 468 "Return error message for message SERIAL on the D-Bus BUS.
461This is an internal function, it shall not be used outside dbus.el." 469This is an internal function, it shall not be used outside dbus.el."
462 470
471 (or (featurep 'dbusbind)
472 (signal 'dbus-error (list "Emacs not compiled with dbus support")))
463 (or (memq bus '(:system :session)) (stringp bus) 473 (or (memq bus '(:system :session)) (stringp bus)
464 (signal 'wrong-type-argument (list 'keywordp bus))) 474 (signal 'wrong-type-argument (list 'keywordp bus)))
465 (or (stringp service) 475 (or (stringp service)
@@ -1763,6 +1773,8 @@ connection used in the same Emacs process, like the one established by
1763GTK+. It should be used with care for at least the `:system' and 1773GTK+. It should be used with care for at least the `:system' and
1764`:session' buses, because other Emacs Lisp packages might already use 1774`:session' buses, because other Emacs Lisp packages might already use
1765this connection to those buses." 1775this connection to those buses."
1776 (or (featurep 'dbusbind)
1777 (signal 'dbus-error (list "Emacs not compiled with dbus support")))
1766 (dbus--init-bus bus private) 1778 (dbus--init-bus bus private)
1767 (dbus-register-signal 1779 (dbus-register-signal
1768 bus nil dbus-path-local dbus-interface-local 1780 bus nil dbus-path-local dbus-interface-local
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 900e1c812ae..15aa1329817 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -4137,7 +4137,7 @@ Goes through the list `tramp-local-coding-commands' and
4137 tmpfile) 4137 tmpfile)
4138 (while (string-match (regexp-quote "-") name) 4138 (while (string-match (regexp-quote "-") name)
4139 (setq name (replace-match "_" nil t name))) 4139 (setq name (replace-match "_" nil t name)))
4140 (when (string-match "%t" value) 4140 (when (string-match "\\(^\\|[^%]\\)%t" value)
4141 (setq tmpfile 4141 (setq tmpfile
4142 (make-temp-name 4142 (make-temp-name
4143 (expand-file-name 4143 (expand-file-name
diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index cd50bce2152..b3ce7aaac25 100644
--- a/lisp/nxml/nxml-mode.el
+++ b/lisp/nxml/nxml-mode.el
@@ -2630,8 +2630,9 @@ With a prefix argument, inserts the character directly."
2630(put 'entity-ref 'nxml-friendly-name "entity reference") 2630(put 'entity-ref 'nxml-friendly-name "entity reference")
2631(put 'char-ref 'nxml-friendly-name "character reference") 2631(put 'char-ref 'nxml-friendly-name "character reference")
2632 2632
2633;;;###autoload 2633;; Only do this in loaddefs, so that if someone defines a different
2634(defalias 'xml-mode 'nxml-mode) 2634;; alias in .emacs, loading this file afterwards does not clobber it.
2635;;;###autoload(defalias 'xml-mode 'nxml-mode)
2635 2636
2636(provide 'nxml-mode) 2637(provide 'nxml-mode)
2637 2638
diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el
index 14f8dd65083..c47a3bd6fbe 100644
--- a/lisp/progmodes/scheme.el
+++ b/lisp/progmodes/scheme.el
@@ -99,7 +99,7 @@
99 (modify-syntax-entry ?\( "() " st) 99 (modify-syntax-entry ?\( "() " st)
100 (modify-syntax-entry ?\) ")( " st) 100 (modify-syntax-entry ?\) ")( " st)
101 ;; It's used for single-line comments as well as for #;(...) sexp-comments. 101 ;; It's used for single-line comments as well as for #;(...) sexp-comments.
102 (modify-syntax-entry ?\; "< 2 " st) 102 (modify-syntax-entry ?\; "<" st)
103 (modify-syntax-entry ?\" "\" " st) 103 (modify-syntax-entry ?\" "\" " st)
104 (modify-syntax-entry ?' "' " st) 104 (modify-syntax-entry ?' "' " st)
105 (modify-syntax-entry ?` "' " st) 105 (modify-syntax-entry ?` "' " st)
@@ -147,19 +147,15 @@
147 (setq-local lisp-indent-function 'scheme-indent-function) 147 (setq-local lisp-indent-function 'scheme-indent-function)
148 (setq mode-line-process '("" scheme-mode-line-process)) 148 (setq mode-line-process '("" scheme-mode-line-process))
149 (setq-local imenu-case-fold-search t) 149 (setq-local imenu-case-fold-search t)
150 (setq imenu-generic-expression scheme-imenu-generic-expression) 150 (setq-local imenu-generic-expression scheme-imenu-generic-expression)
151 (setq-local imenu-syntax-alist 151 (setq-local imenu-syntax-alist '(("+-*/.<>=?!$%_&~^:" . "w")))
152 '(("+-*/.<>=?!$%_&~^:" . "w"))) 152 (setq-local syntax-propertize-function #'scheme-syntax-propertize)
153 (setq font-lock-defaults 153 (setq font-lock-defaults
154 '((scheme-font-lock-keywords 154 '((scheme-font-lock-keywords
155 scheme-font-lock-keywords-1 scheme-font-lock-keywords-2) 155 scheme-font-lock-keywords-1 scheme-font-lock-keywords-2)
156 nil t (("+-*/.<>=!?$%_&~^:" . "w") (?#. "w 14")) 156 nil t (("+-*/.<>=!?$%_&~^:" . "w") (?#. "w 14"))
157 beginning-of-defun 157 beginning-of-defun
158 (font-lock-mark-block-function . mark-defun) 158 (font-lock-mark-block-function . mark-defun)))
159 (font-lock-syntactic-face-function
160 . scheme-font-lock-syntactic-face-function)
161 (parse-sexp-lookup-properties . t)
162 (font-lock-extra-managed-props syntax-table)))
163 (setq-local lisp-doc-string-elt-property 'scheme-doc-string-elt)) 159 (setq-local lisp-doc-string-elt-property 'scheme-doc-string-elt))
164 160
165(defvar scheme-mode-line-process "") 161(defvar scheme-mode-line-process "")
@@ -354,28 +350,28 @@ See `run-hooks'."
354 (forward-comment (point-max)) 350 (forward-comment (point-max))
355 (if (eq (char-after) ?\() 2 0))) 351 (if (eq (char-after) ?\() 2 0)))
356 352
357(defun scheme-font-lock-syntactic-face-function (state) 353(defun scheme-syntax-propertize (beg end)
358 (when (and (null (nth 3 state)) 354 (goto-char beg)
359 (eq (char-after (nth 8 state)) ?#) 355 (scheme-syntax-propertize-sexp-comment (point) end)
360 (eq (char-after (1+ (nth 8 state))) ?\;)) 356 (funcall
361 ;; It's a sexp-comment. Tell parse-partial-sexp where it ends. 357 (syntax-propertize-rules
362 (save-excursion 358 ("\\(#\\);" (1 (prog1 "< cn"
363 (let ((pos (point)) 359 (scheme-syntax-propertize-sexp-comment (point) end)))))
364 (end 360 (point) end))
365 (condition-case err 361
366 (let ((parse-sexp-lookup-properties nil)) 362(defun scheme-syntax-propertize-sexp-comment (_ end)
367 (goto-char (+ 2 (nth 8 state))) 363 (let ((state (syntax-ppss)))
368 ;; FIXME: this doesn't handle the case where the sexp 364 (when (eq 2 (nth 7 state))
369 ;; itself contains a #; comment. 365 ;; It's a sexp-comment. Tell parse-partial-sexp where it ends.
370 (forward-sexp 1) 366 (condition-case nil
371 (point)) 367 (progn
372 (scan-error (nth 2 err))))) 368 (goto-char (+ 2 (nth 8 state)))
373 (when (< pos (- end 2)) 369 ;; FIXME: this doesn't handle the case where the sexp
374 (put-text-property pos (- end 2) 370 ;; itself contains a #; comment.
375 'syntax-table scheme-sexp-comment-syntax-table)) 371 (forward-sexp 1)
376 (put-text-property (- end 1) end 'syntax-table '(12))))) 372 (put-text-property (1- (point)) (point)
377 ;; Choose the face to use. 373 'syntax-table (string-to-syntax "> cn")))
378 (lisp-font-lock-syntactic-face-function state)) 374 (scan-error (goto-char end))))))
379 375
380;;;###autoload 376;;;###autoload
381(define-derived-mode dsssl-mode scheme-mode "DSSSL" 377(define-derived-mode dsssl-mode scheme-mode "DSSSL"
diff --git a/lisp/simple.el b/lisp/simple.el
index af8e47c2383..e5b0203866c 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5069,7 +5069,15 @@ When the `track-eol' feature is doing its job, the value is
5069`most-positive-fixnum'.") 5069`most-positive-fixnum'.")
5070 5070
5071(defcustom line-move-ignore-invisible t 5071(defcustom line-move-ignore-invisible t
5072 "Non-nil means \\[next-line] and \\[previous-line] ignore invisible lines. 5072 "Non-nil means commands that move by lines ignore invisible newlines.
5073When this option is non-nil, \\[next-line], \\[previous-line], \\[move-end-of-line], and \\[move-beginning-of-line] behave
5074as if newlines that are invisible didn't exist, and count
5075only visible newlines. Thus, moving across across 2 newlines
5076one of which is invisible will be counted as a one-line move.
5077Also, a non-nil value causes invisible text to be ignored when
5078counting columns for the purposes of keeping point in the same
5079column by \\[next-line] and \\[previous-line].
5080
5073Outline mode sets this." 5081Outline mode sets this."
5074 :type 'boolean 5082 :type 'boolean
5075 :group 'editing-basics) 5083 :group 'editing-basics)
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index 703b46eb113..6b064260f95 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -886,10 +886,9 @@ and CVS."
886 (minor-num (string-to-number (vc-rcs-minor-part rev)))) 886 (minor-num (string-to-number (vc-rcs-minor-part rev))))
887 (concat branch "." (number-to-string (1+ minor-num)))))) 887 (concat branch "." (number-to-string (1+ minor-num))))))
888 888
889;; Note that most GNU/Linux distributions seem to supply rcs2log in a 889;; You might think that this should be distributed with RCS, but
890;; standard bin directory. Eg both Red Hat and Debian include it in 890;; apparently not. CVS sometimes provides a version of it.
891;; their cvs packages. It's not obvious why Emacs still needs to 891;; http://lists.gnu.org/archive/html/emacs-devel/2014-05/msg00288.html
892;; provide it as well...
893(defvar vc-rcs-rcs2log-program 892(defvar vc-rcs-rcs2log-program
894 (let (exe) 893 (let (exe)
895 (cond ((file-executable-p 894 (cond ((file-executable-p
diff --git a/lisp/window.el b/lisp/window.el
index 60f13e65c4e..c5093ca51a5 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1079,7 +1079,6 @@ WINDOW-OR-FRAME can be a frame or a window and defaults to the
1079selected frame. When WINDOW-OR-FRAME is a window, dump that 1079selected frame. When WINDOW-OR-FRAME is a window, dump that
1080window's frame. The buffer *window-frame-dump* is erased before 1080window's frame. The buffer *window-frame-dump* is erased before
1081dumping to it." 1081dumping to it."
1082 (interactive)
1083 (let* ((window 1082 (let* ((window
1084 (cond 1083 (cond
1085 ((or (not window-or-frame) 1084 ((or (not window-or-frame)
@@ -1102,7 +1101,9 @@ dumping to it."
1102 (frame-text-width frame) (frame-text-height frame) 1101 (frame-text-width frame) (frame-text-height frame)
1103 (frame-text-cols frame) (frame-text-lines frame)) 1102 (frame-text-cols frame) (frame-text-lines frame))
1104 (format "tool: %s scroll: %s fringe: %s border: %s right: %s bottom: %s\n\n" 1103 (format "tool: %s scroll: %s fringe: %s border: %s right: %s bottom: %s\n\n"
1105 (tool-bar-height frame t) 1104 (if (fboundp 'tool-bar-height)
1105 (tool-bar-height frame t)
1106 "0")
1106 (frame-scroll-bar-width frame) 1107 (frame-scroll-bar-width frame)
1107 (frame-fringe-width frame) 1108 (frame-fringe-width frame)
1108 (frame-border-width frame) 1109 (frame-border-width frame)
diff --git a/src/ChangeLog b/src/ChangeLog
index f40931cbabc..76117451b16 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,52 @@
12014-05-26 Eli Zaretskii <eliz@gnu.org>
2
3 * xdisp.c (move_it_in_display_line_to): Don't record wrap position
4 if we are iterating over an object that generates glyphs for
5 marginal areas. (Bug#17585)
6
72014-05-26 Paul Eggert <eggert@cs.ucla.edu>
8
9 * xdisp.c (safe__call1, safe__eval): Now static.
10
112014-05-26 Eli Zaretskii <eliz@gnu.org>
12
13 * xdisp.c (safe__call): Accept va_list argument instead of '...'.
14 (safe_call, safe__call1): Construct a va_list argument for safe_call.
15 (safe_call1): Call safe_call instead of safe__call directly.
16
172014-05-26 Ken Brown <kbrown@cornell.edu>
18
19 * w32term.c (x_delete_display) [CYGWIN]: Don't free
20 dpyinfo->w32_id_name, to make sure it doesn't get freed more than
21 once. (Bug#17510)
22
232014-05-26 Stefan Monnier <monnier@iro.umontreal.ca>
24
25 * xdisp.c: Bind inhibit-quit during pre-redisplay-function.
26 (safe__call, safe__call1, safe__eval): New functions.
27 (safe_call): Use it.
28 (prepare_menu_bars): Use it for pre-redisplay-function (bug#17577).
29 (display_mode_element): Same for `:eval'.
30
312014-05-26 Paul Eggert <eggert@cs.ucla.edu>
32
33 Fix port to 32-bit AIX (Bug#17540).
34 * unexaix.c (copy_text_and_data): Don't add text_scnptr to ptr
35 twice. _text already includes this offset.
36 (unrelocate_symbols): Don't cast 64-bit integer to pointer.
37
382014-05-26 Eli Zaretskii <eliz@gnu.org>
39
40 * xdisp.c (move_it_in_display_line_to): Avoid infinite recursion:
41 when closest_pos is identical to to_charpos, don't recurse, since
42 we already tried that, and failed. (Bug#17539)
43
44 * w32fns.c (unwind_create_frame) [GLYPH_DEBUG]: If we are
45 unwinding when frame's faces were not initialized yet, increment
46 the frame's image-cache reference count before calling
47 x_free_frame_resources. Don't dereference
48 dpyinfo->terminal->image_cache if it is NULL. (Bug#17524)
49
12014-05-25 Jan Djärv <jan.h.d@swipnet.se> 502014-05-25 Jan Djärv <jan.h.d@swipnet.se>
2 51
3 * nsfont.m (nsfont_draw): Simplify as arguments are adjusted in 52 * nsfont.m (nsfont_draw): Simplify as arguments are adjusted in
diff --git a/src/lisp.h b/src/lisp.h
index 40dd03c4fc4..2fd28359868 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1718,8 +1718,8 @@ struct Lisp_Hash_Table
1718 ratio, a float. */ 1718 ratio, a float. */
1719 Lisp_Object rehash_threshold; 1719 Lisp_Object rehash_threshold;
1720 1720
1721 /* Vector of hash codes.. If hash[I] is nil, this means that that 1721 /* Vector of hash codes. If hash[I] is nil, this means that the
1722 entry I is unused. */ 1722 I-th entry is unused. */
1723 Lisp_Object hash; 1723 Lisp_Object hash;
1724 1724
1725 /* Vector used to chain entries. If entry I is free, next[I] is the 1725 /* Vector used to chain entries. If entry I is free, next[I] is the
diff --git a/src/minibuf.c b/src/minibuf.c
index 06fe0c07df6..3042b13b7d6 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -396,7 +396,8 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
396 in previous recursive minibuffer, but was not set explicitly 396 in previous recursive minibuffer, but was not set explicitly
397 to t for this invocation, so set it to nil in this minibuffer. 397 to t for this invocation, so set it to nil in this minibuffer.
398 Save the old value now, before we change it. */ 398 Save the old value now, before we change it. */
399 specbind (intern ("minibuffer-completing-file-name"), Vminibuffer_completing_file_name); 399 specbind (intern ("minibuffer-completing-file-name"),
400 Vminibuffer_completing_file_name);
400 if (EQ (Vminibuffer_completing_file_name, Qlambda)) 401 if (EQ (Vminibuffer_completing_file_name, Qlambda))
401 Vminibuffer_completing_file_name = Qnil; 402 Vminibuffer_completing_file_name = Qnil;
402 403
diff --git a/src/unexaix.c b/src/unexaix.c
index c08d192b32c..c97d5cae2a8 100644
--- a/src/unexaix.c
+++ b/src/unexaix.c
@@ -379,7 +379,7 @@ copy_text_and_data (int new)
379 char *ptr; 379 char *ptr;
380 380
381 lseek (new, text_scnptr, SEEK_SET); 381 lseek (new, text_scnptr, SEEK_SET);
382 ptr = _text + text_scnptr; 382 ptr = _text;
383 end = ptr + f_ohdr.tsize; 383 end = ptr + f_ohdr.tsize;
384 write_segment (new, ptr, end); 384 write_segment (new, ptr, end);
385 385
@@ -606,7 +606,7 @@ unrelocate_symbols (int new, int a_out,
606 PERROR (a_name); 606 PERROR (a_name);
607 } 607 }
608 608
609 p = (int *) (ldrel.l_vaddr + d_reloc); 609 p = (int *) (intptr_t) (ldrel.l_vaddr + d_reloc);
610 610
611 switch (ldrel.l_symndx) { 611 switch (ldrel.l_symndx) {
612 case SYMNDX_TEXT: 612 case SYMNDX_TEXT:
diff --git a/src/w32fns.c b/src/w32fns.c
index fa988583f33..c9a83c98234 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -4244,6 +4244,17 @@ unwind_create_frame (Lisp_Object frame)
4244 { 4244 {
4245#ifdef GLYPH_DEBUG 4245#ifdef GLYPH_DEBUG
4246 struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); 4246 struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
4247
4248 /* If the frame's image cache refcount is still the same as our
4249 private shadow variable, it means we are unwinding a frame
4250 for which we didn't yet call init_frame_faces, where the
4251 refcount is incremented. Therefore, we increment it here, so
4252 that free_frame_faces, called in x_free_frame_resources
4253 below, will not mistakenly decrement the counter that was not
4254 incremented yet to account for this new frame. */
4255 if (FRAME_IMAGE_CACHE (f) != NULL
4256 && FRAME_IMAGE_CACHE (f)->refcount == image_cache_refcount)
4257 FRAME_IMAGE_CACHE (f)->refcount++;
4247#endif 4258#endif
4248 4259
4249 x_free_frame_resources (f); 4260 x_free_frame_resources (f);
@@ -4254,7 +4265,8 @@ unwind_create_frame (Lisp_Object frame)
4254 eassert (dpyinfo->reference_count == dpyinfo_refcount); 4265 eassert (dpyinfo->reference_count == dpyinfo_refcount);
4255 eassert ((dpyinfo->terminal->image_cache == NULL 4266 eassert ((dpyinfo->terminal->image_cache == NULL
4256 && image_cache_refcount == 0) 4267 && image_cache_refcount == 0)
4257 || dpyinfo->terminal->image_cache->refcount == image_cache_refcount); 4268 || (dpyinfo->terminal->image_cache != NULL
4269 && dpyinfo->terminal->image_cache->refcount == image_cache_refcount));
4258#endif 4270#endif
4259 return Qt; 4271 return Qt;
4260 } 4272 }
diff --git a/src/w32term.c b/src/w32term.c
index aa65af4afd3..8ca023a86cb 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -6419,7 +6419,11 @@ x_delete_display (struct w32_display_info *dpyinfo)
6419 if (dpyinfo->palette) 6419 if (dpyinfo->palette)
6420 DeleteObject (dpyinfo->palette); 6420 DeleteObject (dpyinfo->palette);
6421 } 6421 }
6422 /* Avoid freeing dpyinfo->w32_id_name more than once if emacs is
6423 running as a daemon; see bug#17510. */
6424#ifndef CYGWIN
6422 xfree (dpyinfo->w32_id_name); 6425 xfree (dpyinfo->w32_id_name);
6426#endif
6423 6427
6424 w32_reset_fringes (); 6428 w32_reset_fringes ();
6425} 6429}
diff --git a/src/xdisp.c b/src/xdisp.c
index ab492d098d0..1585164f439 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2591,8 +2591,8 @@ safe_eval_handler (Lisp_Object arg, ptrdiff_t nargs, Lisp_Object *args)
2591 following. Return the result, or nil if something went 2591 following. Return the result, or nil if something went
2592 wrong. Prevent redisplay during the evaluation. */ 2592 wrong. Prevent redisplay during the evaluation. */
2593 2593
2594Lisp_Object 2594static Lisp_Object
2595safe_call (ptrdiff_t nargs, Lisp_Object func, ...) 2595safe__call (bool inhibit_quit, ptrdiff_t nargs, Lisp_Object func, va_list ap)
2596{ 2596{
2597 Lisp_Object val; 2597 Lisp_Object val;
2598 2598
@@ -2600,21 +2600,20 @@ safe_call (ptrdiff_t nargs, Lisp_Object func, ...)
2600 val = Qnil; 2600 val = Qnil;
2601 else 2601 else
2602 { 2602 {
2603 va_list ap;
2604 ptrdiff_t i; 2603 ptrdiff_t i;
2605 ptrdiff_t count = SPECPDL_INDEX (); 2604 ptrdiff_t count = SPECPDL_INDEX ();
2606 struct gcpro gcpro1; 2605 struct gcpro gcpro1;
2607 Lisp_Object *args = alloca (nargs * word_size); 2606 Lisp_Object *args = alloca (nargs * word_size);
2608 2607
2609 args[0] = func; 2608 args[0] = func;
2610 va_start (ap, func);
2611 for (i = 1; i < nargs; i++) 2609 for (i = 1; i < nargs; i++)
2612 args[i] = va_arg (ap, Lisp_Object); 2610 args[i] = va_arg (ap, Lisp_Object);
2613 va_end (ap);
2614 2611
2615 GCPRO1 (args[0]); 2612 GCPRO1 (args[0]);
2616 gcpro1.nvars = nargs; 2613 gcpro1.nvars = nargs;
2617 specbind (Qinhibit_redisplay, Qt); 2614 specbind (Qinhibit_redisplay, Qt);
2615 if (inhibit_quit)
2616 specbind (Qinhibit_quit, Qt);
2618 /* Use Qt to ensure debugger does not run, 2617 /* Use Qt to ensure debugger does not run,
2619 so there is no possibility of wanting to redisplay. */ 2618 so there is no possibility of wanting to redisplay. */
2620 val = internal_condition_case_n (Ffuncall, nargs, args, Qt, 2619 val = internal_condition_case_n (Ffuncall, nargs, args, Qt,
@@ -2626,6 +2625,17 @@ safe_call (ptrdiff_t nargs, Lisp_Object func, ...)
2626 return val; 2625 return val;
2627} 2626}
2628 2627
2628Lisp_Object
2629safe_call (ptrdiff_t nargs, Lisp_Object func, ...)
2630{
2631 Lisp_Object retval;
2632 va_list ap;
2633
2634 va_start (ap, func);
2635 retval = safe__call (false, nargs, func, ap);
2636 va_end (ap);
2637 return retval;
2638}
2629 2639
2630/* Call function FN with one argument ARG. 2640/* Call function FN with one argument ARG.
2631 Return the result, or nil if something went wrong. */ 2641 Return the result, or nil if something went wrong. */
@@ -2636,12 +2646,30 @@ safe_call1 (Lisp_Object fn, Lisp_Object arg)
2636 return safe_call (2, fn, arg); 2646 return safe_call (2, fn, arg);
2637} 2647}
2638 2648
2649static Lisp_Object
2650safe__call1 (bool inhibit_quit, Lisp_Object fn, ...)
2651{
2652 Lisp_Object retval;
2653 va_list ap;
2654
2655 va_start (ap, fn);
2656 retval = safe__call (inhibit_quit, 2, fn, ap);
2657 va_end (ap);
2658 return retval;
2659}
2660
2639static Lisp_Object Qeval; 2661static Lisp_Object Qeval;
2640 2662
2641Lisp_Object 2663Lisp_Object
2642safe_eval (Lisp_Object sexpr) 2664safe_eval (Lisp_Object sexpr)
2643{ 2665{
2644 return safe_call1 (Qeval, sexpr); 2666 return safe__call1 (false, Qeval, sexpr);
2667}
2668
2669static Lisp_Object
2670safe__eval (bool inhibit_quit, Lisp_Object sexpr)
2671{
2672 return safe__call1 (inhibit_quit, Qeval, sexpr);
2645} 2673}
2646 2674
2647/* Call function FN with two arguments ARG1 and ARG2. 2675/* Call function FN with two arguments ARG1 and ARG2.
@@ -8528,7 +8556,7 @@ move_it_in_display_line_to (struct it *it,
8528 } 8556 }
8529 else 8557 else
8530 { 8558 {
8531 if (it->line_wrap == WORD_WRAP) 8559 if (it->line_wrap == WORD_WRAP && it->area == TEXT_AREA)
8532 { 8560 {
8533 if (IT_DISPLAYING_WHITESPACE (it)) 8561 if (IT_DISPLAYING_WHITESPACE (it))
8534 may_wrap = 1; 8562 may_wrap = 1;
@@ -8812,8 +8840,11 @@ move_it_in_display_line_to (struct it *it,
8812 if (closest_pos < ZV) 8840 if (closest_pos < ZV)
8813 { 8841 {
8814 RESTORE_IT (it, &ppos_it, ppos_data); 8842 RESTORE_IT (it, &ppos_it, ppos_data);
8815 move_it_in_display_line_to (it, closest_pos, -1, 8843 /* Don't recurse if closest_pos is equal to
8816 MOVE_TO_POS); 8844 to_charpos, since we have just tried that. */
8845 if (closest_pos != to_charpos)
8846 move_it_in_display_line_to (it, closest_pos, -1,
8847 MOVE_TO_POS);
8817 result = MOVE_POS_MATCH_OR_ZV; 8848 result = MOVE_POS_MATCH_OR_ZV;
8818 } 8849 }
8819 else 8850 else
@@ -8874,8 +8905,9 @@ move_it_in_display_line_to (struct it *it,
8874 && !at_eob_p && closest_pos < ZV) 8905 && !at_eob_p && closest_pos < ZV)
8875 { 8906 {
8876 RESTORE_IT (it, &ppos_it, ppos_data); 8907 RESTORE_IT (it, &ppos_it, ppos_data);
8877 move_it_in_display_line_to (it, closest_pos, -1, 8908 if (closest_pos != to_charpos)
8878 MOVE_TO_POS); 8909 move_it_in_display_line_to (it, closest_pos, -1,
8910 MOVE_TO_POS);
8879 } 8911 }
8880 result = MOVE_POS_MATCH_OR_ZV; 8912 result = MOVE_POS_MATCH_OR_ZV;
8881 break; 8913 break;
@@ -8893,7 +8925,9 @@ move_it_in_display_line_to (struct it *it,
8893 if (closest_pos < ZV) 8925 if (closest_pos < ZV)
8894 { 8926 {
8895 RESTORE_IT (it, &ppos_it, ppos_data); 8927 RESTORE_IT (it, &ppos_it, ppos_data);
8896 move_it_in_display_line_to (it, closest_pos, -1, MOVE_TO_POS); 8928 if (closest_pos != to_charpos)
8929 move_it_in_display_line_to (it, closest_pos, -1,
8930 MOVE_TO_POS);
8897 } 8931 }
8898 result = MOVE_POS_MATCH_OR_ZV; 8932 result = MOVE_POS_MATCH_OR_ZV;
8899 break; 8933 break;
@@ -11543,7 +11577,7 @@ prepare_menu_bars (void)
11543 } 11577 }
11544 } 11578 }
11545 } 11579 }
11546 safe_call1 (Vpre_redisplay_function, windows); 11580 safe__call1 (true, Vpre_redisplay_function, windows);
11547 } 11581 }
11548 11582
11549 /* Update all frame titles based on their buffer names, etc. We do 11583 /* Update all frame titles based on their buffer names, etc. We do
@@ -21857,7 +21891,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
21857 if (CONSP (XCDR (elt))) 21891 if (CONSP (XCDR (elt)))
21858 { 21892 {
21859 Lisp_Object spec; 21893 Lisp_Object spec;
21860 spec = safe_eval (XCAR (XCDR (elt))); 21894 spec = safe__eval (true, XCAR (XCDR (elt)));
21861 n += display_mode_element (it, depth, field_width - n, 21895 n += display_mode_element (it, depth, field_width - n,
21862 precision - n, spec, props, 21896 precision - n, spec, props,
21863 risky); 21897 risky);
diff --git a/test/automated/advice-tests.el b/test/automated/advice-tests.el
index e0c3b40487e..a87d979f919 100644
--- a/test/automated/advice-tests.el
+++ b/test/automated/advice-tests.el
@@ -184,6 +184,7 @@ function being an around advice."
184 (sm-advice (lambda (x) (if (consp x) (list (* 5 (car x))) (* 4 x))))) 184 (sm-advice (lambda (x) (if (consp x) (list (* 5 (car x))) (* 4 x)))))
185 (should (equal (funcall sm-test10 5) 15)) 185 (should (equal (funcall sm-test10 5) 15))
186 (add-function :filter-args (var sm-test10) sm-advice) 186 (add-function :filter-args (var sm-test10) sm-advice)
187 (should (advice-function-member-p sm-advice sm-test10))
187 (should (equal (funcall sm-test10 5) 35)) 188 (should (equal (funcall sm-test10 5) 35))
188 (add-function :filter-return (var sm-test10) sm-advice) 189 (add-function :filter-return (var sm-test10) sm-advice)
189 (should (equal (funcall sm-test10 5) 60)) 190 (should (equal (funcall sm-test10 5) 60))