mirror of
https://codeberg.org/cage/tinmop/
synced 2025-01-26 03:44:50 +01:00
- added 'gemini-all-unread-posts', 'shuffle-tour', 'gemlog-add-unread-posts-tour', 'clear-tour'
'gemini-all-unread-posts' give user the choice to add all the currently unread post to the link tour.
This commit is contained in:
parent
13fa0734dd
commit
b437e2846b
@ -157,6 +157,8 @@
|
||||
|
||||
(define-key "M-g s r" #'gemlog-refresh-all)
|
||||
|
||||
(define-key "M-g s t a" #'gemlog-add-unread-posts-tour)
|
||||
|
||||
(define-key "M-g c i" #'import-gemini-certificate)
|
||||
|
||||
(define-key "M-g c s" #'gemini-open-certificates-window)
|
||||
@ -165,6 +167,14 @@
|
||||
|
||||
(define-key "M-g g b s" #'display-bookmark)
|
||||
|
||||
(define-key "M-t t" #'next-tour-link)
|
||||
|
||||
(define-key "M-t s" #'show-tour-links)
|
||||
|
||||
(define-key "M-t S" #'shuffle-tour)
|
||||
|
||||
(define-key "M-t c" #'clean-all-tour)
|
||||
|
||||
(define-key "M-right" #'pass-focus-on-right)
|
||||
|
||||
(define-key "M-left" #'pass-focus-on-left)
|
||||
|
@ -3055,6 +3055,13 @@ than `days-in-the-past' days (default: `(swconf:config-purge-cache-days-offset)'
|
||||
(rows (fetch-all-rows query)))
|
||||
rows))
|
||||
|
||||
(defun gemini-all-unread-posts ()
|
||||
(when-let* ((query (select (:title :url)
|
||||
(from +table-gemlog-entries+)
|
||||
(where (:= :seenp (prepare-for-db nil :to-integer t)))))
|
||||
(rows (fetch-all-rows query)))
|
||||
rows))
|
||||
|
||||
(defun gemini-cancel-subscription (gemlog-url)
|
||||
(query (delete-from +table-gemini-subscription+ (where (:= :url gemlog-url)))))
|
||||
|
||||
|
@ -87,7 +87,7 @@
|
||||
text
|
||||
+preformatted-prefix+))
|
||||
|
||||
(defun make-gemini-link (url title)
|
||||
(defun render-gemini-link (url title)
|
||||
(format nil "~a ~a"
|
||||
(geminize-link url)
|
||||
title))
|
||||
@ -233,6 +233,9 @@
|
||||
:initarg :name
|
||||
:accessor name)))
|
||||
|
||||
(defun make-gemini-link (target link-name)
|
||||
(make-instance 'gemini-link :target target :name link-name))
|
||||
|
||||
(defmethod print-object ((object gemini-link) stream)
|
||||
(print-unreadable-object (object stream :type t :identity t)
|
||||
(with-accessors ((target target)
|
||||
|
@ -49,10 +49,11 @@
|
||||
:geminize-quote
|
||||
:geminize-link
|
||||
:geminize-preformatted
|
||||
:make-gemini-link
|
||||
:render-gemini-link
|
||||
:gemini-link
|
||||
:target
|
||||
:name
|
||||
:make-gemini-link
|
||||
:path-last-dir
|
||||
:gemini-response
|
||||
:status-code
|
||||
|
@ -114,6 +114,7 @@ etc.) happened"
|
||||
(swconf:load-config-file swconf:+conf-filename+)))
|
||||
|
||||
(defun shared-init ()
|
||||
(num:lcg-set-seed)
|
||||
(load-configuration-files)
|
||||
(init-db))
|
||||
|
||||
|
@ -1041,6 +1041,7 @@
|
||||
:row-seen-count
|
||||
:row-unseen-count
|
||||
:find-gemlog-entry
|
||||
:gemini-all-unread-posts
|
||||
:gemini-cancel-subscription
|
||||
:add-gemlog-entries
|
||||
:gemlog-mark-as-seen
|
||||
@ -2675,13 +2676,15 @@
|
||||
:gemlog-cancel-subscription
|
||||
:send-to-pipe
|
||||
:send-message-to-pipe
|
||||
:clean-all-tour
|
||||
:shuffle-tour
|
||||
:clean-tour
|
||||
:clean-all-tour
|
||||
:add-links-to-tour
|
||||
:tour-mode-link
|
||||
:next-tour-link
|
||||
:show-tour-links
|
||||
:save-selected-message-in-tour
|
||||
:gemlog-add-unread-posts-tour
|
||||
:open-gemini-toc
|
||||
:gemini-toc-scroll-up
|
||||
:gemini-toc-scroll-down
|
||||
|
@ -1102,7 +1102,7 @@
|
||||
(text-utils:strcat path " " dir-symbol)
|
||||
path))
|
||||
(encoded-path (gemini-client::percent-encode-path path))
|
||||
(link (gemini-parser:make-gemini-link encoded-path link-label)))
|
||||
(link (gemini-parser:render-gemini-link encoded-path link-label)))
|
||||
(push link link-lines)))
|
||||
(setf link-lines (sort link-lines #'string<))
|
||||
(text-utils:join-with-strings (append (list raw-text) link-lines)
|
||||
@ -1354,7 +1354,7 @@
|
||||
(seenp (db-utils:db-not-nil-p (db:row-post-seenp entry))))
|
||||
(format stream
|
||||
(_ "~a ~:[(not opened)~;(opened)~]~%")
|
||||
(gemini-parser:make-gemini-link link
|
||||
(gemini-parser:render-gemini-link link
|
||||
title)
|
||||
seenp)))))
|
||||
(url (iri:iri-parse gemlog-url))
|
||||
|
@ -1986,7 +1986,12 @@ gemini://gemini.circumlunar.space/docs/companion/subscription.gmi
|
||||
|
||||
(let ((tour ()))
|
||||
|
||||
(defun shuffle-tour ()
|
||||
"Shuffle the links in the tour"
|
||||
(setf tour (shuffle tour)))
|
||||
|
||||
(defun clean-tour (regex)
|
||||
"Remove links from the tour matching `regex'"
|
||||
(let ((scanner (create-scanner regex :case-insensitive-mode t)))
|
||||
(setf tour
|
||||
(remove-if (lambda (a)
|
||||
@ -1995,6 +2000,7 @@ gemini://gemini.circumlunar.space/docs/companion/subscription.gmi
|
||||
tour))))
|
||||
|
||||
(defun clean-all-tour ()
|
||||
"Remove all links from the tour"
|
||||
(clean-tour ".*"))
|
||||
|
||||
(defun add-links-to-tour (links)
|
||||
@ -2056,6 +2062,7 @@ gemini://gemini.circumlunar.space/docs/companion/subscription.gmi
|
||||
(error-message (_ "Tour completed"))
|
||||
(let ((url (gemini-parser:target link)))
|
||||
(setf tour (reverse (rest queue)))
|
||||
(focus-to-message-window)
|
||||
(open-message-link-window:open-message-link url nil)))))
|
||||
|
||||
(defun show-tour-links ()
|
||||
@ -2073,7 +2080,16 @@ gemini://gemini.circumlunar.space/docs/companion/subscription.gmi
|
||||
(label (or (gemini-parser:name selected-link)
|
||||
(gemini-parser:target selected-link))))
|
||||
(push selected-link tour)
|
||||
(info-message (format nil (_ "~s saved in tour") label))))))))
|
||||
(info-message (format nil (_ "~s saved in tour") label)))))))
|
||||
|
||||
(defun gemlog-add-unread-posts-tour ()
|
||||
"Add all the unread gemlog posts to the tour"
|
||||
(when-let* ((unread-posts (db:gemini-all-unread-posts))
|
||||
(links (mapcar (lambda (row)
|
||||
(gemini-parser:make-gemini-link (db:row-url row)
|
||||
(db:row-title row)))
|
||||
unread-posts)))
|
||||
(add-links-to-tour links))))
|
||||
|
||||
(defun open-gemini-toc ()
|
||||
"Opend a windows that contains a generated table of contents of the
|
||||
|
Loading…
Reference in New Issue
Block a user