aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-toot.el
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2021-10-28 17:51:43 +0200
committermousebot <mousebot@riseup.net>2021-10-28 17:51:43 +0200
commit5c4da2fa589e930a25c18363f1f0ace50635786c (patch)
tree6b0eda05bf8550976f2ac574de049cfba2db3c5f /lisp/mastodon-toot.el
parent36f9fe238b778d76809facd3d66120c2166f2c30 (diff)
parent998bfd60ed0ad1c4de161dd9a32c7786ee34b48a (diff)
Merge branch 'develop' into imgcaching
Diffstat (limited to 'lisp/mastodon-toot.el')
-rw-r--r--lisp/mastodon-toot.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 983515e..14dcc29 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -34,7 +34,11 @@
(declare-function emojify-insert-emoji "emojify"))
(require 'cl-lib)
-(require 'company nil :noerror)
+
+(when (require 'company nil :noerror)
+ (declare-function company-mode-on "company")
+ (declare-function company-begin-backend "company")
+ (declare-function company-grab-symbol "company"))
(defvar mastodon-instance-url)
(autoload 'mastodon-auth--user-acct "mastodon-auth")
@@ -563,7 +567,7 @@ It adds the items' ids to `mastodon-toot--media-attachment-ids', which is used t
(mapcar (lambda (attachment)
(let* ((filename (cdr (assoc :filename attachment)))
(caption (cdr (assoc :description attachment)))
- (url (concat mastodon-instance-url "/api/v1/media")))
+ (url (concat mastodon-instance-url "/api/v2/media")))
(message "Uploading %s..." (file-name-nondirectory filename))
(mastodon-http--post-media-attachment url filename caption)))
mastodon-toot--media-attachments))
@@ -727,7 +731,7 @@ REPLY-JSON is the full JSON of the toot being replied to."
(setq mastodon-toot--content-warning t)
(setq mastodon-toot--content-warning-from-reply-or-redraft reply-cw)))))
-(defun mastodon-toot--update-status-fields (&rest args)
+(defun mastodon-toot--update-status-fields (&rest _args)
"Update the status fields in the header based on the current state."
(ignore-errors ;; called from after-change-functions so let's not leak errors
(let ((inhibit-read-only t)
@@ -780,10 +784,11 @@ REPLY-JSON is the full JSON of the toot being replied to."
(mastodon-toot-mode t)
(unless mastodon-toot--max-toot-chars
(mastodon-toot--get-max-toot-chars))
- (when mastodon-toot--enable-completion-for-mentions
- (set (make-local-variable 'company-backends)
- (add-to-list 'company-backends 'mastodon-toot--mentions-completion))
- (company-mode-on))
+ (when (require 'company nil :noerror)
+ (when mastodon-toot--enable-completion-for-mentions
+ (set (make-local-variable 'company-backends)
+ (add-to-list 'company-backends 'mastodon-toot--mentions-completion))
+ (company-mode-on)))
(make-local-variable 'after-change-functions)
(push #'mastodon-toot--update-status-fields after-change-functions)
(mastodon-toot--refresh-attachments-display)