Fix Org ChangeLog entries and remove arch-tag.
[bpt/emacs.git] / lisp / org / org-w3m.el
index d6ab918..8071a1d 100644 (file)
@@ -1,11 +1,11 @@
 ;;; org-w3m.el --- Support from copy and paste from w3m to Org-mode
 
-;; Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Author: Andy Stewart <lazycat dot manatee at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
 ;; Homepage: http://orgmode.org
-;; Version: 6.20g
+;; Version: 7.7
 ;;
 ;; This file is part of GNU Emacs.
 ;;
 ;;; Commentary:
 
 ;; This file implements copying HTML content from a w3m buffer and
-;; transfomring the text on the fly so that it can be pasted into
+;; transforming the text on the fly so that it can be pasted into
 ;; an org-mode buffer with hot links.  It will also work for regions
-;; in gnus buffers that have ben washed with w3m.
+;; in gnus buffers that have been washed with w3m.
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
-;;; Acknowledgements:
+;;; Acknowledgments:
 
 ;; Richard Riley <rileyrgdev at googlemail dot com>
 ;;
@@ -40,8 +40,9 @@
 ;;      proposed by Richard, I'm just coding it.
 ;;
 
+;;; Code:
+
 (require 'org)
-(declare-function w3m-anchor "ext:w3m-util" (position))
 
 (defun org-w3m-copy-for-org-mode ()
   "Copy current buffer content or active region with `org-mode' style links.
@@ -68,7 +69,7 @@ so that it can be yanked into an Org-mode buffer with links working correctly."
         ;; store current point before jump next anchor
         (setq temp-position (point))
         ;; move to next anchor when current point is not at anchor
-        (or (w3m-anchor (point)) (org-w3m-get-next-link-start))
+        (or (get-text-property (point) 'w3m-href-anchor) (org-w3m-get-next-link-start))
         (if (<= (point) transform-end)  ; if point is inside transform bound
             (progn
               ;; get content between two links.
@@ -77,7 +78,7 @@ so that it can be yanked into an Org-mode buffer with links working correctly."
                                                (buffer-substring
                                                 temp-position (point)))))
               ;; get link location at current point.
-              (setq link-location (w3m-anchor (point)))
+              (setq link-location (get-text-property (point) 'w3m-href-anchor))
               ;; get link title at current point.
               (setq link-title (buffer-substring (point)
                                                  (org-w3m-get-anchor-end)))
@@ -93,7 +94,7 @@ so that it can be yanked into an Org-mode buffer with links working correctly."
           (setq return-content
                 (concat return-content
                         (buffer-substring (point) transform-end))))
-      (kill-new return-content)
+      (org-kill-new return-content)
       (message "Transforming links...done, use C-y to insert text into Org-mode file")
       (message "Copy with link transformation complete."))))
 
@@ -115,18 +116,18 @@ so that it can be yanked into an Org-mode buffer with links working correctly."
     (while (next-single-property-change (point) 'w3m-anchor-sequence)
       ;; jump to next anchor
       (goto-char (next-single-property-change (point) 'w3m-anchor-sequence))
-      (when (w3m-anchor (point))
+      (when (get-text-property (point) 'w3m-href-anchor)
         ;; return point when current is valid link
         (throw 'reach nil))))
   (point))
 
 (defun org-w3m-get-prev-link-start ()
-  "Move cursor to the start of prevoius link.  Return point."
+  "Move cursor to the start of previous link.  Return point."
   (catch 'reach
     (while (previous-single-property-change (point) 'w3m-anchor-sequence)
       ;; jump to previous anchor
       (goto-char (previous-single-property-change (point) 'w3m-anchor-sequence))
-      (when (w3m-anchor (point))
+      (when (get-text-property (point) 'w3m-href-anchor)
         ;; return point when current is valid link
         (throw 'reach nil))))
   (point))
@@ -167,6 +168,6 @@ Return t if there is no previous link; otherwise, return nil."
 
 (provide 'org-w3m)
 
-;; arch-tag: 851d7447-488d-49f0-a14d-46c092e84352
+
 
 ;;; org-w3m.el ends here