From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ivan Shmakov Newsgroups: gmane.emacs.bugs Subject: bug#30908: woman2-roff-buffer fails to restore set-text-properties, etc. on error Date: Fri, 23 Mar 2018 03:24:17 +0000 Message-ID: <87fu4r5va6.fsf@violet.siamics.net> References: <87o9jg568u.fsf@violet.siamics.net> <87bmffsjf2.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1521775398 17232 195.159.176.226 (23 Mar 2018 03:23:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 23 Mar 2018 03:23:18 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: Noam Postavsky To: 30908@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 23 04:23:13 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ezDIM-0004MC-Bi for geb-bug-gnu-emacs@m.gmane.org; Fri, 23 Mar 2018 04:23:10 +0100 Original-Received: from localhost ([::1]:35847 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezDKP-0005av-Jy for geb-bug-gnu-emacs@m.gmane.org; Thu, 22 Mar 2018 23:25:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53046) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezDKF-0005Yb-Dz for bug-gnu-emacs@gnu.org; Thu, 22 Mar 2018 23:25:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezDKA-0001sT-ET for bug-gnu-emacs@gnu.org; Thu, 22 Mar 2018 23:25:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40503) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ezDKA-0001s4-1V for bug-gnu-emacs@gnu.org; Thu, 22 Mar 2018 23:25:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ezDK9-0001rU-Pg for bug-gnu-emacs@gnu.org; Thu, 22 Mar 2018 23:25:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Mar 2018 03:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30908 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 30908-submit@debbugs.gnu.org id=B30908.15217754647097 (code B ref 30908); Fri, 23 Mar 2018 03:25:01 +0000 Original-Received: (at 30908) by debbugs.gnu.org; 23 Mar 2018 03:24:24 +0000 Original-Received: from localhost ([127.0.0.1]:48400 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ezDJX-0001qN-Fm for submit@debbugs.gnu.org; Thu, 22 Mar 2018 23:24:23 -0400 Original-Received: from fely.am-1.org ([78.47.74.50]:47418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ezDJV-0001qC-Qv for 30908@debbugs.gnu.org; Thu, 22 Mar 2018 23:24:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net ; s=a2013295; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:Sender: References:X-License:Cc:To:Subject:From:Content-Transfer-Encoding:Reply-To: Content-ID:Content-Description; bh=w/ATy6UM0Gajw0C34NuGYhJHwYXC92FlJ9qlpKXKpwQ=; b=G6e9bqbAHUNltse9SukoSV10ks 9cQIIohlfanJdQb2KMG5l0oyudaqdtUfoAn1yjgeZ+gfcwRHZJ73jGX400tyPTNbAvIhx/KWfq0xy h+fs7cL6ZHWHx9zwSx2ReRvL9jOn+SJMRSv1r3BiFzu2DV9a/n2MJd3QLmvV6yLrBl/Q=; Original-Received: from oneingray-1-pt.tunnel.tserv10.par1.ipv6.he.net ([2001:470:1f12:1eb::2] helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1ezDJT-00035D-6o; Fri, 23 Mar 2018 03:24:19 +0000 Original-Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtp (Exim 4.84_2) (envelope-from ) id 1ezDJR-0006j9-CC; Fri, 23 Mar 2018 03:24:17 +0000 X-License: CC-BY-SA-3.0+ (original contributions only) In-Reply-To: <87bmffsjf2.fsf@gmail.com> (Noam Postavsky's message of "Thu, 22 Mar 2018 20:52:01 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:144547 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >>>>> Noam Postavsky writes: >>>>> Ivan Shmakov 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=E2=80=99t this rather be combined into the existing unwind-prote= ct > around the while? Due to the (not (eobp)) guard, I=E2=80=99ve assumed that the woman2-format-paragraphs call in the =E2=80=98unwind=E2=80=99 branch is fo= r 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. --=20 FSF associate member #7257 http://am-1.org/~ivan/ --=-=-= Content-Type: text/diff Content-Disposition: inline --- - 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) --=-=-=--