330
|
1 ;;; yatex23.el --- YaTeX facilities for Emacs 23 or later -*- coding: sjis -*-
|
|
2 ;;; (c)2014 by HIROSE Yuuji.[yuuji@yatex.org]
|
|
3 ;;; Last modified Tue Dec 16 11:08:10 2014 on firestorm
|
|
4 ;;; $Id:$
|
|
5
|
|
6 ;;; Code:
|
|
7 (defun YaTeX-dnd-handler (uri action)
|
|
8 "DnD handler for yatex-mode
|
|
9 Convert local image URI to \\includegraphcis{} and
|
|
10 .tex file names to \\include{}."
|
|
11 (save-excursion
|
|
12 (YaTeX-visit-main t)
|
|
13 (let*((file (dnd-get-local-file-name uri))
|
|
14 (path (file-relative-name file))
|
|
15 (insert-file-directory nil)
|
|
16 (case-fold-search t))
|
|
17 (cond
|
|
18 ((memq action '(copy link move private))
|
|
19 (cond
|
|
20 ((string-match "\\.\\(jpe?g\\|png\\|gif\\|bmp\\|tiff?\\|e?ps\\|pdf\\)$" path)
|
|
21 (insert "\\includegraphics"
|
|
22 "{" (YaTeX::includegraphics 1 path t) "}")
|
|
23 (YaTeX-package-auto-usepackage "includegraphics" 'section))
|
|
24 ((string-match "\\.tex$" path)
|
|
25 (insert "\\include{" path "}"))
|
|
26 ))
|
|
27 (t (message "%s" action))))))
|
|
28
|
|
29 (provide 'yatex23)
|
|
30
|
|
31 ; Local variables:
|
|
32 ; fill-prefix: ";;; "
|
|
33 ; paragraph-start: "^$\\|\\|;;;$"
|
|
34 ; paragraph-separate: "^$\\|\\|;;;$"
|
|
35 ; coding: sjis
|
|
36 ; End:
|