In the follow-up of this question, I am trying to edit a
gnus-button text-property, called
gnus-data, so that when my invitation emails are exported/updated into
org-mode any MS safelinks have been filtered out. Now, I have no idea of what the text property is a printed representation of. I've tried to do a
hash-table-count to check if it's a list or hash-table and got a wrong argument type for both.
type-of isn't much more helpful, as it returns
My problem is how to update that representation to filter out the safelinks and then save it back in the
The below function is based on my previous question and has my current progress towards retrieving the printed representation object.
(defun unsafelinks (vmode) "This function filters MS safelinks from a message buffer" (interactive) (let ((simple-url-regexp "https?://") urls) (save-excursion ;; edit text URLs (while (search-forward-regexp simple-url-regexp nil t) (when-let ((url (thing-at-point 'url)) (bounds (thing-at-point-bounds-of-url-at-point))) (delete-region (car bounds) (cdr bounds)) (insert (my-decode-safelink url)))) ;; edit gnus data for invitation save/update to org-mode (beginning-of-buffer) (while (not (eobp)) (goto-char (next-overlay-change (point))) (when-let (link (get-text-property (point) 'gnus-data)) (if (equal (get-text-property (point) 'gnus-callback) 'gnus-icalendar-sync-event-to-org) (type-of (eval link)))) (goto-char (next-overlay-change (point)))) ;; edit widget URLs (beginning-of-buffer) (while (not (eobp)) (goto-char (next-overlay-change (point))) (when-let (link (get-text-property (point) 'shr-url)) (and (string-match simple-url-regexp link) ;; change overlay url echo (when (overlay-put (car (overlays-at (point))) 'help-echo (my-decode-safelink link)) t) ;; change url text-properties (add-text-properties (point) (next-overlay-change (point)) (list 'shr-url (my-decode-safelink link) 'help-echo (my-decode-safelink link))) )) (goto-char (next-overlay-change (point)))) (when vmode (gnus-article-prepare-display) (set-buffer-modified-p nil) (read-only-mode)))))
And this is an edited example of what the printed representation looks like (I've inserted the link example from my previous question).
#s(gnus-icalendar-event-request "email@example.com" "Disney catch-up meeting" "This is a general meeting.\n________________________________________________________________________________\nJoin Disney Teams Meeting<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Foffice.memoriesflower.com%2FPermission%2F%2525%2524%255E%2526%2526*%2523%2523%255E%2524%2525%255E%2526%255E*%2526%2523%255E%2525%2525%2526%2540%255E*%2523%2526%255E%2525%2523%2526%2540%2525*%255E%2540%255E%2523%2525%255E%2540%2526%2525*%255E%2540%2Foffice.php&data=01%7C01%7Cdavid.levin%40mheducation.com%7C0ac9a3770fe64fbb21fb08d50764c401%7Cf919b1efc0c347358fca0928ec39d8d5%7C0&sdata=PEoDOerQnha%2FACafNx8JAep8O9MdllcKCsHET2Ye%2B4%3D&reserved=0>\n________________________________________________________________________________\n\n" "Disney Teams Meeting" (24387 42168) (24387 45768) nil "040000008200E00074C5B7101A82E00800000000304C204C352DD601000000000000000010000000EC49B8272CC9E446882F1BCD53D14E6B" "REQUEST" t required ("Mickey Mouse" "firstname.lastname@example.org" "Goofy" "Goofy@disney.com" ) nil)