unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lennart Borgman <lennart.borgman@gmail.com>
To: Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Copy url text to clipboard
Date: Fri, 8 Jan 2010 10:12:50 +0100	[thread overview]
Message-ID: <e01d8a51001080112q6effdc78t1c72aa46f1fe540e@mail.gmail.com> (raw)

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 ;-)




                 reply	other threads:[~2010-01-08  9:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e01d8a51001080112q6effdc78t1c72aa46f1fe540e@mail.gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).