From: Ivan Shmakov <ivan@siamics.net>
To: 30908@debbugs.gnu.org
Cc: Noam Postavsky <npostavs@gmail.com>
Subject: bug#30908: woman2-roff-buffer fails to restore set-text-properties, etc. on error
Date: Fri, 23 Mar 2018 03:24:17 +0000 [thread overview]
Message-ID: <87fu4r5va6.fsf@violet.siamics.net> (raw)
In-Reply-To: <87bmffsjf2.fsf@gmail.com> (Noam Postavsky's message of "Thu, 22 Mar 2018 20:52:01 -0400")
[-- Attachment #1: Type: text/plain, Size: 1098 bytes --]
>>>>> Noam Postavsky <npostavs@gmail.com> writes:
>>>>> Ivan Shmakov <ivan@siamics.net> writes:
>> @@ -3710,13 +3710,14 @@ defun woman2-roff-buffer ()
>> + (unwind-protect
>> + (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)
>> + (set-marker to nil)))))
> Shouldn’t this rather be combined into the existing unwind-protect
> around the while?
Due to the (not (eobp)) guard, I’ve assumed that the
woman2-format-paragraphs call in the ‘unwind’ branch is for some
sort of fallback processing (in the case the while loop fails.)
If the call ended up there by mistake, indeed a progn should be
used, as per the updated patch MIMEd.
--
FSF associate member #7257 http://am-1.org/~ivan/
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/diff, Size: 4203 bytes --]
--- - 2018-03-23 02:20:53.907229515 +0000
+++ 81FOuhEi.el 2018-03-23 02:20:39.083966234 +0000
@@ -3673,46 +3673,47 @@
(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)
- ;; 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))
+ (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!
+ (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)
next prev parent reply other threads:[~2018-03-23 3:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-22 18:12 bug#30908: woman2-roff-buffer fails to restore set-text-properties, etc. on error Ivan Shmakov
2018-03-23 0:52 ` Noam Postavsky
2018-03-23 3:24 ` Ivan Shmakov [this message]
2018-03-23 10:20 ` Noam Postavsky
2018-04-26 12:01 ` Noam Postavsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fu4r5va6.fsf@violet.siamics.net \
--to=ivan@siamics.net \
--cc=30908@debbugs.gnu.org \
--cc=npostavs@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.