all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* sql-mode and LaTeX
@ 2004-02-25 14:28 Roger Mason
  0 siblings, 0 replies; 7+ messages in thread
From: Roger Mason @ 2004-02-25 14:28 UTC (permalink / raw)


Hello,

I have written some lisp functions that allow the output from an SQL buffer
to be redirected to another buffer.  It is designed to work with Alex
Schroeder's sql-mode and Postgres.  The original intent was to be able to formulate
queries in, say, a LaTeX-mode buffer and have the results returned
there for subsequent formatting with latex.  If it ever works reliably
I intend to make it available to the Emacs community.

The problem I am having is that when the output appears in the latex
(AucTeX) buffer the column headings are lost.  For example, this query,
executed in an sql-mode buffer and returning the output to that buffer
produces this output:

--  This outputs the preamble
select'\\documentclass{article}
\\title{GAC Budget 2004}
\\author{Roger Mason \\\\ (with help from Karen Johnston \\& Karen Dawe)}
\\usepackage{float}
\\begin{document}
\\maketitle\n';

?column?                                                                                                                                                             
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
\documentclass{article}
\title{GAC Budget 2004}
\author{Roger Mason \\ (with help from Karen Johnston \& Karen Dawe)}
\usepackage{float}
\begin{document}
\maketitle

(1 row)

Apart from the ^M (which is easy to clean up), this is the normal, expected output.

The same query, with output redirected to a LaTeX buffer produces
this:

...
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
\documentclass{article}
\title{GAC Budget 2004}
\author{Roger Mason \\ (with help from Karen Johnston \& Karen Dawe)}
\usepackage{float}
\begin{document}
\maketitle

(1 row)

'C-x =' on the ... and ^M characters yields: RET.  Only in the LaTeX
buffer does this character suppress the rest of the line.

I have looked at the coding systems for the LaTeX and sql-mode
buffers with describe-current-coding-system: they are identical.

If anyone has any idea how to fix this problem I'd be most grateful.

Thanks,

Roger Mason

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

* Re: sql-mode and LaTeX
@ 2004-02-25 17:33 Joe Corneli
  2004-02-25 20:19 ` Roger Mason
  0 siblings, 1 reply; 7+ messages in thread
From: Joe Corneli @ 2004-02-25 17:33 UTC (permalink / raw)
  Cc: Roger Mason

What query were you talking about?  I think you omitted that.  I
don't know sql, but your code does sounds interesting.  However it
is going to be too hard for me to help debug when I can't see it.

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

* Re: sql-mode and LaTeX
  2004-02-25 17:33 Joe Corneli
@ 2004-02-25 20:19 ` Roger Mason
  0 siblings, 0 replies; 7+ messages in thread
From: Roger Mason @ 2004-02-25 20:19 UTC (permalink / raw)
  Cc: help-gnu-emacs

Joe Corneli <jcorneli@math.utexas.edu> writes:

> What query were you talking about?  I think you omitted that.  I
> don't know sql, but your code does sounds interesting.  However it
> is going to be too hard for me to help debug when I can't see it.

This is the query (it was embeded in my original post):

--  This outputs the preamble
select'\\documentclass{article}
\\title{GAC Budget 2004}
\\author{Roger Mason \\\\ (with help from Karen Johnston \\& Karen Dawe)}
\\usepackage{float}
\\begin{document}
\\maketitle\n';

Not a very interesting query perhaps, but a simple one that
demonstrates the problem.  It just outputs the preamble to a LaTeX
document.  I don't think there is anything wrong with the SQL
statement itself.  The issue is that RET is prepended to the first
line of output, which contains table headings from the database.  In
an sql-mode buffer the RET is displayed as '^M' and the (first line
of) output from the database follows.  This is easy to clean up to
leave behind only the SQL output.  If the output is instead redirected
to a buffer that is in LaTeX mode the RET is displayed as '...' and
the output from the SQL query is lost - the line ends after '...'.

I would like to be able to filter out the prepended RET so it never
reaches the LaTeX buffer or, failing that, have it displayed in a form
that preserves the SQL output and can be removed manually.

I hope my question clearer now.

Thanks for your interest.

Roger

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

* Re: sql-mode and LaTeX
       [not found] <mailman.468.1077720063.340.help-gnu-emacs@gnu.org>
@ 2004-02-26  7:04 ` Kai Grossjohann
  2004-02-26 11:53   ` Roger Mason
       [not found]   ` <mailman.563.1077796563.340.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Kai Grossjohann @ 2004-02-26  7:04 UTC (permalink / raw)


Roger Mason <rmason@esd.mun.ca> writes:

> 'C-x =' on the ... and ^M characters yields: RET.  Only in the LaTeX
> buffer does this character suppress the rest of the line.

That might be the selective display feature.  Once you get rid of the
^M, the hiding will be gone, too.

Try inserting a literal ^M into the LaTeX buffer manually, to see
whether it hides the rest of the line.  Type C-q C-m to insert the
character.

Kai

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

* Re: sql-mode and LaTeX
  2004-02-26  7:04 ` Kai Grossjohann
@ 2004-02-26 11:53   ` Roger Mason
       [not found]   ` <mailman.563.1077796563.340.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Roger Mason @ 2004-02-26 11:53 UTC (permalink / raw)
  Cc: help-gnu-emacs

Kai Grossjohann <kai@emptydomain.de> writes:

> That might be the selective display feature.  Once you get rid of the
> ^M, the hiding will be gone, too.
>
> Try inserting a literal ^M into the LaTeX buffer manually, to see
> whether it hides the rest of the line.  Type C-q C-m to insert the
> character.
>

Yes, manual insertion with C-q C-m hides the rest of the line and yes,
deleting that character restores the remainder of the line.  Duh! I
thought I had tried that.

What is "selective display"?  How is it different from outline mode?

Many thanks to you and to other respondants.

Roger

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

* Re: sql-mode and LaTeX
       [not found]   ` <mailman.563.1077796563.340.help-gnu-emacs@gnu.org>
@ 2004-02-27 12:28     ` Kai Grossjohann
  2004-02-27 14:08       ` Roger Mason
  0 siblings, 1 reply; 7+ messages in thread
From: Kai Grossjohann @ 2004-02-27 12:28 UTC (permalink / raw)


Roger Mason <rmason@esd.mun.ca> writes:

> What is "selective display"?  How is it different from outline mode?

Selective display is a method for telling Emacs to hide some text.
Another method is to use text properties, or overlays.

Outline mode is a major mode which can parse the text into a
hierarchical structure (the outline), and which provides commands for
hiding or showing certain parts of that hierarchical structure.
Outline mode also provides commands for navigating the structure.

When you tell outline mode to hide something, it could use selective
display to do that.  But I think that modern versions of outline mode
use text properties.  Selective display is a deprecated feature, I
think.

But don't take that too seriously -- maybe the term selective display
is wrong, and selective display is something else.

There is also the C-x $ command which can hide parts of the buffer
based on indentation.  It has selective display in its name.

Kai

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

* Re: sql-mode and LaTeX
  2004-02-27 12:28     ` Kai Grossjohann
@ 2004-02-27 14:08       ` Roger Mason
  0 siblings, 0 replies; 7+ messages in thread
From: Roger Mason @ 2004-02-27 14:08 UTC (permalink / raw)
  Cc: help-gnu-emacs

Kai Grossjohann <kai@emptydomain.de> writes:

> Roger Mason <rmason@esd.mun.ca> writes:

> There is also the C-x $ command which can hide parts of the buffer
> based on indentation.  It has selective display in its name.

Thank you once again.  I found the solution in my case was to set
the (buffer-local) variable selective-display to nil.

Roger

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

end of thread, other threads:[~2004-02-27 14:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-25 14:28 sql-mode and LaTeX Roger Mason
  -- strict thread matches above, loose matches on Subject: below --
2004-02-25 17:33 Joe Corneli
2004-02-25 20:19 ` Roger Mason
     [not found] <mailman.468.1077720063.340.help-gnu-emacs@gnu.org>
2004-02-26  7:04 ` Kai Grossjohann
2004-02-26 11:53   ` Roger Mason
     [not found]   ` <mailman.563.1077796563.340.help-gnu-emacs@gnu.org>
2004-02-27 12:28     ` Kai Grossjohann
2004-02-27 14:08       ` Roger Mason

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.