[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/mastodon 00ac9103ad 25/63: multisession var in -toot.el
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/mastodon 00ac9103ad 25/63: multisession var in -toot.el |
Date: |
Sun, 4 Aug 2024 04:00:31 -0400 (EDT) |
branch: elpa/mastodon
commit 00ac9103adba722f8c2ddbd67db6b0ff6bcebc46
Author: marty hiatt <martianhiatus@riseup.net>
Commit: marty hiatt <martianhiatus@riseup.net>
multisession var in -toot.el
---
lisp/mastodon-toot.el | 48 ++++++++++++++++++++++++++++--------------------
1 file changed, 28 insertions(+), 20 deletions(-)
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index bb5a4c3954..902acf919f 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -38,7 +38,6 @@
(defvar emojify-user-emojis)
(require 'cl-lib)
-(require 'persist)
(require 'mastodon-iso)
(require 'facemenu)
(require 'text-property-search)
@@ -226,8 +225,8 @@ Takes its form from `window-configuration-to-register'.")
(defvar mastodon-toot-current-toot-text nil
"The text of the toot being composed.")
-(persist-defvar mastodon-toot-draft-toots-list nil
- "A list of toots that have been saved as drafts.
+(define-multisession-variable mastodon-toot-draft-toots-list nil
+ "A list of toots that have been saved as drafts.
For the moment we just put all composed toots in here, as we want
to also capture toots that are \"sent\" but that don't successfully
send.")
@@ -720,8 +719,10 @@ CANCEL means the toot was not sent, so we save the toot
text as a draft."
(let ((prev-window-config mastodon-toot-previous-window-config))
(unless (eq mastodon-toot-current-toot-text nil)
(when cancel
- (cl-pushnew mastodon-toot-current-toot-text
- mastodon-toot-draft-toots-list :test 'equal)))
+ (setf (multisession-value mastodon-toot-draft-toots-list)
+ (cl-pushnew mastodon-toot-current-toot-text
+ (multisession-value mastodon-toot-draft-toots-list)
+ :test 'equal))))
;; prevent some weird bug when cancelling a non-empty toot:
(delete #'mastodon-toot--save-toot-text after-change-functions)
(quit-window 'kill)
@@ -743,8 +744,10 @@ Pushes `mastodon-toot-current-toot-text' to
`mastodon-toot-draft-toots-list'."
(interactive)
(unless (eq mastodon-toot-current-toot-text nil)
- (cl-pushnew mastodon-toot-current-toot-text
- mastodon-toot-draft-toots-list :test 'equal)
+ (setf (multisession-value mastodon-toot-draft-toots-list)
+ (cl-pushnew mastodon-toot-current-toot-text
+ (multisession-value mastodon-toot-draft-toots-list)
+ :test 'equal))
(message "Draft saved!")))
(defun mastodon-toot--empty-p (&optional text-only)
@@ -1840,15 +1843,17 @@ Added to `after-change-functions' in new toot buffers."
(defun mastodon-toot--open-draft-toot ()
"Prompt for a draft and compose a toot with it."
(interactive)
- (if mastodon-toot-draft-toots-list
- (let ((text (completing-read "Select draft toot: "
- mastodon-toot-draft-toots-list
- nil t)))
+ (if (multisession-value mastodon-toot-draft-toots-list)
+ (let ((text (completing-read
+ "Select draft toot: "
+ (multisession-value mastodon-toot-draft-toots-list)
+ nil t)))
(if (mastodon-toot--compose-buffer-p)
(when (and (not (mastodon-toot--empty-p :text-only))
(y-or-n-p "Replace current text with draft?"))
- (cl-pushnew mastodon-toot-current-toot-text
- mastodon-toot-draft-toots-list)
+ (setf (multisession-value mastodon-toot-draft-toots-list)
+ (cl-pushnew mastodon-toot-current-toot-text
+ (multisession-value
mastodon-toot-draft-toots-list)))
(goto-char
(cdr (mastodon-tl--find-property-range 'toot-post-header
(point-min))))
@@ -1864,19 +1869,22 @@ Added to `after-change-functions' in new toot buffers."
(defun mastodon-toot--delete-draft-toot ()
"Prompt for a draft toot and delete it."
(interactive)
- (if mastodon-toot-draft-toots-list
- (let ((draft (completing-read "Select draft to delete: "
- mastodon-toot-draft-toots-list
- nil t)))
- (setq mastodon-toot-draft-toots-list
- (cl-delete draft mastodon-toot-draft-toots-list :test #'equal))
+ (if (multisession-value mastodon-toot-draft-toots-list)
+ (let ((draft (completing-read
+ "Select draft to delete: "
+ (multisession-value mastodon-toot-draft-toots-list)
+ nil t)))
+ (setf (multisession-value mastodon-toot-draft-toots-list)
+ (cl-delete draft
+ (multisession-value mastodon-toot-draft-toots-list)
+ :test #'equal))
(message "Draft deleted!"))
(message "No drafts to delete.")))
(defun mastodon-toot--delete-all-drafts ()
"Delete all drafts."
(interactive)
- (setq mastodon-toot-draft-toots-list nil)
+ (setf (multisession-value mastodon-toot-draft-toots-list) nil)
(message "All drafts deleted!"))
- [nongnu] elpa/mastodon updated (a191fb5f3f -> 45903de823), ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 2d4cedbf68 01/63: readme re bookmarks, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 9b1b08c9b3 02/63: img help echo: cmd keys and toggle sensitive binding, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon aa6b7b25be 18/63: readme re tofu, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 92e1e7b991 03/63: move/rename with-toot-item, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 8f8c461e01 20/63: wrap --thread in with-item macro, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 6e24c36e86 07/63: screenshots, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon f43ecd6bad 06/63: docstring, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 8df12b8808 15/63: update info, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon e9ddf28832 21/63: horiz-bar refactor, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 00ac9103ad 25/63: multisession var in -toot.el,
ELPA Syncer <=
- [nongnu] elpa/mastodon 8c4f18cca7 32/63: toot--insert-emoji: defalis -> defun., ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 3eb1c4f794 41/63: --thread: diff name for option arg to avoid macro var, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 028ab8ea22 43/63: fix newlines accumulating on (un)folding toots, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 134ec9413a 45/63: small adjustments to point placement with (un)folding, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon cf72fb5af0 47/63: bind fold toggle, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon d0a5bae331 50/63: refactor toot--toggle-boost-or-favourite, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon c75c4b7753 60/63: Revert "readme: multisession", ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 1887a2d414 11/63: readme: multisession, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon a9c6c04ac6 09/63: comments on mastodon-tl--goto-item-pos, ELPA Syncer, 2024/08/04
- [nongnu] elpa/mastodon 4d335d45f4 16/63: index, ELPA Syncer, 2024/08/04