From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [david.hansen@physik.fu-berlin.de: WoMan Bug] Date: Sat, 16 Sep 2006 13:58:39 -0400 Message-ID: References: <87wt87vz03.fsf@cs.cmu.edu> <87k645r8uz.fsf@cs.cmu.edu> <87bqphr7qo.fsf@cs.cmu.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1158464417 1135 80.91.229.2 (17 Sep 2006 03:40:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 17 Sep 2006 03:40:17 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 17 05:40:15 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GOnVt-0007NV-OU for ged-emacs-devel@m.gmane.org; Sun, 17 Sep 2006 05:40:14 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GOnVt-0005jj-9o for ged-emacs-devel@m.gmane.org; Sat, 16 Sep 2006 23:40:13 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GOnVH-0005Yg-2b for emacs-devel@gnu.org; Sat, 16 Sep 2006 23:39:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GOnVG-0005YM-AQ for emacs-devel@gnu.org; Sat, 16 Sep 2006 23:39:34 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GOnVG-0005YF-5O for emacs-devel@gnu.org; Sat, 16 Sep 2006 23:39:34 -0400 Original-Received: from [209.226.175.74] (helo=tomts20-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GOnXm-0002vP-8G; Sat, 16 Sep 2006 23:42:10 -0400 Original-Received: from alfajor ([70.55.143.90]) by tomts20-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20060917033931.YFOT16051.tomts20-srv.bellnexxia.net@alfajor>; Sat, 16 Sep 2006 23:39:31 -0400 Original-Received: by alfajor (Postfix, from userid 20848) id 3D31A1C1B7; Sat, 16 Sep 2006 13:58:39 -0400 (EDT) Original-To: Michael Welsh Duggan In-Reply-To: <87bqphr7qo.fsf@cs.cmu.edu> (Michael Welsh Duggan's message of "Fri\, 15 Sep 2006 01\:58\:39 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:59927 Archived-At: I believe the patch below catches all the places where the problem could have shown up. Can someone check that it makes sense and works? Stefan --- orig/lisp/woman.el +++ mod/lisp/woman.el @@ -438,6 +438,7 @@ (eval-when-compile ; to avoid compiler warnings (require 'dired) + (require 'cl) (require 'apropos)) (defun woman-mapcan (fn x) @@ -2467,6 +2468,7 @@ (woman0-search-regex (concat woman0-search-regex-start woman0-search-regex-end)) woman0-rename-alist) + (set-marker-insertion-type woman0-if-to t) (while (re-search-forward woman0-search-regex nil t) (setq request (match-string 1)) (cond ((string= request "ig") (woman0-ig)) @@ -2540,7 +2542,7 @@ ;; String delimiter can be any non-numeric character, ;; including a special character escape: (looking-at "\\(\\\\(..\\|[^0-9]\\)\\(.*\\)\\1\\(.*\\)\\1\\'")) - (let ((end1 (copy-marker (match-end 2)))) ; end of first string + (let ((end1 (copy-marker (match-end 2) t))) ; End of first string. ;; Delete 2nd and 3rd delimiters to avoid processing them: (delete-region (match-end 3) woman0-if-to) (delete-region (match-end 2) (match-beginning 3)) @@ -2656,9 +2658,8 @@ (beginning-of-line) (woman-delete-line 1) (let ((from (point)) - (to (make-marker)) - (length (woman-insert-file-contents filename 0))) - (set-marker to (+ from length)) + (length (woman-insert-file-contents filename 0)) + (to (copy-marker (+ from length) t))) (woman-pre-process-region from to) (set-marker to nil) (goto-char from) @@ -3442,9 +3443,7 @@ (defsubst woman2-process-escapes-to-eol (&optional numeric) "Process remaining escape sequences up to eol. Handle numeric arguments specially if optional argument NUMERIC is non-nil." - (woman2-process-escapes - (save-excursion (end-of-line) (point-marker)) - numeric)) + (woman2-process-escapes (copy-marker (line-end-position) t) numeric)) (defun woman2-nr (to) ".nr R +/-N M -- Assign +/-N (wrt to previous value, if any) to register R. @@ -3645,6 +3644,7 @@ (woman-registers woman-registers) fn request translations tab-stop-list) + (set-marker-insertion-type to t) ;; ?roff does not squeeze multiple spaces, but does fill, so... (fset 'canonically-space-region 'ignore) ;; Try to avoid spaces inheriting underlines from preceding text! @@ -3687,7 +3687,8 @@ ;; Call the appropriate function: (funcall fn to))) (if (not (eobp)) ; This should not happen, but ... - (woman2-format-paragraphs (point-max-marker) woman-left-margin)) + (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) @@ -3899,6 +3900,7 @@ (defun woman2-process-escapes (to &optional numeric) "Process remaining escape sequences up to marker TO, preserving point. Optional argument NUMERIC, if non-nil, means the argument is numeric." + (assert (and (markerp to) (marker-insertion-type to))) ;; The first two cases below could be merged (maybe)! (let ((from (point))) ;; Discard zero width filler character used to hide leading dots @@ -3968,15 +3970,13 @@ (delete-char -1) (delete-char 1) (looking-at "\\(.\\)\\(.*\\)\\1") - (let ((to (make-marker)) from N c) - (set-marker to (match-end 2)) - (delete-char 1) - (setq from (point) - N (woman-parse-numeric-arg)) - (setq c (if (< (point) to) (following-char) ?_)) + (forward-char 1) + (let* ((to (match-end 2))) + (from (match-beginning 0)) + (N (woman-parse-numeric-arg)) + (c (if (< (point) to) (following-char) ?_))) (delete-region from to) (delete-char 1) - (set-marker to nil) (insert (make-string N c)) ))