unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Copy url text to clipboard
@ 2010-01-08  9:12 Lennart Borgman
  0 siblings, 0 replies; only message in thread
From: Lennart Borgman @ 2010-01-08  9:12 UTC (permalink / raw)
  To: Emacs-Devel devel

In url-copy-file the contents retrieved is saved to a file with the function

(defun mm-save-part-to-file (handle file)
  (mm-with-unibyte-buffer
    (mm-insert-part handle)
    (mm-add-meta-html-tag handle)
    (let ((current-file-modes (default-file-modes)))
      (set-default-file-modes mm-attachment-file-modes)
      (unwind-protect
	  ;; Don't re-compress .gz & al.  Arguably we should make
	  ;; `file-name-handler-alist' nil, but that would chop
	  ;; ange-ftp, which is reasonable to use here.
	  (mm-write-region (point-min) (point-max) file nil nil nil 'binary t)
	(set-default-file-modes current-file-modes)))))

I do not understand the coding issues. How do I do if I want to copy
the text retrieved to the clipboard instead? I am sure it is text that
I have retrieved, but there could be any headers.

In a slightly modified url-copy-file I ave this (some parts left out,
url-http-parse-response added by me, do not know if this is the best
way to get the http status):

  (let ((buffer (url-retrieve-synchronously url))
     (with-current-buffer buffer
        (setq ret (url-http-parse-response))
        (setq handle (mm-dissect-buffer t))
        (mm-save-part-to-file handle newname)

So this is the context where I want to copy to clipboard. I am sure
someone understands this, but that is not me ;-)




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-01-08  9:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-08  9:12 Copy url text to clipboard Lennart Borgman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).