unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
Cc: emacs-devel@gnu.org, rms@gnu.org, Michael Welsh Duggan <md5i@cs.cmu.edu>
Subject: Re: [david.hansen@physik.fu-berlin.de: WoMan Bug]
Date: Mon, 18 Sep 2006 11:51:06 -0400	[thread overview]
Message-ID: <87irjl9nrp.fsf@stupidchicken.com> (raw)
In-Reply-To: <jwvr6yb66je.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat\, 16 Sep 2006 13\:58\:39 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> 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?

Looks OK to me.

> --- 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))
>      ))

  reply	other threads:[~2006-09-18 15:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-14  2:34 [david.hansen@physik.fu-berlin.de: WoMan Bug] Richard Stallman
2006-09-14  4:43 ` Michael Welsh Duggan
2006-09-14  5:36   ` Stefan Monnier
2006-09-14 17:00     ` David Hansen
2006-09-15  5:34     ` Michael Welsh Duggan
2006-09-15  5:58       ` Michael Welsh Duggan
2006-09-16 17:58         ` Stefan Monnier
2006-09-18 15:51           ` Chong Yidong [this message]
2006-09-18 23:11           ` David Hansen
2006-09-22  3:01             ` Chong Yidong
2006-09-22 17:01               ` Richard Stallman
2006-09-23  4:38               ` David Hansen
2006-09-15  5:52     ` Michael Welsh Duggan

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87irjl9nrp.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=md5i@cs.cmu.edu \
    --cc=rms@gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).