auctex
[Top][All Lists]
Advanced

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

Re: [AUCTeX] Drag and drop support


From: Michal Sojka
Subject: Re: [AUCTeX] Drag and drop support
Date: Sun, 19 Dec 2010 18:17:27 +0100
User-agent: Notmuch/0.5-38-g923b170 (http://notmuchmail.org) Emacs/23.2.1 (x86_64-pc-linux-gnu)

On Sun, 19 Dec 2010, Ralf Angeli wrote:
> * 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.)

Yes, I just wanted to know the opinion of others. It seems you are not
against so I'll try to prepare a more polished patch based on your
reasoning bellow.

> 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.

This sounds reasonable.
 
> 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 don't know much about ConTeXt and docTeX so I'll prepare support for
TeX, LaTeX and texinfo.

> I'm not sure about the need to specify the macro to be inserted as a
> string, like you proposed with `auctex-dnd-format'.  

My use-case was to temporarily modify it to
"\includegraphics[width=.5\textwidth]{%s}" so that I don't need to
specify the parameters all the time. I'm not sure whether you can use
C-u prefix to affect what happen when a file is dropped (similarly as it
affect LaTeX-arg-includegraphics).

> 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.

Yes, using something like mml-dnd-attach-options seems much better to
me. However, with auctex, the value cannot apply to all types of files,
so there might be more variables such as auctex-dnd-graphics-options,
etc.

> 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.

Yes, this would be very annoying :-)

-Michal



reply via email to

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