X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/5ace2fe5ec1ac286b69e3ec3db9a0fba6a295f49..c530e1c2a3a036d71942c354ba11b30a06341fd7:/lisp/org/org-w3m.el diff --git a/lisp/org/org-w3m.el b/lisp/org/org-w3m.el index a09d88e153..ff839a9b7c 100644 --- a/lisp/org/org-w3m.el +++ b/lisp/org/org-w3m.el @@ -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-2011 Free Software Foundation, Inc. ;; Author: Andy Stewart ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 6.21b +;; Version: 7.4 ;; ;; This file is part of GNU Emacs. ;; @@ -26,13 +26,13 @@ ;;; 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 ;; @@ -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,5 @@ 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