From mboxrd@z Thu Jan 1 00:00:00 1970 From: Miro Bezjak Subject: org-insert-link with HTML title as default description Date: Sat, 29 Sep 2012 14:23:44 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:45031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THw5r-0007Ba-IB for emacs-orgmode@gnu.org; Sat, 29 Sep 2012 08:24:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THw5p-0008SA-Pr for emacs-orgmode@gnu.org; Sat, 29 Sep 2012 08:24:27 -0400 Received: from mail-ia0-f169.google.com ([209.85.210.169]:61734) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THw5p-0008S1-LA for emacs-orgmode@gnu.org; Sat, 29 Sep 2012 08:24:25 -0400 Received: by iakh37 with SMTP id h37so127281iak.0 for ; Sat, 29 Sep 2012 05:24:24 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi all. I'm new to the whole emacs/elisp/org-mode thing and I have to say I'm amazed by it. Thank you for all the hard work. That having been said, I've hacked together two functions that are useful to me. I was wondering what are your thoughts on including their idea (but with a better implementation) to org-mode? I've done some reasonable googling but haven't concluded that org-mode has something similar. 8<------------------------------------------------------------------------ (defun my-org-insert-link () "Insert org link where default description is set to html title." (interactive) (let* ((url (read-string "URL: ")) (title (get-html-title-from-url url))) (org-insert-link nil url title))) (defun get-html-title-from-url (url) "Return content in tag." (let (x1 x2 (download-buffer (url-retrieve-synchronously url))) (save-excursion (set-buffer download-buffer) (beginning-of-buffer) (setq x1 (search-forward "<title>")) (search-forward "") (setq x2 (search-backward "<")) (buffer-substring-no-properties x1 x2)))) -------------------------------------------------------------------------->8 Cheers, Miro