all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* editing MathML parts with Amaya
@ 2005-01-22 18:59 Wolfgang Jeltsch
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfgang Jeltsch @ 2005-01-22 18:59 UTC (permalink / raw)


Hello,

I'm thinking about editing DocBook XML documents with embedded MathML using 
Emacs and nXML mode.  Alas, MathML is very verbose and therefore not easy to 
edit with a text editor.  So I'd like to edit the MathML parts with an 
external MathML editor, namely Amaya.  What I want is that if I place Emacs' 
cursor inside a MathML fragment and press a specific key combination, the 
whole MathML part is copied into a file (with some additional heading lines), 
Amaya is run on this file, and if Amaya has finished, the file's content 
(minus the heading lines) is written back into my Emacs buffer.

So far, I've written a script which basically puts standard input in a file, 
invokes Amaya and writes the resulting file content to standard output.  If I 
invoke this from Emacs via shell-command-on-buffer then after finishing 
Amaya, Emacs crashes with the message: "X protocol error: BadWindow (invalid 
Window parameter) on protocol request 25".

In addition, shell-command-on-buffer doesn't seem to be the right thing 
because it places the command's output in * Shell Command Output * instead of 
replacing the text in the file's buffer.

So how do I filter parts of a buffer through a shell command so that the 
respective part of the buffer is replaced by the command's output?  Can 
somebody of you imagine why the above error message appears?  Is there a 
better way to invoke X clients for editing parts of a document?  How can I 
tell Emacs to search for the boundaries of a MathML part the cursor is in, so 
that I don't have to mark the whole MathML fragment before editing it?

Thanks a lot for your answers.

Best wishes,
Wolfgang

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

* Re: editing MathML parts with Amaya
       [not found] <mailman.14642.1106422260.27204.help-gnu-emacs@gnu.org>
@ 2005-01-24 17:29 ` Kevin Rodgers
  2005-01-24 20:01   ` Wolfgang Jeltsch
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Rodgers @ 2005-01-24 17:29 UTC (permalink / raw)


Wolfgang Jeltsch wrote:
 > I'm thinking about editing DocBook XML documents with embedded MathML 
using
 > Emacs and nXML mode.  Alas, MathML is very verbose and therefore not 
easy to
 > edit with a text editor.  So I'd like to edit the MathML parts with an
 > external MathML editor, namely Amaya.  What I want is that if I place 
Emacs'
 > cursor inside a MathML fragment and press a specific key combination, 
the
 > whole MathML part is copied into a file (with some additional heading 
lines),
 > Amaya is run on this file, and if Amaya has finished, the file's content
 > (minus the heading lines) is written back into my Emacs buffer.
 >
 > So far, I've written a script which basically puts standard input in 
a file,
 > invokes Amaya and writes the resulting file content to standard 
output.  If I
 > invoke this from Emacs via shell-command-on-buffer then after finishing
 > Amaya, Emacs crashes with the message: "X protocol error: BadWindow 
(invalid
 > Window parameter) on protocol request 25".
 >
 > In addition, shell-command-on-buffer doesn't seem to be the right thing
 > because it places the command's output in * Shell Command Output * 
instead of
 > replacing the text in the file's buffer.
 >
 > So how do I filter parts of a buffer through a shell command so that the
 > respective part of the buffer is replaced by the command's output?

(shell-command-on-region START END "your-shell-script" (current-buffer) t)

 > Can
 > somebody of you imagine why the above error message appears?  Is there a
 > better way to invoke X clients for editing parts of a document?

Sorry, I don't know.

 > How can I
 > tell Emacs to search for the boundaries of a MathML part the cursor 
is in, so
 > that I don't have to mark the whole MathML fragment before editing it?

(let ((mathml-start (re-search-backward ...))
       (mathml-end (re-search-backward ...)))
   (shell-command-on-region mathml-start mathml-end "your-shell-script"
                            (current-buffer) t))

-- 
Kevin Rodgers

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

* Re: editing MathML parts with Amaya
  2005-01-24 17:29 ` editing MathML parts with Amaya Kevin Rodgers
@ 2005-01-24 20:01   ` Wolfgang Jeltsch
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfgang Jeltsch @ 2005-01-24 20:01 UTC (permalink / raw)


Am Montag, 24. Januar 2005 18:29 schrieb Kevin Rodgers:
> [...]

> > So how do I filter parts of a buffer through a shell command so that the
> > respective part of the buffer is replaced by the command's output?
>
> (shell-command-on-region START END "your-shell-script" (current-buffer) t)
>
> > Can somebody of you imagine why the above error message appears?  Is there
> > a better way to invoke X clients for editing parts of a document?
>
> Sorry, I don't know.
>
> > How can I tell Emacs to search for the boundaries of a MathML part the
> > cursor is in, so that I don't have to mark the whole MathML fragment
> > before editing it? 
>
> (let ((mathml-start (re-search-backward ...))
>        (mathml-end (re-search-backward ...)))
>    (shell-command-on-region mathml-start mathml-end "your-shell-script"
>                             (current-buffer) t))

Thank you very much.  Thanks to your tips, I was able to implement a solution 
which basically works.  Interestingly, the X error message doesn't appear.

Best wishes,
Wolfgang

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

end of thread, other threads:[~2005-01-24 20:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.14642.1106422260.27204.help-gnu-emacs@gnu.org>
2005-01-24 17:29 ` editing MathML parts with Amaya Kevin Rodgers
2005-01-24 20:01   ` Wolfgang Jeltsch
2005-01-22 18:59 Wolfgang Jeltsch

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.