emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Nice blog post - Org-mode in Your Pocket Is a GNU-Shaped Devil


From: François Pinard
Subject: Re: [O] Nice blog post - Org-mode in Your Pocket Is a GNU-Shaped Devil
Date: Fri, 05 Apr 2013 06:59:23 -0400
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/23.4 (gnu/linux)

Bastien <address@hidden> writes:

>> It took me about one hour (my Gnus programming is rather rusty) for
>> adding a Gnus command opening many tabs at once, in a graphical
>> browser, for all articles I retain in Gnus for reading.

> That looks nice, is your hack public somewhere?

No, but here it is, usage instructions follow.



(defun fp-gnus-summary-open-links (arg)
  "Open links in a browser for processable articles, like for Hacker News."
  (interactive "P")
  (let ((articles (gnus-summary-work-articles arg)))
    (save-excursion
      (while articles
        (setq article (pop articles))
        (gnus-summary-goto-article article)
        (gnus-summary-show-article t)
        (save-excursion
          (pop-to-buffer gnus-article-buffer)
          (re-search-forward "<a href=\"\\([^\"]+\\)\">Link</a>")
          (browse-url (match-string 1)))
        (gnus-summary-remove-process-mark article))))
  (gnus-summary-position-point))

(defun my-gnus-summary-mode-hook ()
  (define-key gnus-summary-mode-map "\C-cnl" 'fp-gnus-summary-open-links)
  ;; ...
  )
(add-hook 'gnus-summary-mode-hook 'my-gnus-summary-mode-hook)



The function selects articles according to the process/mark convention,
and I want it to fail whenever an article does not have a "Link" button
(that's why I do not catch the error if "re-search" fails).  So, I use
it this way.  In an RSS summary buffer, I use C-k to "read" without
opening any subject I want to skip.  Once done, I use "x M P A C-c n l"
to remove all article I C-k'ed, add a process mark on everything else,
then transfer marked articles into a graphical browser, one tab per
article.  Transferred articles also get "read" in the summary buffer.


I also use this bit of Emacs Lisp code in ~/.emacs, which is related:



;; Chrome (really xdg-open)
;; ------------------------

(defun browse-url-xdg-open (url &optional new-window)
  "Ask the default browser to load URL.
Default to the URL around or before point."
  (interactive (browse-url-interactive-arg "URL: "))
  (shell-command (concat "xdg-open "
                         (shell-quote-argument (browse-url-encode-url url)))))

(setq browse-url-browser-function 'browse-url-xdg-open)



François





reply via email to

[Prev in Thread] Current Thread [Next in Thread]