Created
November 13, 2011 20:50
opens url in chromium if no browser is opened. reuse opened browser if already opened
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun is-proc-opened (procname) | |
(let ((procs (list-system-processes))) | |
(remove-if-not (lambda (proc) | |
(search procname | |
(name-of-proccess proc))) | |
procs))) | |
(defun name-of-process (proc) | |
(cdr (car (process-attributes proc)))) | |
(defun browse-url-open-browser (url &rest new-window) | |
(setq browse-url-generic-program (open-browser)) | |
(apply 'browse-url-generic url new-window)) | |
(defun open-browser () | |
"define the priorities of browsers" | |
(if (is-proc-opened "chromium") | |
"chromium-browser" | |
(if (is-proc-opened "firefox") | |
"firefox" | |
"chromium-browser"))) | |
(setq browse-url-browser-function 'browse-url-open-browser) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment