yatex
diff yahtml.el @ 333:30a8f68abe0a
Supply `dvipdfmx' completion instead of `dvipdf'
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Tue, 16 Dec 2014 13:27:50 +0900 |
parents | 1bbc6cff5b6c |
children | 2a72779d9c50 |
line diff
1.1 --- a/yahtml.el Tue Jun 03 09:40:32 2014 +0900 1.2 +++ b/yahtml.el Tue Dec 16 13:27:50 2014 +0900 1.3 @@ -1,9 +1,9 @@ 1.4 ;;; yahtml.el --- Yet Another HTML mode -*- coding: sjis -*- 1.5 ;;; (c) 1994-2013 by HIROSE Yuuji [yuuji(@)yatex.org] 1.6 -;;; Last modified Tue Jun 3 09:40:02 2014 on firestorm 1.7 +;;; Last modified Tue Dec 16 11:11:25 2014 on firestorm 1.8 ;;; $Id$ 1.9 1.10 -(defconst yahtml-revision-number "1.76" 1.11 +(defconst yahtml-revision-number "1.77" 1.12 "Revision number of running yahtml.el") 1.13 1.14 ;;; Commentary: 1.15 @@ -661,6 +661,12 @@ 1.16 (font-lock-mode 1) ;;Why should I fontify again??? 1.17 ;; in yatex-mode, there's no need to refontify... 1.18 (font-lock-fontify-buffer))))) 1.19 + ;; +dnd for X11 w/ emacs23+ 1.20 + (and window-system (featurep 'dnd) 1.21 + (set (make-local-variable 'dnd-protocol-alist) 1.22 + (cons (cons "^\\(file\\|https?\\):" 'yahtml-dnd-handler) 1.23 + dnd-protocol-alist))) 1.24 + 1.25 (set-syntax-table yahtml-syntax-table) 1.26 (use-local-map yahtml-mode-map) 1.27 (YaTeX-read-user-completion-table) 1.28 @@ -3128,6 +3134,33 @@ 1.29 (font-lock-mode -1) ;is stupid, but sure. 1.30 (font-lock-mode 1)) 1.31 1.32 +;;; 1.33 +;; Drag-n-Drop 1.34 +;;; 1.35 +(defun yahtml-dnd-handler (uri action) 1.36 + "DnD handler for yahtml mode 1.37 +Convert image URI to img-src and others to a-href." 1.38 + (let*((file (dnd-get-local-file-name uri)) 1.39 + (path (if file (file-relative-name file) uri)) 1.40 + (case-fold-search t) 1.41 + (geom "")) 1.42 + (cond 1.43 + ((memq action '(copy link move private)) 1.44 + (cond 1.45 + ((string-match "\\.\\(jpe?g\\|png\\|gif\\|bmp\\|tiff?\\)$" path) 1.46 + (if file 1.47 + (setq geom (yahtml-get-image-info path) 1.48 + geom (if (car geom) 1.49 + (apply 'format " width=\"%s\" height=\"%s\"" geom) 1.50 + ""))) 1.51 + (insert (format "<img src=\"%s\" alt=\"%s\"%s>" 1.52 + path (file-name-nondirectory path) geom))) 1.53 + 1.54 + (t (insert (format "<a href=\"%s\"></a>" path)) 1.55 + (forward-char -4)))) 1.56 + (t (message "No handler for action `%s'" action)))) 1.57 + action) 1.58 + 1.59 (run-hooks 'yahtml-load-hook) 1.60 (provide 'yahtml) 1.61