auctex
[Top][All Lists]
Advanced

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

Re: [AUCTeX] Drag and drop support


From: Ralf Angeli
Subject: Re: [AUCTeX] Drag and drop support
Date: Sun, 19 Dec 2010 17:39:07 +0100

* Michal Sojka (2010-12-14) writes:

> I worked on a LaTeX document that was full of various figures. The
> figures had to be selected from approximately 300 files sored in a
> fileststem. I selected the figure to insert in a filemanager, but it was
> too tedious to copy the name of the figure and insert
> \includegraphics{<filename>} by hand.

In Emacs you don't do stuff by hand, you use a macro or search and
replace with a regexp.  And you usually don't use external file managers
but Dired.

> So I quickly hacked the following
> piece of elisp to accomplish this automatically when a file is
> drag-and-dropped to Emacs window. I think, that it would be useful if
> something like this becomes a part of Auctex. What do you think?

Drag and drop support would be a nice feature, I guess.  The code you
proposed is still a bit crude, though.  But I guess it was not meant as
a full-blown, production-ready patch anyway. (c:  (It seems to be
derived from code in mml.el.)

In AUCTeX it would need to be able to insert different TeX macros for
different file types.  \includegraphics for images, \input or \include
for .tex files, \bibliography for .bib files, etc.

These macros will have to be different for the different modes AUCTeX
provides (plain TeX, LaTeX, ConTeXt, Texinfo, docTeX) and maybe even for
different features loaded by a document.

I'm not sure about the need to specify the macro to be inserted as a
string, like you proposed with `auctex-dnd-format'.  AUCTeX already
knows a lot about certain macros and provides functions which may be
able to ask for optional arguments.  For example there is
`LaTeX-arg-includegraphics' for \includegraphics.  So an idea could be
to reuse such functions and call them when a file is dragged and dropped
into a TeX buffer.  However, it could be difficult to inhibit that they
ask for the file to be included themselves.  And for your use case one
would also need a way to inhibit that they ask for the optional
arguments, similar to `mml-dnd-attach-options'.  So in your case calling
such a function would not make much sense.  Another issue with the use
of the existing functions might be that the user will be prompted in the
minibuffer for optional arguments and that would mean that the user's
hand would have to move from the mouse to the keyboard.

These were a few things that came to mind when thinking about drag and
drop support.  I believe there will be more when one thinks harder. (c:

-- 
Ralf



reply via email to

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