Commit 8cc8239e authored by Stefan Monnier's avatar Stefan Monnier
Browse files

Make sure all the end-of-region markers we use have

a non-nil insertion-type.
(woman0-so): Move things around so we can use copy-marker.
(woman0-roff-buffer, woman2-process-escapes-to-eol, woman2-roff-buffer):
Adjust marker type.
(woman2-process-escapes): Check marker type.
(woman-horizontal-line): Dispense with the use of a marker.
parent eb8c8b04
2006-09-22 Stefan Monnier <monnier@iro.umontreal.ca>
* woman.el: Make sure all the end-of-region markers we use have
a non-nil insertion-type.
(woman0-so): Move things around so we can use copy-marker.
(woman0-roff-buffer, woman2-process-escapes-to-eol, woman2-roff-buffer):
Adjust marker type.
(woman2-process-escapes): Check marker type.
(woman-horizontal-line): Dispense with the use of a marker.
2006-09-22 Jay Belanger <belanger@truman.edu> 2006-09-22 Jay Belanger <belanger@truman.edu>
   
* calc/calc-lang.el: Add Greek letters to math-variable-table * calc/calc-lang.el: Add Greek letters to math-variable-table
......
...@@ -438,6 +438,7 @@ ...@@ -438,6 +438,7 @@
(eval-when-compile ; to avoid compiler warnings (eval-when-compile ; to avoid compiler warnings
(require 'dired) (require 'dired)
(require 'cl)
(require 'apropos)) (require 'apropos))
(defun woman-mapcan (fn x) (defun woman-mapcan (fn x)
...@@ -2467,6 +2468,7 @@ Start at FROM and re-scan new text as appropriate." ...@@ -2467,6 +2468,7 @@ Start at FROM and re-scan new text as appropriate."
(woman0-search-regex (woman0-search-regex
(concat woman0-search-regex-start woman0-search-regex-end)) (concat woman0-search-regex-start woman0-search-regex-end))
woman0-rename-alist) woman0-rename-alist)
(set-marker-insertion-type woman0-if-to t)
(while (re-search-forward woman0-search-regex nil t) (while (re-search-forward woman0-search-regex nil t)
(setq request (match-string 1)) (setq request (match-string 1))
(cond ((string= request "ig") (woman0-ig)) (cond ((string= request "ig") (woman0-ig))
...@@ -2540,7 +2542,7 @@ REQUEST is the invoking directive without the leading dot." ...@@ -2540,7 +2542,7 @@ REQUEST is the invoking directive without the leading dot."
;; String delimiter can be any non-numeric character, ;; String delimiter can be any non-numeric character,
;; including a special character escape: ;; including a special character escape:
(looking-at "\\(\\\\(..\\|[^0-9]\\)\\(.*\\)\\1\\(.*\\)\\1\\'")) (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 2nd and 3rd delimiters to avoid processing them:
(delete-region (match-end 3) woman0-if-to) (delete-region (match-end 3) woman0-if-to)
(delete-region (match-end 2) (match-beginning 3)) (delete-region (match-end 2) (match-beginning 3))
...@@ -2656,9 +2658,8 @@ If DELETE is non-nil then delete from point." ...@@ -2656,9 +2658,8 @@ If DELETE is non-nil then delete from point."
(beginning-of-line) (beginning-of-line)
(woman-delete-line 1) (woman-delete-line 1)
(let ((from (point)) (let ((from (point))
(to (make-marker)) (length (woman-insert-file-contents filename 0))
(length (woman-insert-file-contents filename 0))) (to (copy-marker (+ from length) t)))
(set-marker to (+ from length))
(woman-pre-process-region from to) (woman-pre-process-region from to)
(set-marker to nil) (set-marker to nil)
(goto-char from) (goto-char from)
...@@ -3442,9 +3443,7 @@ Also bound locally in `woman2-roff-buffer'.") ...@@ -3442,9 +3443,7 @@ Also bound locally in `woman2-roff-buffer'.")
(defsubst woman2-process-escapes-to-eol (&optional numeric) (defsubst woman2-process-escapes-to-eol (&optional numeric)
"Process remaining escape sequences up to eol. "Process remaining escape sequences up to eol.
Handle numeric arguments specially if optional argument NUMERIC is non-nil." Handle numeric arguments specially if optional argument NUMERIC is non-nil."
(woman2-process-escapes (woman2-process-escapes (copy-marker (line-end-position) t) numeric))
(save-excursion (end-of-line) (point-marker))
numeric))
(defun woman2-nr (to) (defun woman2-nr (to)
".nr R +/-N M -- Assign +/-N (wrt to previous value, if any) to register R. ".nr R +/-N M -- Assign +/-N (wrt to previous value, if any) to register R.
...@@ -3645,6 +3644,7 @@ expression in parentheses. Leaves point after the value." ...@@ -3645,6 +3644,7 @@ expression in parentheses. Leaves point after the value."
(woman-registers woman-registers) (woman-registers woman-registers)
fn request translations fn request translations
tab-stop-list) tab-stop-list)
(set-marker-insertion-type to t)
;; ?roff does not squeeze multiple spaces, but does fill, so... ;; ?roff does not squeeze multiple spaces, but does fill, so...
(fset 'canonically-space-region 'ignore) (fset 'canonically-space-region 'ignore)
;; Try to avoid spaces inheriting underlines from preceding text! ;; Try to avoid spaces inheriting underlines from preceding text!
...@@ -3687,7 +3687,8 @@ expression in parentheses. Leaves point after the value." ...@@ -3687,7 +3687,8 @@ expression in parentheses. Leaves point after the value."
;; Call the appropriate function: ;; Call the appropriate function:
(funcall fn to))) (funcall fn to)))
(if (not (eobp)) ; This should not happen, but ... (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 'canonically-space-region canonically-space-region)
(fset 'set-text-properties set-text-properties) (fset 'set-text-properties set-text-properties)
(fset 'insert-and-inherit insert-and-inherit) (fset 'insert-and-inherit insert-and-inherit)
...@@ -3899,6 +3900,7 @@ Leave 1 blank line. Format paragraphs upto TO." ...@@ -3899,6 +3900,7 @@ Leave 1 blank line. Format paragraphs upto TO."
(defun woman2-process-escapes (to &optional numeric) (defun woman2-process-escapes (to &optional numeric)
"Process remaining escape sequences up to marker TO, preserving point. "Process remaining escape sequences up to marker TO, preserving point.
Optional argument NUMERIC, if non-nil, means the argument is numeric." 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)! ;; The first two cases below could be merged (maybe)!
(let ((from (point))) (let ((from (point)))
;; Discard zero width filler character used to hide leading dots ;; Discard zero width filler character used to hide leading dots
...@@ -3968,15 +3970,13 @@ Optional argument NUMERIC, if non-nil, means the argument is numeric." ...@@ -3968,15 +3970,13 @@ Optional argument NUMERIC, if non-nil, means the argument is numeric."
(delete-char -1) (delete-char -1)
(delete-char 1) (delete-char 1)
(looking-at "\\(.\\)\\(.*\\)\\1") (looking-at "\\(.\\)\\(.*\\)\\1")
(let ((to (make-marker)) from N c) (forward-char 1)
(set-marker to (match-end 2)) (let* ((to (match-end 2)))
(delete-char 1) (from (match-beginning 0))
(setq from (point) (N (woman-parse-numeric-arg))
N (woman-parse-numeric-arg)) (c (if (< (point) to) (following-char) ?_)))
(setq c (if (< (point) to) (following-char) ?_))
(delete-region from to) (delete-region from to)
(delete-char 1) (delete-char 1)
(set-marker to nil)
(insert (make-string N c)) (insert (make-string N c))
)) ))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment