emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master eb27fc4 5/7: Merge branch 'master' of git.sv.gnu.or


From: Michael Mauger
Subject: [Emacs-diffs] master eb27fc4 5/7: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Date: Sun, 6 Aug 2017 20:59:21 -0400 (EDT)

branch: master
commit eb27fc4d49e8c914cd0e6a8a2d02159601542141
Merge: 7f62a4a c24748a
Author: Michael R. Mauger <address@hidden>
Commit: Michael R. Mauger <address@hidden>

    Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
---
 ChangeLog.2                                        |   8 +-
 doc/emacs/killing.texi                             |   2 +-
 doc/lispref/hooks.texi                             |   5 -
 doc/misc/org.texi                                  |  18 +-
 etc/ORG-NEWS                                       |  14 +-
 lisp/ChangeLog.16                                  |   4 +-
 lisp/auth-source.el                                |   2 +-
 lisp/calendar/todo-mode.el                         | 280 +++++++-----
 lisp/dired-aux.el                                  |   4 +-
 lisp/dired-x.el                                    |   4 +-
 lisp/emacs-lisp/lisp-mode.el                       |  14 +-
 lisp/erc/ChangeLog.2                               |   2 +-
 lisp/help-fns.el                                   |   6 +-
 lisp/mouse.el                                      |   2 +-
 lisp/org/ob-J.el                                   |   2 +-
 lisp/org/ob-ebnf.el                                |   4 +-
 lisp/org/ob-exp.el                                 |   2 +-
 lisp/org/ob-lua.el                                 |   2 +-
 lisp/org/ob-sql.el                                 |   2 +-
 lisp/org/org-bbdb.el                               |   2 +-
 lisp/org/org-bibtex.el                             |   4 +-
 lisp/org/org-footnote.el                           |   2 +-
 lisp/org/org-table.el                              |   2 +-
 lisp/org/org-timer.el                              |   6 +-
 lisp/org/org.el                                    |   8 +-
 lisp/org/ox-ascii.el                               |   5 +-
 lisp/org/ox-man.el                                 |   2 +-
 lisp/org/ox-publish.el                             |   2 +-
 lisp/proced.el                                     |   2 +-
 lisp/progmodes/cc-mode.el                          |   2 +-
 lisp/progmodes/f90.el                              |   4 +-
 lisp/ses.el                                        |   4 +-
 lisp/tar-mode.el                                   |   2 +-
 lisp/window.el                                     |   2 +-
 src/window.c                                       |   6 +-
 src/xdisp.c                                        |  19 -
 .../calendar/todo-mode-resources/todo-test-1.toda  |   6 +-
 .../calendar/todo-mode-resources/todo-test-1.todo  |  14 +-
 test/lisp/calendar/todo-mode-tests.el              | 470 +++++++++++++++++++--
 test/lisp/emacs-lisp/lisp-mode-tests.el            |  26 ++
 test/lisp/epg-tests.el                             |  13 +-
 test/manual/etags/tex-src/gzip.texi                |   2 +-
 42 files changed, 739 insertions(+), 243 deletions(-)

diff --git a/ChangeLog.2 b/ChangeLog.2
index 96a647d..bf52ac0 100644
--- a/ChangeLog.2
+++ b/ChangeLog.2
@@ -16541,7 +16541,7 @@
        * lisp/faces.el (faces--attribute-at-point): Fix an issue
 
        Previous code would signal an error when the face at point was
-       a manually built list of attributes such as '(:foregroud "white").
+       a manually built list of attributes such as '(:foreground "white").
 
        * test/automated/faces-tests.el (faces--test-color-at-point): Add a test
 
@@ -32017,10 +32017,10 @@
 
 2015-05-18  Dmitry Gutov  <address@hidden>
 
-       Add a test case for Maven warning ouput
+       Add a test case for Maven warning output
        * test/automated/compile-tests.el
        (compile-tests--test-regexps-data): Add a case for Maven warning
-       ouput.
+       output.
        (compile--test-error-line): Check the compilation message type, if
        it's specified in the test data.
 
@@ -32142,7 +32142,7 @@
        (xpm_load): Call the above functions.  Handle XPM without mask
        when USE_CAIRO.
        (png_load_body): Handle USE_CAIRO case.
-       (png_load): Remove USE_CAIRO specific fuction, modify png_load_body
+       (png_load): Remove USE_CAIRO specific function, modify png_load_body
        instead.
        (jpeg_load_body): Call create_cairo_image_surface.
        (gif_load, svg_load_image): Handle specified background, call
diff --git a/doc/emacs/killing.texi b/doc/emacs/killing.texi
index 0b5efd0..5165881 100644
--- a/doc/emacs/killing.texi
+++ b/doc/emacs/killing.texi
@@ -521,7 +521,7 @@ data to the clipboard manager, change the variable
 
   Since strings containing NUL bytes are usually truncated when passed
 through the clipboard, Emacs replaces such characters with ``\0''
-before transfering them to the system's clipboard.
+before transferring them to the system's clipboard.
 
 @vindex select-enable-primary
 @findex clipboard-kill-region
diff --git a/doc/lispref/hooks.texi b/doc/lispref/hooks.texi
index 0ac5b08..6443464 100644
--- a/doc/lispref/hooks.texi
+++ b/doc/lispref/hooks.texi
@@ -241,11 +241,6 @@ Redisplay}.
 @itemx window-scroll-functions
 @itemx window-size-change-functions
 @xref{Window Hooks}.
-
address@hidden window-text-change-functions
address@hidden window-text-change-functions
-Functions to call in redisplay when text in the window might change.
-
 @end table
 
 @ignore
diff --git a/doc/misc/org.texi b/doc/misc/org.texi
index e3f8962..e1de308 100644
--- a/doc/misc/org.texi
+++ b/doc/misc/org.texi
@@ -1983,7 +1983,7 @@ you can use the usual commands to follow these links.
 @item C-c '
 @item C-c '
 Edit the footnote definition corresponding to the reference at point in
-a seperate window.  The window can be closed by pressing @kbd{C-c '}.
+a separate window.  The window can be closed by pressing @kbd{C-c '}.
 
 @end table
 
@@ -5291,7 +5291,7 @@ or with a tree they need to be inserted into a special 
drawer
 right below a headline, and its planning line (@pxref{Deadlines and
 scheduling}) when applicable.  Each property is specified on a single line,
 with the key (surrounded by colons) first, and the value after it.  Keys are
-case-insensitives.  Here is an example:
+case-insensitive.  Here is an example:
 
 @example
 * CD collection
@@ -6218,7 +6218,7 @@ format is shorter, things do work as expected.
 @section Deadlines and scheduling
 
 A timestamp may be preceded by special keywords to facilitate planning.  Both
-the timestamp and the keyword have to be positioned immediatly after the task
+the timestamp and the keyword have to be positioned immediately after the task
 they refer to.
 
 @table @var
@@ -10011,7 +10011,7 @@ completions.  If you need such a symbol inside a word, 
terminate it with
 a pair of curly brackets.  For example
 
 @example
-Protip: Given a circle \Gamma of diameter d, the length of its circumference
+Pro tip: Given a circle \Gamma of diameter d, the length of its circumference
 is address@hidden@}d.
 @end example
 
@@ -11395,7 +11395,7 @@ transcoding @LaTeX{} fragments to images (@pxref{Math 
formatting in HTML
 export}).
 
 @item SUBTITLE
address@hidden #+SUBTILE (HTML)
address@hidden #+SUBTITLE (HTML)
 The document's subtitle.  HTML exporter formats subtitle if document type is
 @samp{HTML5} and the CSS has a @samp{subtitle} class.
 @end table
@@ -11692,7 +11692,7 @@ buffer.  For example, with the following settings,
 @smallexample
 #+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
 @end smallexample
-equation labels will be displayed on the left marign and equations will be
+equation labels will be displayed on the left margin and equations will be
 five ems from the left margin.
 
 @noindent See the docstring of
@@ -17679,7 +17679,7 @@ thes variable, @code{org-imenu-depth}.
 @cindex Ludlam, Eric M.
 Speedbar package creates a special Emacs frame for displaying files and index
 items in files.  Org mode supports Speedbar; users can drill into Org files
-directly from the Speedbar.  The @kbd{<} in the Speedbar frame tweeks the
+directly from the Speedbar.  The @kbd{<} in the Speedbar frame tweaks the
 agenda commands to that file or to a subtree.
 @cindex @file{table.el}
 @item @file{table.el} by Takaaki Ota
@@ -18459,7 +18459,7 @@ meaningful string suitable for the agenda view.
 @vindex org-agenda-skip-function
 
 Search for entries with a limit set on levels for the custom search.  This is
-a general appraoch to creating custom searches in Org.  To include all
+a general approach to creating custom searches in Org.  To include all
 levels, use @samp{LEVEL>address@hidden that, for
 @code{org-odd-levels-only}, a level number corresponds to order in the
 hierarchy, not to the number of stars.}.  Then to selectively pick the
@@ -19116,7 +19116,7 @@ calculations and improved XEmacs compatibility, in 
particular by porting
 @file{nouline.el} to XEmacs.
 @item
 @i{Sacha Chua} suggested copying some linking code from Planner, and helped
-make Org pupular through her blog.
+make Org popular through her blog.
 @item
 @i{Toby S. Cubitt} contributed to the code for clock formats.
 @item
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 87c6458..f8399db 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -20,7 +20,7 @@ above is suggested.
 *** XEmacs support has been dropped
 
 Incomplete compatibility layer with XEmacs has been removed.  If you
-want to take over maintainance of this compatibility, please contact
+want to take over maintenance of this compatibility, please contact
 our mailing list.
 
 *** New syntax for export blocks
@@ -117,7 +117,7 @@ exists.
 *** ~org-file-apps~ no longer accepts S-expressions as commands
 
 The variable now accepts functions of two arguments instead of plain
-S-expressions.  Replacing a S-expresion with an appropriate function
+S-expressions.  Replacing an S-expression with an appropriate function
 is straightforward.  For example
 
 : ("pdf" . (foo))
@@ -198,7 +198,7 @@ entries are added to last in the date tree.
 
 *** New ~vbar~ entity
 
-~\vbar~ or ~\vbar{}~ will be exported unconditionnally as a =|=,
+~\vbar~ or ~\vbar{}~ will be exported unconditionally as a =|=,
 unlike to existing ~\vert~, which is expanded as ~&vert;~ when using
 a HTML derived export back-end.
 
@@ -579,7 +579,7 @@ is that spaces are allowed within the path.
 *** ~:preparation-function~ called earlier during publishing
 
 Functions in this list are called before any file is associated to the
-current projet.  Thus, they can be used to generate to be published
+current project.  Thus, they can be used to generate to be published
 Org files.
 
 *** Function ~org-remove-indentation~ changes.
@@ -986,7 +986,7 @@ a source block.
 *** New option in ASCII export
 
 Plain lists can have an extra margin by setting ~org-ascii-list-margin~
-variable to an appopriate integer.
+variable to an appropriate integer.
 
 *** New blocks in ASCII export
 
@@ -1022,7 +1022,7 @@ more features.  See docstring for details.
 *** New filter: ~org-export-filter-body-functions~
 
 Functions in this filter are applied on the body of the exported
-document, befor wrapping it within the template.
+document, before wrapping it within the template.
 
 *** New :environment parameter when exporting example blocks to LaTeX
 
@@ -1087,7 +1087,7 @@ property is inherited by children.
 
 *** Tables can be sorted with an arbitrary function
 
-It is now possible to specify a function, both programatically,
+It is now possible to specify a function, both programmatically,
 through a new optional argument, and interactively with ~f~ or ~F~ keys,
 to sort a table.
 
diff --git a/lisp/ChangeLog.16 b/lisp/ChangeLog.16
index 691b794..ffd99f7 100644
--- a/lisp/ChangeLog.16
+++ b/lisp/ChangeLog.16
@@ -11992,11 +11992,11 @@
        * progmodes/verilog-mode.el (verilog-pretty-expr): Don't line up
        assignment with tests in ifs and for loops.
        (verilog-extended-complete-re, verilog-complete-reg): Change so
-       that DPI inport functions don't look like fuction declarations.
+       that DPI inport functions don't look like function declarations.
        (verilog-pretty-expr): Don't line up assignment
        operations to the test and increment in if and for loops
        (verilog-extended-complete-re, verilog-complete-reg): Change so
-       that DPI inport functions don't look like fuction declarations.
+       that DPI inport functions don't look like function declarations.
 
 2012-05-03  Kenichi Handa  <address@hidden>
 
diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index 01d12c2..d1747bd 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -934,7 +934,7 @@ Note that the MAX parameter is used so we can exit the 
parse early."
                              (or
                               ;; the required list of keys is nil, or
                               (null require)
-                              ;; every element of require is in n(ormalized)
+                              ;; every element of require is in n (normalized)
                               (let ((n (nth 0 (auth-source-netrc-normalize
                                                (list alist) file))))
                                 (cl-loop for req in require
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index 7b27e70..235eb83 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -1034,29 +1034,41 @@ empty line above the done items separator."
        (hl-line-mode -1)
       (hl-line-mode 1))))
 
+(defvar todo--item-headers-hidden nil
+  "Non-nil if item date-time headers in current buffer are hidden.")
+
 (defun todo-toggle-item-header ()
   "Hide or show item date-time headers in the current file.
 With done items, this hides only the done date-time string, not
 the the original date-time string."
   (interactive)
-  (save-excursion
-    (save-restriction
-      (goto-char (point-min))
-      (let ((ov (todo-get-overlay 'header)))
-       (if ov
-           (remove-overlays 1 (1+ (buffer-size)) 'todo 'header)
-         (widen)
-         (goto-char (point-min))
-         (while (not (eobp))
-           (when (re-search-forward
-                  (concat todo-item-start
-                          "\\( " diary-time-regexp "\\)?"
-                          (regexp-quote todo-nondiary-end) "? ")
-                  nil t)
-             (setq ov (make-overlay (match-beginning 0) (match-end 0) nil t))
-             (overlay-put ov 'todo 'header)
-             (overlay-put ov 'display ""))
-           (todo-forward-item)))))))
+  (unless (catch 'nonempty
+           (dolist (type '(todo done))
+              (dolist (c todo-categories)
+                (let ((count (todo-get-count type (car c))))
+                  (unless (zerop count)
+                    (throw 'nonempty t))))))
+    (user-error "This file has no items"))
+  (if todo--item-headers-hidden
+      (progn
+        (remove-overlays 1 (1+ (buffer-size)) 'todo 'header)
+        (setq todo--item-headers-hidden nil))
+    (save-excursion
+      (save-restriction
+        (widen)
+        (goto-char (point-min))
+        (let (ov)
+          (while (not (eobp))
+            (when (re-search-forward
+                   (concat todo-item-start
+                           "\\( " diary-time-regexp "\\)?"
+                           (regexp-quote todo-nondiary-end) "? ")
+                   nil t)
+              (setq ov (make-overlay (match-beginning 0) (match-end 0) nil t))
+              (overlay-put ov 'todo 'header)
+              (overlay-put ov 'display ""))
+            (forward-line)))
+        (setq todo--item-headers-hidden t)))))
 
 ;; 
-----------------------------------------------------------------------------
 ;;; File and category editing
@@ -1731,46 +1743,49 @@ done items sections are visible, the sequence of N 
items can
 consist of the the last todo items and the first done items."
   (interactive "p")
   (when (todo-item-string)
-    (unless (> n 1) (setq n 1))
-    (catch 'end
-      (dotimes (i n)
-       (let* ((cat (todo-current-category))
-              (marks (assoc cat todo-categories-with-marks))
-              (ov (progn
-                    (unless (looking-at todo-item-start)
-                      (todo-item-start))
-                    (todo-get-overlay 'prefix)))
-              (pref (overlay-get ov 'before-string)))
-         (if (todo-marked-item-p)
-             (progn
-               (overlay-put ov 'before-string (substring pref 1))
-               (if (= (cdr marks) 1)   ; Deleted last mark in this category.
-                   (setq todo-categories-with-marks
-                         (assq-delete-all cat todo-categories-with-marks))
-                 (setcdr marks (1- (cdr marks)))))
-           (overlay-put ov 'before-string (concat todo-item-mark pref))
-           (if marks
-               (setcdr marks (1+ (cdr marks)))
-             (push (cons cat 1) todo-categories-with-marks))))
-       (todo-forward-item)
-       ;; Don't try to mark the empty lines at the end of the todo
-       ;; and done items sections.
-       (when (looking-at "^$")
-         (if (eobp)
-             (throw 'end nil)
-           (todo-forward-item)))))))
+    (let ((cat (todo-current-category)))
+      (unless (> n 1) (setq n 1))
+      (catch 'end
+        (dotimes (i n)
+          (let* ((marks (assoc cat todo-categories-with-marks))
+                 (ov (progn
+                       (unless (looking-at todo-item-start)
+                         (todo-item-start))
+                       (todo-get-overlay 'prefix)))
+                 (pref (overlay-get ov 'before-string)))
+            (if (todo-marked-item-p)
+                (progn
+                  (overlay-put ov 'before-string (substring pref 1))
+                  (if (= (cdr marks) 1)        ; Deleted last mark in this 
category.
+                      (setq todo-categories-with-marks
+                            (assq-delete-all cat todo-categories-with-marks))
+                    (setcdr marks (1- (cdr marks)))))
+              (overlay-put ov 'before-string (concat todo-item-mark pref))
+              (if marks
+                  (setcdr marks (1+ (cdr marks)))
+                (push (cons cat 1) todo-categories-with-marks))))
+          (todo-forward-item)
+          ;; Don't try to mark the empty lines at the end of the todo
+          ;; and done items sections.
+          (when (looking-at "^$")
+            (if (eobp)
+                (throw 'end nil)
+              (todo-forward-item))))))))
 
 (defun todo-mark-category ()
   "Mark all visible items in this category with `todo-item-mark'."
   (interactive)
-  (let* ((cat (todo-current-category))
-        (marks (assoc cat todo-categories-with-marks)))
+  (let ((cat (todo-current-category)))
     (save-excursion
       (goto-char (point-min))
       (while (not (eobp))
-       (let* ((ov (todo-get-overlay 'prefix))
-              (pref (overlay-get ov 'before-string)))
-         (unless (todo-marked-item-p)
+       (let* ((marks (assoc cat todo-categories-with-marks))
+               (ov (todo-get-overlay 'prefix))
+               ;; When done items are shown and there are no todo items, the
+               ;; loop starts on the empty line in the todo items sections,
+               ;; which has no overlay, so don't try to get it.
+              (pref (when ov (overlay-get ov 'before-string))))
+         (unless (or (todo-marked-item-p) (not ov))
            (overlay-put ov 'before-string (concat todo-item-mark pref))
            (if marks
                (setcdr marks (1+ (cdr marks)))
@@ -1791,7 +1806,7 @@ consist of the the last todo items and the first done 
items."
       (goto-char (point-min))
       (while (not (eobp))
        (let* ((ov (todo-get-overlay 'prefix))
-              ;; No overlay on empty line between todo and done items.
+              ;; See comment above in `todo-mark-category'.
               (pref (when ov (overlay-get ov 'before-string))))
          (when (todo-marked-item-p)
            (overlay-put ov 'before-string (substring pref 1)))
@@ -2513,7 +2528,7 @@ numerical prefix argument, or noninteractively by 
argument ARG,
 whose value can be either of the symbols `raise' or `lower',
 meaning to raise or lower the item's priority by one."
   (interactive)
-  (unless (and (called-interactively-p 'any)
+  (unless (and (or (called-interactively-p 'any) (memq arg '(raise lower)))
               (or (todo-done-item-p) (looking-at "^$")))
     (let* ((item (or item (todo-item-string)))
           (marked (todo-marked-item-p))
@@ -2530,7 +2545,7 @@ meaning to raise or lower the item's priority by one."
                                   (re-search-forward regexp1 nil t)
                                   (match-string-no-properties 1)))))))
           curnum
-          (todo (cond ((or (eq arg 'raise) (eq arg 'lower)
+          (todo (cond ((or (memq arg '(raise lower))
                            (eq major-mode 'todo-filtered-items-mode))
                        (save-excursion
                          (let ((curstart (todo-item-start))
@@ -2670,7 +2685,7 @@ section in the category moved to."
             (num todo-category-number)
             (item (todo-item-string))
             (diary-item (todo-diary-item-p))
-            (done-item (and (todo-done-item-p) (concat item "\n")))
+            (done-item (and (todo-done-item-p) item))
             (omark (save-excursion (todo-item-start) (point-marker)))
             (todo 0)
             (diary 0)
@@ -2700,43 +2715,51 @@ section in the category moved to."
              (while (not (eobp))
                (when (todo-marked-item-p)
                  (if (todo-done-item-p)
-                     (setq done-items (concat done-items
-                                              (todo-item-string) "\n")
-                           done (1+ done))
-                   (setq todo-items (concat todo-items
-                                            (todo-item-string) "\n")
-                         todo (1+ todo))
+                      (progn
+                        (push (todo-item-string) done-items)
+                       (setq done (1+ done)))
+                    (push (todo-item-string) todo-items)
+                   (setq todo (1+ todo))
                    (when (todo-diary-item-p)
                      (setq diary (1+ diary)))))
                (todo-forward-item))
-             ;; Chop off last newline of multiple todo item string,
-             ;; since it will be reinserted when setting priority
-             ;; (but with done items priority is not set, so keep
-             ;; last newline).
-             (and todo-items
-                  (setq todo-items (substring todo-items 0 -1))))
+              (setq todo-items (nreverse todo-items))
+              (setq done-items (nreverse done-items)))
          (if (todo-done-item-p)
-             (setq done 1)
-           (setq todo 1)
+              (progn
+                (push done-item done-items)
+               (setq done 1))
+            (push item todo-items)
+            (setq todo 1)
            (when (todo-diary-item-p) (setq diary 1))))
        (set-window-buffer (selected-window)
                           (set-buffer (find-file-noselect file2 'nowarn)))
        (unwind-protect
-           (progn
-             (when (or todo-items (and item (not done-item)))
-               (todo-set-item-priority (or todo-items item) cat2 t))
+           (let (here)
+              (when todo-items
+                (todo-set-item-priority (pop todo-items) cat2 t)
+                (setq here (point))
+                (while todo-items
+                  (todo-forward-item)
+                  (todo-insert-with-overlays (pop todo-items))))
              ;; Move done items en bloc to top of done items section.
-             (when (or done-items done-item)
+              (when done-items
                (todo-category-number cat2)
                (widen)
                (goto-char (point-min))
                (re-search-forward
-                (concat "^" (regexp-quote (concat todo-category-beg cat2))
-                        "$") nil t)
+                (concat "^" (regexp-quote (concat todo-category-beg cat2)) "$")
+                 nil t)
                (re-search-forward
                 (concat "^" (regexp-quote todo-category-done)) nil t)
                (forward-line)
-               (insert (or done-items done-item)))
+                (unless here (setq here (point)))
+                (while done-items
+                  (todo-insert-with-overlays (pop done-items))
+                  (todo-forward-item)))
+              ;; If only done items were moved, move point to the top
+              ;; one, otherwise, move point to the top moved todo item.
+              (goto-char here)
              (setq moved t))
          (cond
           ;; Move succeeded, so remove item from starting category,
@@ -2761,10 +2784,13 @@ section in the category moved to."
                        (forward-line)
                        (setq beg (point))
                        (setq end (if (re-search-forward
-                                      (concat "^" (regexp-quote
-                                                   todo-category-beg)) nil t)
-                                     (match-beginning 0)
-                                   (point-max)))
+                                      (concat "^"
+                                               (regexp-quote 
todo-category-beg))
+                                       nil t)
+                                      (progn
+                                       (goto-char (match-beginning 0))
+                                        (point-marker))
+                                   (point-max-marker)))
                        (goto-char beg)
                        (while (< (point) end)
                          (if (todo-marked-item-p)
@@ -2781,7 +2807,7 @@ section in the category moved to."
            (set-window-buffer (selected-window)
                               (set-buffer (find-file-noselect file2 'nowarn)))
            (setq todo-category-number (todo-category-number cat2))
-           (let ((todo-show-with-done (or done-items done-item)))
+           (let ((todo-show-with-done (> done 0)))
              (todo-category-select))
            (goto-char nmark)
            ;; If item is moved to end of (just first?) category, make
@@ -2830,12 +2856,13 @@ visible."
                          (goto-char (point-min))
                          (re-search-forward todo-done-string-start nil t)))
             (buffer-read-only nil)
-            item done-item
+            header item done-items
             (opoint (point)))
        ;; Don't add empty comment to done item.
        (setq comment (unless (zerop (length comment))
                        (concat " [" todo-comment-string ": " comment "]")))
        (and marked (goto-char (point-min)))
+        (setq header (todo-get-overlay 'header))
        (catch 'done
          ;; Stop looping when we hit the empty line below the last
          ;; todo item (this is eobp if only done items are hidden).
@@ -2843,17 +2870,15 @@ visible."
            (if (or (not marked) (and marked (todo-marked-item-p)))
                (progn
                  (setq item (todo-item-string))
-                 (setq done-item (concat done-item done-prefix item
-                                         comment (and marked "\n")))
+                  (push (concat done-prefix item comment) done-items)
                  (setq item-count (1+ item-count))
                  (when (todo-diary-item-p)
                    (setq diary-count (1+ diary-count)))
                  (todo-remove-item)
                  (unless marked (throw 'done nil)))
              (todo-forward-item))))
+        (setq done-items (nreverse done-items))
        (when marked
-         ;; Chop off last newline of done item string.
-         (setq done-item (substring done-item 0 -1))
          (setq todo-categories-with-marks
                (assq-delete-all cat todo-categories-with-marks)))
        (save-excursion
@@ -2862,7 +2887,17 @@ visible."
           (concat "^" (regexp-quote todo-category-done)) nil t)
          (forward-char)
          (when show-done (setq opoint (point)))
-         (insert done-item "\n"))
+          (while done-items
+            (insert (pop done-items) "\n")
+            (when header (let ((copy (copy-overlay header)))
+                  (re-search-backward
+                   (concat todo-item-start
+                           "\\( " diary-time-regexp "\\)?"
+                           (regexp-quote todo-nondiary-end) "? ")
+                   nil t)
+                  (move-overlay copy (match-beginning 0) (match-end 0)))
+                  (todo-item-end)
+                  (forward-char))))
        (todo-update-count 'todo (- item-count))
        (todo-update-count 'done item-count)
        (todo-update-count 'diary (- diary-count))
@@ -3089,7 +3124,9 @@ this category does not exist in the archive, it is 
created."
              (throw 'end (message "Only done items can be archived"))
            (with-current-buffer archive
              (unless (derived-mode-p 'todo-archive-mode) (todo-archive-mode))
-             (let (buffer-read-only)
+             (let ((headers-hidden todo--item-headers-hidden)
+                    buffer-read-only)
+                (if headers-hidden (todo-toggle-item-header))
                (widen)
                (goto-char (point-min))
                (if (and (re-search-forward
@@ -3115,7 +3152,8 @@ this category does not exist in the archive, it is 
created."
                (unless (nth 7 (file-attributes afile))
                  (write-region nil nil afile t t)
                  (setq todo-archives (funcall todo-files-function t))
-                 (todo-archive-mode))))
+                 (todo-archive-mode))
+                (if headers-hidden (todo-toggle-item-header))))
            (with-current-buffer tbuf
              (cond
               (all
@@ -3194,7 +3232,9 @@ the only category in the archive, the archive file is 
deleted."
            (todo-forward-item))))
       ;; Restore items to top of category's done section and update counts.
       (with-current-buffer tbuf
-       (let (buffer-read-only newcat)
+       (let ((headers-hidden todo--item-headers-hidden)
+              buffer-read-only newcat)
+          (if headers-hidden (todo-toggle-item-header))
          (widen)
          (goto-char (point-min))
          ;; Find the corresponding todo category, or if there isn't
@@ -3218,6 +3258,7 @@ the only category in the archive, the archive file is 
deleted."
                 (todo-update-count 'done 1 cat)
                 (unless newcat         ; Newly added category has no archive.
                   (todo-update-count 'archived -1 cat))))
+          (if headers-hidden (todo-toggle-item-header))
          (todo-update-categories-sexp)))
       ;; Delete restored items from archive.
       (when marked
@@ -3263,6 +3304,10 @@ the only category in the archive, the archive file is 
deleted."
                           (set-buffer (find-file-noselect tfile)))
        (todo-category-number cat)
        (todo-category-select)
+        ;; Selecting the category leaves point at the end of the done
+        ;; items separator string, so move it to the (first) restored
+        ;; done item.
+        (forward-line)
        (message "Items unarchived.")))))
 
 (defun todo-jump-to-archive-category (&optional file)
@@ -5146,7 +5191,17 @@ empty line above the done items separator."
   (let* ((done (todo-done-item-p)))
     (todo-item-start)
     (unless (bobp)
-      (re-search-backward todo-item-start nil t (or count 1)))
+      (re-search-backward (concat todo-item-start
+                                  "\\( " diary-time-regexp "\\)?"
+                                  (regexp-quote todo-nondiary-end) "? ")
+                          nil t (or count 1))
+      ;; If the item date-time header is hidden, the display engine
+      ;; moves point to the next earlier displayable position, which
+      ;; is the end of the next item above, so we move it to the start
+      ;; of the current item's text (that's what the display engine
+      ;; does with todo-forward-item in this case.)
+      ;; FIXME: would it be better to use cursor-sensor-functions?
+      (when todo--item-headers-hidden (goto-char (match-end 0))))
     ;; Unless this is a regexp filtered items buffer (which can contain
     ;; intermixed todo and done items), if points advances by one from a
     ;; done to a todo item, go back to the space above
@@ -5162,10 +5217,12 @@ empty line above the done items separator."
 
 (defun todo-remove-item ()
   "Internal function called in editing, deleting or moving items."
-  (let* ((end (progn (todo-item-end) (1+ (point))))
-        (beg (todo-item-start))
-        (ov (todo-get-overlay 'prefix)))
-    (when ov (delete-overlay ov))
+  (let ((end (progn (todo-item-end) (1+ (point))))
+       (beg (todo-item-start))
+        ovs)
+    (push (todo-get-overlay 'prefix) ovs)
+    (push (todo-get-overlay 'header) ovs)
+    (dolist (ov ovs) (when ov (delete-overlay ov)))
     (delete-region beg end)))
 
 (defun todo-diary-item-p ()
@@ -5221,7 +5278,10 @@ Also preserve category display, if applicable."
   (let ((revert-buffer-function nil))
     (revert-buffer ignore-auto noconfirm 'preserve-modes)
     (when (memq major-mode '(todo-mode todo-archive-mode))
-      (todo-category-select))))
+      (save-excursion (todo-category-select))
+      ;; revert-buffer--default calls after-find-file, which makes
+      ;; buffer writable.
+      (setq buffer-read-only t))))
 
 (defun todo-desktop-save-buffer (_dir)
   `((catnum . ,(todo-category-number (todo-current-category)))))
@@ -5296,6 +5356,11 @@ marked) not done todo items."
 
 (defun todo-get-overlay (val)
   "Return the overlay at point whose `todo' property has value VAL."
+  ;; When headers are hidden, the display engine makes item's start
+  ;; inaccessible to commands, so go there here, if necessary, in
+  ;; order to check for prefix and header overlays.
+  (when (memq val '(prefix header))
+    (unless (looking-at todo-item-start) (todo-item-start)))
   ;; Use overlays-in to find prefix overlays and check over two
   ;; positions to find done separator overlay.
   (let ((ovs (overlays-in (point) (1+ (point))))
@@ -5320,16 +5385,26 @@ In that case, return the item's prefix overlay."
     (when marked ov)))
 
 (defun todo-insert-with-overlays (item)
-  "Insert ITEM at point and update prefix/priority number overlays."
+  "Insert ITEM at point and update prefix and header overlays."
   (todo-item-start)
-  ;; Insertion pushes item down but not its prefix overlay.  When the
-  ;; overlay includes a mark, this would now mark the inserted ITEM,
-  ;; so move it to the pushed down item.
   (let ((ov (todo-get-overlay 'prefix))
        (marked (todo-marked-item-p)))
     (insert item "\n")
-    (when marked (move-overlay ov (point) (point))))
-  (todo-backward-item)
+    ;; Insertion pushes item down but not its prefix overlay.  When
+    ;; the overlay includes a mark, this would now mark the inserted
+    ;; ITEM, so move it to the pushed down item.
+    (when marked (move-overlay ov (point) (point)))
+    (todo-backward-item)
+    ;; With hidden headers, todo-backward-item puts point on first
+    ;; visible character after header, so we have to search backward.
+    (when todo--item-headers-hidden
+      (re-search-backward (concat todo-item-start
+                                 "\\( " diary-time-regexp "\\)?"
+                                 (regexp-quote todo-nondiary-end) "? ")
+                         nil t)
+              (setq ov (make-overlay (match-beginning 0) (match-end 0) nil t))
+              (overlay-put ov 'todo 'header)
+              (overlay-put ov 'display "")))
   (todo-prefix-overlays))
 
 (defun todo-prefix-overlays ()
@@ -6594,6 +6669,7 @@ Added to `window-configuration-change-hook' in Todo mode."
   "Make some settings that apply to multiple Todo modes."
   (add-to-invisibility-spec 'todo)
   (setq buffer-read-only t)
+  (setq-local todo--item-headers-hidden nil)
   (setq-local desktop-save-buffer 'todo-desktop-save-buffer)
   (setq-local hl-line-range-function 'todo-hl-line-range))
 
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index e454775..095ce8b 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1399,7 +1399,7 @@ files matching `dired-omit-regexp'."
                    ;; else try to find correct place to insert
                    (if (dired-goto-subdir directory)
                        (progn ;; unhide if necessary
-                         (if (looking-at-p "\r")
+                         (if (= (following-char) ?\r)
                              ;; Point is at end of subdir line.
                              (dired-unhide-subdir))
                          ;; found - skip subdir and `total' line
@@ -2639,7 +2639,7 @@ Lower levels are unaffected."
   (and selective-display
        (save-excursion
         (dired-goto-subdir dir)
-        (looking-at-p "\r"))))
+        (= (following-char) ?\r))))
 
 ;;;###autoload
 (defun dired-hide-subdir (arg)
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 527685a..7ceb672 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -634,7 +634,7 @@ Optional fifth argument CASE-FOLD-P specifies the value of
     (dired-mark-if
      (and
       ;; not already marked
-      (looking-at-p " ")
+      (= (following-char) ?\s)
       ;; uninteresting
       (let ((fn (dired-get-filename localp t))
             ;; Match patterns case-insensitively on case-insensitive
@@ -1530,7 +1530,7 @@ refer at all to the underlying file system.  Contrast 
this with
           (setq mode (buffer-substring (point) (+ mode-len (point))))
           (forward-char mode-len)
           ;; Skip any extended attributes marker ("." or "+").
-          (or (looking-at " ")
+          (or (= (following-char) ?\s)
               (forward-char 1))
           (setq nlink (read (current-buffer)))
           ;; Karsten Wenger <address@hidden> fixed uid.
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 985b751..fa25a0c 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -738,12 +738,14 @@ or to switch back to an existing one."
 
 (defun lisp-comment-indent ()
   "Like `comment-indent-default', but don't put space after open paren."
-  (let ((pt (point)))
-    (skip-syntax-backward " ")
-    (if (eq (preceding-char) ?\()
-        (cons (current-column) (current-column))
-      (goto-char pt)
-      (comment-indent-default))))
+  (or (when (looking-at "\\s<\\s<")
+        (let ((pt (point)))
+          (skip-syntax-backward " ")
+          (if (eq (preceding-char) ?\()
+              (cons (current-column) (current-column))
+            (goto-char pt)
+            nil)))
+      (comment-indent-default)))
 
 (define-obsolete-function-alias 'lisp-mode-auto-fill 'do-auto-fill "23.1")
 
diff --git a/lisp/erc/ChangeLog.2 b/lisp/erc/ChangeLog.2
index d961fbf..6d789e4 100644
--- a/lisp/erc/ChangeLog.2
+++ b/lisp/erc/ChangeLog.2
@@ -120,7 +120,7 @@
 
 2014-09-25  Kelvin White  <address@hidden>
 
-       * erc.el: Follow Emacs version instead of tracking it seperately.
+       * erc.el: Follow Emacs version instead of tracking it separately.
        (erc-quit/part-reason-default) : Clean up quit/part message
        functions by abstracting repetitive code, change version string.
        (erc-quit-reason-various, erc-quit-reason-normal, erc-quit-reason-zippy)
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 32324ae..f5d94d8 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -1271,14 +1271,14 @@ BUFFER should be a buffer or a buffer name."
   (insert-file-contents file)
   (let (notfirst)
     (while (search-forward "" nil 'move)
-      (if (looking-at "S")
+      (if (= (following-char) ?S)
           (delete-region (1- (point)) (line-end-position))
         (delete-char -1)
         (if notfirst
             (insert "\n.DE\n")
           (setq notfirst t))
         (insert "\n.SH ")
-        (insert (if (looking-at "F") "Function " "Variable "))
+        (insert (if (= (following-char) ?F) "Function " "Variable "))
         (delete-char 1)
         (forward-line 1)
         (insert ".DS L\n"))))
@@ -1304,7 +1304,7 @@ BUFFER should be a buffer or a buffer name."
         (forward-char 1))
       (goto-char (point-min))
       (while (search-forward "" nil t)
-        (unless (looking-at "S")
+        (when (/= (following-char) ?S)
           (setq type (char-after)
                 name (buffer-substring (1+ (point)) (line-end-position))
                 doc (buffer-substring (line-beginning-position 2)
diff --git a/lisp/mouse.el b/lisp/mouse.el
index e079443..2fbaaad 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -663,7 +663,7 @@ frame with the mouse."
          ;; difference between `pos-x' and `snap-x' (or `pos-y' and
          ;; `snap-y') exceeds the value of FRAME's `snap-width'
          ;; parameter, unsnap FRAME (at the respective side).  `snap-x'
-         ;; and `snap-y' nil mean FRAME is curerntly not snapped.
+         ;; and `snap-y' nil mean FRAME is currently not snapped.
          snap-x snap-y
          (exitfun nil)
          (move
diff --git a/lisp/org/ob-J.el b/lisp/org/ob-J.el
index eba4bc6..ff4190b 100644
--- a/lisp/org/ob-J.el
+++ b/lisp/org/ob-J.el
@@ -89,7 +89,7 @@ This function is called by `org-babel-execute-src-block'"
        (org-babel-J-eval-string full-body)))))
 
 (defun org-babel-J-eval-string (str)
-  "Sends STR to the `j-console-cmd' session and exectues it."
+  "Sends STR to the `j-console-cmd' session and executes it."
   (let ((session (j-console-ensure-session)))
     (with-current-buffer (process-buffer session)
       (goto-char (point-max))
diff --git a/lisp/org/ob-ebnf.el b/lisp/org/ob-ebnf.el
index ec5001c..0fceb5f 100644
--- a/lisp/org/ob-ebnf.el
+++ b/lisp/org/ob-ebnf.el
@@ -25,7 +25,7 @@
 ;;; Commentary:
 
 ;;; Org-Babel support for using ebnf2ps to generate encapsulated postscript
-;;; railroad diagrams. It recogises these arguments:
+;;; railroad diagrams. It recognizes these arguments:
 ;;;
 ;;;     :file is required; it must include the extension '.eps.' All the rules
 ;;;           in the block will be drawn in the same file. This is done by
@@ -33,7 +33,7 @@
 ;;;           documentation for ebnf-eps-buffer for more information).
 ;;;
 ;;;     :style specifies a value in ebnf-style-database. This provides the
-;;;            ability to customise the output. The style can also specify the
+;;;            ability to customize the output. The style can also specify the
 ;;;            grammar syntax (by setting ebnf-syntax); note that only ebnf,
 ;;;            iso-ebnf, and yacc are supported by this file.
 
diff --git a/lisp/org/ob-exp.el b/lisp/org/ob-exp.el
index 2556362..f87d0f8 100644
--- a/lisp/org/ob-exp.el
+++ b/lisp/org/ob-exp.el
@@ -41,7 +41,7 @@
 (defcustom org-export-babel-evaluate t
   "Switch controlling code evaluation during export.
 When set to nil no code will be evaluated as part of the export
-process and no header argumentss will be obeyed.  When set to
+process and no header arguments will be obeyed.  When set to
 `inline-only', only inline code blocks will be executed.  Users
 who wish to avoid evaluating code on export should use the header
 argument `:eval never-export'."
diff --git a/lisp/org/ob-lua.el b/lisp/org/ob-lua.el
index 686d41a..877d895 100644
--- a/lisp/org/ob-lua.el
+++ b/lisp/org/ob-lua.el
@@ -25,7 +25,7 @@
 ;; for session support, lua-mode is needed.
 ;; lua-mode is not part of GNU Emacs/orgmode, but can be obtained
 ;; from marmalade or melpa.
-;; The source respository is here:
+;; The source repository is here:
 ;; https://github.com/immerrr/lua-mode
 
 ;; However, sessions are not yet working.
diff --git a/lisp/org/ob-sql.el b/lisp/org/ob-sql.el
index 06477d3..6d39e95 100644
--- a/lisp/org/ob-sql.el
+++ b/lisp/org/ob-sql.el
@@ -105,7 +105,7 @@ Pass nil to omit that arg."
   (format "%s/address@hidden:%s/%s" user password host port database))
 
 (defun org-babel-sql-dbstring-mssql (host user password database)
-  "Make sqlcmd commmand line args for database connection.
+  "Make sqlcmd command line args for database connection.
 `sqlcmd' is the preferred command line tool to access Microsoft
 SQL Server on Windows and Linux platform."
   (mapconcat #'identity
diff --git a/lisp/org/org-bbdb.el b/lisp/org/org-bbdb.el
index f851668..bf6a79a 100644
--- a/lisp/org/org-bbdb.el
+++ b/lisp/org/org-bbdb.el
@@ -105,7 +105,7 @@
 (declare-function bbdb-name "ext:bbdb-com" (string elidep))
 (declare-function bbdb-completing-read-record "ext:bbdb-com"
                  (prompt &optional omit-records))
-(declare-function bbdb-record-field "ext:bbdb" (recond field))
+(declare-function bbdb-record-field "ext:bbdb" (record field))
 (declare-function bbdb-record-getprop "ext:bbdb" (record property))
 (declare-function bbdb-record-name "ext:bbdb" (record))
 (declare-function bbdb-records "ext:bbdb"
diff --git a/lisp/org/org-bibtex.el b/lisp/org/org-bibtex.el
index d81c9f1..d52b947 100644
--- a/lisp/org/org-bibtex.el
+++ b/lisp/org/org-bibtex.el
@@ -290,8 +290,8 @@ is non-nil."
 (defcustom org-bibtex-inherit-tags nil
   "Controls whether inherited tags are converted to bibtex keywords.
 It is relevant only if `org-bibtex-tags-are-keywords' is non-nil.
-Tag inheritence itself is controlled by `org-use-tag-inheritence'
-and `org-exclude-tags-from-inheritence'."
+Tag inheritance itself is controlled by `org-use-tag-inheritance'
+and `org-exclude-tags-from-inheritance'."
   :group 'org-bibtex
   :version "26.1"
   :package-version '(Org . "8.3")
diff --git a/lisp/org/org-footnote.el b/lisp/org/org-footnote.el
index af03fbf..b9f23f1 100644
--- a/lisp/org/org-footnote.el
+++ b/lisp/org/org-footnote.el
@@ -345,7 +345,7 @@ to rename."
        (t nil)))
 
 (defun org-footnote--collect-references (&optional anonymous)
-  "Collect all labelled footnote references in current buffer.
+  "Collect all labeled footnote references in current buffer.
 
 Return an alist where associations follow the pattern
 
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index 40a715a..357fdcf 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -1748,7 +1748,7 @@ function is being called interactively."
                 (or compare-func
                     (and interactive?
                          (org-read-function
-                          (concat "Fuction for comparing keys "
+                          (concat "Function for comparing keys "
                                   "(empty for default `sort-subr' predicate): 
")
                           'allow-empty)))))))
        (goto-char (point-min))
diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el
index 146775b..58eb4bd 100644
--- a/lisp/org/org-timer.el
+++ b/lisp/org/org-timer.el
@@ -143,7 +143,7 @@ the region 0:00:00."
              (seconds-to-time
               ;; Pass `current-time' result to `float-time' (instead
               ;; of calling without arguments) so that only
-              ;; `current-time' has to be overriden in tests.
+              ;; `current-time' has to be overridden in tests.
               (- (float-time (current-time)) delta))))
       (setq org-timer-pause-time nil)
       (org-timer-set-mode-line 'on)
@@ -172,7 +172,7 @@ With prefix arg STOP, stop it entirely."
        (setq org-timer-start-time
              ;; Pass `current-time' result to `float-time' (instead
              ;; of calling without arguments) so that only
-             ;; `current-time' has to be overriden in tests.
+             ;; `current-time' has to be overridden in tests.
              (seconds-to-time (- (float-time (current-time))
                                  (- pause-secs start-secs)))))
       (setq org-timer-pause-time nil)
@@ -235,7 +235,7 @@ it in the buffer."
 (defun org-timer-seconds ()
   ;; Pass `current-time' result to `float-time' (instead of calling
   ;; without arguments) so that only `current-time' has to be
-  ;; overriden in tests.
+  ;; overridden in tests.
   (if org-timer-countdown-timer
       (- (float-time org-timer-start-time)
         (float-time (or org-timer-pause-time (current-time))))
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 22b7dbf..5d10eed 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -4132,7 +4132,7 @@ PROPERTIES accepts the following attributes:
   :image-output-type  string, output file type of image converter (e.g., 
\"png\").
   :use-xcolor         boolean, when non-nil, LaTeX \"xcolor\" macro is used to
                       deal with background and foreground color of image.
-                      Otherwise, dvipng style background and foregroud color
+                      Otherwise, dvipng style background and foreground color
                       format are generated.  You may then refer to them in
                       command options with \"%F\" and \"%B\".
   :image-size-adjust  cons of numbers, the car element is used to adjust LaTeX
@@ -17106,7 +17106,7 @@ user."
   ;; FIXME: cleanup and comment
   ;; Pass `current-time' result to `decode-time' (instead of calling
   ;; without arguments) so that only `current-time' has to be
-  ;; overriden in tests.
+  ;; overridden in tests.
   (let ((org-def def)
        (org-defdecode defdecode)
        (nowdecode (decode-time (current-time)))
@@ -17288,7 +17288,7 @@ user."
       (unless deltadef
        ;; Pass `current-time' result to `decode-time' (instead of
        ;; calling without arguments) so that only `current-time' has
-       ;; to be overriden in tests.
+       ;; to be overridden in tests.
        (let ((now (decode-time (current-time))))
          (setq day (nth 3 now) month (nth 4 now) year (nth 5 now))))
       (cond ((member deltaw '("d" "")) (setq day (+ day deltan)))
@@ -17743,7 +17743,7 @@ BUFFER.
 
 Diary sexp timestamps are matched against DAYNR, when non-nil.
 If matching fails or DAYNR is nil, `org-diary-sexp-no-match' is
-signalled."
+signaled."
   (cond
    ((string-match "\\`%%\\((.*)\\)" s)
     ;; Sexp timestamp: try to match DAYNR, if available, since we're
diff --git a/lisp/org/ox-ascii.el b/lisp/org/ox-ascii.el
index 2a129e9..8dc31be 100644
--- a/lisp/org/ox-ascii.el
+++ b/lisp/org/ox-ascii.el
@@ -916,7 +916,8 @@ as a plist."
           ;; If destination is a target, make sure we can name the
           ;; container it refers to.
           (enumerable
-           (org-element-lineage datum '(headline paragrah src-block table) t)))
+           (org-element-lineage datum
+                                '(headline paragraph src-block table) t)))
        (pcase (org-element-type enumerable)
         (`headline
          (format (org-ascii--translate "See section %s" info)
@@ -1752,7 +1753,7 @@ contextual information."
   "Transcode a SPECIAL-BLOCK element from Org to ASCII.
 CONTENTS holds the contents of the block.  INFO is a plist
 holding contextual information."
-  ;; "JUSTIFYLEFT" and "JUSTFYRIGHT" have already been taken care of
+  ;; "JUSTIFYLEFT" and "JUSTIFYRIGHT" have already been taken care of
   ;; at a lower level.  There is no other special block type to
   ;; handle.
   contents)
diff --git a/lisp/org/ox-man.el b/lisp/org/ox-man.el
index 71718ab..d0e4976 100644
--- a/lisp/org/ox-man.el
+++ b/lisp/org/ox-man.el
@@ -1014,7 +1014,7 @@ information."
 
 (defun org-man-timestamp (_timestamp _contents _info)
   "Transcode a TIMESTAMP object from Org to Man.
-ONTENTS is nil.  INFO is a plist holding contextual information."
+CONTENTS is nil.  INFO is a plist holding contextual information."
   "")
 
 
diff --git a/lisp/org/ox-publish.el b/lisp/org/ox-publish.el
index 884d6bf..508209a 100644
--- a/lisp/org/ox-publish.el
+++ b/lisp/org/ox-publish.el
@@ -1107,7 +1107,7 @@ publishing directory."
 (defun org-publish--store-crossrefs (output _backend info)
   "Store cross-references for current published file.
 
-OUPUT is the produced output, as a string.  BACKEND is the export
+OUTPUT is the produced output, as a string.  BACKEND is the export
 back-end used, as a symbol.  INFO is the final export state, as
 a plist.
 
diff --git a/lisp/proced.el b/lisp/proced.el
index 0736ab0..86d7968 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -767,7 +767,7 @@ The time interval for updates is specified via 
`proced-auto-update-interval'."
       (while (not (eobp))
         (cond ((looking-at mark-re)
                (proced-insert-mark nil))
-              ((looking-at " ")
+              ((= (following-char) ?\s)
                (proced-insert-mark t))
               (t
                (forward-line 1)))))))
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 4ea0974..9b89681 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1198,7 +1198,7 @@ Note that this is a strict tail, so won't match, e.g. 
\"0x....\".")
   ;; This function is called exclusively as a before-change function via the
   ;; variable `c-get-state-before-change-functions'.
   (c-save-buffer-state (p-limit found)
-    ;; Special consideraton for deleting \ from '\''.
+    ;; Special consideration for deleting \ from '\''.
     (if (and (> end beg)
             (eq (char-before end) ?\\)
             (<= c-new-END end))
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index b3661bf..49e072c 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -1880,8 +1880,8 @@ after indenting."
     ;; FIXME This means f90-calculate-indent gives different answers
     ;; for comments and preprocessor lines to this function.
     ;; Better to make f90-calculate-indent return the correct answer?
-    (cond ((looking-at "!") (setq indent (f90-comment-indent)))
-          ((looking-at "#") (setq indent 0))
+    (cond ((= (following-char) ?!) (setq indent (f90-comment-indent)))
+          ((= (following-char) ?#) (setq indent 0))
           (t
            (and f90-smart-end (looking-at "end")
                 (f90-match-end))
diff --git a/lisp/ses.el b/lisp/ses.el
index 97bade3..741d588 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -1880,7 +1880,7 @@ Does not execute cell formulas or print functions."
       (setq ses--numlocprn 0)
       (dotimes (_ numlocprn)
        (let ((x      (read (current-buffer))))
-         (or (and (looking-at-p "\n")
+         (or (and (= (following-char) ?\n)
                   (eq (car-safe x) 'ses-local-printer)
                   (apply #'ses--local-printer (cdr x)))
              (error "local printer-def error"))
@@ -1890,7 +1890,7 @@ Does not execute cell formulas or print functions."
     (dotimes (col ses--numcols)
       (let* ((x      (read (current-buffer)))
             (sym  (car-safe (cdr-safe x))))
-       (or (and (looking-at-p "\n")
+       (or (and (= (following-char) ?\n)
                 (eq (car-safe x) 'ses-cell)
                 (ses-create-cell-variable sym row col))
            (error "Cell-def error"))
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el
index f25b1a4..1d453d2 100644
--- a/lisp/tar-mode.el
+++ b/lisp/tar-mode.el
@@ -1118,7 +1118,7 @@ for this to be permanent."
        (save-excursion
          (goto-char (point-min))
          (while (not (eobp))
-           (if (looking-at "D")
+           (if (= (following-char) ?D)
                (progn (tar-expunge-internal)
                       (setq n (1+ n)))
                (forward-line 1)))
diff --git a/lisp/window.el b/lisp/window.el
index c933996..43e9e99 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -8033,7 +8033,7 @@ parameters of FRAME."
            ;; to its workarea or the parent frame's native rectangle.
            (margins (or (frame-parameter frame 'fit-frame-to-buffer-margins)
                         fit-frame-to-buffer-margins))
-           ;; Convert margins intto pixel offsets from the left-top
+           ;; Convert margins into pixel offsets from the left-top
            ;; corner of FRAME's display or parent.
            (left-margin (if (nth 0 margins)
                             (window--sanitize-margin
diff --git a/src/window.c b/src/window.c
index 4816bd6..8578705 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4875,7 +4875,7 @@ mark_window_cursors_off (struct window *w)
  * window_wants_mode_line:
  *
  * Return 1 if window W wants a mode line and is high enough to
- * accomodate it, 0 otherwise.
+ * accommodate it, 0 otherwise.
  *
  * W wants a mode line if it's a leaf window and neither a minibuffer
  * nor a pseudo window.  Moreover, its 'window-mode-line-format'
@@ -4905,14 +4905,14 @@ window_wants_mode_line (struct window *w)
  * window_wants_header_line:
  *
  * Return 1 if window W wants a header line and is high enough to
- * accomodate it, 0 otherwise.
+ * accommodate it, 0 otherwise.
  *
  * W wants a header line if it's a leaf window and neither a minibuffer
  * nor a pseudo window.  Moreover, its 'window-mode-line-format'
  * parameter must not be 'none' and either that parameter or W's
  * buffer's 'mode-line-format' value must be non-nil.  Finally, W must
  * be higher than its frame's canonical character height and be able to
- * accomodate a mode line too if necessary (the mode line prevails).
+ * accommodate a mode line too if necessary (the mode line prevails).
  */
 bool
 window_wants_header_line (struct window *w)
diff --git a/src/xdisp.c b/src/xdisp.c
index 8bc5d81..1c316fa 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -16431,9 +16431,6 @@ redisplay_window (Lisp_Object window, bool 
just_this_one_p)
   eassert (XMARKER (w->start)->buffer == buffer);
   eassert (XMARKER (w->pointm)->buffer == buffer);
 
-  /* We come here again if we need to run window-text-change-functions
-     below.  */
- restart:
   reconsider_clip_changes (w);
   frame_line_height = default_line_pixel_height (w);
   margin = window_scroll_margin (w, MARGIN_IN_LINES);
@@ -16500,16 +16497,6 @@ redisplay_window (Lisp_Object window, bool 
just_this_one_p)
        && !window_outdated (w)
        && !hscrolling_current_line_p (w));
 
-  /* Run the window-text-change-functions
-     if it is possible that the text on the screen has changed
-     (either due to modification of the text, or any other reason).  */
-  if (!current_matrix_up_to_date_p
-      && !NILP (Vwindow_text_change_functions))
-    {
-      safe_run_hooks (Qwindow_text_change_functions);
-      goto restart;
-    }
-
   beg_unchanged = BEG_UNCHANGED;
   end_unchanged = END_UNCHANGED;
 
@@ -31692,7 +31679,6 @@ They are still logged to the *Messages* buffer.  */);
   DEFSYM (Qoverriding_terminal_local_map, "overriding-terminal-local-map");
   DEFSYM (Qoverriding_local_map, "overriding-local-map");
   DEFSYM (Qwindow_scroll_functions, "window-scroll-functions");
-  DEFSYM (Qwindow_text_change_functions, "window-text-change-functions");
   DEFSYM (Qredisplay_end_trigger_functions, "redisplay-end-trigger-functions");
   DEFSYM (Qinhibit_point_motion_hooks, "inhibit-point-motion-hooks");
   DEFSYM (Qeval, "eval");
@@ -32016,11 +32002,6 @@ is scrolled.  It is not designed for that, and such 
use probably won't
 work.  */);
   Vwindow_scroll_functions = Qnil;
 
-  DEFVAR_LISP ("window-text-change-functions",
-              Vwindow_text_change_functions,
-    doc: /* Functions to call in redisplay when text in the window might 
change.  */);
-  Vwindow_text_change_functions = Qnil;
-
   DEFVAR_LISP ("redisplay-end-trigger-functions", 
Vredisplay_end_trigger_functions,
     doc: /* Functions called when redisplay of a window reaches the end 
trigger.
 Each function is called with two arguments, the window and the end trigger 
value.
diff --git a/test/lisp/calendar/todo-mode-resources/todo-test-1.toda 
b/test/lisp/calendar/todo-mode-resources/todo-test-1.toda
index 8ca4e19..82262bd 100644
--- a/test/lisp/calendar/todo-mode-resources/todo-test-1.toda
+++ b/test/lisp/calendar/todo-mode-resources/todo-test-1.toda
@@ -1,4 +1,4 @@
-(("testcat1" . [0 0 1 0]) ("testcat2" . [0 0 1 0]) ("testcat3" . [0 0 1 0]))
+(("testcat1" . [0 0 1 0]) ("testcat2" . [0 0 1 0]) ("testcat33" . [0 0 1 0]))
 --==-- testcat1
 
 ==--== DONE 
@@ -7,7 +7,7 @@
 
 ==--== DONE 
 [DONE May 28, 2017] [May 28, 2017] testcat2 item1
---==-- testcat3
+--==-- testcat33
 
 ==--== DONE 
-[DONE May 28, 2017] [May 28, 2017] testcat3 item1
+[DONE May 28, 2017] [May 28, 2017] testcat33 item1
diff --git a/test/lisp/calendar/todo-mode-resources/todo-test-1.todo 
b/test/lisp/calendar/todo-mode-resources/todo-test-1.todo
index 8e845df..598d487 100644
--- a/test/lisp/calendar/todo-mode-resources/todo-test-1.todo
+++ b/test/lisp/calendar/todo-mode-resources/todo-test-1.todo
@@ -1,12 +1,20 @@
-(("testcat1" . [2 0 0 1]) ("testcat2" . [1 0 0 1]))
+(("testcat1" . [2 0 2 1]) ("testcat2" . [3 0 1 1]) ("testcat3" . [0 0 0 0]))
 --==-- testcat1
 [May 29, 2017] testcat1 item3
                has more than one line
                to test item highlighting
-[May 26, 2017] testcat1 item2
+[Jul 3, 2017] testcat1 item4
 
 ==--== DONE 
+[DONE Jul 3, 2017] [Jun 30, 2017] testcat1 item5
+[DONE Jul 3, 2017] [May 30, 2017] testcat1 item2
 --==-- testcat2
-[May 28, 2017] testcat2 item2
+[Jul 3, 2017] testcat2 item3
+[Jul 3, 2017] testcat2 item4
+[Jul 3, 2017] testcat2 item5
+
+==--== DONE 
+[DONE Jul 3, 2017] [May 28, 2017] testcat2 item2
+--==-- testcat3
 
 ==--== DONE 
diff --git a/test/lisp/calendar/todo-mode-tests.el 
b/test/lisp/calendar/todo-mode-tests.el
index 08dfe54..7158987 100644
--- a/test/lisp/calendar/todo-mode-tests.el
+++ b/test/lisp/calendar/todo-mode-tests.el
@@ -44,6 +44,7 @@
 
 (defmacro with-todo-test (&rest body)
   "Set up an isolated todo-mode test environment."
+  (declare (debug (body)))
   `(let* ((todo-test-home (make-temp-file "todo-test-home-" t))
           (process-environment (cons (format "HOME=%s" todo-test-home)
                                      process-environment))
@@ -52,27 +53,35 @@
                                   (car (funcall todo-files-function)))))
      (unwind-protect
          (progn ,@body)
+       ;; Restore pre-test-run state of test files.
+       (dolist (f (directory-files todo-directory))
+         (let ((buf (get-file-buffer f)))
+           (when buf
+             (with-current-buffer buf
+               (restore-buffer-modified-p nil)
+               (kill-buffer)))))
        (delete-directory todo-test-home t))))
 
-;; (defun todo-test-show (num &optional archive)
-;;   "Display category NUM of test todo file.
-;; With non-nil ARCHIVE argument, display test archive file category."
-;;   (let* ((file (if archive todo-test-archive-1 todo-test-file-1))
-;;          (buf (find-file-noselect file)))
-;;     (set-buffer buf)
-;;     (if archive (todo-archive-mode) (todo-mode))
+(defun todo-test--show (num &optional archive)
+  "Display category NUM of test todo file.
+With non-nil ARCHIVE argument, display test archive file category."
+  (let* ((file (if archive todo-test-archive-1 todo-test-file-1))
+         (buf (find-file-noselect file)))
+    (set-buffer buf)
+    (if archive (todo-archive-mode) (todo-mode))
+    (setq todo-category-number num)
+    (todo-category-select)
+    (goto-char (point-min))))
+
+;; (defun todo-test-get-archive (num)
+;;   "Display category NUM of todo archive test file."
+;;   (let ((archive-buf (find-file-noselect todo-test-archive-1)))
+;;     (set-buffer archive-buf)
+;;     (todo-archive-mode)
 ;;     (setq todo-category-number num)
 ;;     (todo-category-select)))
 
-(defun todo-test-get-archive (num)
-  "Display category NUM of todo archive test file."
-  (let ((archive-buf (find-file-noselect todo-test-archive-1)))
-    (set-buffer archive-buf)
-    (todo-archive-mode)
-    (setq todo-category-number num)
-    (todo-category-select)))
-
-(defun todo-test-is-current-buffer (filename)
+(defun todo-test--is-current-buffer (filename)
   "Return non-nil if FILENAME's buffer is current."
   (let ((bufname (buffer-file-name (current-buffer))))
     (and bufname (equal (file-truename bufname) filename))))
@@ -85,24 +94,24 @@ the current todo-mode category.  Quitting todo-mode without 
an
 intermediate buffer switch should not make the archive buffer
 current again."
   (with-todo-test
-   (todo-test-get-archive 2)
+   (todo-test--show 2 'archive)
    (let ((cat-name (todo-current-category)))
      (todo-quit)
-     (should (todo-test-is-current-buffer todo-test-file-1))
+     (should (todo-test--is-current-buffer todo-test-file-1))
      (should (equal (todo-current-category) cat-name))
-     (todo-test-get-archive 1)
+     (todo-test--show 1 'archive)
      (setq cat-name (todo-current-category))
      (todo-quit)
-     (should (todo-test-is-current-buffer todo-test-file-1))
+     (should (todo-test--is-current-buffer todo-test-file-1))
      (should (equal todo-category-number 1))
      (todo-forward-category)         ; Category 2 in todo file now current.
-     (todo-test-get-archive 3)       ; No corresponding category in todo file.
+     (todo-test--show 3 'archive)    ; No corresponding category in todo file.
      (setq cat-name (todo-current-category))
      (todo-quit)
-     (should (todo-test-is-current-buffer todo-test-file-1))
+     (should (todo-test--is-current-buffer todo-test-file-1))
      (should (equal todo-category-number 2))
      (todo-quit)
-     (should-not (todo-test-is-current-buffer todo-test-archive-1)))))
+     (should-not (todo-test--is-current-buffer todo-test-archive-1)))))
 
 (ert-deftest todo-test-todo-quit02 () ; bug#27121
   "Test the behavior of todo-quit with todo and non-todo buffers.
@@ -111,20 +120,19 @@ buffer is buried by quit-window, the todo-mode buffer 
should not
 become current."
   (with-todo-test
    (todo-show)
-   (should (todo-test-is-current-buffer todo-test-file-1))
+   (should (todo-test--is-current-buffer todo-test-file-1))
    (let ((dir (dired default-directory)))
      (todo-show)
      (todo-quit)
      (should (equal (current-buffer) dir))
      (quit-window)
-     (should-not (todo-test-is-current-buffer todo-test-file-1)))))
+     (should-not (todo-test--is-current-buffer todo-test-file-1)))))
 
 (ert-deftest todo-test-item-highlighting () ; bug#27133
   "Test whether `todo-toggle-item-highlighting' highlights whole item.
 In particular, all lines of a multiline item should be highlighted."
   (with-todo-test
-   (todo-show)
-   (todo-jump-to-category nil "testcat1") ; For test rerun.
+   (todo-test--show 1)
    (todo-toggle-item-highlighting)
    (let ((end (1- (todo-item-end)))
          (beg (todo-item-start)))
@@ -134,5 +142,413 @@ In particular, all lines of a multiline item should be 
highlighted."
      (should (eq (next-single-char-property-change beg 'face) (1+ end))))
    (todo-toggle-item-highlighting)))   ; Turn off highlighting (for test 
rerun).
 
+(ert-deftest todo-test-revert-buffer01 ()   ; bug#27609
+  "Test whether todo-mode buffer remains read-only after reverting."
+  (with-todo-test
+   (todo-show)
+   (let ((opoint (point)))
+     (should (equal buffer-read-only t))
+     (todo-revert-buffer nil t)
+     (should (equal buffer-read-only t))
+     (should (eq (point) opoint)))))
+
+(ert-deftest todo-test-revert-buffer02 ()   ; bug#27609
+  "Test whether todo-archive-mode buffer remains read-only after reverting."
+  (with-todo-test
+   (todo-test--show 1 'archive)
+   (let ((opoint (point)))
+     (should (equal buffer-read-only t))
+     (todo-revert-buffer nil t)
+     (should (equal buffer-read-only t))
+     (should (eq (point) opoint)))))
+
+(ert-deftest todo-test-raise-lower-priority ()
+  "Test the behavior of todo-{raise,lower}-item-priority."
+  (with-todo-test
+   ;; (todo-show)
+   (todo-test--show 1)
+   (goto-char (point-min))
+   (let ((p1 (point))
+        (s1 (todo-item-string))
+        p2 s2 p3)
+     ;; First item in category.
+     (should (equal p1 (todo-item-start)))
+     (todo-next-item)
+     (setq p2 (point))
+     ;; Second item in category.
+     (setq s2 (todo-item-string))
+     ;; Second item is lower.
+     (should (> p2 p1))
+     ;; Case 1: lowering priority.
+     (todo-previous-item)
+     (todo-lower-item-priority)
+     ;; Now what was the first item is the second and vice versa.
+     (setq p1 (point))
+     (should (equal s1 (todo-item-string)))
+     (todo-previous-item)
+     (setq p2 (point))
+     (should (equal s2 (todo-item-string)))
+     (should (> p1 p2))
+     ;; Case 2: raising priority.
+     (todo-next-item)
+     (todo-raise-item-priority)
+     ;; Now what had become the second item is again the first and
+     ;; vice versa.
+     (setq p1 (point))
+     (should (equal s1 (todo-item-string)))
+     (todo-next-item)
+     (setq p2 (point))
+     (should (equal s2 (todo-item-string)))
+     (should (> p2 p1))
+     ;; Case 3: empty line (bug#27609).
+     (goto-char (point-max))
+     ;; The last line in the category is always empty.
+     (should-not (todo-item-string))
+     (todo-raise-item-priority)
+     ;; Raising item priority on the empty string is a noop.
+     (should (equal (point) (point-max)))
+     (todo-lower-item-priority)
+     ;; Lowering item priority on the empty string is a noop.
+     (should (equal (point) (point-max)))
+     ;; Case 4: done item (bug#27609).
+     ;; todo-toggle-view-done-items recenters the window if point is
+     ;; not visible, so we have to make sure the todo-mode buffer is
+     ;; in a live window in the test run to avoid failing with (error
+     ;; "`recenter'ing a window that does not display ;; current-buffer.").
+     ;; (But this is not necessary in todo-test-toggle-item-header01
+     ;; below -- why not, or why is it here?  Note that without
+     ;; setting window buffer, the test only fails on the first run --
+     ;; on rerunning it passes.)
+     (set-window-buffer nil (current-buffer))
+     (todo-toggle-view-done-items)
+     (todo-next-item)
+     ;; Now the current item is the first done item.
+     (should (todo-done-item-p))
+     (setq p3 (point))
+     (todo-raise-item-priority)
+     ;; Raising item priority on a done item is a noop.
+     (should (eq (point) p3))
+     (todo-lower-item-priority)
+     ;; Lowering item priority on a done item is a noop.
+     (should (eq (point) p3)))))
+
+(ert-deftest todo-test-todo-mark-unmark-category () ; bug#27609
+  "Test behavior of todo-mark-category and todo-unmark-category."
+  (with-todo-test
+   (todo-show)
+   (let ((cat (todo-current-category)))
+     (todo-mark-category)
+     (should (equal (todo-get-count 'todo cat)
+                   (cdr (assoc cat todo-categories-with-marks))))
+     (todo-unmark-category)
+     (should-not (assoc cat todo-categories-with-marks)))))
+
+(defun todo-test--move-item (cat &optional priority file)
+  "Move item(s) to category CAT with priority PRIORITY (for todo item).
+This provides a noninteractive API for todo-move-item for use in
+automatic testing."
+  (let ((cat0 (car (nth (1- cat) todo-categories)))
+        (file0 (or file todo-current-todo-file)))
+    (cl-letf (((symbol-function 'todo-read-category)
+               (lambda (_prompt &optional _match-type _file) (cons cat0 
file0)))
+              ((symbol-function 'read-number) ; For todo-set-item-priority
+               (lambda (_prompt &optional _default) (or priority 1))))
+      (todo-move-item))))
+
+(ert-deftest todo-test-move-item01 ()
+  "Test moving a todo item to another category with a given priority."
+  (with-todo-test
+   (todo-test--show 1)
+   (let* ((cat1 (todo-current-category))
+         (cat2 (car (nth 1 todo-categories)))
+         (cat1-todo (todo-get-count 'todo cat1))
+         (cat2-todo (todo-get-count 'todo cat2))
+         (item (todo-item-string)))
+     (todo-test--move-item 2 3)
+     (should (equal (todo-current-category) cat2))
+     (should (equal (todo-item-string) item))
+     (should (equal (overlay-get (todo-get-overlay 'prefix) 'before-string)
+                    "3 "))
+     (todo-backward-category)           ; Go to first category again.
+     (should-error (search-forward item))
+     (should (= (todo-get-count 'todo cat1) (1- cat1-todo)))
+     (should (= (todo-get-count 'todo cat2) (1+ cat2-todo))))))
+
+(ert-deftest todo-test-move-item02 ()   ; bug#27609
+  "Test moving a marked todo item to previous category."
+  (with-todo-test
+   (todo-test--show 2)
+   (let* ((cat2 (todo-current-category))
+         (cat1 (car (nth 0 todo-categories)))
+         (cat2-todo (todo-get-count 'todo cat2))
+         (cat1-todo (todo-get-count 'todo cat1))
+         (item (todo-item-string)))
+     ;; If todo-toggle-mark-item is not called interactively, its
+     ;; optional prefix argument evaluates to nil and this raises a
+     ;; wrong-type-argument error.
+     (call-interactively 'todo-toggle-mark-item)
+     (todo-test--move-item 1)
+     (should (equal (todo-current-category) cat1))
+     (should (equal (todo-item-string) item))
+     (should (equal (overlay-get (todo-get-overlay 'prefix) 'before-string)
+                    "1 "))
+     (todo-forward-category)           ; Go to second category again.
+     (should-error (search-forward item))
+     (should (= (todo-get-count 'todo cat1) (1+ cat1-todo)))
+     (should (= (todo-get-count 'todo cat2) (1- cat2-todo))))))
+
+(ert-deftest todo-test-move-item03 ()   ; bug#27609
+  "Test moving a done item to another category.
+In the new category it should be the first done item."
+  (with-todo-test
+   (todo-test--show 1)
+   (let* ((cat1 (todo-current-category))
+         (cat2 (car (nth 1 todo-categories)))
+         (cat1-done (todo-get-count 'done cat1))
+         (cat2-done (todo-get-count 'done cat2)))
+     (goto-char (point-max))
+     (set-window-buffer nil (current-buffer)) ; Why is this necessary?
+     (todo-toggle-view-done-items)
+     (todo-next-item)
+     (let ((item (todo-item-string)))
+       (todo-test--move-item 2)
+       (should (equal (todo-current-category) cat2))
+       (should (equal (todo-item-string) item))
+       (should (todo-done-item-p))
+       (forward-line -1)
+       (should (looking-at todo-category-done))
+       (todo-backward-category)
+       (should-error (search-forward item))
+       (should (= (todo-get-count 'done cat1) (1- cat1-done)))
+       (should (= (todo-get-count 'done cat2) (1+ cat2-done)))))))
+
+(ert-deftest todo-test-move-item04 ()   ; bug#27609
+  "Test moving both a todo and a done item to another category.
+In the new category the todo item should have the provided
+priority and the done item should be the first done item."
+  (with-todo-test
+   (todo-test--show 1)
+   (let* ((cat1 (todo-current-category))
+         (cat2 (car (nth 1 todo-categories)))
+         (cat1-todo (todo-get-count 'todo cat1))
+         (cat2-todo (todo-get-count 'todo cat2))
+         (cat1-done (todo-get-count 'done cat1))
+         (cat2-done (todo-get-count 'done cat2))
+         (todo-item (todo-item-string)))
+     (call-interactively 'todo-toggle-mark-item)
+     (goto-char (point-max))
+     ;; Why is this necessary here but not below?
+     (set-window-buffer nil (current-buffer))
+     (todo-toggle-view-done-items)
+     (todo-next-item)
+     (let ((done-item (todo-item-string)))
+       (call-interactively 'todo-toggle-mark-item)
+       (todo-test--move-item 2 3)
+       (should (equal (todo-current-category) cat2))
+       ;; Point should be on the moved todo item.
+       (should (equal (todo-item-string) todo-item))
+       ;; Done items section should be visible and the move done item
+       ;; should be at the top of it.
+       (should (search-forward done-item))
+       (should (todo-done-item-p))
+       (forward-line -1)
+       (should (looking-at todo-category-done))
+       ;; Make sure marked items are no longer in first category.
+       (todo-backward-category)
+       (should-error (search-forward todo-item))
+       (todo-toggle-view-done-items)
+       (should-error (search-forward done-item))
+       (should (= (todo-get-count 'todo cat1) (1- cat1-todo)))
+       (should (= (todo-get-count 'todo cat2) (1+ cat2-todo)))
+       (should (= (todo-get-count 'done cat1) (1- cat1-done)))
+       (should (= (todo-get-count 'done cat2) (1+ cat2-done)))))))
+
+(ert-deftest todo-test-move-item05 ()   ; bug#27609
+  "Test moving multiple todo and done items to another category.
+Both types of item should be moved en bloc to the new category,
+and the the top todo item should have the provided priority and
+the top done item should be the first done item."
+  (with-todo-test
+   (todo-test--show 1)
+   (let* ((cat1 (todo-current-category))
+         (cat2 (car (nth 1 todo-categories)))
+         (cat1-todo (todo-get-count 'todo cat1))
+         (cat2-todo (todo-get-count 'todo cat2))
+         (cat1-done (todo-get-count 'done cat1))
+         (cat2-done (todo-get-count 'done cat2))
+         (todo-items (buffer-string))
+          (done-items (prog2 (todo-toggle-view-done-only)
+                          (buffer-string)
+                        (todo-toggle-view-done-only))))
+     ;; Why is this necessary here but not below?
+     (set-window-buffer nil (current-buffer))
+     (todo-toggle-view-done-items)
+     (todo-mark-category)
+     (todo-test--move-item 2 3)
+     (should (equal (todo-current-category) cat2))
+     ;; Point should be at the start of the first moved todo item.
+     (should (looking-at (regexp-quote todo-items)))
+     ;; Done items section should be visible and the move done item
+     ;; should be at the top of it.
+     (should (search-forward done-items))
+     (goto-char (match-beginning 0))
+     (should (todo-done-item-p))
+     (forward-line -1)
+     (should (looking-at todo-category-done))
+     ;; Make sure marked items are no longer in first category.
+     (todo-backward-category)
+     (should (eq (point-min) (point-max))) ; All todo items were moved.
+     ;; This passes when run interactively but fails in a batch run:
+     ;; the message is displayed but (current-message) evaluates to
+     ;; nil.
+     ;; (todo-toggle-view-done-items)         ; All done items were moved.
+     ;; (let ((msg (current-message)))
+     ;;   (should (equal msg "There are no done items in this category.")))
+     (todo-toggle-view-done-only)
+     (should (eq (point-min) (point-max))) ; All done items were moved.
+     (should (= (todo-get-count 'todo cat1) 0))
+     (should (= (todo-get-count 'todo cat2) (+ cat1-todo cat2-todo)))
+     (should (= (todo-get-count 'done cat1) 0))
+     (should (= (todo-get-count 'done cat2) (+ cat1-done cat2-done))))))
+
+(ert-deftest todo-test-toggle-item-header01 () ; bug#27609
+  "Test toggling item header from an empty category."
+  (with-todo-test
+   (todo-test--show 3)
+   (should (eq (point-min) (point-max))) ; Category is empty.
+   (todo-toggle-item-header)
+   (todo-backward-category)
+   ;; Header is hidden.
+   (should (equal (overlay-get (todo-get-overlay 'header) 'display) ""))
+   (todo-forward-category)
+   (todo-toggle-item-header)
+   (todo-backward-category)
+   ;; Header is shown.
+   (should-not (todo-get-overlay 'header))))
+
+(ert-deftest todo-test-toggle-item-header02 () ; bug#27609
+  "Test navigating between items with hidden header."
+  :expected-result :failed              ; FIXME
+  (with-todo-test
+   (todo-test--show 2)
+   (let* ((start0 (point))
+          (find-start (lambda ()
+                        (re-search-forward
+                         (concat todo-date-string-start
+                                 todo-date-pattern
+                                "\\( " diary-time-regexp "\\)?"
+                                (regexp-quote todo-nondiary-end) "?")
+                        (line-end-position) t)
+                        (forward-char)
+                        (point)))
+          (start1 (save-excursion (funcall find-start)))
+          (start2 (save-excursion (todo-next-item) (funcall find-start))))
+     (should (looking-at todo-item-start))
+     (todo-toggle-item-header)
+     ;; Point hasn't changed...
+     (should (eq (point) start0))
+     (should (looking-at todo-item-start))
+     ;; FIXME: In the test run this puts point at todo-item-start,
+     ;; i.e. the display overlay doesn't affect this movement, unlike
+     ;; with the command in todo-mode (and using call-interactively
+     ;; here doesn't change this).
+     (todo-next-item)
+     (should (eq (point) start2))
+     (should-not (looking-at todo-item-start))
+     (todo-previous-item)
+     ;; ...but now it has.
+     (should (eq (point) start1))
+     (should-not (looking-at todo-item-start))
+     ;; This is the status quo but is it desirable?
+     (todo-toggle-item-header)
+     (should (eq (point) start1))
+     (should-not (looking-at todo-item-start)))))
+
+(ert-deftest todo-test-toggle-item-header03 () ; bug#27609
+  "Test display of hidden item header when changing item's priority."
+  (with-todo-test
+   (todo-test--show 2)
+   (todo-toggle-item-header)
+   (should (equal (overlay-get (todo-get-overlay 'header) 'display) ""))
+   (todo-lower-item-priority)
+   (should (equal (overlay-get (todo-get-overlay 'header) 'display) ""))
+   (todo-raise-item-priority)
+   (should (equal (overlay-get (todo-get-overlay 'header) 'display) ""))
+   ;; Set priority noninteractively.
+   (cl-letf (((symbol-function 'read-number)
+              (lambda (_prompt &optional _default) 3)))
+     (todo-item-undone))
+   (should (equal (overlay-get (todo-get-overlay 'header) 'display) ""))))
+
+(ert-deftest todo-test-toggle-item-header04 () ; bug#27609
+  "Test display of hidden item header under todo-item-(un)done."
+  (with-todo-test
+   (todo-test--show 1)
+   (let ((item (todo-item-string)))
+     (todo-toggle-item-header)
+     (should (equal (overlay-get (todo-get-overlay 'header) 'display) ""))
+     (todo-item-done)
+     ;; Without set-window-buffer here this test passes when run
+     ;; interactively but fails in a batch run.
+     (set-window-buffer nil (current-buffer))
+     (todo-toggle-view-done-items)
+     (should (search-forward item))
+     (todo-item-start)
+     (should (equal (overlay-get (todo-get-overlay 'header) 'display) ""))
+     ;; Set priority for todo-item-undone noninteractively.
+     (cl-letf (((symbol-function 'read-number)
+               (lambda (_prompt &optional _default) 1)))
+       (todo-item-undone))
+     (should (equal (overlay-get (todo-get-overlay 'header) 'display) "")))))
+
+(ert-deftest todo-test-toggle-item-header05 () ; bug#27609
+  "Test display of hidden item header under todo-move-item."
+  (with-todo-test
+   (todo-test--show 1)
+   (todo-toggle-item-header)
+   (todo-test--move-item 2 3)
+   (should (equal (overlay-get (todo-get-overlay 'header) 'display) ""))))
+
+(ert-deftest todo-test-toggle-item-header06 () ; bug#27609
+  "Test display of hidden item header under (un)archiving.
+The relocated item's header should take on the display status of
+headers in the goal file, even when the display status in the
+source file is different."
+  (with-todo-test
+   (todo-test--show 1)
+   (todo-toggle-item-header)
+   (todo-toggle-view-done-only)         ; Go to first (i.e. top) done item.
+   (let ((item (todo-item-string)))
+     (todo-archive-done-item)
+     (todo-toggle-view-done-only)       ; To display all items on unarchiving.
+     (todo-find-archive)
+     (should (equal (todo-item-string) item)) ; The just archived item.
+     ;; The archive file headers are displayed by default.
+     (should-not (todo-get-overlay 'header))
+     (todo-unarchive-items)
+     ;; Headers in the todo file are still hidden.
+     (should (equal (overlay-get (todo-get-overlay 'header) 'display) "")))))
+
+(defun todo-test--insert-item (item &optional priority)
+  "Insert string ITEM into current category with priority PRIORITY.
+Use defaults for all other item insertion parameters.  This
+provides a noninteractive API for todo-insert-item for use in
+automatic testing."
+  (cl-letf (((symbol-function 'read-from-minibuffer)
+             (lambda (_prompt) item))
+            ((symbol-function 'read-number) ; For todo-set-item-priority
+             (lambda (_prompt &optional _default) (or priority 1))))
+    (todo-insert-item--basic)))
+
+(ert-deftest todo-test-toggle-item-header07 () ; bug#27609
+  "Test display of hidden item header under todo-insert-item."
+  (with-todo-test
+   (todo-test--show 1)
+   (todo-toggle-item-header)
+   (let ((item "Test display of hidden item header under todo-insert-item."))
+     (todo-test--insert-item item 1)
+     (should (equal (overlay-get (todo-get-overlay 'header) 'display) "")))))
+
+
 (provide 'todo-mode-tests)
 ;;; todo-mode-tests.el ends here
diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el 
b/test/lisp/emacs-lisp/lisp-mode-tests.el
index 582041c..cc196be 100644
--- a/test/lisp/emacs-lisp/lisp-mode-tests.el
+++ b/test/lisp/emacs-lisp/lisp-mode-tests.el
@@ -198,6 +198,32 @@ Expected initialization file: `%s'\"
       (indent-region (point-min) (point-max))
       (should (equal (buffer-string) correct)))))
 
+(ert-deftest lisp-comment-indent-1 ()
+  (with-temp-buffer
+    (insert "\
+\(let (                                  ;sf
+      (x 3))
+  4)")
+    (let ((indent-tabs-mode nil)
+          (correct (buffer-string)))
+      (emacs-lisp-mode)
+      (goto-char (point-min))
+      (comment-indent)
+      (should (equal (buffer-string) correct)))))
+
+(ert-deftest lisp-comment-indent-2 ()
+  (with-temp-buffer
+    (insert "\
+\(let (;;sf
+      (x 3))
+  4)")
+    (let ((indent-tabs-mode nil)
+          (correct (buffer-string)))
+      (emacs-lisp-mode)
+      (goto-char (point-min))
+      (comment-indent)
+      (should (equal (buffer-string) correct)))))
+
 
 (provide 'lisp-mode-tests)
 ;;; lisp-mode-tests.el ends here
diff --git a/test/lisp/epg-tests.el b/test/lisp/epg-tests.el
index 9dd093e..36db478 100644
--- a/test/lisp/epg-tests.el
+++ b/test/lisp/epg-tests.el
@@ -30,17 +30,8 @@
   (expand-file-name "data/epg" (getenv "EMACS_TEST_DIRECTORY"))
   "Directory containing epg test data.")
 
-(defconst epg-tests-program-alist-for-passphrase-callback
-  '((OpenPGP
-     nil
-     ("gpg" . "1.4.3"))))
-
-(defun epg-tests-find-usable-gpg-configuration (&optional require-passphrase)
-  (epg-find-configuration
-   'OpenPGP
-   'no-cache
-   (if require-passphrase
-       epg-tests-program-alist-for-passphrase-callback)))
+(defun epg-tests-find-usable-gpg-configuration (&optional _require-passphrase)
+  (epg-find-configuration 'OpenPGP 'no-cache))
 
 (defun epg-tests-passphrase-callback (_c _k _d)
   ;; Need to create a copy here, since the string will be wiped out
diff --git a/test/manual/etags/tex-src/gzip.texi 
b/test/manual/etags/tex-src/gzip.texi
index 07be371..ea5f7f5 100644
--- a/test/manual/etags/tex-src/gzip.texi
+++ b/test/manual/etags/tex-src/gzip.texi
@@ -240,7 +240,7 @@ Force compression or decompression even if the file has 
multiple links
 or the corresponding file already exists, or if the compressed data
 is read from or written to a terminal. If the input data is not in
 a format recognized by @code{gzip}, and if the option --stdout is also
-given, copy the input data without change to the standard ouput: let
+given, copy the input data without change to the standard output: let
 @code{zcat} behave as @code{cat}. If @samp{-f} is not given, and
 when not running in the background, @code{gzip} prompts to verify
 whether an existing file should be overwritten.



reply via email to

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