Subject: mailing-list for TeXmacs Users
List archive
From : Henri Lesourd <address@hidden>- To: Robert Jerrard <address@hidden>
- Cc: address@hidden
- Subject: Re: [TeXmacs] default behaviour when closing texmacs
- Date: Wed, 07 Dec 2005 22:05:55 +0100
Robert Jerrard wrote:
Version 1.0.6-1 of texmacs indicates there are unsaved files and asksYou should try. What I tried just right now is that the command :
"Really quit?" when attempting to close a file to which modifications
have been made which is a good thing. However, it now also fills in the
default answer of "no" which must be removed when you really want to
close it anyway. When I use TeXmacs as a front-end for Maxima I often
use it as a scratch pad and am not interested in saving the results. I
would prefer the default not be added in but assume I would have to
modify the code controlling this default behaviour. If I change
(tm-define (safely-quit-TeXmacs)
(dialogue
(if (or (not (exists-unsaved-buffer?))
(dialogue-confirm?
"There are unsaved files. Really quit?" #f))
(quit-TeXmacs))))
in /usr/share/texmacs/TeXmacs/progs/texmacs/texmacs/tm-server.scm to
(tm-define (safely-quit-TeXmacs)
(dialogue
(if (or (not (exists-unsaved-buffer?))
(dialogue-confirm?
"There are unsaved files. Really quit?"))
(quit-TeXmacs))))
will that safely eliminate the default behaviour of supplying "no"?
<<
(quit-TeXmacs)
>>
exits TeXmacs without doing any test (namely, even if there
are unsaved buffers, it exits TeXmacs).
As far as the example you give is concerned, I'm
not sure of the precise meaning of the 2nd parameter
of (dialogue-confirm?). Another function I know that
could do the job is << (interactive) >>, which precisely
spells :
<<
(interactive [lambda (p1 ... pn)] [prompt1] ... [promptn])
>>
and which interactively asks you for the values of p1 ... pn
one after the other, using respectively prompt1 ... promptn,
as prompts, and then evaluates (lambda (p1 ... pn)).
So for example :
<<
(interactive (lambda (x y) (display* "x=" x "; y=" y "\n")) "x=" "y=")
>>
asks you first :
<<
x=_
>>
then you type, for example :
<<
x=1<Carriage Return>
>>
then you get the next prompt :
<<
y=_
>>
then you type, for example :
<<
y=2<Carriage Return>
>>
and then the Scheme interpreter evaluates :
<<
(lambda (1 2) (display* "x=" 1 "; y=" 2 "\n"))
>>
and then you finally see on the console :
<<
x=1; y=2
_
>>
So I guess that :
<<
(interactive (lambda (quit?) (if (!= quit? "no") (quit-TeXmacs))) "Quit (Y/n):")
>>
gives you an interactive prompt that always exits except if you answer exactly "no".
Alternatively, is it possible to add a button to the file menu to quitYes, the following should work (this is just intended as an
without saving?
example, you should check the details (namely, the path of
the image for the icon in << (icon ...) >> below)) :
<<
(menu-extend texmacs-main-icons
((balloon (icon "/home/robert/images/my_exit_icon.xpm") "Insert graphics")
(quit-TeXmacs)
))
>>
You should add this directly in the init file of a plugin you
write especially for this purpose (it will probably not work
if you just put it in my-init-texmacs.scm).
You can find everything you need to know about writing TeXmacs
plugins for extending the TeXmacs iconbars or menus, defining
new keyboard shortcuts, and other things at :
<<
http://www.ags.uni-sb.de/~henri/texmacs/aTeXmacsTutorial.pdf
>>
(still not finished, I know...).
Best, Henri
P.S. : I don't know exactly how to add an entry in the file
menu ; the example above adds a new icon to the main iconbar,
and a very similar one could be used to add a new menu to
the TeXmacs menus. But I don't know if it is possible to
extend a menu that already exists (anyway, adding a new
icon seems to be more convenient for your purpose ; you
could also add a keyboard shortcut for this ; although
perhaps it should not become **too** easy to leave
TeXmacs without saving ;-).
- default behaviour when closing texmacs, Robert Jerrard, 12/07/2005
- Re: [TeXmacs] default behaviour when closing texmacs, Henri Lesourd, 12/07/2005
- Message not available
- Re: [TeXmacs] default behaviour when closing texmacs, Henri Lesourd, 12/08/2005
- Message not available
- Re: [TeXmacs] default behaviour when closing texmacs, Henri Lesourd, 12/07/2005
Archive powered by MHonArc 2.6.19.