emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r108933: * woman.el (woman-strings):


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108933: * woman.el (woman-strings): Fix double-quote handling.
Date: Sat, 07 Jul 2012 18:06:38 +0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108933
fixes bug: http://debbugs.gnu.org/1151
author: Kevin Ryde <address@hidden>
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2012-07-07 18:06:38 +0800
message:
  * woman.el (woman-strings): Fix double-quote handling.
  (woman-decode-region): Replace escaped-escapes without destroying
  bold or underline.
modified:
  lisp/ChangeLog
  lisp/woman.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-07-07 09:33:28 +0000
+++ b/lisp/ChangeLog    2012-07-07 10:06:38 +0000
@@ -1,3 +1,9 @@
+2012-07-07  Kevin Ryde <address@hidden>
+
+       * woman.el (woman-strings): Fix double-quote handling (Bug#1151).
+       (woman-decode-region): Replace escaped-escapes without destroying
+       bold or underline (Bug#11552).
+
 2012-07-07  Chong Yidong  <address@hidden>
 
        * simple.el (yank-pop-change-selection): Doc fix (Bug#11361).

=== modified file 'lisp/woman.el'
--- a/lisp/woman.el     2012-06-26 16:23:01 +0000
+++ b/lisp/woman.el     2012-07-07 10:06:38 +0000
@@ -2385,20 +2385,20 @@
     (if woman-negative-vertical-space
        (woman-negative-vertical-space from))
 
-    (if woman-preserve-ascii
-       ;; Re-instate escaped escapes to just `\' and unpaddable
-       ;; spaces to just `space', without inheriting any text
-       ;; properties.  This is not necessary, UNLESS the buffer is to
-       ;; be saved as ASCII.
-       (progn
-         (goto-char from)
-         (while (search-forward woman-escaped-escape-string nil t)
-           (delete-char -1)
-           (insert ?\\))
-         (goto-char from)
-         (while (search-forward woman-unpadded-space-string nil t)
-           (delete-char -1)
-           (insert ?\s))))
+    (when woman-preserve-ascii
+      ;; Re-instate escaped escapes to just `\' and unpaddable spaces
+      ;; to just `space'.  This is not necessary for display since
+      ;; there are display table entries for the escaped chars, but it
+      ;; is necessary if the buffer might be saved as ASCII.
+      ;;
+      ;; `subst-char-in-region' preserves text properties on the
+      ;; characters, which is necessary for bold, underline, etc on
+      ;; \e.  There's usually no face on spaces, but if there is then
+      ;; it's good to keep that too.
+      (subst-char-in-region from (point-max)
+                           woman-escaped-escape-char ?\\)
+      (subst-char-in-region from (point-max)
+                           woman-unpadded-space-char ?\s))
 
     ;; Must return the new end of file if used in format-alist.
     (point-max)))
@@ -2865,15 +2865,18 @@
             (re-search-forward "[^ \t\n]+")
             (let ((string (match-string 0)))
               (skip-chars-forward " \t")
-;               (setq string
-;                     (cons string
-;                           ;; hack (?) for CGI.man!
-;                           (cond ((looking-at "\"\"") "\"")
-;                                 ((looking-at ".*") (match-string 0)))
-;                           ))
-              ;; Above hack causes trouble in arguments!
-              (looking-at ".*")
-              (setq string (cons string (match-string 0)))
+              (if (= ?\" (following-char))
+                  ;; Double-quote starts a string, eg.
+                  ;;   .ds foo "blah...
+                  ;; is value blah... through to newline.  There's no
+                  ;; closing " (per the groff manual), but rather any
+                  ;; further " is included literally in the string.  Eg.
+                  ;;   .ds foo ""
+                  ;; sets foo to a single " character.
+                  (forward-char))
+              (setq string (cons string
+                                 (buffer-substring (point)
+                                                   (line-end-position))))
               ;; This should be an update, but consing a new string
               ;; onto the front of the alist has the same effect:
               (setq woman-string-alist (cons string woman-string-alist))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]