emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Copy url text to clipboard


From: Lennart Borgman
Subject: Copy url text to clipboard
Date: Fri, 8 Jan 2010 10:12:50 +0100

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 via email to

[Prev in Thread] Current Thread [Next in Thread]