diff options
author | Marco Wahl <marcowahlsoft@gmail.com> | 2016-01-09 23:14:47 +0100 |
---|---|---|
committer | Marco Wahl <marcowahlsoft@gmail.com> | 2016-01-09 23:14:47 +0100 |
commit | 88a2f285f0d46d76f2be5efc03fd5f0217a21d01 (patch) | |
tree | a7afeb6ef5233ac1e99e28ac89068cc0d007e4d4 | |
parent | e0d3944985acdd710e6fa47e6d0cc189a21cf49e (diff) | |
download | org-mode-88a2f285f0d46d76f2be5efc03fd5f0217a21d01.tar.gz |
contrib/org-eww: Use lexical binding + 𝜀
* contrib/lisp/org-eww.el: Copyright year update. Simplified program
logic. Replaced `replace-regexp' (following the advice of
`elint-file'.)
-rw-r--r-- | contrib/lisp/org-eww.el | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/contrib/lisp/org-eww.el b/contrib/lisp/org-eww.el index a6973e9..11ccb68 100644 --- a/contrib/lisp/org-eww.el +++ b/contrib/lisp/org-eww.el @@ -1,6 +1,6 @@ -;;; org-eww.el --- Store url and kill from Eww mode for Org +;;; org-eww.el --- Store url and kill from Eww mode for Org -*- lexical-binding: t -*- -;; Copyright (C) 2014, 2015 Free Software Foundation, Inc. +;; Copyright (C) 2014-2016 Free Software Foundation, Inc. ;; Author: Marco Wahl <marcowahlsoft>a<gmailcom> ;; Keywords: link, eww @@ -72,11 +72,10 @@ move. Return point." (or (next-single-property-change (point) 'shr-url) (point)))) -(defun org-eww-no-next-link-p () - "Whether there is no next link after the cursor. -Return t if there is no next link; otherwise, return nil." +(defun org-eww-has-further-url-property-change-p () + "Return t if there is a next url property change else nil." (save-excursion - (and (eq (point) (org-eww-goto-next-url-property-change)) t))) + (not (eq (point) (org-eww-goto-next-url-property-change))))) (defun org-eww-url-below-point () "Return the url below point if there is an url; otherwise, return nil." @@ -107,7 +106,7 @@ the structure of the org file." (save-excursion (goto-char transform-start) (while (and (not out-bound) ; still inside region to copy - (not (org-eww-no-next-link-p))) ; there is a next link + (org-eww-has-further-url-property-change-p)) ; there is a next link ;; store current point before jump next anchor (setq temp-position (point)) ;; move to next anchor when current point is not at anchor @@ -118,7 +117,7 @@ the structure of the org file." (if (<= (point) transform-end) ; if point is inside transform bound (progn ;; get content between two links. - (if (> (point) temp-position) + (if (< temp-position (point)) (setq return-content (concat return-content (buffer-substring temp-position (point))))) @@ -146,7 +145,8 @@ the structure of the org file." (with-temp-buffer (insert return-content) (goto-char 0) - (replace-regexp "^\*" ",*") + (while (re-search-forward "^\*" nil t) + (replace-match ",*")) (buffer-string))) (message "Transforming links...done, use C-y to insert text into Org-mode file")))) |