|
|
@@ -563,13 +563,16 @@ Including ancestors and descendants, if any."
|
|
|
(defvar exitter-dir (locate-user-emacs-file "exitter")
|
|
|
"Path to local directory of saved threads.")
|
|
|
|
|
|
+(defun exitter-post-file-name (id)
|
|
|
+ (format (file-name-concat exitter-dir (format "%s.org" id))))
|
|
|
+
|
|
|
(defun exitter-save-posts (filtered-details id)
|
|
|
;; (pp filtered-details)
|
|
|
(if (length= filtered-details 0)
|
|
|
(message "Empty filtered-details - will not save.")
|
|
|
(exitter-save-text-and-switch-to-buffer
|
|
|
(exitter-format-posts filtered-details)
|
|
|
- (format (file-name-concat exitter-dir (format "%s.org" id))))))
|
|
|
+ (exitter-post-file-name id))))
|
|
|
|
|
|
(defun exitter-post-url (user post-id)
|
|
|
(format "https://x.com/%s/status/%s" user post-id))
|
|
|
@@ -611,12 +614,16 @@ Including ancestors and descendants, if any."
|
|
|
(string-match-p "^/[^/]+/status/\\([0-9]+\\)"
|
|
|
(url-filename (url-generic-parse-url url))))
|
|
|
|
|
|
-(defun exitter-open-post (url)
|
|
|
- (interactive "sTwitter link: ")
|
|
|
+(defun exitter-open-post (url &optional arg)
|
|
|
+ (interactive "sTwitter link: \nP")
|
|
|
(let ((path-etc (url-filename (url-generic-parse-url url))))
|
|
|
(unless (string-match "^/[^/]+/status/\\([0-9]+\\)" path-etc)
|
|
|
(error "Not a valid x/twitter (or a frontend) url!"))
|
|
|
- (exitter-get-tweet (match-string 1 path-etc))))
|
|
|
+ (let* ((id (match-string 1 path-etc))
|
|
|
+ (file-name (exitter-post-file-name id)))
|
|
|
+ (if (or arg (not (file-exists-p file-name)))
|
|
|
+ (exitter-get-tweet (match-string 1 path-etc))
|
|
|
+ (find-file file-name)))))
|
|
|
|
|
|
;;; utilities
|
|
|
|