aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-10-15 12:12:54 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-10-15 12:43:08 +0200
commitd59b8d0f8bae9c7ab8490cb6b1683d4c9beafd0d (patch)
tree9afe9f2017fe98469b334994eed18dacffaf4e93 /lisp
parent574c17c4bdfe43a3081ddcbde4452dd477929c02 (diff)
next-/prev-toot>next-/prev-item, cond-case around pos update call
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-discover.el4
-rw-r--r--lisp/mastodon-tl.el46
-rw-r--r--lisp/mastodon-toot.el4
-rw-r--r--lisp/mastodon-views.el12
-rw-r--r--lisp/mastodon.el8
5 files changed, 35 insertions, 39 deletions
diff --git a/lisp/mastodon-discover.el b/lisp/mastodon-discover.el
index b3d8537..da25196 100644
--- a/lisp/mastodon-discover.el
+++ b/lisp/mastodon-discover.el
@@ -55,8 +55,8 @@
("c" "Toggle hidden text (CW)" mastodon-tl--toggle-spoiler-text-in-toot)
("k" "Bookmark toot" mastodon-toot--toggle-bookmark)
("v" "Vote on poll" mastodon-tl--poll-vote)
- ("n" "Next" mastodon-tl--goto-next-toot)
- ("p" "Prev" mastodon-tl--goto-prev-toot)
+ ("n" "Next" mastodon-tl--goto-next-item)
+ ("p" "Prev" mastodon-tl--goto-prev-item)
("TAB" "Next link item" mastodon-tl--next-tab-item)
("S-TAB" "Prev link item" mastodon-tl--previous-tab-item)
;; NB: (when (require 'mpv etc. calls don't work here
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 1600b49..ac00079 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -274,7 +274,7 @@ types of mastodon links and not just shr.el-generated ones.")
(define-key map (kbd "RET") #'mastodon-profile--get-toot-author)
map))
"The keymap to be set for the author byline.
-It is active where point is placed by `mastodon-tl--goto-next-toot.'")
+It is active where point is placed by `mastodon-tl--goto-next-item.'")
;;; MACROS
@@ -373,16 +373,22 @@ Optionally start from POS."
(goto-char npos)
;; force display of help-echo on moving to a toot byline:
(mastodon-tl--message-help-echo))
- (funcall refresh))))
+ ;; FIXME: this doesn't really work, as the funcall doesn't return if we
+ ;; run into an endless refresh loop
+ (condition-case nil
+ (funcall refresh)
+ (error "No more items")))))
-(defun mastodon-tl--goto-next-toot ()
- "Jump to next toot header."
+(defun mastodon-tl--goto-next-item ()
+ "Jump to next item.
+Load more items it no next item."
(interactive)
(mastodon-tl--goto-item-pos 'next-single-property-change
'mastodon-tl--more))
-(defun mastodon-tl--goto-prev-toot ()
- "Jump to last toot header."
+(defun mastodon-tl--goto-prev-item ()
+ "Jump to previous item.
+Update if no previous items"
(interactive)
(mastodon-tl--goto-item-pos 'previous-single-property-change
'mastodon-tl--update))
@@ -390,23 +396,13 @@ Optionally start from POS."
(defun mastodon-tl--goto-first-item ()
"Jump to first toot or item in buffer.
Used on initializing a timeline or thread."
- ;; goto-next-toot assumes we already have toots, and is therefore
+ ;; goto-next-item assumes we already have items, and is therefore
;; incompatible with any view where it is possible to have no items.
;; when that is the case the call to goto-toot-pos loops infinitely
(goto-char (point-min))
- (mastodon-tl--goto-next-item))
-
-(defun mastodon-tl--goto-next-item ()
- "Jump to next item, e.g. filter or follow request."
- (interactive)
(mastodon-tl--goto-item-pos 'next-single-property-change
'next-line))
-
-(defun mastodon-tl--goto-prev-item ()
- "Jump to previous item, e.g. filter or follow request."
- (interactive)
- (mastodon-tl--goto-item-pos 'previous-single-property-change
- 'previous-line))
+;; (mastodon-tl--goto-next-item))
;;; TIMELINES
@@ -541,7 +537,7 @@ With arg AVATAR, include the account's avatar image."
Displays a toot's media types and optionally the binding to play
moving image media from the byline.
Used when point is at the start of a byline, i.e. where
-`mastodon-tl--goto-next-toot' leaves point."
+`mastodon-tl--goto-next-item' leaves point."
(let* ((toot-to-count
(or ; simply praying this order works
(alist-get 'status toot) ; notifications timeline
@@ -634,7 +630,7 @@ this just means displaying toot client."
(concat
;; Boosted/favourited markers are not technically part of the byline, so
;; we don't propertize them with 'byline t', as per the rest. This
- ;; ensures that `mastodon-tl--goto-next-toot' puts point on
+ ;; ensures that `mastodon-tl--goto-next-item' puts point on
;; author-byline, not before the (F) or (B) marker. Not propertizing like
;; this makes the behaviour of these markers consistent whether they are
;; displayed for an already boosted/favourited toot or as the result of
@@ -649,7 +645,7 @@ this just means displaying toot client."
(mastodon-tl--format-faved-or-boosted-byline
(mastodon-tl--symbol 'bookmark))))
;; we remove avatars from the byline also, so that they also do not mess
- ;; with `mastodon-tl--goto-next-toot':
+ ;; with `mastodon-tl--goto-next-item':
(when (and mastodon-tl--show-avatars
mastodon-tl--display-media-p
(if (version< emacs-version "27.1")
@@ -1704,8 +1700,8 @@ BACKWARD means move backward (up) the timeline."
(or (get-text-property (point) prop)
(save-excursion
(if backward
- (mastodon-tl--goto-prev-toot)
- (mastodon-tl--goto-next-toot))
+ (mastodon-tl--goto-prev-item)
+ (mastodon-tl--goto-next-item))
(get-text-property (point) prop)))))
(defun mastodon-tl--newest-id ()
@@ -1813,7 +1809,7 @@ view all branches of a thread."
:thread)
;; put point at the toot:
(goto-char (marker-position marker))
- (mastodon-tl--goto-next-toot)))
+ (mastodon-tl--goto-next-item)))
;; else just print the lone toot:
(mastodon-tl--single-toot id)))))))
@@ -2416,7 +2412,7 @@ HEADERS is the http headers returned in the response, if any."
(if (eq (mastodon-tl--get-buffer-type) 'thread)
;; if thread view, call --thread with parent ID
(progn (goto-char (point-min))
- (mastodon-tl--goto-next-toot)
+ (mastodon-tl--goto-next-item)
(funcall (mastodon-tl--update-function))
(goto-char point-before)
(message "Loaded full thread."))
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index e9b98dd..426a371 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -79,7 +79,7 @@
(autoload 'mastodon-tl--field "mastodon-tl")
(autoload 'mastodon-tl--find-property-range "mastodon-tl")
(autoload 'mastodon-tl--find-property-range "mastodon-tl")
-(autoload 'mastodon-tl--goto-next-toot "mastodon-tl")
+(autoload 'mastodon-tl--goto-next-item "mastodon-tl")
(autoload 'mastodon-tl--map-alist "mastodon-tl")
(autoload 'mastodon-tl--property "mastodon-tl")
(autoload 'mastodon-tl--reload-timeline-or-profile "mastodon-tl")
@@ -329,7 +329,7 @@ Remove MARKER if REMOVE is non-nil, otherwise add it."
;; we don't move to the following toot:
(beginning-of-line)
(forward-line -1)
- (mastodon-tl--goto-next-toot)))))
+ (mastodon-tl--goto-next-item)))))
(defun mastodon-toot--action (action callback)
"Take ACTION on toot at point, then execute CALLBACK.
diff --git a/lisp/mastodon-views.el b/lisp/mastodon-views.el
index 8571e15..24a9de0 100644
--- a/lisp/mastodon-views.el
+++ b/lisp/mastodon-views.el
@@ -51,8 +51,8 @@
(autoload 'mastodon-tl--set-face "mastodon-tl")
(autoload 'mastodon-tl--buffer-type-eq "mastodon-tl")
(autoload 'mastodon-tl--profile-buffer-p "mastodon-tl")
-(autoload 'mastodon-tl--goto-next-toot "mastodon-tl")
-(autoload 'mastodon-tl--goto-prev-toot "mastodon-tl")
+(autoload 'mastodon-tl--goto-next-item "mastodon-tl")
+(autoload 'mastodon-tl--goto-prev-item "mastodon-tl")
(autoload 'mastodon-tl--goto-next-item "mastodon-tl")
(autoload 'mastodon-tl--goto-first-item "mastodon-tl")
(autoload 'mastodon-tl--do-if-item "mastodon-tl")
@@ -87,8 +87,8 @@
(defvar mastodon-views-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map mastodon-mode-map)
- (define-key map (kbd "n") #'mastodon-tl--goto-next-toot)
- (define-key map (kbd "p") #'mastodon-tl--goto-prev-toot)
+ (define-key map (kbd "n") #'mastodon-tl--goto-next-item)
+ (define-key map (kbd "p") #'mastodon-tl--goto-prev-item)
map)
"Base keymap for minor mastodon views.")
@@ -97,7 +97,7 @@
(set-keymap-parent map mastodon-views-map)
(define-key map (kbd "d") #'mastodon-views--delete-filter)
(define-key map (kbd "c") #'mastodon-views--create-filter)
- (define-key map (kbd "TAB") #'mastodon-tl--goto-next-item)
+ (define-key map (kbd "TAB") #'mastodon-tl--next-tab-item)
(define-key map (kbd "g") #'mastodon-views--view-filters)
map)
"Keymap for viewing filters.")
@@ -185,7 +185,7 @@ provides the JSON data."
(goto-char (point-min)))
;; (when data
;; FIXME: this seems to trigger a new request, but ideally would run.
- ;; (mastodon-tl--goto-next-toot))
+ ;; (mastodon-tl--goto-next-item))
)
diff --git a/lisp/mastodon.el b/lisp/mastodon.el
index 11be674..10c2745 100644
--- a/lisp/mastodon.el
+++ b/lisp/mastodon.el
@@ -72,8 +72,8 @@
(autoload 'mastodon-tl--get-home-timeline "mastodon-tl")
(autoload 'mastodon-tl--get-local-timeline "mastodon-tl")
(autoload 'mastodon-tl--get-tag-timeline "mastodon-tl")
-(autoload 'mastodon-tl--goto-next-toot "mastodon-tl")
-(autoload 'mastodon-tl--goto-prev-toot "mastodon-tl")
+(autoload 'mastodon-tl--goto-next-item "mastodon-tl")
+(autoload 'mastodon-tl--goto-prev-item "mastodon-tl")
(autoload 'mastodon-tl--init-sync "mastodon-tl")
(autoload 'mastodon-tl--list-followed-tags "mastodon-tl")
(autoload 'mastodon-tl--mute-user "mastodon-tl")
@@ -145,8 +145,8 @@ Use. e.g. \"%c\" for your locale's date and time format."
(defvar mastodon-mode-map
(let ((map (make-sparse-keymap)))
;; navigation inside a timeline
- (define-key map (kbd "n") #'mastodon-tl--goto-next-toot)
- (define-key map (kbd "p") #'mastodon-tl--goto-prev-toot)
+ (define-key map (kbd "n") #'mastodon-tl--goto-next-item)
+ (define-key map (kbd "p") #'mastodon-tl--goto-prev-item)
(define-key map (kbd "M-n") #'mastodon-tl--next-tab-item)
(define-key map (kbd "M-p") #'mastodon-tl--previous-tab-item)
(define-key map [?\t] #'mastodon-tl--next-tab-item)