emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/mastodon a7fec25557 17/63: Merge branch 'multisession' int


From: ELPA Syncer
Subject: [nongnu] elpa/mastodon a7fec25557 17/63: Merge branch 'multisession' into develop
Date: Sun, 4 Aug 2024 04:00:30 -0400 (EDT)

branch: elpa/mastodon
commit a7fec255574decfe24302f260b451203d13a8b22
Merge: 7b4d77b86b 4e8d286164
Author: marty hiatt <martianhiatus@riseup.net>
Commit: marty hiatt <martianhiatus@riseup.net>

    Merge branch 'multisession' into develop
---
 README.org               |  2 +-
 lisp/mastodon-profile.el | 19 +++++++++++--------
 lisp/mastodon-toot.el    |  9 ++++-----
 lisp/mastodon.el         | 10 ++++++++--
 4 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/README.org b/README.org
index 53cb508cc0..b542142ca4 100644
--- a/README.org
+++ b/README.org
@@ -421,7 +421,7 @@ to your translator function as its text argument. Here's 
what
 
 Hard dependencies (should all install with =mastodon.el=):
 - =request= (for uploading attachments), 
[[https://github.com/tkf/emacs-request][emacs-request]]
-- =persist= for storing some settings across sessions
+- +=persist= for storing some settings across sessions+ (we now use 
=multisession.el= for this)
 
 Optional dependencies (install yourself, =mastodon.el= can use them):
 - =emojify= for inserting and viewing emojis
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el
index de16b7d216..cd1978fde1 100644
--- a/lisp/mastodon-profile.el
+++ b/lisp/mastodon-profile.el
@@ -35,7 +35,6 @@
 ;;; Code:
 (require 'seq)
 (require 'cl-lib)
-(require 'persist)
 (require 'parse-time)
 (require 'mastodon-http)
 (eval-when-compile
@@ -125,8 +124,8 @@ It contains details of the current user's account.")
     map)
   "Keymap for `mastodon-profile-update-mode'.")
 
-(persist-defvar mastodon-profile-account-settings nil
-                "An alist of account settings saved from the server.
+(define-multisession-variable mastodon-profile-account-settings nil
+  "An alist of account settings saved from the server.
 Other clients can change these settings on the server at any
 time, so this list is not the canonical source for settings. It
 is updated on entering mastodon mode and on toggle any setting it
@@ -365,13 +364,16 @@ SOURCE means that the preference is in the `source' part 
of the account JSON."
 
 (defun mastodon-profile--get-pref (pref)
   "Return PREF from `mastodon-profile-account-settings'."
-  (plist-get mastodon-profile-account-settings pref))
+  (plist-get (multisession-value mastodon-profile-account-settings)
+             pref))
 
 (defun mastodon-profile--update-preference-plist (pref val)
   "Set local account preference plist preference PREF to VAL.
 This is done after changing the setting on the server."
-  (setq mastodon-profile-account-settings
-        (plist-put mastodon-profile-account-settings pref val)))
+  (setf (multisession-value mastodon-profile-account-settings)
+        (plist-put
+         (multisession-value mastodon-profile-account-settings)
+         pref val)))
 
 ;; used in toot.el
 (defun mastodon-profile--fetch-server-account-settings-maybe ()
@@ -384,7 +386,8 @@ Only do so if `mastodon-profile-account-settings' is nil."
 Store the values in `mastodon-profile-account-settings'.
 Run in `mastodon-mode-hook'.
 If NO-FORCE, only fetch if `mastodon-profile-account-settings' is nil."
-  (unless (and no-force mastodon-profile-account-settings)
+  (unless (and no-force
+               (multisession-value mastodon-profile-account-settings))
     (let ((keys '(locked discoverable display_name bot))
           (source-keys '(privacy sensitive language)))
       (mapc (lambda (k)
@@ -402,7 +405,7 @@ If NO-FORCE, only fetch if 
`mastodon-profile-account-settings' is nil."
       ;; TODO: remove now redundant vars, replace with fetchers from the plist
       (setq mastodon-toot--visibility (mastodon-profile--get-pref 'privacy)
             mastodon-toot--content-nsfw (mastodon-profile--get-pref 
'sensitive))
-      mastodon-profile-account-settings)))
+      (multisession-value mastodon-profile-account-settings))))
 
 (defun mastodon-profile--account-locked-toggle ()
   "Toggle the locked status of your account.
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index e934352690..496f334cad 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -158,10 +158,7 @@ If the original toot visibility is different we use the 
more restricted one."
   "Whether to enable your instance's custom emoji by default."
   :type 'boolean)
 
-(defcustom mastodon-toot--emojify-in-compose-buffer t
-  "Whether to enable `emojify-mode' in the compose buffer.
-We only attempt to enable it if its bound."
-  :type 'boolean)
+(defvar mastodon-use-emojify)
 
 (defcustom mastodon-toot--proportional-fonts-compose nil
   "Nonnil to enable using proportional fonts in the compose buffer.
@@ -1964,7 +1961,9 @@ EDIT means we are editing an existing toot, not composing 
a new one."
     (mastodon-toot-mode t)
     ;; set visibility:
     (setq mastodon-toot--visibility
-          (or (plist-get mastodon-profile-account-settings 'privacy)
+          (or (plist-get
+               (multisession-value mastodon-profile-account-settings)
+               'privacy)
               ;; use toot visibility setting from the server:
               (mastodon-profile--get-source-value 'privacy)
               "public")) ; fallback
diff --git a/lisp/mastodon.el b/lisp/mastodon.el
index d0dddeeb6f..8a0aa91790 100644
--- a/lisp/mastodon.el
+++ b/lisp/mastodon.el
@@ -7,7 +7,7 @@
 ;;         Marty Hiatt <martianhiatus@riseup.net>
 ;; Maintainer: Marty Hiatt <martianhiatus@riseup.net>
 ;; Version: 1.0.24
-;; Package-Requires: ((emacs "27.1") (request "0.3.0") (persist "0.4"))
+;; Package-Requires: ((emacs "27.1") (request "0.3.0"))
 ;; Homepage: https://codeberg.org/martianh/mastodon.el
 
 ;; This file is not part of GNU Emacs.
@@ -144,6 +144,11 @@ The default value \"%F %T\" prints ISO8601-style 
YYYY-mm-dd HH:MM:SS.
 Use. e.g. \"%c\" for your locale's date and time format."
   :type 'string)
 
+(defcustom mastodon-use-emojify nil
+  "Whether to use emojify.el to display emojis.
+From version 28, Emacs can display emojis natively. But
+currently, it doesn't seem to have a way to handle custom emoji,
+while emojify,el has this feature and mastodon.el implements it.")
 
 (defun mastodon-kill-window ()
   "Quit window and delete helper."
@@ -464,7 +469,8 @@ Calls `mastodon-tl--get-buffer-type', which see."
 
 (defun mastodon-mode-hook-fun ()
   "Function to add to `mastodon-mode-hook'."
-  (when (require 'emojify nil :noerror)
+  (when (and mastodon-use-emojify
+             (require 'emojify nil :noerror))
     (emojify-mode t)
     (when mastodon-toot--enable-custom-instance-emoji
       (mastodon-toot--enable-custom-emoji)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]