[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/mastodon e5c9f403b6 14/45: Merge branch 'quote-region' int
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/mastodon e5c9f403b6 14/45: Merge branch 'quote-region' into develop |
Date: |
Thu, 1 Feb 2024 10:00:41 -0500 (EST) |
branch: elpa/mastodon
commit e5c9f403b6e71407b6e8e14a72a0d08848970213
Merge: a6680b093e 1a4c9545ec
Author: marty hiatt <martianhiatus@riseup.net>
Commit: marty hiatt <martianhiatus@riseup.net>
Merge branch 'quote-region' into develop
---
lisp/mastodon-toot.el | 44 +++++++++++++++++++++++++++++++++++++++-----
1 file changed, 39 insertions(+), 5 deletions(-)
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 2951ac8603..6b2f7918b4 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -1088,7 +1088,10 @@ Customize `mastodon-toot-display-orig-in-reply-buffer'
to display
text of the toot being replied to in the compose buffer."
(interactive)
(mastodon-tl--do-if-item-strict
- (let* ((toot (mastodon-tl--property 'item-json))
+ (let* ((quote (when (region-active-p)
+ (buffer-substring (region-beginning)
+ (region-end))))
+ (toot (mastodon-tl--property 'item-json))
;; no-move arg for base toot: don't try next toot
(base-toot (mastodon-tl--property 'base-toot :no-move)) ; for new
notifs handling
(id (mastodon-tl--as-string (mastodon-tl--field 'id (or base-toot
toot))))
@@ -1119,7 +1122,8 @@ text of the toot being replied to in the compose buffer."
;; user in mentions already:
(mastodon-toot--mentions-to-string (copy-sequence mentions)))))
id
- (or base-toot toot)))))
+ (or base-toot toot)
+ quote))))
;;; COMPOSE TOOT SETTINGS
@@ -1537,7 +1541,30 @@ The default is given by
`mastodon-toot--default-reply-visibility'."
(if (member (intern reply-visibility) less-restrictive)
mastodon-toot--default-reply-visibility reply-visibility))))
-(defun mastodon-toot--setup-as-reply (reply-to-user reply-to-id reply-json)
+(defun mastodon-toot--fill-buffer ()
+ "Mark buffer, call fill-region."
+ (mark-whole-buffer)
+ (fill-region (region-beginning) (region-end)))
+
+(defun mastodon-toot--render-reply-region-str (str)
+ "Refill STR and prefix all lines with >, as reply-quote text."
+ (with-temp-buffer
+ ;; (switch-to-buffer (current-buffer))
+ (insert str)
+ ;; unfill first:
+ (let ((fill-column (point-max)))
+ (mastodon-toot--fill-buffer))
+ ;; then fill:
+ (mastodon-toot--fill-buffer)
+ ;; add our own prefix, pauschal:
+ (save-match-data
+ (while (re-search-forward "^" nil t)
+ (replace-match " > ")))
+ (buffer-substring-no-properties (point-min)
+ (point-max))))
+
+(defun mastodon-toot--setup-as-reply (reply-to-user reply-to-id
+ reply-json reply-region)
"If REPLY-TO-USER is provided, inject their handle into the message.
If REPLY-TO-ID is provided, set `mastodon-toot--reply-to-id'.
REPLY-JSON is the full JSON of the toot being replied to."
@@ -1547,6 +1574,10 @@ REPLY-JSON is the full JSON of the toot being replied
to."
(when reply-to-user
(when (> (length reply-to-user) 0) ; self is "" unforch
(insert (format "%s " reply-to-user)))
+ (when reply-region
+ (insert "\n"
+ (mastodon-toot--render-reply-region-str reply-region)
+ "\n"))
(setq mastodon-toot--reply-to-id reply-to-id)
(unless (equal mastodon-toot--visibility reply-visibility)
(setq mastodon-toot--visibility reply-visibility))
@@ -1767,7 +1798,9 @@ EDIT means we are editing an existing toot, not composing
a new one."
;; perhaps we should not always call --setup-as-reply, or make its
;; workings conditional on reply-to-id. currently it only checks for
;; reply-to-user.
- (mastodon-toot--setup-as-reply reply-to-user reply-to-id reply-json))
+ (mastodon-toot--setup-as-reply reply-to-user reply-to-id reply-json
+ ;; only initial-text if reply (not edit):
+ (when reply-json initial-text)))
(unless mastodon-toot--max-toot-chars
;; no need to fetch from `mastodon-profile-account-settings' as
;; `mastodon-toot--max-toot-chars' is set when we set it
@@ -1800,7 +1833,8 @@ EDIT means we are editing an existing toot, not composing
a new one."
(setq mastodon-toot-previous-window-config previous-window-config)
(when mastodon-toot--proportional-fonts-compose
(facemenu-set-face 'variable-pitch))
- (when initial-text
+ (when (and initial-text
+ (not reply-json))
(insert initial-text))))
;; flyspell ignore masto toot regexes:
- [nongnu] elpa/mastodon updated (a8c80d25b7 -> 136e4d387a), ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon e5c9f403b6 14/45: Merge branch 'quote-region' into develop,
ELPA Syncer <=
- [nongnu] elpa/mastodon ee33bd1d2d 22/45: toot--send: check for media with media-attachment-ids for speed, ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon 2f68bc776d 29/45: tl--content: only call tl--media if we have media, ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon f0137a0ad6 42/45: Add 'o' binding to open the current toot in a browser, ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon 2e195ee009 01/45: update cmd index, ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon 1da8ab0675 05/45: add cmd to url-lookup with no fedi-like check, ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon d9959ace12 04/45: update info re patches, ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon 406d87cc7a 07/45: display-media-p var > defcustom, ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon 33d0011c7c 11/45: toot--reply: call toot--compose-buffer not just toot, ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon 0c7322e839 24/45: refactor mastodon-toot--make-capf, ELPA Syncer, 2024/02/01
- [nongnu] elpa/mastodon 0c048e154b 20/45: copy image caption cmd, ELPA Syncer, 2024/02/01