|
|
|
|
@ -907,6 +907,56 @@ |
|
|
|
|
|
|
|
|
|
(setq mu4e-contact-process-function 'my-mu4e-contact-filter-function) |
|
|
|
|
#+end_src |
|
|
|
|
This snippet improves handling of links that span several lines. |
|
|
|
|
It piggy-backs on ~gnus~ doing all the heavy lifting |
|
|
|
|
#+begin_src emacs-lisp |
|
|
|
|
(defun gnus-next-url () |
|
|
|
|
(gnus-text-property-search 'action 'browse-url t t)) |
|
|
|
|
|
|
|
|
|
(defun gnus-bounds-of-url-at-point () |
|
|
|
|
(let ((start (point)) |
|
|
|
|
(current-url (get-text-property (point) 'button-data))) |
|
|
|
|
(gnus-text-property-search 'action 'browse-url t t t) |
|
|
|
|
(while (and (= 1 (- (or (gnus-text-property-search 'action 'browse-url t) 0) (point))) |
|
|
|
|
(string-equal current-url (get-text-property (1+ (point)) 'button-data)) ) |
|
|
|
|
(forward-char) |
|
|
|
|
(gnus-text-property-search 'action 'browse-url t t t)) |
|
|
|
|
(cons start (point)))) |
|
|
|
|
|
|
|
|
|
(defun mu4e~view-activate-urls () |
|
|
|
|
"Turn things that look like URLs into clickable things. |
|
|
|
|
Also number them so they can be opened using `mu4e-view-go-to-url'." |
|
|
|
|
(let ((num 0) |
|
|
|
|
(use-gnus-properties mu4e-view-use-gnus)) |
|
|
|
|
(save-excursion |
|
|
|
|
(setq mu4e~view-link-map ;; buffer local |
|
|
|
|
(make-hash-table :size 32 :weakness nil)) |
|
|
|
|
(goto-char (point-min)) |
|
|
|
|
(while (if use-gnus-properties (gnus-next-url) |
|
|
|
|
(re-search-forward mu4e~view-beginning-of-url-regexp nil t)) |
|
|
|
|
(let ((bounds (if use-gnus-properties (gnus-bounds-of-url-at-point) |
|
|
|
|
(thing-at-point-bounds-of-url-at-point)))) |
|
|
|
|
(when bounds |
|
|
|
|
(let* ((url (or (get-text-property (car bounds) 'button-data) |
|
|
|
|
(thing-at-point-url-at-point))) |
|
|
|
|
(ov (make-overlay (car bounds) (cdr bounds)))) |
|
|
|
|
(when (string-match-p "https?" url) |
|
|
|
|
(puthash (cl-incf num) url mu4e~view-link-map) |
|
|
|
|
(add-text-properties |
|
|
|
|
(car bounds) |
|
|
|
|
(cdr bounds) |
|
|
|
|
`(face mu4e-link-face |
|
|
|
|
mouse-face highlight |
|
|
|
|
mu4e-url ,url |
|
|
|
|
keymap ,mu4e-view-active-urls-keymap |
|
|
|
|
help-echo |
|
|
|
|
"[mouse-1] or [M-RET] to open the link")) |
|
|
|
|
(overlay-put ov 'mu4e-overlay t) |
|
|
|
|
(overlay-put ov 'after-string |
|
|
|
|
(propertize (format "\u200B[%d]" num) |
|
|
|
|
'face 'mu4e-url-number-face)))))))))) |
|
|
|
|
#+end_src |
|
|
|
|
|
|
|
|
|
** org-mode |
|
|
|
|
*** Require |
|
|
|
|
Require the ~org~ package; I also occasionally use org-pomodoro |
|
|
|
|
|