bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#11551: 23.4; woman.el .ds "" quote


From: Kevin Ryde
Subject: bug#11551: 23.4; woman.el .ds "" quote
Date: Thu, 24 May 2012 11:28:44 +1000
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.4 (gnu/linux)

With the ds-quote.1 below,

    (woman-find-file "ds-quote.1")

produces

     Expands to "ABC

where I expected it not to have the ", so

     Expands to ABC

I think woman.el.ds-quote.diff below can correct this.  (Diff against
the bazaar emacs-24, if that's the right branch.  I've been having
connection troubles lately so not sure what's supposed to be what.)

2012-05-19  Kevin Ryde  <user42@zip.com.au>

        * woman.el (woman-strings): .ds foo "ABC don't include the leading "
        in the string value.  Fixes definitions like .ds xx "" which should be
        a single " char, as described in the groff manual and used by perl
        pod2man.


The commented out bit about a "hack" for CGI.man was on the right track,
but it's more general than just "".  The groff manual "Strings" node
describes how a leading " in a .ds request begins the string and is not
part of it

    .ds sign "           Yours in a white wine sauce,

As per this example there's no closing quote, and I don't think there's
any backslashing or further quoting to interpret at the .ds definition
stage.  The bit in the groff manual reading

    To put a single double quote character into a string, use two
    consecutive double quote characters.

I believe is trying to say

    .ds xx ""

makes xx equal to a single " character.  From a bit of experimenting I
believe it doesn't mean "" -> " or anything like that in the rest of the
line.

I struck this from perl pod2man which uses a .ds xx "" to produce a
double-quote varying between nroff and troff.  woman.el on pod2man
output wrongly doubles the double-quotes giving things like

    See ""FUNCTIONS"" in Blah::Blah ...


.TH FOO 1
.ds xx "ABC
.SH NAME
Expands to \*(xx
--- woman.el.orig       2012-05-19 12:08:35.000000000 +1000
+++ woman.el    2012-05-24 06:48:36.000000000 +1000
@@ -2872,15 +2872,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))



In GNU Emacs 23.4.1 (i486-pc-linux-gnu, GTK+ Version 2.24.10)
 of 2012-04-08 on biber, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
configured using `configure  '--build' 'i486-linux-gnu' '--build' 
'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' 
'--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' 
'--mandir=/usr/share/man' '--with-pop=yes' 
'--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.4/site-lisp:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/i386-linux-gnu' '--with-x=yes' '--with-x-toolkit=gtk' 
'--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'CFLAGS=-g -O2 
-fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security 
-Werror=format-security -Wall -DDEBIAN -O2' 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

reply via email to

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