A bunch of dumb functions for academic emacs use.
This allows you to call the set-timer function through M-x.
You provide
the function an interval of X minutes. After X minutes have passed,
the function flash-mode-line is called. The mode line flashes, reminding
you to take a break.
(defun flash-mode-line (str) (invert-face 'mode-line) (run-with-timer 1.0 nil #'invert-face 'mode-line) (message str)) (defun set-timer (interval) (interactive "s > set interval: ") (run-at-time (format "%s min" interval) nil #'flash-mode-line " > time for a break.") (message (format " > will alert in %s min." interval)))
Tries to invert the color scheme. Works well with the default theme. I haven't tested it with custom color themes.
(defun switch-colors () (interactive) (invert-face 'default) )
This has two implementations, which may give different results. The first one is a pure elisp
implementation, the second one calls the external curl program.
(defun doi-to-bib-elisp (doi)
"modified from iosad (https://www.anghyflawn.net/blog/2014/emacs-give-a-doi-get-a-bibtex-entry/)"
(interactive "Mdoi: ")
(get-buffer-create "*doi2bib-el*")
(switch-to-buffer "*doi2bib-el*")
(let ((url-mime-accept-string "text/bibliography;style=bibtex"))
(with-current-buffer
(url-retrieve-synchronously (format "http://dx.doi.org/%s" doi))
(switch-to-buffer (current-buffer))
(goto-char (point-max))
(setq bibtex-entry (buffer-substring (string-match "@" (buffer-string)) (point)))
(kill-buffer (current-buffer))))
(insert (decode-coding-string bibtex-entry 'utf-8))
(bibtex-fill-entry))
(defun doi-to-bib-bash (doi)
(interactive "Mdoi: ")
(shell-command (format "curl -LH \"Accept: application/x-bibtex\" http://dx.doi.org/%s" doi)))