Reputation: 2812
I want to use Emacs to manage my bookmarks
for Firefox. I just want to store them inside a simple shared text file
. From what I see, org-mode
seems very close to what I want, I write an URL
, this is detected by org-mode
, the URL
is clickable and open a new tab inside Firefox. So far so good.
There is a small list of websites that I check frequently:
URL
of the buffer
in one time? (click or elisp
function)URL
of a sub-part of the buffer
? (paragraph, prefix, etc)An idea of such file:
My daily links:
http://link1
http://link2
http://link3
http://link4
My weekly links:
http://link5
http://link6
http://link7
http://link8
Or maybe, if it's more easy to implement:
[1] daily links and [2] weekly links:
[1] http://link1
[1] http://link2
[1] http://link3
[1] http://link4
[2] http://link5
[2] http://link6
[2] http://link7
[2] http://link8
Upvotes: 2
Views: 420
Reputation: 1712
If it is an org file, then you can place links in the file, and they will be click-able. See the Hyperlinks section of the org manual. Worth looking at because there is a nice way you can associate a description with the address.
Instead of just saying: http://someplace.on.earth
You can say: [[http://someplace.on.earth][Important Site]]
Which will show up as a clickable link called "Important Site".
I am guessing the behavior you want is to be able to click on the link, and have your browser open to that page. I think this is the default behavior. You can look at the variable browse-url-browser-function and specify the behavior you like.
Next step, you can look at the org-cliplink package - it provides a simple command that takes a URL from the clipboard and inserts an org-mode link with a title of a page found by the URL into the current buffer.
Upvotes: 0
Reputation: 2812
Thanks to BrunoO, I have been able to do the following:
(defun do-lines (fun &optional start end)
"Invoke function FUN on the text of each line from START to END."
(interactive)
(save-excursion
(goto-char start)
(while (< (point) end)
(funcall fun (buffer-substring (line-beginning-position) (line-end-position)))
(forward-line 1))))
(defun do-open-urls ()
(interactive)
(if (use-region-p)
(do-lines 'browse-url (region-beginning) (region-end))
(do-lines 'browse-url (point-min) (point-max))))
Upvotes: 1