emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 66dbb78 2/3: Ensure woman2-roff-buffer restores fun


From: Noam Postavsky
Subject: [Emacs-diffs] master 66dbb78 2/3: Ensure woman2-roff-buffer restores functions on error (Bug#30908)
Date: Thu, 26 Apr 2018 07:56:25 -0400 (EDT)

branch: master
commit 66dbb787a22d4ae1d513a3ee27e22eed395f5676
Author: Ivan Shmakov <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Ensure woman2-roff-buffer restores functions on error (Bug#30908)
    
    * lisp/woman.el (woman2-roff-buffer): Put the fallback paragraph
    processing inside the protected part of the unwind-protect form,
    rather than the cleanup forms.  Attempting to format paragraphs again
    after an error has been signaled is unlikely to be helpful.  The
    fallback processing should be triggered only in case the loop
    terminated normally, but did not reach the end of the buffer for some
    reason.
---
 lisp/woman.el | 78 +++++++++++++++++++++++++++++------------------------------
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/lisp/woman.el b/lisp/woman.el
index eab97fb..238a7d3 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -3663,46 +3663,46 @@ expression in parentheses.  Leaves point after the 
value."
     (fset 'insert-and-inherit (symbol-function 'insert))
     (fset 'set-text-properties 'ignore)
     (unwind-protect
-       (while
-           ;; Find next control line:
-            (re-search-forward woman-request-regexp nil t)
-          (cond
-           ;; Construct woman function to call:
-           ((setq fn (intern-soft
-                      (concat "woman2-"
-                              (setq woman-request (match-string 1)))))
-            ;; Delete request or macro name:
-            (woman-delete-match 0))
-           ;; Unrecognized request:
-           ((prog1 nil
-              ;; (WoMan-warn ".%s request ignored!" woman-request)
-              (WoMan-warn-ignored woman-request "ignored!")
-              ;; (setq fn 'woman2-LP)
+        (progn
+          (while
+              ;; Find next control line:
+              (re-search-forward woman-request-regexp nil t)
+            (cond
+             ;; Construct woman function to call:
+             ((setq fn (intern-soft
+                        (concat "woman2-"
+                                (setq woman-request (match-string 1)))))
+              ;; Delete request or macro name:
+              (woman-delete-match 0))
+             ;; Unrecognized request:
+             ((prog1 nil
+                ;; (WoMan-warn ".%s request ignored!" woman-request)
+                (WoMan-warn-ignored woman-request "ignored!")
+                ;; (setq fn 'woman2-LP)
+                ;; AVOID LEAVING A BLANK LINE!
+                ;; (setq fn 'woman2-format-paragraphs)
+                ))
+             ;; .LP assumes it is at eol and leaves a (blank) line,
+             ;; so leave point at end of line before paragraph:
+             ((or (looking-at "[ \t]*$") ; no argument
+                  woman-ignore)          ; ignore all
+              ;; (beginning-of-line) (kill-line)
               ;; AVOID LEAVING A BLANK LINE!
-              ;; (setq fn 'woman2-format-paragraphs)
-              ))
-           ;; .LP assumes it is at eol and leaves a (blank) line,
-           ;; so leave point at end of line before paragraph:
-           ((or (looking-at "[ \t]*$") ; no argument
-                woman-ignore)          ; ignore all
-            ;; (beginning-of-line) (kill-line)
-            ;; AVOID LEAVING A BLANK LINE!
-            (beginning-of-line) (woman-delete-line 1))
-           (t (end-of-line) (insert ?\n))
-           )
-           (if (not (or fn
-                        (and (not (memq (following-char) '(?. ?')))
-                             (setq fn 'woman2-format-paragraphs))))
-               ()
-             ;; Find next control line:
-            (if (equal woman-request "TS")
-                (set-marker to (woman-find-next-control-line "TE"))
-              (set-marker to (woman-find-next-control-line)))
-             ;; Call the appropriate function:
-             (funcall fn to)))
-      (if (not (eobp))                 ; This should not happen, but ...
-         (woman2-format-paragraphs (copy-marker (point-max) t)
-                                    woman-left-margin))
+              (beginning-of-line) (woman-delete-line 1))
+             (t (end-of-line) (insert ?\n)))
+            (if (not (or fn
+                         (and (not (memq (following-char) '(?. ?')))
+                              (setq fn 'woman2-format-paragraphs))))
+                ()
+              ;; Find next control line:
+              (if (equal woman-request "TS")
+                  (set-marker to (woman-find-next-control-line "TE"))
+                (set-marker to (woman-find-next-control-line)))
+              ;; Call the appropriate function:
+              (funcall fn to)))
+          (if (not (eobp))             ; This should not happen, but ...
+              (woman2-format-paragraphs (copy-marker (point-max) t)
+                                        woman-left-margin)))
       (fset 'canonically-space-region canonically-space-region)
       (fset 'set-text-properties set-text-properties)
       (fset 'insert-and-inherit insert-and-inherit)



reply via email to

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