johnsu01 (johnsu01) wrote,
johnsu01
johnsu01

  • Music:

Marking URLS in Gnus articles

I do a lot of copying both URLS and sexps from mail and news messages, partly because I read a large portion of my RSS feeds as mail. So I added this to my .gnus file today:

(defun johnsu01/mark-url-or-sexp (&optional arg allow-extend)
  "If there is a URL at point, set the mark at the end of it.
If there is not, then follow normal `mark-sexp' behavior."
  (interactive "P\np")
  (cond
   ((thing-at-point-url-at-point)
    (set-mark
     (save-excursion
       (goto-char
        (cdr (thing-at-point-bounds-of-url-at-point)))
       (point))))
   (t
    (call-interactively 'mark-sexp))))

(define-key gnus-article-mode-map
  (kbd "C-M-@") 'johnsu01/mark-url-or-sexp)

Note that I use transient-mark-mode.

Tags: emacs, gnus, lisp
Subscribe
  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments