jed-users mailing list

[2005 Date Index] [2005 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: Esc-q and new line / line feed chars


On Tue, May 03, 2005 at 04:09:15PM -0400, Jack McDermot wrote:
> Hi Joerg,
> 
> >Do you mean Windows people?
> 
> Nope, they are running Solaris. As Guenter pointed out before, the trouble 
> is the presence of any newline character at the end of "visual" (on screen) 
> lines. 

I think that the misunderstanding lies here. Jack, in JED (as in any "real"
text editor [1]) the lines you see are not visual lines. They are _physical_
lines, and when you do "Esc-q" to reformat the text, JED changes the real
lines of the "paragraph". What your Solaris collegues see is that they see
(in Staroffice Word, maybe, or whatever) is that they see every line as a
different paragraph, because all word processor out there use the newlines
as the end-of-paragraph marker [2]. 

Really, JED knows nothing about paragraph. You can change the idea of JED
paragraph by changing a function... 

> When the layout people import it into their stuff they complain that 
> the text is jagged, ie that lines don't wrap as they want them to because 
> paragraphs contain newlines. If there's no built-in way around this I'll 
> probably end up trying to code a save hook as suggested.

What I usually do is what Guenter suggest. If you keep your "JED paragraph"
separated by at least a  blank line, when you need to pass the file to, say,
Word, you can do the following:

- replace every new line (M-x replace is esc-% in emacs mode, then to enter
the new line use ctrl-q ctrl-j) with a char you never use, say "¿". You have
now all the text in one long line. 

- replace every "¿¿" with a new-line.

- replace every "¿" with a space. 

Or use the attached "para_to_line.py" script to do the same. 

           HTH, Romano 

[1] There is a tendence to call "text editor" programs that was best known
    as a "word processor". With the effect that in some manual you see the 
    plain text editor as "program editor"... :-)

[2] Which is most unfortunate, to tell the truth. Why on hearth didn't they
    choose, for example, form-feed (^L) for the job? End-of-line here and
    End-of-paragraph is a quite different concept and often you need the two
    well separated. 
    

-- 
Romano Giannetti             -  Univ. Pontificia Comillas (Madrid, Spain)
Electronic Engineer - phone +34 915 422 800 ext 2416  fax +34 915 596 569
#!/usr/bin/python
#
# Transform tex-like paragraph into line
#
import sys
#
if len(sys.argv)!=2 :
    sys.stderr.write("Usage: %s <filename>\n" % sys.argv[0])
    sys.exit(1)
try: 
    f = file(sys.argv[1], "r")
except IOError:
    sys.stderr.write("Could not open %s for read\n" % sys.argv[1])
    sys.stderr.write("Usage: %s <filename>\n" % sys.argv[0])
    sys.exit(1)
    
allf = f.read()
seen_a_nl=False
seen_a_mul_nl=False
for c in allf:
    if seen_a_mul_nl and c=="\n":
        continue
    if seen_a_mul_nl and c!="\n":
        sys.stdout.write("\n%s" % c)
        seen_a_nl = seen_a_mul_nl = False
        continue
    if seen_a_nl and c=="\n":
        seen_a_mul_nl = True
        continue
    if seen_a_nl and c!="\n":
        seen_a_nl = False
        sys.stdout.write(" %s" % c)
        continue
    if c=="\n":
        seen_a_nl = True
    else:
        sys.stdout.write("%s" % c)

sys.stdout.write("\n")


[2005 date index] [2005 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]