second try for posting dpaste
This commit is contained in:
parent
5765ccb517
commit
5ec7bec779
|
@ -115,10 +115,33 @@ binding for Kuso IDE dpaste plugin"
|
||||||
(defun dpaste-region ()
|
(defun dpaste-region ()
|
||||||
"dpaste the region and return the URL."
|
"dpaste the region and return the URL."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let (text)
|
(let (start end text type title run poster command buf)
|
||||||
(setq text (get-region-text))
|
(setq start (region-beginning))
|
||||||
|
(setq end (region-end))
|
||||||
|
(if (> start end)
|
||||||
|
(progn
|
||||||
|
(setq tmp start)
|
||||||
|
(setq start end)
|
||||||
|
(setq end tmp)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
;;(setq text (get-region-text))
|
||||||
(deactivate-mark)
|
(deactivate-mark)
|
||||||
(message "<<<<<<< %s" text)
|
(setq title (or (buffer-file-name) (buffer-name)))
|
||||||
|
(setq poster "sameer")
|
||||||
|
(setq but (generate-new-buffer "*Paste*"))
|
||||||
|
;; This line of code gets from the el file that i mentioned above
|
||||||
|
(setq type (or (cdr (assoc major-mode dpaste-support-types)) ""))
|
||||||
|
(shell-command-on-region star end(concat "curl -si" " -F 'content=<-'"
|
||||||
|
" -F 'language=" type "'"
|
||||||
|
" -F 'title=" title "'"
|
||||||
|
" -F 'poster=" poster "'"
|
||||||
|
" http://dpaste.com/api/v1/") buf)
|
||||||
|
(with-current-buffer buf
|
||||||
|
(message "<><><> %s " buffer-string)
|
||||||
|
)
|
||||||
|
;;(setq output (shell-command-to-string command))
|
||||||
|
;;(message ">>> %s" output)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
;; ----------------------------------------------------------------------
|
;; ----------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue