aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp/my/link-gopher.el
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2023-12-26 16:47:17 +1100
committerYuchen Pei <id@ypei.org>2023-12-26 16:47:17 +1100
commit8bf74036d8d0d1699d05dbc335d5155ee5888805 (patch)
treea34fd323a8ccf4ecbb325a9c758e44bf4d7fb879 /emacs/.emacs.d/lisp/my/link-gopher.el
parent855a412061bc119dbc618158290745dd3b8664f6 (diff)
[emacs] Fixing a few things
- link-gopher: some formatting - my-org: extend my-org-attach-copy-attached-orgs to fallback to a staging area - my-libgen: better naming just in case
Diffstat (limited to 'emacs/.emacs.d/lisp/my/link-gopher.el')
-rw-r--r--emacs/.emacs.d/lisp/my/link-gopher.el32
1 files changed, 16 insertions, 16 deletions
diff --git a/emacs/.emacs.d/lisp/my/link-gopher.el b/emacs/.emacs.d/lisp/my/link-gopher.el
index 11bb75d..5e3fe77 100644
--- a/emacs/.emacs.d/lisp/my/link-gopher.el
+++ b/emacs/.emacs.d/lisp/my/link-gopher.el
@@ -50,12 +50,12 @@ no duplicates."
(let ((results) (clean-url) (hash (make-hash-table :test 'equal)))
(while (re-search-forward
"\\(href\\|HREF\\|src\\|SRC\\)\\ *=\\ *['\"]\\([^\"']+\\)['\"]" nil t)
- (setq clean-url (link-gopher-clean-url (match-string 2) url))
- (when (or (not filter-regexp)
- (string-match filter-regexp clean-url))
- (when (not (gethash clean-url hash))
- (puthash clean-url t hash)
- (push clean-url results))))
+ (setq clean-url (link-gopher-clean-url (match-string 2) url))
+ (when (or (not filter-regexp)
+ (string-match filter-regexp clean-url))
+ (when (not (gethash clean-url hash))
+ (puthash clean-url t hash)
+ (push clean-url results))))
(reverse results))))
(defun link-gopher-clean-url (url current-url)
"clean url
@@ -65,17 +65,17 @@ no duplicates."
removing frags
"
(let* ((current-domain
- (progn (string-match "^\\(.*://[^/]+/\\)" current-url)
- (match-string 1 current-url)))
- (current-domain-dir-path
- (progn (string-match "^\\(.*/\\)" current-url)
- (match-string 1 current-url)))
- (url-no-frags (replace-regexp-in-string "#.*" "" url)))
- (url-encode-url
+ (progn (string-match "^\\(.*://[^/]+/\\)" current-url)
+ (match-string 1 current-url)))
+ (current-domain-dir-path
+ (progn (string-match "^\\(.*/\\)" current-url)
+ (match-string 1 current-url)))
+ (url-no-frags (replace-regexp-in-string "#.*" "" url)))
+ (url-encode-url
(cond ((string-match "://" url-no-frags) url-no-frags)
- ((string-match "^//" url-no-frags) (concat "https:" url-no-frags))
- ((string-match "^/" url-no-frags) (concat current-domain url-no-frags))
- (t (concat current-domain-dir-path url-no-frags))))))
+ ((string-match "^//" url-no-frags) (concat "https:" url-no-frags))
+ ((string-match "^/" url-no-frags) (concat current-domain url-no-frags))
+ (t (concat current-domain-dir-path url-no-frags))))))
(defun link-gopher-get-all-links-in-buffer (filter-regexp)
(let ((results) (hash (make-hash-table :test 'equal)))
(save-excursion