diff options
author | Yuchen Pei <hi@ypei.me> | 2022-11-25 16:07:25 +1100 |
---|---|---|
committer | Yuchen Pei <hi@ypei.me> | 2022-11-25 16:07:25 +1100 |
commit | 9233bd90bbfe50b3b819f805d2f9f3c5722a0320 (patch) | |
tree | f1428d8640479079c2a871c46d144dcd8985cb10 | |
parent | 70d799cb088d7730d755ac7f9ba0669ea315407f (diff) |
fixing FIXMEs
-rw-r--r-- | luwak-org.el | 38 | ||||
-rw-r--r-- | luwak.el | 19 |
2 files changed, 41 insertions, 16 deletions
diff --git a/luwak-org.el b/luwak-org.el new file mode 100644 index 0000000..1c1b7c1 --- /dev/null +++ b/luwak-org.el @@ -0,0 +1,38 @@ +;;; luwak-org.el --- org integration for luwak. -*- lexical-binding: t; -*- + +;; Copyright (C) 2022 Free Software Foundation, Inc. +;; +;; This file is part of luwak. +;; +;; luwak is free software: you can redistribute it and/or modify it under +;; the terms of the GNU Affero General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; luwak is distributed in the hope that it will be useful, but WITHOUT +;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General +;; Public License for more details. +;; +;; You should have received a copy of the GNU Affero General Public +;; License along with luwak. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'org) +(require 'luwak) + +(defun luwak-org-store-link () + (when (derived-mode-p 'luwak-mode) + (org-link-store-props + :type "luwak" + :link (plist-get luwak-data :url) + :description (luwak-guess-title)))) + +(org-link-set-parameters "luwak" + :follow #'luwak-open + :store #'luwak-org-store-link) + +(provide 'luwak-org) @@ -6,7 +6,7 @@ ;; Version: 0 ;; Keywords: web-browser, lynx, html, tor ;; Package-Requires: ((emacs "28")) -;; Package-Type: +;; Package-Type: multi ;; Homepage: https://g.ypei.me/luwak.git ;; Copyright (C) 2022 Free Software Foundation, Inc. @@ -125,26 +125,13 @@ non-nill, swap the tor-switch in prefix-arg effect." (buffer-substring-no-properties (1- (point)) (progn (end-of-line 1) (point)))))) -(defun luwak-org-store-link () - (when (derived-mode-p 'luwak-mode) - (org-link-store-props - :type "luwak" - :link (plist-get luwak-data :url) - :description (luwak-guess-title)))) - -;; FIXME: `org' is always available, so this should never fail! -(when (require 'org nil t) - (org-link-set-parameters "luwak" - :follow #'luwak-open - :store #'luwak-org-store-link)) - ;;;###autoload (defun luwak-open (url) "Open URL in luwak." (interactive (list (if luwak-use-history - (car ;FIXME: Why throw away everything after space? + (car (split-string (completing-read "Url to open: " (luwak-history-collection-from-file)))) @@ -342,7 +329,7 @@ non-nill, swap the tor-switch in prefix-arg effect." (goto-char (point-min)) (re-search-forward "^References\n\n\\(\\ *Visible links:\n\\)?" nil t) (delete-region (point-min) (match-end 0)) - (seq-filter #'identity ;`delq nil' ? + (delq nil (mapcar (lambda (s) (when (string-match "^\\ *\\([0-9]+\\)\\. \\(.*\\)" s) (concat (match-string 1 s) " " (match-string 2 s)))) |