unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [david.hansen@physik.fu-berlin.de: WoMan Bug]
@ 2006-09-14  2:34 Richard Stallman
  2006-09-14  4:43 ` Michael Welsh Duggan
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Stallman @ 2006-09-14  2:34 UTC (permalink / raw)


Would someone please fix this, then ack?

------- Start of forwarded message -------
From: David Hansen <david.hansen@physik.fu-berlin.de>
To: emacs-pretest-bug@gnu.org
Organization: disorganized
Date: Wed, 13 Sep 2006 17:31:47 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Subject: WoMan Bug
X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed 
	version=3.0.4


Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the emacs-pretest-bug@gnu.org mailing list.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

In emacs -Q when i try to read the screen man page (from the
debian unstable package):

Debugger entered--Lisp error: (error "Invalid search bound (wrong side of point)")
  search-forward("	" #<marker at 101901 in *WoMan 1 screen*> t)
  woman2-process-escapes(#<marker at 101901 in *WoMan 1 screen*> nil)
  woman2-tagged-paragraph(#<marker at 102002 in *WoMan 1 screen*> 5)
  woman2-IP(#<marker at 102002 in *WoMan 1 screen*>)
  woman2-roff-buffer()
  woman-decode-region(1 146569)
  woman-decode-buffer()
  woman-process-buffer()
  woman-really-find-file("/usr/share/man/man1/screen.1.gz" t "*WoMan 1 screen*")
  woman-find-file("/usr/share/man/man1/screen.1.gz")
  woman(nil nil)
  call-interactively(woman)
  execute-extended-command(nil)
  call-interactively(execute-extended-command)

If you need the man page file drop a node.

David

If emacs crashed, and you have the emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/home/dhansen/share/emacs/22.0.50/etc/DEBUG for instructions.


In GNU Emacs 22.0.50.1 (i686-pc-linux-gnu)
 of 2006-09-08 on robotron
X server distributor `The X.Org Foundation', version 11.0.70000000
configured using `configure '--prefix=/home/dhansen' '--disable-sound' '--disable-pop' '--with-x-toolkit=no''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: en_US.UTF-8
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: Group

Minor modes in effect:
  gnus-topic-mode: t
  hl-line-mode: t
  gnus-undo-mode: t
  erc-list-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-netsplit-mode: t
  erc-spelling-mode: t
  erc-truncate-mode: t
  shell-dirtrack-mode: t
  iswitchb-mode: t
  show-paren-mode: t
  jabber-activity-mode: t
  erc-button-mode: t
  erc-services-mode: t
  erc-match-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-autojoin-mode: t
  erc-smiley-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-readonly-mode: t
  erc-scrolltobottom-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-x k <return> 
y C-x b g r <return> g C-n C-n C-n C-n <return> q C-p 
C-p C-p M-g g M-x r e p SPC o SPC r SPC e m a SPC b 
u SPC <return>

Recent messages:
nnrss: Requesting piratebay.audiobooks...done
nnrss: Requesting piratebay.music...done
Reading active file from localhost via nntp...
Reading active file via nnml...
nnml: Reading incoming mail from directory...
Wrote /home/dhansen/Mail/eztorrent/11692
nnml: Reading incoming mail (1 new)...done
Reading active file via nnml...done
Checking new news...done
Making completion list... [2 times]


_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
------- End of forwarded message -------

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [david.hansen@physik.fu-berlin.de: WoMan Bug]
  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
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Welsh Duggan @ 2006-09-14  4:43 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

> Would someone please fix this, then ack?

The following patch would appear to fix this problem:

*** woman.el	04 Sep 2006 13:03:49 -0400	1.46
--- woman.el	14 Sep 2006 00:41:56 -0400	
***************
*** 4391,4399 ****
  		    tab (- tab (if (eq type ?C) (/ n 2) n))) )
  	  (setq n (- tab (current-column)))
  	  (while (> n 0)
! 	    (insert ?\ )
  	    (setq n (1- n))))
!       (insert ?\ ))))
  
  (defun woman2-DT (to)
    ".DT -- Restore default tabs.  Format paragraphs upto TO.
--- 4391,4399 ----
  		    tab (- tab (if (eq type ?C) (/ n 2) n))) )
  	  (setq n (- tab (current-column)))
  	  (while (> n 0)
! 	    (insert-before-markers ?\ )
  	    (setq n (1- n))))
!       (insert-before-markers ?\ ))))
  
  (defun woman2-DT (to)
    ".DT -- Restore default tabs.  Format paragraphs upto TO.

> From: David Hansen <david.hansen@physik.fu-berlin.de>
> Subject: WoMan Bug
> To: emacs-pretest-bug@gnu.org
> Date: Wed, 13 Sep 2006 17:31:47 +0200
> Organization: disorganized
> X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed 
> 	version=3.0.4
>
>
> Please write in English if possible, because the Emacs maintainers
> usually do not have translators to read other languages for them.
>
> Your bug report will be posted to the emacs-pretest-bug@gnu.org mailing list.
>
> Please describe exactly what actions triggered the bug
> and the precise symptoms of the bug:
>
> In emacs -Q when i try to read the screen man page (from the
> debian unstable package):
>
> Debugger entered--Lisp error: (error "Invalid search bound (wrong side of point)")
>   search-forward("	" #<marker at 101901 in *WoMan 1 screen*> t)
>   woman2-process-escapes(#<marker at 101901 in *WoMan 1 screen*> nil)
>   woman2-tagged-paragraph(#<marker at 102002 in *WoMan 1 screen*> 5)
>   woman2-IP(#<marker at 102002 in *WoMan 1 screen*>)
>   woman2-roff-buffer()
>   woman-decode-region(1 146569)
>   woman-decode-buffer()
>   woman-process-buffer()
>   woman-really-find-file("/usr/share/man/man1/screen.1.gz" t "*WoMan 1 screen*")
>   woman-find-file("/usr/share/man/man1/screen.1.gz")
>   woman(nil nil)
>   call-interactively(woman)
>   execute-extended-command(nil)
>   call-interactively(execute-extended-command)
>
> If you need the man page file drop a node.
>
> David

-- 
Michael Welsh Duggan
(md5i@cs.cmu.edu)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [david.hansen@physik.fu-berlin.de: WoMan Bug]
  2006-09-14  4:43 ` Michael Welsh Duggan
@ 2006-09-14  5:36   ` Stefan Monnier
  2006-09-14 17:00     ` David Hansen
                       ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Stefan Monnier @ 2006-09-14  5:36 UTC (permalink / raw)
  Cc: rms, emacs-devel

>> Would someone please fix this, then ack?

> The following patch would appear to fix this problem:

I believe the right patch is to change the marker's insertion type (so that
insertions are automatically made "before").  The patch below does that at
the spot caught by the OP.  There might be other places where we need some
fixup, so please try it and tell me if you hit the "Internal error" check
or not (and if you do, please provide a backtrace).


        Stefan


--- woman.el	05 sep 2006 23:20:53 -0400	1.46
+++ woman.el	14 sep 2006 01:32:37 -0400	
@@ -3442,9 +3442,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 (line-end-position) numeric))
 
 (defun woman2-nr (to)
   ".nr R +/-N M -- Assign +/-N (wrt to previous value, if any) to register R.
@@ -3897,10 +3895,15 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defun woman2-process-escapes (to &optional numeric)
-  "Process remaining escape sequences up to marker TO, preserving point.
+  "Process remaining escape sequences up to TO, preserving point.
 Optional argument NUMERIC, if non-nil, means the argument is numeric."
   ;; The first two cases below could be merged (maybe)!
   (let ((from (point)))
+    ;; Make sure TO is a move-after-insertion kind of marker.
+    (if (markerp to)
+        (unless (marker-insertion-type to)
+          (error "Internal error: wrong marker type"))
+      (setq to (copy-marker to t)))
     ;; Discard zero width filler character used to hide leading dots
     ;; and zero width characters \|, \^:
     (while (re-search-forward "\\\\[&|^]" to t)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [david.hansen@physik.fu-berlin.de: WoMan Bug]
  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:52     ` Michael Welsh Duggan
  2 siblings, 0 replies; 13+ messages in thread
From: David Hansen @ 2006-09-14 17:00 UTC (permalink / raw)


On Thu, 14 Sep 2006 01:36:59 -0400 Stefan Monnier wrote:

>>> Would someone please fix this, then ack?
>
>> The following patch would appear to fix this problem:
>
> I believe the right patch is to change the marker's insertion type (so that
> insertions are automatically made "before").  The patch below does that at
> the spot caught by the OP.  There might be other places where we need some
> fixup, so please try it and tell me if you hit the "Internal error" check
> or not (and if you do, please provide a backtrace).
>

Now i get:

Debugger entered--Lisp error: (error "Internal error: wrong marker type")
  signal(error ("Internal error: wrong marker type"))
  error("Internal error: wrong marker type")
  woman2-process-escapes(#<marker at 90 in *WoMan 1 screen*> numeric)
  woman2-format-paragraphs(#<marker at 90 in *WoMan 1 screen*> 5)
  woman2-SH(#<marker at 90 in *WoMan 1 screen*>)
  woman2-roff-buffer()
  woman-decode-region(1 146569)
  woman-decode-buffer()
  woman-process-buffer()
  woman-really-find-file("/usr/share/man/man1/screen.1.gz" t "*WoMan 1 screen*")
  woman-find-file("/usr/share/man/man1/screen.1.gz")
  woman(nil nil)
  call-interactively(woman)
  execute-extended-command(nil)
  call-interactively(execute-extended-command)

David

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [david.hansen@physik.fu-berlin.de: WoMan Bug]
  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-15  5:52     ` Michael Welsh Duggan
  2 siblings, 1 reply; 13+ messages in thread
From: Michael Welsh Duggan @ 2006-09-15  5:34 UTC (permalink / raw)
  Cc: rms, emacs-devel

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

>>> Would someone please fix this, then ack?
>
>> The following patch would appear to fix this problem:
>
> I believe the right patch is to change the marker's insertion type (so that
> insertions are automatically made "before").  The patch below does that at
> the spot caught by the OP.  There might be other places where we need some
> fixup, so please try it and tell me if you hit the "Internal error" check
> or not (and if you do, please provide a backtrace).

Actually, this patch doesn't appear to change the marker insertion
type at all.  Was something left out?

> --- woman.el	05 sep 2006 23:20:53 -0400	1.46
> +++ woman.el	14 sep 2006 01:32:37 -0400	
> @@ -3442,9 +3442,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 (line-end-position) numeric))
>  
>  (defun woman2-nr (to)
>    ".nr R +/-N M -- Assign +/-N (wrt to previous value, if any) to register R.
> @@ -3897,10 +3895,15 @@
>  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>  
>  (defun woman2-process-escapes (to &optional numeric)
> -  "Process remaining escape sequences up to marker TO, preserving point.
> +  "Process remaining escape sequences up to TO, preserving point.
>  Optional argument NUMERIC, if non-nil, means the argument is numeric."
>    ;; The first two cases below could be merged (maybe)!
>    (let ((from (point)))
> +    ;; Make sure TO is a move-after-insertion kind of marker.
> +    (if (markerp to)
> +        (unless (marker-insertion-type to)
> +          (error "Internal error: wrong marker type"))
> +      (setq to (copy-marker to t)))
>      ;; Discard zero width filler character used to hide leading dots
>      ;; and zero width characters \|, \^:
>      (while (re-search-forward "\\\\[&|^]" to t)

-- 
Michael Welsh Duggan
(md5i@cs.cmu.edu)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [david.hansen@physik.fu-berlin.de: WoMan Bug]
  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:52     ` Michael Welsh Duggan
  2 siblings, 0 replies; 13+ messages in thread
From: Michael Welsh Duggan @ 2006-09-15  5:52 UTC (permalink / raw)
  Cc: rms, emacs-devel

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

>>> Would someone please fix this, then ack?
>
>> The following patch would appear to fix this problem:
>
> I believe the right patch is to change the marker's insertion type (so that
> insertions are automatically made "before").  The patch below does that at
> the spot caught by the OP.  There might be other places where we need some
> fixup, so please try it and tell me if you hit the "Internal error" check
> or not (and if you do, please provide a backtrace).

[patch elided]

How about the following instead?

--- woman.el	04 Sep 2006 13:03:49 -0400	1.46
+++ woman.el	15 Sep 2006 01:49:25 -0400	
@@ -3442,9 +3442,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 +3643,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!
@@ -3897,10 +3896,15 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defun woman2-process-escapes (to &optional numeric)
-  "Process remaining escape sequences up to marker TO, preserving point.
+  "Process remaining escape sequences up to TO, preserving point.
 Optional argument NUMERIC, if non-nil, means the argument is numeric."
   ;; The first two cases below could be merged (maybe)!
   (let ((from (point)))
+    ;; Make sure TO is a move-after-insertion kind of marker.
+    (if (markerp to)
+	(unless (marker-insertion-type to)
+	  (error "Internal error: wrong marker type"))
+      (setq to (copy-marker to t)))
     ;; Discard zero width filler character used to hide leading dots
     ;; and zero width characters \|, \^:
     (while (re-search-forward "\\\\[&|^]" to t)

-- 
Michael Welsh Duggan
(md5i@cs.cmu.edu)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [david.hansen@physik.fu-berlin.de: WoMan Bug]
  2006-09-15  5:34     ` Michael Welsh Duggan
@ 2006-09-15  5:58       ` Michael Welsh Duggan
  2006-09-16 17:58         ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Welsh Duggan @ 2006-09-15  5:58 UTC (permalink / raw)
  Cc: rms, emacs-devel

Michael Welsh Duggan <md5i@cs.cmu.edu> writes:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>>>> Would someone please fix this, then ack?
>>
>>> The following patch would appear to fix this problem:
>>
>> I believe the right patch is to change the marker's insertion type (so that
>> insertions are automatically made "before").  The patch below does that at
>> the spot caught by the OP.  There might be other places where we need some
>> fixup, so please try it and tell me if you hit the "Internal error" check
>> or not (and if you do, please provide a backtrace).
>
> Actually, this patch doesn't appear to change the marker insertion
> type at all.  Was something left out?

I take that back.  I simply misunderstood the code.  Ignore also my
followup patch, in favor of the following:

--- woman.el	04 Sep 2006 13:03:49 -0400	1.46
+++ woman.el	15 Sep 2006 01:57:31 -0400	
@@ -3442,9 +3442,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 (end-of-line) numeric))
 
 (defun woman2-nr (to)
   ".nr R +/-N M -- Assign +/-N (wrt to previous value, if any) to register R.
@@ -3645,6 +3643,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!
@@ -3897,10 +3896,15 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defun woman2-process-escapes (to &optional numeric)
-  "Process remaining escape sequences up to marker TO, preserving point.
+  "Process remaining escape sequences up to TO, preserving point.
 Optional argument NUMERIC, if non-nil, means the argument is numeric."
   ;; The first two cases below could be merged (maybe)!
   (let ((from (point)))
+    ;; Make sure TO is a move-after-insertion kind of marker.
+    (if (markerp to)
+        (unless (marker-insertion-type to)
+          (error "Internal error: wrong marker type"))
+      (setq to (copy-marker to t)))
     ;; Discard zero width filler character used to hide leading dots
     ;; and zero width characters \|, \^:
     (while (re-search-forward "\\\\[&|^]" to t)

-- 
Michael Welsh Duggan
(md5i@cs.cmu.edu)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [david.hansen@physik.fu-berlin.de: WoMan Bug]
  2006-09-15  5:58       ` Michael Welsh Duggan
@ 2006-09-16 17:58         ` Stefan Monnier
  2006-09-18 15:51           ` Chong Yidong
  2006-09-18 23:11           ` David Hansen
  0 siblings, 2 replies; 13+ messages in thread
From: Stefan Monnier @ 2006-09-16 17:58 UTC (permalink / raw)
  Cc: rms, emacs-devel

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [david.hansen@physik.fu-berlin.de: WoMan Bug]
  2006-09-16 17:58         ` Stefan Monnier
@ 2006-09-18 15:51           ` Chong Yidong
  2006-09-18 23:11           ` David Hansen
  1 sibling, 0 replies; 13+ messages in thread
From: Chong Yidong @ 2006-09-18 15:51 UTC (permalink / raw)
  Cc: emacs-devel, rms, Michael Welsh Duggan

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [david.hansen@physik.fu-berlin.de: WoMan Bug]
  2006-09-16 17:58         ` Stefan Monnier
  2006-09-18 15:51           ` Chong Yidong
@ 2006-09-18 23:11           ` David Hansen
  2006-09-22  3:01             ` Chong Yidong
  1 sibling, 1 reply; 13+ messages in thread
From: David Hansen @ 2006-09-18 23:11 UTC (permalink / raw)


On Sat, 16 Sep 2006 13:58:39 -0400 Stefan Monnier wrote:

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

Hmm, against which version of woman i have to apply this
patch?  Can't get it to work with a fresh updated emacs.

David

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [david.hansen@physik.fu-berlin.de: WoMan Bug]
  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
  0 siblings, 2 replies; 13+ messages in thread
From: Chong Yidong @ 2006-09-22  3:01 UTC (permalink / raw)


David Hansen <david.hansen@gmx.net> writes:

> On Sat, 16 Sep 2006 13:58:39 -0400 Stefan Monnier wrote:
>
>> 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?
>
> Hmm, against which version of woman i have to apply this
> patch?  Can't get it to work with a fresh updated emacs.

Works for me.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [david.hansen@physik.fu-berlin.de: WoMan Bug]
  2006-09-22  3:01             ` Chong Yidong
@ 2006-09-22 17:01               ` Richard Stallman
  2006-09-23  4:38               ` David Hansen
  1 sibling, 0 replies; 13+ messages in thread
From: Richard Stallman @ 2006-09-22 17:01 UTC (permalink / raw)
  Cc: emacs-devel

Could you send Hansen a complete modified woman.el to try?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [david.hansen@physik.fu-berlin.de: WoMan Bug]
  2006-09-22  3:01             ` Chong Yidong
  2006-09-22 17:01               ` Richard Stallman
@ 2006-09-23  4:38               ` David Hansen
  1 sibling, 0 replies; 13+ messages in thread
From: David Hansen @ 2006-09-23  4:38 UTC (permalink / raw)


On Thu, 21 Sep 2006 23:01:35 -0400 Chong Yidong wrote:

> David Hansen <david.hansen@gmx.net> writes:
>
>> On Sat, 16 Sep 2006 13:58:39 -0400 Stefan Monnier wrote:
>>
>>> 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?
>>
>> Hmm, against which version of woman i have to apply this
>> patch?  Can't get it to work with a fresh updated emacs.
>
> Works for me.

I doubt.  It even has unbalanced parens.  But with a patched
patch it's rendering the screen man page (please check.  I
only did the obvious stuff to get it compiled w/o warnings).

*** /home/dhansen/.emacs.d/saves/!home!dhansen!woman.el.~1~	2006-09-23 06:10:16.000000000 +0200
--- /home/dhansen/share/emacs/22.0.50/lisp/woman.el	2006-09-23 06:24:46.000000000 +0200
***************
*** 2657,2665 ****
  	(error "File `%s' not found" name))
      (beginning-of-line)
      (woman-delete-line 1)
!     (let ((from (point))
! 	  (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)
--- 2657,2665 ----
  	(error "File `%s' not found" name))
      (beginning-of-line)
      (woman-delete-line 1)
!     (let* ((from (point))
!            (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)
***************
*** 3971,3984 ****
    (delete-char 1)
    (looking-at "\\(.\\)\\(.*\\)\\1")
    (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)
!     (insert (make-string N c))
!     ))
  
  ;;; 4. Text Filling, Adjusting, and Centering
  
--- 3971,3983 ----
    (delete-char 1)
    (looking-at "\\(.\\)\\(.*\\)\\1")
    (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)
!     (insert (make-string N c))))
  
  ;;; 4. Text Filling, Adjusting, and Centering

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2006-09-23  4:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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