;;; org-w3m.el --- Support from copy and paste from w3m to Org-mode
-;; Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2011 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.30c
+;; Version: 7.4
;;
;; 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>
;;
;; 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.
;; 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.
(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)))
(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))
(provide 'org-w3m)
-;; arch-tag: 851d7447-488d-49f0-a14d-46c092e84352
;;; org-w3m.el ends here